@kuina-ui/vue 0.5.0 → 0.7.0
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/blocks/pagination/Pagination.js +4 -0
- package/dist/blocks/pagination/Pagination.vue.d.ts +39 -0
- package/dist/blocks/pagination/Pagination.vue_vue_type_script_setup_true_lang.js +151 -0
- package/dist/blocks/pagination/index.d.ts +2 -0
- package/dist/blocks/pagination/pagination.theme.d.ts +12 -0
- package/dist/blocks/pagination/pagination.theme.js +12 -0
- package/dist/blocks/table/Table.js +4 -0
- package/dist/blocks/table/Table.vue.d.ts +149 -0
- package/dist/blocks/table/Table.vue_vue_type_script_setup_true_lang.js +933 -0
- package/dist/blocks/table/TableCellText.js +4 -0
- package/dist/blocks/table/TableCellText.vue.d.ts +8 -0
- package/dist/blocks/table/TableCellText.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/blocks/table/index.d.ts +2 -0
- package/dist/blocks/table/table.theme.d.ts +286 -0
- package/dist/blocks/table/table.theme.js +391 -0
- package/dist/blocks/table/useLoadMoreTrigger.d.ts +11 -0
- package/dist/blocks/table/useLoadMoreTrigger.js +31 -0
- package/dist/blocks/table/usePinnedColumnOffsets.d.ts +10 -0
- package/dist/blocks/table/usePinnedColumnOffsets.js +63 -0
- package/dist/blocks/table/useRowReorder.d.ts +18 -0
- package/dist/blocks/table/useRowReorder.js +92 -0
- package/dist/blocks/table/useRowVirtualizer.d.ts +17 -0
- package/dist/blocks/table/useRowVirtualizer.js +45 -0
- package/dist/blocks/table/useTableSections.d.ts +46 -0
- package/dist/blocks/table/useTableSections.js +86 -0
- package/dist/components/alert/Alert.js +4 -0
- package/dist/components/alert/Alert.vue.d.ts +2 -2
- package/dist/components/alert/Alert.vue_vue_type_script_setup_true_lang.js +87 -0
- package/dist/components/alert/alert.theme.js +93 -0
- package/dist/components/avatar-group/AvatarGroup.js +4 -0
- package/dist/components/avatar-group/AvatarGroup.vue.d.ts +1 -1
- package/dist/components/avatar-group/AvatarGroup.vue_vue_type_script_setup_true_lang.js +42 -0
- package/dist/components/avatar-group/avatar-group.theme.js +22 -0
- package/dist/components/date-picker/DateCalendar.js +4 -0
- package/dist/components/date-picker/DateCalendar.vue_vue_type_script_setup_true_lang.js +194 -0
- package/dist/components/date-picker/DateCalendarMonth.js +4 -0
- package/dist/components/date-picker/DateCalendarMonth.vue_vue_type_script_setup_true_lang.js +106 -0
- package/dist/components/date-picker/DateCalendarPopover.js +4 -0
- package/dist/components/date-picker/DateCalendarPopover.vue_vue_type_script_setup_true_lang.js +161 -0
- package/dist/components/date-picker/DatePicker.js +4 -0
- package/dist/components/date-picker/DatePicker.vue.d.ts +6 -6
- package/dist/components/date-picker/DatePicker.vue_vue_type_script_setup_true_lang.js +224 -0
- package/dist/components/date-picker/DatePickerField.js +4 -0
- package/dist/components/date-picker/DatePickerField.vue.d.ts +6 -6
- package/dist/components/date-picker/DatePickerField.vue_vue_type_script_setup_true_lang.js +241 -0
- package/dist/components/date-picker/DatePickerPanel.js +4 -0
- package/dist/components/date-picker/DatePickerPanel.vue_vue_type_script_setup_true_lang.js +55 -0
- package/dist/components/date-picker/DateRangePicker.js +4 -0
- package/dist/components/date-picker/DateRangePicker.vue.d.ts +6 -6
- package/dist/components/date-picker/DateRangePicker.vue_vue_type_script_setup_true_lang.js +212 -0
- package/dist/components/date-picker/DateRangePickerField.js +4 -0
- package/dist/components/date-picker/DateRangePickerField.vue.d.ts +7 -7
- package/dist/components/date-picker/DateRangePickerField.vue_vue_type_script_setup_true_lang.js +228 -0
- package/dist/components/date-picker/date-calendar.theme.js +46 -0
- package/dist/components/date-picker/date-picker.theme.js +16 -0
- package/dist/components/date-picker/useDatePickerControl.js +47 -0
- package/dist/components/date-picker/useDatePickerPopover.js +39 -0
- package/dist/components/date-picker/useDateRangeSelection.js +50 -0
- package/dist/components/date-picker/useDateRangeTyping.js +59 -0
- package/dist/components/date-picker/useDateTypingFocus.js +37 -0
- package/dist/components/date-picker/useSingleDateSelection.js +11 -0
- package/dist/components/date-picker/useSingleDateTyping.js +31 -0
- package/dist/components/date-picker/useTypedDateInput.js +39 -0
- package/dist/components/menu/Menu.js +4 -0
- package/dist/components/menu/Menu.vue.d.ts +3 -2
- package/dist/components/menu/Menu.vue_vue_type_script_setup_true_lang.js +137 -0
- package/dist/components/menu/MenuItemRow.js +4 -0
- package/dist/components/menu/MenuItemRow.vue_vue_type_script_setup_true_lang.js +117 -0
- package/dist/components/menu/MenuPanel.js +4 -0
- package/dist/components/menu/MenuPanel.vue.d.ts +2 -1
- package/dist/components/menu/MenuPanel.vue_vue_type_script_setup_true_lang.js +249 -0
- package/dist/components/menu/menu.theme.d.ts +5 -0
- package/dist/components/menu/menu.theme.js +174 -0
- package/dist/components/menu/menuContext.js +9 -0
- package/dist/components/menu/menuEntries.js +25 -0
- package/dist/components/select/Select.js +4 -0
- package/dist/components/select/Select.vue.d.ts +2 -2
- package/dist/components/select/Select.vue_vue_type_script_setup_true_lang.js +262 -0
- package/dist/components/select/SelectField.js +4 -0
- package/dist/components/select/SelectField.vue.d.ts +2 -2
- package/dist/components/select/SelectField.vue_vue_type_script_setup_true_lang.js +271 -0
- package/dist/components/select/SelectOptionRow.js +4 -0
- package/dist/components/select/SelectOptionRow.vue_vue_type_script_setup_true_lang.js +55 -0
- package/dist/components/select/SelectPanel.js +4 -0
- package/dist/components/select/SelectPanel.vue_vue_type_script_setup_true_lang.js +169 -0
- package/dist/components/select/select-panel.theme.js +44 -0
- package/dist/components/select/selectOptions.d.ts +0 -2
- package/dist/components/select/selectOptions.js +66 -0
- package/dist/components/select/useSelectControl.d.ts +3 -3
- package/dist/components/select/useSelectControl.js +62 -0
- package/dist/components/select/useSelectListbox.js +169 -0
- package/dist/components/slider/RangeSlider.js +4 -0
- package/dist/components/slider/RangeSlider.vue.d.ts +55 -0
- package/dist/components/slider/RangeSlider.vue_vue_type_script_setup_true_lang.js +214 -0
- package/dist/components/slider/Slider.js +4 -0
- package/dist/components/slider/Slider.vue.d.ts +49 -0
- package/dist/components/slider/Slider.vue_vue_type_script_setup_true_lang.js +151 -0
- package/dist/components/slider/SliderHeader.js +4 -0
- package/dist/components/slider/SliderHeader.vue.d.ts +30 -0
- package/dist/components/slider/SliderHeader.vue_vue_type_script_setup_true_lang.js +61 -0
- package/dist/components/slider/index.d.ts +5 -0
- package/dist/components/slider/slider.theme.d.ts +33 -0
- package/dist/components/slider/slider.theme.js +34 -0
- package/dist/components/text-field/TextField.js +4 -0
- package/dist/components/text-field/TextField.vue.d.ts +2 -2
- package/dist/components/text-field/TextField.vue_vue_type_script_setup_true_lang.js +122 -0
- package/dist/components/text-field/text-field.theme.js +379 -0
- package/dist/components/textarea/Textarea.js +4 -0
- package/dist/components/textarea/Textarea.vue.d.ts +1 -1
- package/dist/components/textarea/Textarea.vue_vue_type_script_setup_true_lang.js +93 -0
- package/dist/components/textarea/textarea.theme.js +222 -0
- package/dist/elements/avatar/Avatar.js +4 -0
- package/dist/elements/avatar/Avatar.vue.d.ts +3 -3
- package/dist/elements/avatar/Avatar.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/elements/avatar/avatar.theme.js +141 -0
- package/dist/elements/badge/Badge.js +4 -0
- package/dist/elements/badge/Badge.vue.d.ts +2 -2
- package/dist/elements/badge/Badge.vue_vue_type_script_setup_true_lang.js +49 -0
- package/dist/elements/badge/badge.theme.js +111 -0
- package/dist/elements/button/Button.js +4 -0
- package/dist/elements/button/Button.vue.d.ts +3 -3
- package/dist/elements/button/Button.vue_vue_type_script_setup_true_lang.js +83 -0
- package/dist/elements/button/button.theme.js +424 -0
- package/dist/elements/checkbox/Checkbox.js +4 -0
- package/dist/elements/checkbox/Checkbox.vue.d.ts +3 -1
- package/dist/elements/checkbox/Checkbox.vue_vue_type_script_setup_true_lang.js +69 -0
- package/dist/elements/checkbox/checkbox.theme.d.ts +1 -0
- package/dist/elements/checkbox/checkbox.theme.js +22 -0
- package/dist/elements/circular-progress/CircularProgress.js +4 -0
- package/dist/elements/circular-progress/CircularProgress.vue_vue_type_script_setup_true_lang.js +44 -0
- package/dist/elements/circular-progress/circular-progress.theme.js +8 -0
- package/dist/elements/input/Input.js +4 -0
- package/dist/elements/input/Input.vue.d.ts +62 -0
- package/dist/elements/input/Input.vue_vue_type_script_setup_true_lang.js +138 -0
- package/dist/elements/input/focusInputFromContainer.d.ts +2 -0
- package/dist/elements/input/focusInputFromContainer.js +28 -0
- package/dist/elements/input/index.d.ts +2 -0
- package/dist/elements/input/input.theme.d.ts +81 -0
- package/dist/elements/input/input.theme.js +391 -0
- package/dist/elements/loading-dots/LoadingDots.js +4 -0
- package/dist/elements/loading-dots/LoadingDots.vue_vue_type_script_setup_true_lang.js +26 -0
- package/dist/elements/loading-dots/loading-dots.theme.js +4 -0
- package/dist/elements/loading-indicator/LoadingIndicator.js +4 -0
- package/dist/elements/loading-indicator/LoadingIndicator.vue_vue_type_script_setup_true_lang.js +26 -0
- package/dist/elements/loading-indicator/loading-indicator.theme.js +4 -0
- package/dist/elements/popover/Popover.js +4 -0
- package/dist/elements/popover/Popover.vue.d.ts +60 -0
- package/dist/elements/popover/Popover.vue_vue_type_script_setup_true_lang.js +218 -0
- package/dist/elements/popover/index.d.ts +2 -0
- package/dist/elements/popover/popover.theme.d.ts +20 -0
- package/dist/elements/popover/popover.theme.js +17 -0
- package/dist/elements/popover/popoverLayers.d.ts +5 -0
- package/dist/elements/popover/popoverLayers.js +22 -0
- package/dist/elements/radio-group/RadioGroup.js +4 -0
- package/dist/elements/radio-group/RadioGroup.vue.d.ts +1 -1
- package/dist/elements/radio-group/RadioGroup.vue_vue_type_script_setup_true_lang.js +105 -0
- package/dist/elements/radio-group/radio-group.theme.js +126 -0
- package/dist/elements/segmented-control/SegmentedControl.js +4 -0
- package/dist/elements/segmented-control/SegmentedControl.vue.d.ts +1 -1
- package/dist/elements/segmented-control/SegmentedControl.vue_vue_type_script_setup_true_lang.js +98 -0
- package/dist/elements/segmented-control/segmented-control.theme.js +201 -0
- package/dist/elements/select-control/SelectControl.js +4 -0
- package/dist/elements/select-control/SelectControl.vue.d.ts +1 -1
- package/dist/elements/select-control/SelectControl.vue_vue_type_script_setup_true_lang.js +105 -0
- package/dist/elements/select-control/select-control.theme.js +360 -0
- package/dist/elements/select-field-control/SelectFieldControl.js +4 -0
- package/dist/elements/select-field-control/SelectFieldControl.vue.d.ts +1 -1
- package/dist/elements/select-field-control/SelectFieldControl.vue_vue_type_script_setup_true_lang.js +123 -0
- package/dist/elements/select-field-control/select-field-control.theme.js +299 -0
- package/dist/elements/slider-control/SliderControl.js +4 -0
- package/dist/elements/slider-control/SliderControl.vue.d.ts +35 -0
- package/dist/elements/slider-control/SliderControl.vue_vue_type_script_setup_true_lang.js +228 -0
- package/dist/elements/slider-control/index.d.ts +3 -0
- package/dist/elements/slider-control/slider-control.theme.d.ts +38 -0
- package/dist/elements/slider-control/slider-control.theme.js +35 -0
- package/dist/elements/slider-control/useSliderMarksLayout.d.ts +6 -0
- package/dist/elements/slider-control/useSliderMarksLayout.js +25 -0
- package/dist/elements/switch/Switch.js +4 -0
- package/dist/elements/switch/Switch.vue.d.ts +1 -1
- package/dist/elements/switch/Switch.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/elements/switch/switch.theme.js +37 -0
- package/dist/elements/text-link/TextLink.js +4 -0
- package/dist/elements/text-link/TextLink.vue_vue_type_script_setup_true_lang.js +64 -0
- package/dist/elements/text-link/text-link.theme.js +25 -0
- package/dist/elements/tooltip/Tooltip.js +4 -0
- package/dist/elements/tooltip/Tooltip.vue.d.ts +48 -0
- package/dist/elements/tooltip/Tooltip.vue_vue_type_script_setup_true_lang.js +161 -0
- package/dist/elements/tooltip/index.d.ts +2 -0
- package/dist/elements/tooltip/tooltip.theme.d.ts +29 -0
- package/dist/elements/tooltip/tooltip.theme.js +46 -0
- package/dist/elements/tooltip/useTooltipOpenState.d.ts +17 -0
- package/dist/elements/tooltip/useTooltipOpenState.js +57 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +38 -1
- package/dist/nuxt.js +12 -13
- package/dist/shared/composables/useApplePlatform.js +10 -0
- package/dist/shared/composables/useCalendarLabels.js +13 -0
- package/dist/shared/composables/useCustomColor.js +10 -0
- package/dist/shared/composables/useDismissOnOutsidePointerDown.d.ts +1 -1
- package/dist/shared/composables/useDismissOnOutsidePointerDown.js +14 -0
- package/dist/shared/composables/useFieldDescription.js +16 -0
- package/dist/shared/composables/useFloatingPosition.d.ts +3 -2
- package/dist/shared/composables/useFloatingPosition.js +113 -0
- package/dist/shared/composables/useMask.js +32 -0
- package/dist/shared/composables/useMaskedFieldModel.d.ts +7 -0
- package/dist/shared/composables/useMaskedFieldModel.js +19 -0
- package/dist/shared/composables/useNumberFieldTyping.d.ts +21 -0
- package/dist/shared/composables/useNumberFieldTyping.js +70 -0
- package/dist/shared/composables/usePointerGraceArea.d.ts +11 -0
- package/dist/shared/composables/usePointerGraceArea.js +40 -0
- package/dist/shared/composables/useRowSelection.d.ts +17 -0
- package/dist/shared/composables/useRowSelection.js +40 -0
- package/dist/shared/composables/useShortcuts.js +21 -0
- package/dist/shared/composables/useSlidingThumb.js +65 -0
- package/dist/shared/composables/useTableRows.d.ts +26 -0
- package/dist/shared/composables/useTableRows.js +41 -0
- package/dist/shared/types/floating-position.d.ts +9 -0
- package/dist/shared/types/pointer-grace-area.d.ts +12 -0
- package/dist/shared/types/slider.d.ts +6 -0
- package/dist/shared/types/table.d.ts +59 -0
- package/dist/shared/types/value-path.d.ts +6 -0
- package/dist/shared/utils/calendarMonth.js +23 -0
- package/dist/shared/utils/computeFloatingPosition.js +32 -0
- package/dist/shared/utils/createDateFormatters.js +31 -0
- package/dist/shared/utils/createDateInputMask.js +103 -0
- package/dist/shared/utils/createDebouncedCallback.d.ts +5 -0
- package/dist/shared/utils/createDebouncedCallback.js +17 -0
- package/dist/shared/utils/createMask.js +65 -0
- package/dist/shared/utils/createShortcutHandler.js +60 -0
- package/dist/shared/utils/createTypeaheadSearch.js +16 -0
- package/dist/shared/utils/editableFieldGuard.js +11 -0
- package/dist/shared/utils/findFirstRenderedVNode.d.ts +3 -0
- package/dist/shared/utils/findFirstRenderedVNode.js +14 -0
- package/dist/shared/utils/flipFloatingPosition.js +28 -0
- package/dist/shared/utils/floatingPanelTransition.js +25 -0
- package/dist/shared/utils/formatShortcut.js +86 -0
- package/dist/shared/utils/isApplePlatform.js +5 -0
- package/dist/shared/utils/isExternalUrl.js +5 -0
- package/dist/shared/utils/isoDate.js +50 -0
- package/dist/shared/utils/normalizeSearchText.d.ts +2 -0
- package/dist/shared/utils/normalizeSearchText.js +6 -0
- package/dist/shared/utils/parseShortcut.js +48 -0
- package/dist/shared/utils/pointerGraceArea.d.ts +11 -0
- package/dist/shared/utils/pointerGraceArea.js +92 -0
- package/dist/shared/utils/readValueAtPath.d.ts +2 -0
- package/dist/shared/utils/readValueAtPath.js +7 -0
- package/dist/shared/utils/resolveFloatingAnchor.d.ts +4 -0
- package/dist/shared/utils/resolveFloatingAnchor.js +15 -0
- package/dist/shared/utils/resolvePressScale.js +5 -0
- package/dist/shared/utils/shiftFloatingPosition.d.ts +3 -0
- package/dist/shared/utils/shiftFloatingPosition.js +21 -0
- package/dist/shared/utils/sliderPosition.d.ts +11 -0
- package/dist/shared/utils/sliderPosition.js +27 -0
- package/dist/shared/utils/sliderThumbs.d.ts +13 -0
- package/dist/shared/utils/sliderThumbs.js +16 -0
- package/dist/shared/utils/steppedValue.d.ts +18 -0
- package/dist/shared/utils/steppedValue.js +21 -0
- package/dist/shared/utils/tableColumnTypes.d.ts +21 -0
- package/dist/shared/utils/tableColumnTypes.js +77 -0
- package/dist/shared/utils/tableColumns.d.ts +20 -0
- package/dist/shared/utils/tableColumns.js +77 -0
- package/dist/shared/utils/tableGroups.d.ts +10 -0
- package/dist/shared/utils/tableGroups.js +34 -0
- package/dist/shared/utils/tableRows.d.ts +25 -0
- package/dist/shared/utils/tableRows.js +80 -0
- package/dist/shared/utils/tableTree.d.ts +15 -0
- package/dist/shared/utils/tableTree.js +22 -0
- package/dist/shared/utils/toggleColumnSort.d.ts +5 -0
- package/dist/shared/utils/toggleColumnSort.js +27 -0
- package/dist/shared/utils/tv.js +1 -0
- package/dist/shared/utils/warnInDevelopment.d.ts +3 -0
- package/dist/shared/utils/warnInDevelopment.js +13 -0
- package/package.json +1 -1
- package/src/index.css +2 -0
- package/src/shared/styles/utilities/shake.css +21 -0
- package/src/shared/styles/utilities/slider-mark-position.css +8 -0
- package/dist/src-Bnn36nLV.js +0 -7856
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Comment as e, Fragment as t, Text as n } from "vue";
|
|
2
|
+
// src/shared/utils/findFirstRenderedVNode.ts
|
|
3
|
+
function r(e) {
|
|
4
|
+
return e.type === n && !String(e.children).trim();
|
|
5
|
+
}
|
|
6
|
+
function i(n) {
|
|
7
|
+
for (let a of n) {
|
|
8
|
+
if (a.type === e || r(a)) continue;
|
|
9
|
+
if (a.type !== t) return a;
|
|
10
|
+
let n = i(Array.isArray(a.children) ? a.children : []);
|
|
11
|
+
if (n) return n;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export { i as findFirstRenderedVNode };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { placeFloatingAgainstAnchor as e } from "./computeFloatingPosition.js";
|
|
2
|
+
// src/shared/utils/flipFloatingPosition.ts
|
|
3
|
+
var t = {
|
|
4
|
+
top: "bottom",
|
|
5
|
+
bottom: "top",
|
|
6
|
+
left: "right",
|
|
7
|
+
right: "left"
|
|
8
|
+
};
|
|
9
|
+
function n(e, { floatingSize: t, viewportSize: n }, r) {
|
|
10
|
+
return {
|
|
11
|
+
top: r - e.y,
|
|
12
|
+
bottom: e.y + t.height - (n.height - r),
|
|
13
|
+
left: r - e.x,
|
|
14
|
+
right: e.x + t.width - (n.width - r)
|
|
15
|
+
}[e.placement.side];
|
|
16
|
+
}
|
|
17
|
+
function r(r = 8) {
|
|
18
|
+
return (i, a) => {
|
|
19
|
+
let o = n(i, a, r);
|
|
20
|
+
if (o <= 0) return i;
|
|
21
|
+
let s = e(a, {
|
|
22
|
+
...i.placement,
|
|
23
|
+
side: t[i.placement.side]
|
|
24
|
+
});
|
|
25
|
+
return n(s, a, r) < o ? s : i;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export { r as flipFloatingPosition };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// src/shared/utils/floatingPanelTransition.ts
|
|
2
|
+
var e = {
|
|
3
|
+
enterFromClass: "scale-95 opacity-0",
|
|
4
|
+
enterActiveClass: "transition duration-350 ease-[cubic-bezier(0.19,1,0.22,1)] motion-reduce:transition-none",
|
|
5
|
+
leaveActiveClass: "transition duration-200 ease-[cubic-bezier(0.8,0,0.4,1)] motion-reduce:transition-none",
|
|
6
|
+
leaveToClass: "scale-95 opacity-0"
|
|
7
|
+
}, t = {
|
|
8
|
+
top: "bottom",
|
|
9
|
+
bottom: "top",
|
|
10
|
+
left: "right",
|
|
11
|
+
right: "left"
|
|
12
|
+
};
|
|
13
|
+
function n(e) {
|
|
14
|
+
let n = t[e.side], r = e.side === "top" || e.side === "bottom", i = r ? {
|
|
15
|
+
start: "left",
|
|
16
|
+
center: "center",
|
|
17
|
+
end: "right"
|
|
18
|
+
} : {
|
|
19
|
+
start: "top",
|
|
20
|
+
center: "center",
|
|
21
|
+
end: "bottom"
|
|
22
|
+
};
|
|
23
|
+
return r ? `${i[e.align]} ${n}` : `${n} ${i[e.align]}`;
|
|
24
|
+
}
|
|
25
|
+
export { n as findFloatingTransformOrigin, e as floatingPanelTransitionClasses };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { parseShortcut as e } from "./parseShortcut.js";
|
|
2
|
+
// src/shared/utils/formatShortcut.ts
|
|
3
|
+
var t = [
|
|
4
|
+
["ctrl", "⌃"],
|
|
5
|
+
["alt", "⌥"],
|
|
6
|
+
["shift", "⇧"],
|
|
7
|
+
["meta", "⌘"]
|
|
8
|
+
], n = [
|
|
9
|
+
["ctrl", "Ctrl"],
|
|
10
|
+
["alt", "Alt"],
|
|
11
|
+
["shift", "Shift"],
|
|
12
|
+
["meta", "Win"]
|
|
13
|
+
], r = {
|
|
14
|
+
" ": {
|
|
15
|
+
apple: "Space",
|
|
16
|
+
other: "Space"
|
|
17
|
+
},
|
|
18
|
+
escape: {
|
|
19
|
+
apple: "Esc",
|
|
20
|
+
other: "Esc"
|
|
21
|
+
},
|
|
22
|
+
enter: {
|
|
23
|
+
apple: "↩",
|
|
24
|
+
other: "Enter"
|
|
25
|
+
},
|
|
26
|
+
tab: {
|
|
27
|
+
apple: "⇥",
|
|
28
|
+
other: "Tab"
|
|
29
|
+
},
|
|
30
|
+
backspace: {
|
|
31
|
+
apple: "⌫",
|
|
32
|
+
other: "Backspace"
|
|
33
|
+
},
|
|
34
|
+
delete: {
|
|
35
|
+
apple: "⌦",
|
|
36
|
+
other: "Delete"
|
|
37
|
+
},
|
|
38
|
+
insert: {
|
|
39
|
+
apple: "Insert",
|
|
40
|
+
other: "Insert"
|
|
41
|
+
},
|
|
42
|
+
arrowup: {
|
|
43
|
+
apple: "↑",
|
|
44
|
+
other: "↑"
|
|
45
|
+
},
|
|
46
|
+
arrowdown: {
|
|
47
|
+
apple: "↓",
|
|
48
|
+
other: "↓"
|
|
49
|
+
},
|
|
50
|
+
arrowleft: {
|
|
51
|
+
apple: "←",
|
|
52
|
+
other: "←"
|
|
53
|
+
},
|
|
54
|
+
arrowright: {
|
|
55
|
+
apple: "→",
|
|
56
|
+
other: "→"
|
|
57
|
+
},
|
|
58
|
+
home: {
|
|
59
|
+
apple: "Home",
|
|
60
|
+
other: "Home"
|
|
61
|
+
},
|
|
62
|
+
end: {
|
|
63
|
+
apple: "End",
|
|
64
|
+
other: "End"
|
|
65
|
+
},
|
|
66
|
+
pageup: {
|
|
67
|
+
apple: "Page Up",
|
|
68
|
+
other: "Page Up"
|
|
69
|
+
},
|
|
70
|
+
pagedown: {
|
|
71
|
+
apple: "Page Down",
|
|
72
|
+
other: "Page Down"
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
function i(e, t) {
|
|
76
|
+
let n = r[e];
|
|
77
|
+
return n ? t ? n.apple : n.other : e.toUpperCase();
|
|
78
|
+
}
|
|
79
|
+
function a(e, r) {
|
|
80
|
+
let a = new Set([...e.modifiers].map((e) => e === "mod" ? r ? "meta" : "ctrl" : e)), o = i(e.key, r);
|
|
81
|
+
return r ? t.filter(([e]) => a.has(e)).map(([, e]) => e).join("") + o : [...n.filter(([e]) => a.has(e)).map(([, e]) => e), o].join("+");
|
|
82
|
+
}
|
|
83
|
+
function o(t, n) {
|
|
84
|
+
return e(t).map((e) => a(e, n)).join(" ");
|
|
85
|
+
}
|
|
86
|
+
export { o as formatShortcut };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// src/shared/utils/isoDate.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
return String(e).padStart(2, "0");
|
|
4
|
+
}
|
|
5
|
+
function t(e) {
|
|
6
|
+
return /* @__PURE__ */ new Date(`${e}T00:00:00Z`);
|
|
7
|
+
}
|
|
8
|
+
function n(e) {
|
|
9
|
+
return e.toISOString().slice(0, 10);
|
|
10
|
+
}
|
|
11
|
+
function r(e) {
|
|
12
|
+
return e.slice(0, 7);
|
|
13
|
+
}
|
|
14
|
+
function i(e) {
|
|
15
|
+
let [t, n] = e.split("-").map(Number);
|
|
16
|
+
return new Date(Date.UTC(t, n, 0)).getUTCDate();
|
|
17
|
+
}
|
|
18
|
+
function a(e) {
|
|
19
|
+
return t(e).getUTCDay();
|
|
20
|
+
}
|
|
21
|
+
function o(e, r) {
|
|
22
|
+
let i = t(e);
|
|
23
|
+
return i.setUTCDate(i.getUTCDate() + r), n(i);
|
|
24
|
+
}
|
|
25
|
+
function s(e, i) {
|
|
26
|
+
let a = t(`${e}-01`);
|
|
27
|
+
return a.setUTCMonth(a.getUTCMonth() + i), r(n(a));
|
|
28
|
+
}
|
|
29
|
+
function c(t, n) {
|
|
30
|
+
let a = s(r(t), n);
|
|
31
|
+
return `${a}-${e(Math.min(Number(t.slice(8, 10)), i(a)))}`;
|
|
32
|
+
}
|
|
33
|
+
function l(e, t) {
|
|
34
|
+
let [n, r] = e.split("-").map(Number), [i, a] = t.split("-").map(Number);
|
|
35
|
+
return (i - n) * 12 + (a - r);
|
|
36
|
+
}
|
|
37
|
+
function u(e, t) {
|
|
38
|
+
return t.some((t) => typeof t == "string" ? t === e : e >= t[0] && e <= t[1]);
|
|
39
|
+
}
|
|
40
|
+
function d(e, t) {
|
|
41
|
+
return t.min && e < t.min || t.max && e > t.max || t.disabledDates && u(e, t.disabledDates) ? !0 : !!t.isDateDisabled?.(e);
|
|
42
|
+
}
|
|
43
|
+
function f(e, t, n) {
|
|
44
|
+
return t && e < t ? t : n && e > n ? n : e;
|
|
45
|
+
}
|
|
46
|
+
function p() {
|
|
47
|
+
let t = /* @__PURE__ */ new Date();
|
|
48
|
+
return `${t.getFullYear()}-${e(t.getMonth() + 1)}-${e(t.getDate())}`;
|
|
49
|
+
}
|
|
50
|
+
export { o as addDaysToIsoDate, c as addMonthsToIsoDate, s as addMonthsToIsoMonth, f as clampIsoDate, i as countDaysInIsoMonth, l as countMonthsBetweenIsoMonths, r as extractIsoMonth, a as findIsoDateWeekday, p as findLocalTodayIsoDate, u as isIsoDateInDateList, d as isIsoDateUnavailable, t as isoDateToUtcDate, n as utcDateToIsoDate };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// src/shared/utils/parseShortcut.ts
|
|
2
|
+
var e = /* @__PURE__ */ new Set([
|
|
3
|
+
"ctrl",
|
|
4
|
+
"meta",
|
|
5
|
+
"alt",
|
|
6
|
+
"shift",
|
|
7
|
+
"mod"
|
|
8
|
+
]), t = {
|
|
9
|
+
space: " ",
|
|
10
|
+
plus: "+"
|
|
11
|
+
}, n = /* @__PURE__ */ new Set([
|
|
12
|
+
"escape",
|
|
13
|
+
"enter",
|
|
14
|
+
"tab",
|
|
15
|
+
"backspace",
|
|
16
|
+
"delete",
|
|
17
|
+
"insert",
|
|
18
|
+
"arrowup",
|
|
19
|
+
"arrowdown",
|
|
20
|
+
"arrowleft",
|
|
21
|
+
"arrowright",
|
|
22
|
+
"home",
|
|
23
|
+
"end",
|
|
24
|
+
"pageup",
|
|
25
|
+
"pagedown"
|
|
26
|
+
]), r = /^f([1-9]|1\d|2[0-4])$/;
|
|
27
|
+
function i(t) {
|
|
28
|
+
return e.has(t);
|
|
29
|
+
}
|
|
30
|
+
function a(e) {
|
|
31
|
+
return [...e].length === 1 || n.has(e) || r.test(e);
|
|
32
|
+
}
|
|
33
|
+
function o(e, n) {
|
|
34
|
+
let r = e.toLowerCase().split("+"), o = r.pop() ?? "", s = t[o] ?? o;
|
|
35
|
+
if (!a(s)) throw Error(`Unknown key "${o}" in shortcut "${n}".`);
|
|
36
|
+
let c = r.map((e) => {
|
|
37
|
+
if (!i(e)) throw Error(`Unknown modifier "${e}" in shortcut "${n}".`);
|
|
38
|
+
return e;
|
|
39
|
+
});
|
|
40
|
+
return {
|
|
41
|
+
key: s,
|
|
42
|
+
modifiers: new Set(c)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function s(e) {
|
|
46
|
+
return e.trim().split(/\s+/).map((t) => o(t, e));
|
|
47
|
+
}
|
|
48
|
+
export { s as parseShortcut };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ElementEdges, PointerExitSide, PointerGraceArea, PointerPosition } from '../types/pointer-grace-area';
|
|
2
|
+
/** Find which edge of the element the pointer crossed when it left. */
|
|
3
|
+
export declare function findPointerExitSide(exitPoint: PointerPosition, leftElementEdges: ElementEdges): PointerExitSide;
|
|
4
|
+
/** Widen the exit point into two points, set back inside the element it left, so the area starts with some width. */
|
|
5
|
+
export declare function padPointerExitPoint(exitPoint: PointerPosition, exitSide: PointerExitSide): PointerPosition[];
|
|
6
|
+
/** Build the smallest convex polygon that contains every point (Andrew's monotone chain). */
|
|
7
|
+
export declare function computeConvexHull(points: PointerPosition[]): PointerPosition[];
|
|
8
|
+
/** Tell whether a point lies inside a polygon, by counting how many of its edges a ray from the point crosses. */
|
|
9
|
+
export declare function isPointInPolygon(point: PointerPosition, polygon: PointerPosition[]): boolean;
|
|
10
|
+
/** Build the area the pointer may cross, from where it left an element to the element it is heading for. */
|
|
11
|
+
export declare function createPointerGraceArea(exitPoint: PointerPosition, leftElementEdges: ElementEdges, targetElementEdges: ElementEdges): PointerGraceArea;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
function e(e, t) {
|
|
2
|
+
return [
|
|
3
|
+
["left", Math.abs(t.left - e.x)],
|
|
4
|
+
["right", Math.abs(t.right - e.x)],
|
|
5
|
+
["top", Math.abs(t.top - e.y)],
|
|
6
|
+
["bottom", Math.abs(t.bottom - e.y)]
|
|
7
|
+
].reduce((e, t) => t[1] < e[1] ? t : e)[0];
|
|
8
|
+
}
|
|
9
|
+
function t(e, t) {
|
|
10
|
+
let { x: n, y: r } = e;
|
|
11
|
+
return {
|
|
12
|
+
top: [{
|
|
13
|
+
x: n - 5,
|
|
14
|
+
y: r + 5
|
|
15
|
+
}, {
|
|
16
|
+
x: n + 5,
|
|
17
|
+
y: r + 5
|
|
18
|
+
}],
|
|
19
|
+
bottom: [{
|
|
20
|
+
x: n - 5,
|
|
21
|
+
y: r - 5
|
|
22
|
+
}, {
|
|
23
|
+
x: n + 5,
|
|
24
|
+
y: r - 5
|
|
25
|
+
}],
|
|
26
|
+
left: [{
|
|
27
|
+
x: n + 5,
|
|
28
|
+
y: r - 5
|
|
29
|
+
}, {
|
|
30
|
+
x: n + 5,
|
|
31
|
+
y: r + 5
|
|
32
|
+
}],
|
|
33
|
+
right: [{
|
|
34
|
+
x: n - 5,
|
|
35
|
+
y: r - 5
|
|
36
|
+
}, {
|
|
37
|
+
x: n - 5,
|
|
38
|
+
y: r + 5
|
|
39
|
+
}]
|
|
40
|
+
}[t];
|
|
41
|
+
}
|
|
42
|
+
function n({ top: e, right: t, bottom: n, left: r }) {
|
|
43
|
+
return [
|
|
44
|
+
{
|
|
45
|
+
x: r,
|
|
46
|
+
y: e
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
x: t,
|
|
50
|
+
y: e
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
x: t,
|
|
54
|
+
y: n
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
x: r,
|
|
58
|
+
y: n
|
|
59
|
+
}
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
function r(e, t) {
|
|
63
|
+
return e.x - t.x || e.y - t.y;
|
|
64
|
+
}
|
|
65
|
+
function i(e, t, n) {
|
|
66
|
+
return (t.x - e.x) * (n.y - e.y) >= (t.y - e.y) * (n.x - e.x);
|
|
67
|
+
}
|
|
68
|
+
function a(e) {
|
|
69
|
+
let t = [];
|
|
70
|
+
for (let n of e) {
|
|
71
|
+
for (; t.length >= 2 && i(t[t.length - 2], t[t.length - 1], n);) t.pop();
|
|
72
|
+
t.push(n);
|
|
73
|
+
}
|
|
74
|
+
return t.pop(), t;
|
|
75
|
+
}
|
|
76
|
+
function o(e) {
|
|
77
|
+
let t = [...e].sort(r);
|
|
78
|
+
if (t.length <= 1) return t;
|
|
79
|
+
let n = a(t), i = a([...t].reverse());
|
|
80
|
+
return n.length === 1 && i.length === 1 && n[0].x === i[0].x && n[0].y === i[0].y ? n : [...n, ...i];
|
|
81
|
+
}
|
|
82
|
+
function s(e, t) {
|
|
83
|
+
let n = !1;
|
|
84
|
+
return t.forEach((r, i) => {
|
|
85
|
+
let a = t.at(i - 1);
|
|
86
|
+
r.y > e.y != a.y > e.y && e.x < (a.x - r.x) * (e.y - r.y) / (a.y - r.y) + r.x && (n = !n);
|
|
87
|
+
}), n;
|
|
88
|
+
}
|
|
89
|
+
function c(r, i, a) {
|
|
90
|
+
return o([...t(r, e(r, i)), ...n(a)]);
|
|
91
|
+
}
|
|
92
|
+
export { o as computeConvexHull, c as createPointerGraceArea, e as findPointerExitSide, s as isPointInPolygon, t as padPointerExitPoint };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { FloatingAnchor, FloatingPoint } from '../types/floating-position';
|
|
2
|
+
export declare function isFloatingPoint(requestedAnchor: FloatingAnchor | FloatingPoint): requestedAnchor is FloatingPoint;
|
|
3
|
+
/** Turn an element, a virtual anchor or a point of the viewport into an anchor to place a floating element against. */
|
|
4
|
+
export declare function resolveFloatingAnchor(requestedAnchor: FloatingAnchor | FloatingPoint): FloatingAnchor;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/shared/utils/resolveFloatingAnchor.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
return !("getBoundingClientRect" in e);
|
|
4
|
+
}
|
|
5
|
+
function t(t) {
|
|
6
|
+
if (!e(t)) return t;
|
|
7
|
+
let { x: n, y: r } = t;
|
|
8
|
+
return { getBoundingClientRect: () => ({
|
|
9
|
+
x: n,
|
|
10
|
+
y: r,
|
|
11
|
+
width: 0,
|
|
12
|
+
height: 0
|
|
13
|
+
}) };
|
|
14
|
+
}
|
|
15
|
+
export { e as isFloatingPoint, t as resolveFloatingAnchor };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { FloatingPositionModifier } from '../types/floating-position';
|
|
2
|
+
/** Slide the floating element along its anchor to keep it inside the viewport, without letting it leave the anchor. */
|
|
3
|
+
export declare function shiftFloatingPosition(viewportPadding?: number): FloatingPositionModifier;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// src/shared/utils/shiftFloatingPosition.ts
|
|
2
|
+
function e(e, t, n) {
|
|
3
|
+
return Math.max(t, Math.min(e, n));
|
|
4
|
+
}
|
|
5
|
+
function t(t = 8) {
|
|
6
|
+
return (n, { anchorRect: r, floatingSize: i, viewportSize: a }) => {
|
|
7
|
+
if (n.placement.side === "top" || n.placement.side === "bottom") {
|
|
8
|
+
let o = e(n.x, t, a.width - t - i.width);
|
|
9
|
+
return {
|
|
10
|
+
...n,
|
|
11
|
+
x: e(o, r.x - i.width, r.x + r.width)
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
let o = e(n.y, t, a.height - t - i.height);
|
|
15
|
+
return {
|
|
16
|
+
...n,
|
|
17
|
+
y: e(o, r.y - i.height, r.y + r.height)
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export { t as shiftFloatingPosition };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SliderMark } from '../types/slider';
|
|
2
|
+
/** Place a value along the track, from 0 at min to 1 at max, or 0 when the range is empty. */
|
|
3
|
+
export declare function convertValueToRatio(value: number, min: number, max: number): number;
|
|
4
|
+
/** Convert a value to its position along the track, as a percentage kept between 0 and 100. */
|
|
5
|
+
export declare function convertValueToPercent(value: number, min: number, max: number): number;
|
|
6
|
+
/** Read the value under a pointer from its distance to the start of the track. */
|
|
7
|
+
export declare function convertPointerToValue(pointerOffset: number, trackLength: number, min: number, max: number): number;
|
|
8
|
+
/** Sort the marks along the track, and throw when one is outside the range or repeats a value. */
|
|
9
|
+
export declare function sortSliderMarks(sliderMarks: readonly SliderMark[], min: number, max: number): SliderMark[];
|
|
10
|
+
/** Tell whether two neighboring mark labels come closer than the minimum spacing. */
|
|
11
|
+
export declare function hasCrowdedMarks(markBoxes: readonly Pick<DOMRect, 'left' | 'right'>[], minimumSpacing: number): boolean;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { clampToRange as e } from "./steppedValue.js";
|
|
2
|
+
// src/shared/utils/sliderPosition.ts
|
|
3
|
+
function t(e, t, n) {
|
|
4
|
+
return n > t ? (e - t) / (n - t) : 0;
|
|
5
|
+
}
|
|
6
|
+
function n(n, r, i) {
|
|
7
|
+
return e(t(n, r, i) * 100, 0, 100);
|
|
8
|
+
}
|
|
9
|
+
function r(e, t, n, r) {
|
|
10
|
+
return t > 0 ? n + (r - n) / t * e : n;
|
|
11
|
+
}
|
|
12
|
+
function i(e, t, n) {
|
|
13
|
+
let r = /* @__PURE__ */ new Set();
|
|
14
|
+
for (let i of e) {
|
|
15
|
+
if (i.value < t || i.value > n) throw Error(`Slider mark value ${i.value} is out of bounds [${t}, ${n}]`);
|
|
16
|
+
if (r.has(i.value)) throw Error("Slider marks must have unique values");
|
|
17
|
+
r.add(i.value);
|
|
18
|
+
}
|
|
19
|
+
return [...e].sort((e, t) => e.value - t.value);
|
|
20
|
+
}
|
|
21
|
+
function a(e, t) {
|
|
22
|
+
return e.some((n, r) => {
|
|
23
|
+
let i = e[r + 1];
|
|
24
|
+
return i !== void 0 && n.right + t > i.left;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export { r as convertPointerToValue, n as convertValueToPercent, t as convertValueToRatio, a as hasCrowdedMarks, i as sortSliderMarks };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface SliderThumbLimits {
|
|
2
|
+
min: number;
|
|
3
|
+
max: number;
|
|
4
|
+
minRange: number;
|
|
5
|
+
}
|
|
6
|
+
/** Find the values a thumb can take without passing its neighbors, kept minRange apart from them. */
|
|
7
|
+
export declare function resolveThumbBounds(thumbValues: readonly number[], thumbIndex: number, thumbLimits: SliderThumbLimits): {
|
|
8
|
+
lowestValue: number;
|
|
9
|
+
highestValue: number;
|
|
10
|
+
};
|
|
11
|
+
/** Pick the thumb closest to a value; among stacked thumbs, the one on the side the value lies. */
|
|
12
|
+
export declare function findClosestThumbIndex(thumbValues: readonly number[], targetValue: number): number;
|
|
13
|
+
export declare function isThumbStacked(thumbValues: readonly number[], thumbIndex: number): boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/shared/utils/sliderThumbs.ts
|
|
2
|
+
function e(e, t, n) {
|
|
3
|
+
let r = e[t - 1], i = e[t + 1];
|
|
4
|
+
return {
|
|
5
|
+
lowestValue: r === void 0 ? n.min : r + n.minRange,
|
|
6
|
+
highestValue: i === void 0 ? n.max : i - n.minRange
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
function t(e, t) {
|
|
10
|
+
let n = e.map((e) => Math.abs(e - t)), r = Math.min(...n), i = n.indexOf(r), a = n.lastIndexOf(r);
|
|
11
|
+
return t > (e[a] ?? t) ? a : i;
|
|
12
|
+
}
|
|
13
|
+
function n(e, t) {
|
|
14
|
+
return e.some((n, r) => r !== t && n === e[t]);
|
|
15
|
+
}
|
|
16
|
+
export { t as findClosestThumbIndex, n as isThumbStacked, e as resolveThumbBounds };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface StepScale {
|
|
2
|
+
min: number;
|
|
3
|
+
max: number;
|
|
4
|
+
step: number;
|
|
5
|
+
}
|
|
6
|
+
export interface StepMove {
|
|
7
|
+
direction: 1 | -1;
|
|
8
|
+
stepCount: number;
|
|
9
|
+
}
|
|
10
|
+
/** Count the decimals of a step, including steps written in scientific notation like 1e-7. */
|
|
11
|
+
export declare function countStepDecimals(step: number): number;
|
|
12
|
+
/** Round a number to a count of decimals by shifting its exponent, so 1.005 rounds to 1.01. */
|
|
13
|
+
export declare function roundToDecimals(value: number, decimalCount: number): number;
|
|
14
|
+
export declare function clampToRange(value: number, min: number, max: number): number;
|
|
15
|
+
/** Round a value to the nearest step counted from min, then keep it between min and max. */
|
|
16
|
+
export declare function snapToStep(value: number, { min, max, step }: StepScale): number;
|
|
17
|
+
/** Move a value by whole steps; a value between two steps first lands on the next step in that direction. */
|
|
18
|
+
export declare function moveByStep(value: number, { min, step }: Omit<StepScale, 'max'>, { direction, stepCount }: StepMove): number;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// src/shared/utils/steppedValue.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
if (!Number.isFinite(e)) return 0;
|
|
4
|
+
let [t = "", n] = String(e).split("e"), r = t.split(".")[1]?.length ?? 0;
|
|
5
|
+
return Math.max(0, r - Number(n ?? 0));
|
|
6
|
+
}
|
|
7
|
+
function t(e, t) {
|
|
8
|
+
let [n = "", r] = String(e).split("e"), i = Math.round(Number(`${n}e${Number(r ?? 0) + t}`)), [a = "", o] = String(i).split("e");
|
|
9
|
+
return Number(`${a}e${Number(o ?? 0) - t}`);
|
|
10
|
+
}
|
|
11
|
+
function n(e, t, n) {
|
|
12
|
+
return Math.min(Math.max(e, t), n);
|
|
13
|
+
}
|
|
14
|
+
function r(r, { min: i, max: a, step: o }) {
|
|
15
|
+
return n(t(Math.round((r - i) / o) * o + i, e(o)), i, a);
|
|
16
|
+
}
|
|
17
|
+
function i(n, { min: r, step: i }, { direction: a, stepCount: o }) {
|
|
18
|
+
let s = e(i), c = (n - r) / i, l = Math.round(c), u = t(l * i + r, s) === t(n, s), d = a > 0 ? Math.ceil(c) : Math.floor(c);
|
|
19
|
+
return u && (d = l + o * a), t(d * i + r, s);
|
|
20
|
+
}
|
|
21
|
+
export { n as clampToRange, e as countStepDecimals, i as moveByStep, t as roundToDecimals, r as snapToStep };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TableColumnType, TableColumnTypes, TableValueContext } from '../types/table';
|
|
2
|
+
export declare const builtInTableColumnTypes: {
|
|
3
|
+
text: {
|
|
4
|
+
format: (cellValue: unknown) => string;
|
|
5
|
+
compare: (firstValue: unknown, secondValue: unknown, { locale }: TableValueContext) => number;
|
|
6
|
+
};
|
|
7
|
+
number: TableColumnType;
|
|
8
|
+
decimal: TableColumnType;
|
|
9
|
+
percentage: TableColumnType;
|
|
10
|
+
date: {
|
|
11
|
+
format: (cellValue: unknown, { locale, formatOptions }: TableValueContext) => string;
|
|
12
|
+
compare: (firstValue: unknown, secondValue: unknown) => number;
|
|
13
|
+
};
|
|
14
|
+
boolean: {
|
|
15
|
+
align: "center";
|
|
16
|
+
format: (cellValue: unknown) => "Yes" | "No";
|
|
17
|
+
compare: (firstValue: unknown, secondValue: unknown) => number;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
/** Declare column types of your own, like a status ordered by importance, with the same shape as the built-in ones. */
|
|
21
|
+
export declare function defineTableColumnTypes<ColumnTypes extends TableColumnTypes>(columnTypes: ColumnTypes): ColumnTypes;
|