@helpwave/hightide 0.0.13 → 0.0.16
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/coloring/shading.d.mts +5 -0
- package/dist/coloring/shading.d.ts +5 -2
- package/dist/coloring/shading.js +80 -38
- package/dist/coloring/shading.js.map +1 -0
- package/dist/coloring/shading.mjs +47 -0
- package/dist/coloring/shading.mjs.map +1 -0
- package/dist/coloring/types.d.mts +13 -0
- package/dist/coloring/types.d.ts +8 -6
- package/dist/coloring/types.js +31 -1
- package/dist/coloring/types.js.map +1 -0
- package/dist/coloring/types.mjs +6 -0
- package/dist/coloring/types.mjs.map +1 -0
- package/dist/components/Avatar.d.mts +17 -0
- package/dist/components/Avatar.d.ts +9 -6
- package/dist/components/Avatar.js +79 -29
- package/dist/components/Avatar.js.map +1 -0
- package/dist/components/Avatar.mjs +48 -0
- package/dist/components/Avatar.mjs.map +1 -0
- package/dist/components/AvatarGroup.d.mts +14 -0
- package/dist/components/AvatarGroup.d.ts +7 -3
- package/dist/components/AvatarGroup.js +117 -12
- package/dist/components/AvatarGroup.js.map +1 -0
- package/dist/components/AvatarGroup.mjs +81 -0
- package/dist/components/AvatarGroup.mjs.map +1 -0
- package/dist/components/BreadCrumb.d.mts +19 -0
- package/dist/components/BreadCrumb.d.ts +6 -3
- package/dist/components/BreadCrumb.js +49 -11
- package/dist/components/BreadCrumb.js.map +1 -0
- package/dist/components/BreadCrumb.mjs +15 -0
- package/dist/components/BreadCrumb.mjs.map +1 -0
- package/dist/components/Button.d.mts +44 -0
- package/dist/components/Button.d.ts +16 -13
- package/dist/components/Button.js +232 -80
- package/dist/components/Button.js.map +1 -0
- package/dist/components/Button.mjs +198 -0
- package/dist/components/Button.mjs.map +1 -0
- package/dist/components/ChipList.d.mts +24 -0
- package/dist/components/ChipList.d.ts +10 -7
- package/dist/components/ChipList.js +103 -36
- package/dist/components/ChipList.js.map +1 -0
- package/dist/components/ChipList.mjs +69 -0
- package/dist/components/ChipList.mjs.map +1 -0
- package/dist/components/Circle.d.mts +10 -0
- package/dist/components/Circle.d.ts +7 -3
- package/dist/components/Circle.js +61 -9
- package/dist/components/Circle.js.map +1 -0
- package/dist/components/Circle.mjs +27 -0
- package/dist/components/Circle.mjs.map +1 -0
- package/dist/components/ErrorComponent.d.mts +18 -0
- package/dist/components/ErrorComponent.d.ts +9 -4
- package/dist/components/ErrorComponent.js +86 -17
- package/dist/components/ErrorComponent.js.map +1 -0
- package/dist/components/ErrorComponent.mjs +53 -0
- package/dist/components/ErrorComponent.mjs.map +1 -0
- package/dist/components/Expandable.d.mts +33 -0
- package/dist/components/Expandable.d.ts +8 -5
- package/dist/components/Expandable.js +79 -15
- package/dist/components/Expandable.js.map +1 -0
- package/dist/components/Expandable.mjs +45 -0
- package/dist/components/Expandable.mjs.map +1 -0
- package/dist/components/HelpwaveBadge.d.mts +14 -0
- package/dist/components/HelpwaveBadge.d.ts +6 -3
- package/dist/components/HelpwaveBadge.js +125 -13
- package/dist/components/HelpwaveBadge.js.map +1 -0
- package/dist/components/HelpwaveBadge.mjs +91 -0
- package/dist/components/HelpwaveBadge.mjs.map +1 -0
- package/dist/components/HideableContentSection.d.mts +14 -0
- package/dist/components/HideableContentSection.d.ts +7 -3
- package/dist/components/HideableContentSection.js +69 -14
- package/dist/components/HideableContentSection.js.map +1 -0
- package/dist/components/HideableContentSection.mjs +35 -0
- package/dist/components/HideableContentSection.mjs.map +1 -0
- package/dist/components/InputGroup.d.mts +17 -0
- package/dist/components/InputGroup.d.ts +7 -3
- package/dist/components/InputGroup.js +96 -32
- package/dist/components/InputGroup.js.map +1 -0
- package/dist/components/InputGroup.mjs +62 -0
- package/dist/components/InputGroup.mjs.map +1 -0
- package/dist/components/LoadingAndErrorComponent.d.mts +24 -0
- package/dist/components/LoadingAndErrorComponent.d.ts +12 -5
- package/dist/components/LoadingAndErrorComponent.js +178 -23
- package/dist/components/LoadingAndErrorComponent.js.map +1 -0
- package/dist/components/LoadingAndErrorComponent.mjs +145 -0
- package/dist/components/LoadingAndErrorComponent.mjs.map +1 -0
- package/dist/components/LoadingAnimation.d.mts +18 -0
- package/dist/components/LoadingAnimation.d.ts +9 -4
- package/dist/components/LoadingAnimation.js +124 -16
- package/dist/components/LoadingAnimation.js.map +1 -0
- package/dist/components/LoadingAnimation.mjs +90 -0
- package/dist/components/LoadingAnimation.mjs.map +1 -0
- package/dist/components/LoadingButton.d.mts +10 -0
- package/dist/components/LoadingButton.d.ts +7 -3
- package/dist/components/LoadingButton.js +169 -9
- package/dist/components/LoadingButton.js.map +1 -0
- package/dist/components/LoadingButton.mjs +135 -0
- package/dist/components/LoadingButton.mjs.map +1 -0
- package/dist/components/MarkdownInterpreter.d.mts +28 -0
- package/dist/components/MarkdownInterpreter.d.ts +8 -5
- package/dist/components/MarkdownInterpreter.js +246 -175
- package/dist/components/MarkdownInterpreter.js.map +1 -0
- package/dist/components/MarkdownInterpreter.mjs +235 -0
- package/dist/components/MarkdownInterpreter.mjs.map +1 -0
- package/dist/components/Pagination.d.mts +19 -0
- package/dist/components/Pagination.d.ts +9 -4
- package/dist/components/Pagination.js +100 -23
- package/dist/components/Pagination.js.map +1 -0
- package/dist/components/Pagination.mjs +67 -0
- package/dist/components/Pagination.mjs.map +1 -0
- package/dist/components/Profile.d.mts +31 -0
- package/dist/components/Profile.d.ts +8 -5
- package/dist/components/Profile.js +194 -42
- package/dist/components/Profile.js.map +1 -0
- package/dist/components/Profile.mjs +162 -0
- package/dist/components/Profile.mjs.map +1 -0
- package/dist/components/ProgressIndicator.d.mts +24 -0
- package/dist/components/ProgressIndicator.d.ts +6 -3
- package/dist/components/ProgressIndicator.js +82 -22
- package/dist/components/ProgressIndicator.js.map +1 -0
- package/dist/components/ProgressIndicator.mjs +59 -0
- package/dist/components/ProgressIndicator.mjs.map +1 -0
- package/dist/components/Ring.d.mts +35 -0
- package/dist/components/Ring.d.ts +13 -9
- package/dist/components/Ring.js +331 -107
- package/dist/components/Ring.js.map +1 -0
- package/dist/components/Ring.mjs +299 -0
- package/dist/components/Ring.mjs.map +1 -0
- package/dist/components/SearchableList.d.mts +22 -0
- package/dist/components/SearchableList.d.ts +9 -5
- package/dist/components/SearchableList.js +268 -24
- package/dist/components/SearchableList.js.map +1 -0
- package/dist/components/SearchableList.mjs +241 -0
- package/dist/components/SearchableList.mjs.map +1 -0
- package/dist/components/SortButton.d.mts +15 -0
- package/dist/components/SortButton.d.ts +9 -4
- package/dist/components/SortButton.js +131 -8
- package/dist/components/SortButton.js.map +1 -0
- package/dist/components/SortButton.mjs +97 -0
- package/dist/components/SortButton.mjs.map +1 -0
- package/dist/components/StepperBar.d.mts +28 -0
- package/dist/components/StepperBar.d.ts +10 -5
- package/dist/components/StepperBar.js +248 -44
- package/dist/components/StepperBar.js.map +1 -0
- package/dist/components/StepperBar.mjs +216 -0
- package/dist/components/StepperBar.mjs.map +1 -0
- package/dist/components/Table.d.mts +90 -0
- package/dist/components/Table.d.ts +20 -17
- package/dist/components/Table.js +396 -170
- package/dist/components/Table.js.map +1 -0
- package/dist/components/Table.mjs +370 -0
- package/dist/components/Table.mjs.map +1 -0
- package/dist/components/TechRadar.d.mts +39 -0
- package/dist/components/TechRadar.d.ts +5 -2
- package/dist/components/TechRadar.js +241 -189
- package/dist/components/TechRadar.js.map +1 -0
- package/dist/components/TechRadar.mjs +208 -0
- package/dist/components/TechRadar.mjs.map +1 -0
- package/dist/components/TextImage.d.mts +25 -0
- package/dist/components/TextImage.d.ts +9 -4
- package/dist/components/TextImage.js +121 -29
- package/dist/components/TextImage.js.map +1 -0
- package/dist/components/TextImage.mjs +86 -0
- package/dist/components/TextImage.mjs.map +1 -0
- package/dist/components/TimeDisplay.d.mts +35 -0
- package/dist/components/TimeDisplay.d.ts +8 -3
- package/dist/components/TimeDisplay.js +134 -81
- package/dist/components/TimeDisplay.js.map +1 -0
- package/dist/components/TimeDisplay.mjs +109 -0
- package/dist/components/TimeDisplay.mjs.map +1 -0
- package/dist/components/Tooltip.d.mts +37 -0
- package/dist/components/Tooltip.d.ts +7 -4
- package/dist/components/Tooltip.js +135 -37
- package/dist/components/Tooltip.js.map +1 -0
- package/dist/components/Tooltip.mjs +109 -0
- package/dist/components/Tooltip.mjs.map +1 -0
- package/dist/components/VerticalDivider.d.mts +15 -0
- package/dist/components/VerticalDivider.d.ts +6 -2
- package/dist/components/VerticalDivider.js +80 -6
- package/dist/components/VerticalDivider.js.map +1 -0
- package/dist/components/VerticalDivider.mjs +56 -0
- package/dist/components/VerticalDivider.mjs.map +1 -0
- package/dist/components/date/DatePicker.d.mts +32 -0
- package/dist/components/date/DatePicker.d.ts +13 -7
- package/dist/components/date/DatePicker.js +624 -55
- package/dist/components/date/DatePicker.js.map +1 -0
- package/dist/components/date/DatePicker.mjs +591 -0
- package/dist/components/date/DatePicker.mjs.map +1 -0
- package/dist/components/date/DayPicker.d.mts +20 -0
- package/dist/components/date/DayPicker.d.ts +8 -4
- package/dist/components/date/DayPicker.js +232 -36
- package/dist/components/date/DayPicker.js.map +1 -0
- package/dist/components/date/DayPicker.mjs +195 -0
- package/dist/components/date/DayPicker.mjs.map +1 -0
- package/dist/components/date/TimePicker.d.mts +15 -0
- package/dist/components/date/TimePicker.d.ts +7 -4
- package/dist/components/date/TimePicker.js +196 -75
- package/dist/components/date/TimePicker.js.map +1 -0
- package/dist/components/date/TimePicker.mjs +164 -0
- package/dist/components/date/TimePicker.mjs.map +1 -0
- package/dist/components/date/YearMonthPicker.d.mts +15 -0
- package/dist/components/date/YearMonthPicker.d.ts +7 -3
- package/dist/components/date/YearMonthPicker.js +281 -57
- package/dist/components/date/YearMonthPicker.js.map +1 -0
- package/dist/components/date/YearMonthPicker.mjs +247 -0
- package/dist/components/date/YearMonthPicker.mjs.map +1 -0
- package/dist/components/icons/Helpwave.d.mts +14 -0
- package/dist/components/icons/Helpwave.d.ts +7 -3
- package/dist/components/icons/Helpwave.js +66 -18
- package/dist/components/icons/Helpwave.js.map +1 -0
- package/dist/components/icons/Helpwave.mjs +43 -0
- package/dist/components/icons/Helpwave.mjs.map +1 -0
- package/dist/components/icons/Tag.d.mts +14 -0
- package/dist/components/icons/Tag.d.ts +7 -3
- package/dist/components/icons/Tag.js +59 -11
- package/dist/components/icons/Tag.js.map +1 -0
- package/dist/components/icons/Tag.mjs +25 -0
- package/dist/components/icons/Tag.mjs.map +1 -0
- package/dist/components/layout/Carousel.d.mts +25 -0
- package/dist/components/layout/Carousel.d.ts +6 -3
- package/dist/components/layout/Carousel.js +477 -226
- package/dist/components/layout/Carousel.js.map +1 -0
- package/dist/components/layout/Carousel.mjs +449 -0
- package/dist/components/layout/Carousel.mjs.map +1 -0
- package/dist/components/layout/DividerInserter.d.mts +15 -0
- package/dist/components/layout/DividerInserter.d.ts +7 -3
- package/dist/components/layout/DividerInserter.js +58 -18
- package/dist/components/layout/DividerInserter.js.map +1 -0
- package/dist/components/layout/DividerInserter.mjs +25 -0
- package/dist/components/layout/DividerInserter.mjs.map +1 -0
- package/dist/components/layout/FAQSection.d.mts +26 -0
- package/dist/components/layout/FAQSection.d.ts +9 -6
- package/dist/components/layout/FAQSection.js +336 -13
- package/dist/components/layout/FAQSection.js.map +1 -0
- package/dist/components/layout/FAQSection.mjs +302 -0
- package/dist/components/layout/FAQSection.mjs.map +1 -0
- package/dist/components/layout/Tile.d.mts +37 -0
- package/dist/components/layout/Tile.d.ts +9 -6
- package/dist/components/layout/Tile.js +76 -16
- package/dist/components/layout/Tile.js.map +1 -0
- package/dist/components/layout/Tile.mjs +42 -0
- package/dist/components/layout/Tile.mjs.map +1 -0
- package/dist/components/modals/ConfirmDialog.d.mts +38 -0
- package/dist/components/modals/ConfirmDialog.d.ts +13 -9
- package/dist/components/modals/ConfirmDialog.js +422 -28
- package/dist/components/modals/ConfirmDialog.js.map +1 -0
- package/dist/components/modals/ConfirmDialog.mjs +388 -0
- package/dist/components/modals/ConfirmDialog.mjs.map +1 -0
- package/dist/components/modals/DiscardChangesDialog.d.mts +23 -0
- package/dist/components/modals/DiscardChangesDialog.d.ts +9 -5
- package/dist/components/modals/DiscardChangesDialog.js +406 -23
- package/dist/components/modals/DiscardChangesDialog.js.map +1 -0
- package/dist/components/modals/DiscardChangesDialog.mjs +370 -0
- package/dist/components/modals/DiscardChangesDialog.mjs.map +1 -0
- package/dist/components/modals/InputModal.d.mts +19 -0
- package/dist/components/modals/InputModal.d.ts +14 -4
- package/dist/components/modals/InputModal.js +598 -8
- package/dist/components/modals/InputModal.js.map +1 -0
- package/dist/components/modals/InputModal.mjs +567 -0
- package/dist/components/modals/InputModal.mjs.map +1 -0
- package/dist/components/modals/LanguageModal.d.mts +21 -0
- package/dist/components/modals/LanguageModal.d.ts +9 -5
- package/dist/components/modals/LanguageModal.js +524 -33
- package/dist/components/modals/LanguageModal.js.map +1 -0
- package/dist/components/modals/LanguageModal.mjs +489 -0
- package/dist/components/modals/LanguageModal.mjs.map +1 -0
- package/dist/components/modals/Modal.d.mts +43 -0
- package/dist/components/modals/Modal.d.ts +13 -8
- package/dist/components/modals/Modal.js +280 -51
- package/dist/components/modals/Modal.js.map +1 -0
- package/dist/components/modals/Modal.mjs +249 -0
- package/dist/components/modals/Modal.mjs.map +1 -0
- package/dist/components/modals/ModalRegister.d.mts +16 -0
- package/dist/components/modals/ModalRegister.d.ts +9 -4
- package/dist/components/modals/ModalRegister.js +61 -26
- package/dist/components/modals/ModalRegister.js.map +1 -0
- package/dist/components/modals/ModalRegister.mjs +37 -0
- package/dist/components/modals/ModalRegister.mjs.map +1 -0
- package/dist/components/properties/CheckboxProperty.d.mts +20 -0
- package/dist/components/properties/CheckboxProperty.d.ts +10 -5
- package/dist/components/properties/CheckboxProperty.js +323 -24
- package/dist/components/properties/CheckboxProperty.js.map +1 -0
- package/dist/components/properties/CheckboxProperty.mjs +291 -0
- package/dist/components/properties/CheckboxProperty.mjs.map +1 -0
- package/dist/components/properties/DateProperty.d.mts +18 -0
- package/dist/components/properties/DateProperty.d.ts +10 -3
- package/dist/components/properties/DateProperty.js +422 -21
- package/dist/components/properties/DateProperty.js.map +1 -0
- package/dist/components/properties/DateProperty.mjs +393 -0
- package/dist/components/properties/DateProperty.mjs.map +1 -0
- package/dist/components/properties/MultiSelectProperty.d.mts +18 -0
- package/dist/components/properties/MultiSelectProperty.d.ts +12 -6
- package/dist/components/properties/MultiSelectProperty.js +815 -31
- package/dist/components/properties/MultiSelectProperty.js.map +1 -0
- package/dist/components/properties/MultiSelectProperty.mjs +787 -0
- package/dist/components/properties/MultiSelectProperty.mjs.map +1 -0
- package/dist/components/properties/NumberProperty.d.mts +21 -0
- package/dist/components/properties/NumberProperty.d.ts +10 -5
- package/dist/components/properties/NumberProperty.js +429 -39
- package/dist/components/properties/NumberProperty.js.map +1 -0
- package/dist/components/properties/NumberProperty.mjs +402 -0
- package/dist/components/properties/NumberProperty.mjs.map +1 -0
- package/dist/components/properties/PropertyBase.d.mts +27 -0
- package/dist/components/properties/PropertyBase.d.ts +9 -5
- package/dist/components/properties/PropertyBase.js +194 -24
- package/dist/components/properties/PropertyBase.js.map +1 -0
- package/dist/components/properties/PropertyBase.mjs +162 -0
- package/dist/components/properties/PropertyBase.mjs.map +1 -0
- package/dist/components/properties/SelectProperty.d.mts +19 -0
- package/dist/components/properties/SelectProperty.d.ts +13 -6
- package/dist/components/properties/SelectProperty.js +547 -19
- package/dist/components/properties/SelectProperty.js.map +1 -0
- package/dist/components/properties/SelectProperty.mjs +520 -0
- package/dist/components/properties/SelectProperty.mjs.map +1 -0
- package/dist/components/properties/TextProperty.d.mts +20 -0
- package/dist/components/properties/TextProperty.d.ts +10 -5
- package/dist/components/properties/TextProperty.js +378 -34
- package/dist/components/properties/TextProperty.js.map +1 -0
- package/dist/components/properties/TextProperty.mjs +346 -0
- package/dist/components/properties/TextProperty.mjs.map +1 -0
- package/dist/components/user-input/Checkbox.d.mts +41 -0
- package/dist/components/user-input/Checkbox.d.ts +9 -5
- package/dist/components/user-input/Checkbox.js +148 -63
- package/dist/components/user-input/Checkbox.js.map +1 -0
- package/dist/components/user-input/Checkbox.mjs +112 -0
- package/dist/components/user-input/Checkbox.mjs.map +1 -0
- package/dist/components/user-input/DateAndTimePicker.d.mts +47 -0
- package/dist/components/user-input/DateAndTimePicker.d.ts +15 -7
- package/dist/components/user-input/DateAndTimePicker.js +831 -60
- package/dist/components/user-input/DateAndTimePicker.js.map +1 -0
- package/dist/components/user-input/DateAndTimePicker.mjs +801 -0
- package/dist/components/user-input/DateAndTimePicker.mjs.map +1 -0
- package/dist/components/user-input/Input.d.mts +64 -0
- package/dist/components/user-input/Input.d.ts +12 -9
- package/dist/components/user-input/Input.js +219 -57
- package/dist/components/user-input/Input.js.map +1 -0
- package/dist/components/user-input/Input.mjs +191 -0
- package/dist/components/user-input/Input.mjs.map +1 -0
- package/dist/components/user-input/Label.d.mts +16 -0
- package/dist/components/user-input/Label.d.ts +8 -4
- package/dist/components/user-input/Label.js +43 -11
- package/dist/components/user-input/Label.js.map +1 -0
- package/dist/components/user-input/Label.mjs +19 -0
- package/dist/components/user-input/Label.mjs.map +1 -0
- package/dist/components/user-input/Menu.d.mts +24 -0
- package/dist/components/user-input/Menu.d.ts +8 -5
- package/dist/components/user-input/Menu.js +162 -25
- package/dist/components/user-input/Menu.js.map +1 -0
- package/dist/components/user-input/Menu.mjs +127 -0
- package/dist/components/user-input/Menu.mjs.map +1 -0
- package/dist/components/user-input/MultiSelect.d.mts +43 -0
- package/dist/components/user-input/MultiSelect.d.ts +12 -8
- package/dist/components/user-input/MultiSelect.js +545 -56
- package/dist/components/user-input/MultiSelect.js.map +1 -0
- package/dist/components/user-input/MultiSelect.mjs +516 -0
- package/dist/components/user-input/MultiSelect.mjs.map +1 -0
- package/dist/components/user-input/ScrollPicker.d.mts +15 -0
- package/dist/components/user-input/ScrollPicker.d.ts +6 -2
- package/dist/components/user-input/ScrollPicker.js +276 -145
- package/dist/components/user-input/ScrollPicker.js.map +1 -0
- package/dist/components/user-input/ScrollPicker.mjs +247 -0
- package/dist/components/user-input/ScrollPicker.mjs.map +1 -0
- package/dist/components/user-input/SearchableSelect.d.mts +14 -0
- package/dist/components/user-input/SearchableSelect.d.ts +9 -3
- package/dist/components/user-input/SearchableSelect.js +334 -13
- package/dist/components/user-input/SearchableSelect.js.map +1 -0
- package/dist/components/user-input/SearchableSelect.mjs +305 -0
- package/dist/components/user-input/SearchableSelect.mjs.map +1 -0
- package/dist/components/user-input/Select.d.mts +36 -0
- package/dist/components/user-input/Select.d.ts +9 -5
- package/dist/components/user-input/Select.js +152 -47
- package/dist/components/user-input/Select.js.map +1 -0
- package/dist/components/user-input/Select.mjs +118 -0
- package/dist/components/user-input/Select.mjs.map +1 -0
- package/dist/components/user-input/Textarea.d.mts +24 -0
- package/dist/components/user-input/Textarea.d.ts +8 -4
- package/dist/components/user-input/Textarea.js +153 -31
- package/dist/components/user-input/Textarea.js.map +1 -0
- package/dist/components/user-input/Textarea.mjs +120 -0
- package/dist/components/user-input/Textarea.mjs.map +1 -0
- package/dist/components/user-input/ToggleableInput.d.mts +35 -0
- package/dist/components/user-input/ToggleableInput.d.ts +6 -3
- package/dist/components/user-input/ToggleableInput.js +161 -38
- package/dist/components/user-input/ToggleableInput.js.map +1 -0
- package/dist/components/user-input/ToggleableInput.mjs +128 -0
- package/dist/components/user-input/ToggleableInput.mjs.map +1 -0
- package/dist/hooks/useHoverState.d.mts +42 -0
- package/dist/hooks/useHoverState.d.ts +5 -3
- package/dist/hooks/useHoverState.js +69 -43
- package/dist/hooks/useHoverState.js.map +1 -0
- package/dist/hooks/useHoverState.mjs +47 -0
- package/dist/hooks/useHoverState.mjs.map +1 -0
- package/dist/hooks/useLanguage.d.mts +21 -0
- package/dist/hooks/useLanguage.d.ts +15 -11
- package/dist/hooks/useLanguage.js +145 -50
- package/dist/hooks/useLanguage.js.map +1 -0
- package/dist/hooks/useLanguage.mjs +115 -0
- package/dist/hooks/useLanguage.mjs.map +1 -0
- package/dist/hooks/useLocalStorage.d.mts +6 -0
- package/dist/hooks/useLocalStorage.d.ts +4 -2
- package/dist/hooks/useLocalStorage.js +79 -23
- package/dist/hooks/useLocalStorage.js.map +1 -0
- package/dist/hooks/useLocalStorage.mjs +59 -0
- package/dist/hooks/useLocalStorage.mjs.map +1 -0
- package/dist/hooks/useOutsideClick.d.mts +5 -0
- package/dist/hooks/useOutsideClick.d.ts +5 -2
- package/dist/hooks/useOutsideClick.js +47 -21
- package/dist/hooks/useOutsideClick.js.map +1 -0
- package/dist/hooks/useOutsideClick.mjs +23 -0
- package/dist/hooks/useOutsideClick.mjs.map +1 -0
- package/dist/hooks/useSaveDelay.d.mts +6 -0
- package/dist/hooks/useSaveDelay.d.ts +2 -1
- package/dist/hooks/useSaveDelay.js +62 -38
- package/dist/hooks/useSaveDelay.js.map +1 -0
- package/dist/hooks/useSaveDelay.mjs +44 -0
- package/dist/hooks/useSaveDelay.mjs.map +1 -0
- package/dist/hooks/useTheme.d.mts +21 -0
- package/dist/hooks/useTheme.d.ts +14 -9
- package/dist/hooks/useTheme.js +65 -29
- package/dist/hooks/useTheme.js.map +1 -0
- package/dist/hooks/useTheme.mjs +40 -0
- package/dist/hooks/useTheme.mjs.map +1 -0
- package/dist/hooks/useTranslation.d.mts +28 -0
- package/dist/hooks/useTranslation.d.ts +9 -5
- package/dist/hooks/useTranslation.js +53 -10
- package/dist/hooks/useTranslation.js.map +1 -0
- package/dist/hooks/useTranslation.mjs +27 -0
- package/dist/hooks/useTranslation.mjs.map +1 -0
- package/dist/index.d.mts +86 -0
- package/dist/index.d.ts +86 -0
- package/dist/index.js +5716 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +5542 -0
- package/dist/index.mjs.map +1 -0
- package/dist/util/array.d.mts +25 -0
- package/dist/util/array.d.ts +9 -7
- package/dist/util/array.js +119 -92
- package/dist/util/array.js.map +1 -0
- package/dist/util/array.mjs +99 -0
- package/dist/util/array.mjs.map +1 -0
- package/dist/util/builder.d.mts +8 -0
- package/dist/util/builder.d.ts +3 -1
- package/dist/util/builder.js +33 -8
- package/dist/util/builder.js.map +1 -0
- package/dist/util/builder.mjs +9 -0
- package/dist/util/builder.mjs.map +1 -0
- package/dist/util/date.d.mts +30 -0
- package/dist/util/date.d.ts +17 -15
- package/dist/util/date.js +184 -123
- package/dist/util/date.js.map +1 -0
- package/dist/util/date.mjs +156 -0
- package/dist/util/date.mjs.map +1 -0
- package/dist/util/easeFunctions.d.mts +11 -0
- package/dist/util/easeFunctions.d.ts +4 -2
- package/dist/util/easeFunctions.js +63 -30
- package/dist/util/easeFunctions.js.map +1 -0
- package/dist/util/easeFunctions.mjs +36 -0
- package/dist/util/easeFunctions.mjs.map +1 -0
- package/dist/util/emailValidation.d.mts +3 -0
- package/dist/util/emailValidation.d.ts +3 -1
- package/dist/util/emailValidation.js +32 -2
- package/dist/util/emailValidation.js.map +1 -0
- package/dist/util/emailValidation.mjs +8 -0
- package/dist/util/emailValidation.mjs.map +1 -0
- package/dist/util/loopingArray.d.mts +25 -0
- package/dist/util/loopingArray.d.ts +4 -2
- package/dist/util/loopingArray.js +89 -59
- package/dist/util/loopingArray.js.map +1 -0
- package/dist/util/loopingArray.mjs +72 -0
- package/dist/util/loopingArray.mjs.map +1 -0
- package/dist/util/math.d.mts +3 -0
- package/dist/util/math.d.ts +3 -1
- package/dist/util/math.js +32 -2
- package/dist/util/math.js.map +1 -0
- package/dist/util/math.mjs +8 -0
- package/dist/util/math.mjs.map +1 -0
- package/dist/util/news.d.mts +103 -0
- package/dist/util/news.d.ts +12 -7
- package/dist/util/news.js +73 -24
- package/dist/util/news.js.map +1 -0
- package/dist/util/news.mjs +48 -0
- package/dist/util/news.mjs.map +1 -0
- package/dist/util/noop.d.mts +3 -0
- package/dist/util/noop.d.ts +3 -1
- package/dist/util/noop.js +31 -1
- package/dist/util/noop.js.map +1 -0
- package/dist/util/noop.mjs +6 -0
- package/dist/util/noop.mjs.map +1 -0
- package/dist/util/simpleSearch.d.mts +50 -0
- package/dist/util/simpleSearch.d.ts +6 -4
- package/dist/util/simpleSearch.js +50 -58
- package/dist/util/simpleSearch.js.map +1 -0
- package/dist/util/simpleSearch.mjs +26 -0
- package/dist/util/simpleSearch.mjs.map +1 -0
- package/dist/util/storage.d.mts +16 -0
- package/dist/util/storage.d.ts +4 -3
- package/dist/util/storage.js +63 -31
- package/dist/util/storage.js.map +1 -0
- package/dist/util/storage.mjs +38 -0
- package/dist/util/storage.mjs.map +1 -0
- package/dist/util/types.d.mts +3 -0
- package/dist/util/types.d.ts +3 -1
- package/dist/util/types.js +19 -1
- package/dist/util/types.js.map +1 -0
- package/dist/util/types.mjs +1 -0
- package/dist/util/types.mjs.map +1 -0
- package/package.json +20 -9
- package/dist/components/Span.d.ts +0 -0
- package/dist/components/Span.js +0 -1
- package/dist/components/examples/InputGroupExample.d.ts +0 -6
- package/dist/components/examples/InputGroupExample.js +0 -21
- package/dist/components/examples/MultiSelectExample.d.ts +0 -7
- package/dist/components/examples/MultiSelectExample.js +0 -27
- package/dist/components/examples/SearchableSelectExample.d.ts +0 -6
- package/dist/components/examples/SearchableSelectExample.js +0 -17
- package/dist/components/examples/SelectExample.d.ts +0 -4
- package/dist/components/examples/SelectExample.js +0 -15
- package/dist/components/examples/StackingModals.d.ts +0 -4
- package/dist/components/examples/StackingModals.js +0 -15
- package/dist/components/examples/TableExample.d.ts +0 -9
- package/dist/components/examples/TableExample.js +0 -92
- package/dist/components/examples/TextareaExample.d.ts +0 -6
- package/dist/components/examples/TextareaExample.js +0 -10
- package/dist/components/examples/TileExample.d.ts +0 -9
- package/dist/components/examples/TileExample.js +0 -9
- package/dist/components/examples/Title.d.ts +0 -0
- package/dist/components/examples/Title.js +0 -1
- package/dist/components/examples/date/DateTimePickerExample.d.ts +0 -10
- package/dist/components/examples/date/DateTimePickerExample.js +0 -21
- package/dist/components/examples/properties/CheckboxPropertyExample.d.ts +0 -8
- package/dist/components/examples/properties/CheckboxPropertyExample.js +0 -13
- package/dist/components/examples/properties/DatePropertyExample.d.ts +0 -8
- package/dist/components/examples/properties/DatePropertyExample.js +0 -23
- package/dist/components/examples/properties/MultiSelectPropertyExample.d.ts +0 -8
- package/dist/components/examples/properties/MultiSelectPropertyExample.js +0 -16
- package/dist/components/examples/properties/NumberPropertyExample.d.ts +0 -6
- package/dist/components/examples/properties/NumberPropertyExample.js +0 -13
- package/dist/components/examples/properties/SelectPropertyExample.d.ts +0 -6
- package/dist/components/examples/properties/SelectPropertyExample.js +0 -18
- package/dist/components/examples/properties/TextPropertyExample.d.ts +0 -8
- package/dist/components/examples/properties/TextPropertyExample.js +0 -13
package/dist/util/date.js
CHANGED
|
@@ -1,133 +1,194 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
9
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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;
|
|
15
17
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/util/date.ts
|
|
21
|
+
var date_exports = {};
|
|
22
|
+
__export(date_exports, {
|
|
23
|
+
addDuration: () => addDuration,
|
|
24
|
+
changeDuration: () => changeDuration,
|
|
25
|
+
equalDate: () => equalDate,
|
|
26
|
+
formatDate: () => formatDate,
|
|
27
|
+
formatDateTime: () => formatDateTime,
|
|
28
|
+
getBetweenDuration: () => getBetweenDuration,
|
|
29
|
+
getDaysInMonth: () => getDaysInMonth,
|
|
30
|
+
getWeeksForCalenderMonth: () => getWeeksForCalenderMonth,
|
|
31
|
+
isInTimeSpan: () => isInTimeSpan,
|
|
32
|
+
monthsList: () => monthsList,
|
|
33
|
+
subtractDuration: () => subtractDuration,
|
|
34
|
+
weekDayList: () => weekDayList
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(date_exports);
|
|
37
|
+
|
|
38
|
+
// src/util/array.ts
|
|
39
|
+
var equalSizeGroups = (array, groupSize) => {
|
|
40
|
+
if (groupSize <= 0) {
|
|
41
|
+
console.warn(`group size should be greater than 0: groupSize = ${groupSize}`);
|
|
42
|
+
return [[...array]];
|
|
43
|
+
}
|
|
44
|
+
const groups = [];
|
|
45
|
+
for (let i = 0; i < array.length; i += groupSize) {
|
|
46
|
+
groups.push(array.slice(i, Math.min(i + groupSize, array.length)));
|
|
47
|
+
}
|
|
48
|
+
return groups;
|
|
19
49
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return new Date(date);
|
|
30
|
-
}
|
|
31
|
-
if (days < 0) {
|
|
32
|
-
console.error(`Range error days must be greater than 0: received ${days}`);
|
|
33
|
-
return new Date(date);
|
|
34
|
-
}
|
|
35
|
-
if (hours < 0 || hours > 23) {
|
|
36
|
-
console.error(`Range error hours must be 0 <= hours <= 23: received ${hours}`);
|
|
37
|
-
return new Date(date);
|
|
38
|
-
}
|
|
39
|
-
if (minutes < 0 || minutes > 59) {
|
|
40
|
-
console.error(`Range error minutes must be 0 <= minutes <= 59: received ${minutes}`);
|
|
41
|
-
return new Date(date);
|
|
42
|
-
}
|
|
43
|
-
if (seconds < 0 || seconds > 59) {
|
|
44
|
-
console.error(`Range error seconds must be 0 <= seconds <= 59: received ${seconds}`);
|
|
45
|
-
return new Date(date);
|
|
46
|
-
}
|
|
47
|
-
if (milliseconds < 0) {
|
|
48
|
-
console.error(`Range error seconds must be greater than 0: received ${milliseconds}`);
|
|
49
|
-
return new Date(date);
|
|
50
|
-
}
|
|
51
|
-
const multiplier = isAdding ? 1 : -1;
|
|
52
|
-
const newDate = new Date(date);
|
|
53
|
-
newDate.setFullYear(newDate.getFullYear() + multiplier * years);
|
|
54
|
-
newDate.setMonth(newDate.getMonth() + multiplier * months);
|
|
55
|
-
newDate.setDate(newDate.getDate() + multiplier * days);
|
|
56
|
-
newDate.setHours(newDate.getHours() + multiplier * hours);
|
|
57
|
-
newDate.setMinutes(newDate.getMinutes() + multiplier * minutes);
|
|
58
|
-
newDate.setSeconds(newDate.getSeconds() + multiplier * seconds);
|
|
59
|
-
newDate.setMilliseconds(newDate.getMilliseconds() + multiplier * milliseconds);
|
|
60
|
-
return newDate;
|
|
50
|
+
|
|
51
|
+
// src/util/date.ts
|
|
52
|
+
var monthsList = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];
|
|
53
|
+
var weekDayList = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
|
|
54
|
+
var formatDate = (date) => {
|
|
55
|
+
const year = date.getFullYear().toString().padStart(4, "0");
|
|
56
|
+
const month = (date.getMonth() + 1).toString().padStart(2, "0");
|
|
57
|
+
const day = date.getDate().toString().padStart(2, "0");
|
|
58
|
+
return `${year}-${month}-${day}`;
|
|
61
59
|
};
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
var formatDateTime = (date) => {
|
|
61
|
+
const dateString = formatDate(date);
|
|
62
|
+
const hours = date.getHours().toString().padStart(2, "0");
|
|
63
|
+
const minutes = date.getMinutes().toString().padStart(2, "0");
|
|
64
|
+
return `${dateString}T${hours}:${minutes}`;
|
|
64
65
|
};
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
var getDaysInMonth = (year, month) => {
|
|
67
|
+
const lastDayOfMonth = new Date(year, month + 1, 0);
|
|
68
|
+
return lastDayOfMonth.getDate();
|
|
67
69
|
};
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
70
|
+
var changeDuration = (date, duration, isAdding) => {
|
|
71
|
+
const {
|
|
72
|
+
years = 0,
|
|
73
|
+
months = 0,
|
|
74
|
+
days = 0,
|
|
75
|
+
hours = 0,
|
|
76
|
+
minutes = 0,
|
|
77
|
+
seconds = 0,
|
|
78
|
+
milliseconds = 0
|
|
79
|
+
} = duration;
|
|
80
|
+
if (years < 0) {
|
|
81
|
+
console.error(`Range error years must be greater than 0: received ${years}`);
|
|
82
|
+
return new Date(date);
|
|
83
|
+
}
|
|
84
|
+
if (months < 0 || months > 11) {
|
|
85
|
+
console.error(`Range error month must be 0 <= month <= 11: received ${months}`);
|
|
86
|
+
return new Date(date);
|
|
87
|
+
}
|
|
88
|
+
if (days < 0) {
|
|
89
|
+
console.error(`Range error days must be greater than 0: received ${days}`);
|
|
90
|
+
return new Date(date);
|
|
91
|
+
}
|
|
92
|
+
if (hours < 0 || hours > 23) {
|
|
93
|
+
console.error(`Range error hours must be 0 <= hours <= 23: received ${hours}`);
|
|
94
|
+
return new Date(date);
|
|
95
|
+
}
|
|
96
|
+
if (minutes < 0 || minutes > 59) {
|
|
97
|
+
console.error(`Range error minutes must be 0 <= minutes <= 59: received ${minutes}`);
|
|
98
|
+
return new Date(date);
|
|
99
|
+
}
|
|
100
|
+
if (seconds < 0 || seconds > 59) {
|
|
101
|
+
console.error(`Range error seconds must be 0 <= seconds <= 59: received ${seconds}`);
|
|
102
|
+
return new Date(date);
|
|
103
|
+
}
|
|
104
|
+
if (milliseconds < 0) {
|
|
105
|
+
console.error(`Range error seconds must be greater than 0: received ${milliseconds}`);
|
|
106
|
+
return new Date(date);
|
|
107
|
+
}
|
|
108
|
+
const multiplier = isAdding ? 1 : -1;
|
|
109
|
+
const newDate = new Date(date);
|
|
110
|
+
newDate.setFullYear(newDate.getFullYear() + multiplier * years);
|
|
111
|
+
newDate.setMonth(newDate.getMonth() + multiplier * months);
|
|
112
|
+
newDate.setDate(newDate.getDate() + multiplier * days);
|
|
113
|
+
newDate.setHours(newDate.getHours() + multiplier * hours);
|
|
114
|
+
newDate.setMinutes(newDate.getMinutes() + multiplier * minutes);
|
|
115
|
+
newDate.setSeconds(newDate.getSeconds() + multiplier * seconds);
|
|
116
|
+
newDate.setMilliseconds(newDate.getMilliseconds() + multiplier * milliseconds);
|
|
117
|
+
return newDate;
|
|
89
118
|
};
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
* An undefined value for startDate or endDate means no bound for the start or end respectively
|
|
93
|
-
*/
|
|
94
|
-
export const isInTimeSpan = (value, startDate, endDate) => {
|
|
95
|
-
if (startDate && endDate) {
|
|
96
|
-
console.assert(startDate <= endDate);
|
|
97
|
-
return startDate <= value && value <= endDate;
|
|
98
|
-
}
|
|
99
|
-
else if (startDate) {
|
|
100
|
-
return startDate <= value;
|
|
101
|
-
}
|
|
102
|
-
else if (endDate) {
|
|
103
|
-
return endDate >= value;
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
return true;
|
|
107
|
-
}
|
|
119
|
+
var addDuration = (date, duration) => {
|
|
120
|
+
return changeDuration(date, duration, true);
|
|
108
121
|
};
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return date1.getFullYear() === date2.getFullYear()
|
|
112
|
-
&& date1.getMonth() === date2.getMonth()
|
|
113
|
-
&& date1.getDate() === date2.getDate();
|
|
122
|
+
var subtractDuration = (date, duration) => {
|
|
123
|
+
return changeDuration(date, duration, false);
|
|
114
124
|
};
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
125
|
+
var getBetweenDuration = (startDate, endDate) => {
|
|
126
|
+
const durationInMilliseconds = endDate.getTime() - startDate.getTime();
|
|
127
|
+
const millisecondsInSecond = 1e3;
|
|
128
|
+
const millisecondsInMinute = 60 * millisecondsInSecond;
|
|
129
|
+
const millisecondsInHour = 60 * millisecondsInMinute;
|
|
130
|
+
const millisecondsInDay = 24 * millisecondsInHour;
|
|
131
|
+
const millisecondsInMonth = 30 * millisecondsInDay;
|
|
132
|
+
const years = Math.floor(durationInMilliseconds / (365.25 * millisecondsInDay));
|
|
133
|
+
const months = Math.floor(durationInMilliseconds / millisecondsInMonth);
|
|
134
|
+
const days = Math.floor(durationInMilliseconds / millisecondsInDay);
|
|
135
|
+
const hours = Math.floor(durationInMilliseconds % millisecondsInDay / millisecondsInHour);
|
|
136
|
+
const seconds = Math.floor(durationInMilliseconds % millisecondsInHour / millisecondsInSecond);
|
|
137
|
+
const milliseconds = durationInMilliseconds % millisecondsInSecond;
|
|
138
|
+
return {
|
|
139
|
+
years,
|
|
140
|
+
months,
|
|
141
|
+
days,
|
|
142
|
+
hours,
|
|
143
|
+
seconds,
|
|
144
|
+
milliseconds
|
|
145
|
+
};
|
|
133
146
|
};
|
|
147
|
+
var isInTimeSpan = (value, startDate, endDate) => {
|
|
148
|
+
if (startDate && endDate) {
|
|
149
|
+
console.assert(startDate <= endDate);
|
|
150
|
+
return startDate <= value && value <= endDate;
|
|
151
|
+
} else if (startDate) {
|
|
152
|
+
return startDate <= value;
|
|
153
|
+
} else if (endDate) {
|
|
154
|
+
return endDate >= value;
|
|
155
|
+
} else {
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
var equalDate = (date1, date2) => {
|
|
160
|
+
return date1.getFullYear() === date2.getFullYear() && date1.getMonth() === date2.getMonth() && date1.getDate() === date2.getDate();
|
|
161
|
+
};
|
|
162
|
+
var getWeeksForCalenderMonth = (date, weekStart, weeks = 6) => {
|
|
163
|
+
const month = date.getMonth();
|
|
164
|
+
const year = date.getFullYear();
|
|
165
|
+
const dayList = [];
|
|
166
|
+
let currentDate = new Date(year, month, 1);
|
|
167
|
+
const weekStartIndex = weekDayList.indexOf(weekStart);
|
|
168
|
+
while (currentDate.getDay() !== weekStartIndex) {
|
|
169
|
+
currentDate = subtractDuration(currentDate, { days: 1 });
|
|
170
|
+
}
|
|
171
|
+
while (dayList.length < 7 * weeks) {
|
|
172
|
+
const date2 = new Date(currentDate);
|
|
173
|
+
date2.setHours(date2.getHours(), date2.getMinutes());
|
|
174
|
+
dayList.push(date2);
|
|
175
|
+
currentDate = addDuration(currentDate, { days: 1 });
|
|
176
|
+
}
|
|
177
|
+
return equalSizeGroups(dayList, 7);
|
|
178
|
+
};
|
|
179
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
180
|
+
0 && (module.exports = {
|
|
181
|
+
addDuration,
|
|
182
|
+
changeDuration,
|
|
183
|
+
equalDate,
|
|
184
|
+
formatDate,
|
|
185
|
+
formatDateTime,
|
|
186
|
+
getBetweenDuration,
|
|
187
|
+
getDaysInMonth,
|
|
188
|
+
getWeeksForCalenderMonth,
|
|
189
|
+
isInTimeSpan,
|
|
190
|
+
monthsList,
|
|
191
|
+
subtractDuration,
|
|
192
|
+
weekDayList
|
|
193
|
+
});
|
|
194
|
+
//# sourceMappingURL=date.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/util/date.ts","../../src/util/array.ts"],"sourcesContent":["import { equalSizeGroups } from './array'\n\nexport const monthsList = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'] as const\nexport type Month = typeof monthsList[number]\n\nexport const weekDayList = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'] as const\nexport type WeekDay = typeof weekDayList[number]\n\nexport const formatDate = (date: Date) => {\n const year = date.getFullYear().toString().padStart(4, '0')\n const month = (date.getMonth() + 1).toString().padStart(2, '0')\n const day = (date.getDate()).toString().padStart(2, '0')\n return `${year}-${month}-${day}`\n}\n\nexport const formatDateTime = (date: Date) => {\n const dateString = formatDate(date)\n const hours = date.getHours().toString().padStart(2, '0')\n const minutes = date.getMinutes().toString().padStart(2, '0')\n return `${dateString}T${hours}:${minutes}`\n}\n\nexport const getDaysInMonth = (year: number, month: number): number => {\n const lastDayOfMonth = new Date(year, month + 1, 0)\n return lastDayOfMonth.getDate()\n}\n\nexport type Duration = {\n years?: number,\n months?: number,\n days?: number,\n hours?: number,\n minutes?: number,\n seconds?: number,\n milliseconds?: number,\n}\n\nexport const changeDuration = (date: Date, duration: Duration, isAdding?: boolean): Date => {\n const {\n years = 0,\n months = 0,\n days = 0,\n hours = 0,\n minutes = 0,\n seconds = 0,\n milliseconds = 0,\n } = duration\n\n // Check ranges\n if (years < 0) {\n console.error(`Range error years must be greater than 0: received ${years}`)\n return new Date(date)\n }\n if (months < 0 || months > 11) {\n console.error(`Range error month must be 0 <= month <= 11: received ${months}`)\n return new Date(date)\n }\n if (days < 0) {\n console.error(`Range error days must be greater than 0: received ${days}`)\n return new Date(date)\n }\n if (hours < 0 || hours > 23) {\n console.error(`Range error hours must be 0 <= hours <= 23: received ${hours}`)\n return new Date(date)\n }\n if (minutes < 0 || minutes > 59) {\n console.error(`Range error minutes must be 0 <= minutes <= 59: received ${minutes}`)\n return new Date(date)\n }\n if (seconds < 0 || seconds > 59) {\n console.error(`Range error seconds must be 0 <= seconds <= 59: received ${seconds}`)\n return new Date(date)\n }\n if (milliseconds < 0) {\n console.error(`Range error seconds must be greater than 0: received ${milliseconds}`)\n return new Date(date)\n }\n\n const multiplier = isAdding ? 1 : -1\n\n const newDate = new Date(date)\n\n newDate.setFullYear(newDate.getFullYear() + multiplier * years)\n\n newDate.setMonth(newDate.getMonth() + multiplier * months)\n\n newDate.setDate(newDate.getDate() + multiplier * days)\n\n newDate.setHours(newDate.getHours() + multiplier * hours)\n\n newDate.setMinutes(newDate.getMinutes() + multiplier * minutes)\n\n newDate.setSeconds(newDate.getSeconds() + multiplier * seconds)\n\n newDate.setMilliseconds(newDate.getMilliseconds() + multiplier * milliseconds)\n\n return newDate\n}\n\nexport const addDuration = (date: Date, duration: Duration): Date => {\n return changeDuration(date, duration, true)\n}\n\nexport const subtractDuration = (date: Date, duration: Duration): Date => {\n return changeDuration(date, duration, false)\n}\n\nexport const getBetweenDuration = (startDate: Date, endDate: Date): Duration => {\n const durationInMilliseconds = endDate.getTime() - startDate.getTime()\n\n const millisecondsInSecond = 1000\n const millisecondsInMinute = 60 * millisecondsInSecond\n const millisecondsInHour = 60 * millisecondsInMinute\n const millisecondsInDay = 24 * millisecondsInHour\n const millisecondsInMonth = 30 * millisecondsInDay // Rough estimation, can be adjusted\n\n const years = Math.floor(durationInMilliseconds / (365.25 * millisecondsInDay))\n const months = Math.floor(durationInMilliseconds / millisecondsInMonth)\n const days = Math.floor(durationInMilliseconds / millisecondsInDay)\n const hours = Math.floor((durationInMilliseconds % millisecondsInDay) / millisecondsInHour)\n const seconds = Math.floor((durationInMilliseconds % millisecondsInHour) / millisecondsInSecond)\n const milliseconds = durationInMilliseconds % millisecondsInSecond\n\n return {\n years,\n months,\n days,\n hours,\n seconds,\n milliseconds,\n }\n}\n\n/** Checks if a given date is in the range of two dates\n *\n * An undefined value for startDate or endDate means no bound for the start or end respectively\n */\nexport const isInTimeSpan = (value: Date, startDate?: Date, endDate?: Date): boolean => {\n if(startDate && endDate) {\n console.assert(startDate <= endDate)\n return startDate <= value && value <= endDate\n } else if (startDate) {\n return startDate <= value\n } else if(endDate) {\n return endDate >= value\n } else {\n return true\n }\n}\n\n/** Compare two dates on the year, month, day */\nexport const equalDate = (date1: Date, date2: Date) => {\n return date1.getFullYear() === date2.getFullYear()\n && date1.getMonth() === date2.getMonth()\n && date1.getDate() === date2.getDate()\n}\n\nexport const getWeeksForCalenderMonth = (date: Date, weekStart: WeekDay, weeks: number = 6) => {\n const month = date.getMonth()\n const year = date.getFullYear()\n\n const dayList: Date[] = []\n let currentDate = new Date(year, month, 1) // Start of month\n const weekStartIndex = weekDayList.indexOf(weekStart)\n\n // Move the current day to the week before\n while (currentDate.getDay() !== weekStartIndex) {\n currentDate = subtractDuration(currentDate, { days: 1 })\n }\n\n while (dayList.length < 7 * weeks) {\n const date = new Date(currentDate)\n date.setHours(date.getHours(), date.getMinutes()) // To make sure we are not overwriting the time\n dayList.push(date)\n currentDate = addDuration(currentDate, { days: 1 })\n }\n\n // weeks\n return equalSizeGroups(dayList, 7)\n}\n","export const equalSizeGroups = <T >(array: T[], groupSize: number): T[][] => {\n if (groupSize <= 0) {\n console.warn(`group size should be greater than 0: groupSize = ${groupSize}`)\n return [[...array]]\n }\n\n const groups = []\n for (let i = 0; i < array.length; i += groupSize) {\n groups.push(array.slice(i, Math.min(i + groupSize, array.length)))\n }\n return groups\n}\n\n/**\n * @param start\n * @param end inclusive\n * @param allowEmptyRange Whether the range can be defined empty via end < start\n */\nexport const range = (start: number, end: number, allowEmptyRange: boolean = false): number[] => {\n if (end < start) {\n if (!allowEmptyRange) {\n console.warn(`range: end (${end}) < start (${start}) should be allowed explicitly, set allowEmptyRange to true`)\n }\n return []\n }\n return Array.from({ length: end - start + 1 }, (_, index) => index + start)\n}\n\n/** Finds the closest match\n * @param list The list of all possible matches\n * @param firstCloser Return whether item1 is closer than item2\n */\nexport const closestMatch = <T >(list: T[], firstCloser: (item1: T, item2: T) => boolean) => {\n return list.reduce((item1, item2) => {\n return firstCloser(item1, item2) ? item1 : item2\n })\n}\n\n/**\n * returns the item in middle of a list and its neighbours before and after\n * e.g. [1,2,3,4,5,6] for item = 1 would return [5,6,1,2,3]\n */\nexport const getNeighbours = <T >(list: T[], item: T, neighbourDistance: number = 2) => {\n const index = list.indexOf(item)\n const totalItems = neighbourDistance * 2 + 1\n if (list.length < totalItems) {\n console.warn('List is to short')\n return list\n }\n\n if (index === -1) {\n console.error('item not found in list')\n return list.splice(0, totalItems)\n }\n\n let start = index - neighbourDistance\n if (start < 0) {\n start += list.length\n }\n const end = (index + neighbourDistance + 1) % list.length\n\n const result: T[] = []\n let ignoreOnce = list.length === totalItems\n for (let i = start; i !== end || ignoreOnce; i = (i + 1) % list.length) {\n result.push(list[i]!)\n if (end === i && ignoreOnce) {\n ignoreOnce = false\n }\n }\n return result\n}\n\nexport const createLoopingListWithIndex = <T >(list: T[], startIndex: number = 0, length: number = 0, forwards: boolean = true) => {\n if (length < 0) {\n console.warn(`createLoopingList: length must be >= 0, given ${length}`)\n } else if (length === 0) {\n length = list.length\n }\n\n const returnList: [number, T][] = []\n\n if (forwards) {\n for (let i = startIndex; returnList.length < length; i = (i + 1) % list.length) {\n returnList.push([i, list[i]!])\n }\n } else {\n for (let i = startIndex; returnList.length < length; i = i === 0 ? i = list.length - 1 : i - 1) {\n returnList.push([i, list[i]!])\n }\n }\n\n return returnList\n}\n\nexport const createLoopingList = <T >(list: T[], startIndex: number = 0, length: number = 0, forwards: boolean = true) => {\n return createLoopingListWithIndex(list, startIndex, length, forwards).map(([_, item]) => item)\n}\n\nexport const ArrayUtil = {\n unique: <T>(list: T[]): T[] => {\n const seen = new Set<T>()\n return list.filter((item) => {\n if (seen.has(item)) {\n return false\n }\n seen.add(item)\n return true\n })\n },\n\n difference: <T>(list: T[], removeList: T[]): T[] => {\n const remove = new Set<T>(removeList)\n return list.filter((item) => !remove.has(item))\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA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U,SAAS;AACjB,WAAO,WAAW;AAAA,EACpB,OAAO;AACL,WAAO;AAAA,EACT;AACF;AAGO,IAAM,YAAY,CAAC,OAAa,UAAgB;AACrD,SAAO,MAAM,YAAY,MAAM,MAAM,YAAY,KAC5C,MAAM,SAAS,MAAM,MAAM,SAAS,KACpC,MAAM,QAAQ,MAAM,MAAM,QAAQ;AACzC;AAEO,IAAM,2BAA2B,CAAC,MAAY,WAAoB,QAAgB,MAAM;AAC7F,QAAM,QAAQ,KAAK,SAAS;AAC5B,QAAM,OAAO,KAAK,YAAY;AAE9B,QAAM,UAAkB,CAAC;AACzB,MAAI,cAAc,IAAI,KAAK,MAAM,OAAO,CAAC;AACzC,QAAM,iBAAiB,YAAY,QAAQ,SAAS;AAGpD,SAAO,YAAY,OAAO,MAAM,gBAAgB;AAC9C,kBAAc,iBAAiB,aAAa,EAAE,MAAM,EAAE,CAAC;AAAA,EACzD;AAEA,SAAO,QAAQ,SAAS,IAAI,OAAO;AACjC,UAAMA,QAAO,IAAI,KAAK,WAAW;AACjC,IAAAA,MAAK,SAASA,MAAK,SAAS,GAAGA,MAAK,WAAW,CAAC;AAChD,YAAQ,KAAKA,KAAI;AACjB,kBAAc,YAAY,aAAa,EAAE,MAAM,EAAE,CAAC;AAAA,EACpD;AAGA,SAAO,gBAAgB,SAAS,CAAC;AACnC;","names":["date"]}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
// src/util/array.ts
|
|
2
|
+
var equalSizeGroups = (array, groupSize) => {
|
|
3
|
+
if (groupSize <= 0) {
|
|
4
|
+
console.warn(`group size should be greater than 0: groupSize = ${groupSize}`);
|
|
5
|
+
return [[...array]];
|
|
6
|
+
}
|
|
7
|
+
const groups = [];
|
|
8
|
+
for (let i = 0; i < array.length; i += groupSize) {
|
|
9
|
+
groups.push(array.slice(i, Math.min(i + groupSize, array.length)));
|
|
10
|
+
}
|
|
11
|
+
return groups;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// src/util/date.ts
|
|
15
|
+
var monthsList = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];
|
|
16
|
+
var weekDayList = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
|
|
17
|
+
var formatDate = (date) => {
|
|
18
|
+
const year = date.getFullYear().toString().padStart(4, "0");
|
|
19
|
+
const month = (date.getMonth() + 1).toString().padStart(2, "0");
|
|
20
|
+
const day = date.getDate().toString().padStart(2, "0");
|
|
21
|
+
return `${year}-${month}-${day}`;
|
|
22
|
+
};
|
|
23
|
+
var formatDateTime = (date) => {
|
|
24
|
+
const dateString = formatDate(date);
|
|
25
|
+
const hours = date.getHours().toString().padStart(2, "0");
|
|
26
|
+
const minutes = date.getMinutes().toString().padStart(2, "0");
|
|
27
|
+
return `${dateString}T${hours}:${minutes}`;
|
|
28
|
+
};
|
|
29
|
+
var getDaysInMonth = (year, month) => {
|
|
30
|
+
const lastDayOfMonth = new Date(year, month + 1, 0);
|
|
31
|
+
return lastDayOfMonth.getDate();
|
|
32
|
+
};
|
|
33
|
+
var changeDuration = (date, duration, isAdding) => {
|
|
34
|
+
const {
|
|
35
|
+
years = 0,
|
|
36
|
+
months = 0,
|
|
37
|
+
days = 0,
|
|
38
|
+
hours = 0,
|
|
39
|
+
minutes = 0,
|
|
40
|
+
seconds = 0,
|
|
41
|
+
milliseconds = 0
|
|
42
|
+
} = duration;
|
|
43
|
+
if (years < 0) {
|
|
44
|
+
console.error(`Range error years must be greater than 0: received ${years}`);
|
|
45
|
+
return new Date(date);
|
|
46
|
+
}
|
|
47
|
+
if (months < 0 || months > 11) {
|
|
48
|
+
console.error(`Range error month must be 0 <= month <= 11: received ${months}`);
|
|
49
|
+
return new Date(date);
|
|
50
|
+
}
|
|
51
|
+
if (days < 0) {
|
|
52
|
+
console.error(`Range error days must be greater than 0: received ${days}`);
|
|
53
|
+
return new Date(date);
|
|
54
|
+
}
|
|
55
|
+
if (hours < 0 || hours > 23) {
|
|
56
|
+
console.error(`Range error hours must be 0 <= hours <= 23: received ${hours}`);
|
|
57
|
+
return new Date(date);
|
|
58
|
+
}
|
|
59
|
+
if (minutes < 0 || minutes > 59) {
|
|
60
|
+
console.error(`Range error minutes must be 0 <= minutes <= 59: received ${minutes}`);
|
|
61
|
+
return new Date(date);
|
|
62
|
+
}
|
|
63
|
+
if (seconds < 0 || seconds > 59) {
|
|
64
|
+
console.error(`Range error seconds must be 0 <= seconds <= 59: received ${seconds}`);
|
|
65
|
+
return new Date(date);
|
|
66
|
+
}
|
|
67
|
+
if (milliseconds < 0) {
|
|
68
|
+
console.error(`Range error seconds must be greater than 0: received ${milliseconds}`);
|
|
69
|
+
return new Date(date);
|
|
70
|
+
}
|
|
71
|
+
const multiplier = isAdding ? 1 : -1;
|
|
72
|
+
const newDate = new Date(date);
|
|
73
|
+
newDate.setFullYear(newDate.getFullYear() + multiplier * years);
|
|
74
|
+
newDate.setMonth(newDate.getMonth() + multiplier * months);
|
|
75
|
+
newDate.setDate(newDate.getDate() + multiplier * days);
|
|
76
|
+
newDate.setHours(newDate.getHours() + multiplier * hours);
|
|
77
|
+
newDate.setMinutes(newDate.getMinutes() + multiplier * minutes);
|
|
78
|
+
newDate.setSeconds(newDate.getSeconds() + multiplier * seconds);
|
|
79
|
+
newDate.setMilliseconds(newDate.getMilliseconds() + multiplier * milliseconds);
|
|
80
|
+
return newDate;
|
|
81
|
+
};
|
|
82
|
+
var addDuration = (date, duration) => {
|
|
83
|
+
return changeDuration(date, duration, true);
|
|
84
|
+
};
|
|
85
|
+
var subtractDuration = (date, duration) => {
|
|
86
|
+
return changeDuration(date, duration, false);
|
|
87
|
+
};
|
|
88
|
+
var getBetweenDuration = (startDate, endDate) => {
|
|
89
|
+
const durationInMilliseconds = endDate.getTime() - startDate.getTime();
|
|
90
|
+
const millisecondsInSecond = 1e3;
|
|
91
|
+
const millisecondsInMinute = 60 * millisecondsInSecond;
|
|
92
|
+
const millisecondsInHour = 60 * millisecondsInMinute;
|
|
93
|
+
const millisecondsInDay = 24 * millisecondsInHour;
|
|
94
|
+
const millisecondsInMonth = 30 * millisecondsInDay;
|
|
95
|
+
const years = Math.floor(durationInMilliseconds / (365.25 * millisecondsInDay));
|
|
96
|
+
const months = Math.floor(durationInMilliseconds / millisecondsInMonth);
|
|
97
|
+
const days = Math.floor(durationInMilliseconds / millisecondsInDay);
|
|
98
|
+
const hours = Math.floor(durationInMilliseconds % millisecondsInDay / millisecondsInHour);
|
|
99
|
+
const seconds = Math.floor(durationInMilliseconds % millisecondsInHour / millisecondsInSecond);
|
|
100
|
+
const milliseconds = durationInMilliseconds % millisecondsInSecond;
|
|
101
|
+
return {
|
|
102
|
+
years,
|
|
103
|
+
months,
|
|
104
|
+
days,
|
|
105
|
+
hours,
|
|
106
|
+
seconds,
|
|
107
|
+
milliseconds
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
var isInTimeSpan = (value, startDate, endDate) => {
|
|
111
|
+
if (startDate && endDate) {
|
|
112
|
+
console.assert(startDate <= endDate);
|
|
113
|
+
return startDate <= value && value <= endDate;
|
|
114
|
+
} else if (startDate) {
|
|
115
|
+
return startDate <= value;
|
|
116
|
+
} else if (endDate) {
|
|
117
|
+
return endDate >= value;
|
|
118
|
+
} else {
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
var equalDate = (date1, date2) => {
|
|
123
|
+
return date1.getFullYear() === date2.getFullYear() && date1.getMonth() === date2.getMonth() && date1.getDate() === date2.getDate();
|
|
124
|
+
};
|
|
125
|
+
var getWeeksForCalenderMonth = (date, weekStart, weeks = 6) => {
|
|
126
|
+
const month = date.getMonth();
|
|
127
|
+
const year = date.getFullYear();
|
|
128
|
+
const dayList = [];
|
|
129
|
+
let currentDate = new Date(year, month, 1);
|
|
130
|
+
const weekStartIndex = weekDayList.indexOf(weekStart);
|
|
131
|
+
while (currentDate.getDay() !== weekStartIndex) {
|
|
132
|
+
currentDate = subtractDuration(currentDate, { days: 1 });
|
|
133
|
+
}
|
|
134
|
+
while (dayList.length < 7 * weeks) {
|
|
135
|
+
const date2 = new Date(currentDate);
|
|
136
|
+
date2.setHours(date2.getHours(), date2.getMinutes());
|
|
137
|
+
dayList.push(date2);
|
|
138
|
+
currentDate = addDuration(currentDate, { days: 1 });
|
|
139
|
+
}
|
|
140
|
+
return equalSizeGroups(dayList, 7);
|
|
141
|
+
};
|
|
142
|
+
export {
|
|
143
|
+
addDuration,
|
|
144
|
+
changeDuration,
|
|
145
|
+
equalDate,
|
|
146
|
+
formatDate,
|
|
147
|
+
formatDateTime,
|
|
148
|
+
getBetweenDuration,
|
|
149
|
+
getDaysInMonth,
|
|
150
|
+
getWeeksForCalenderMonth,
|
|
151
|
+
isInTimeSpan,
|
|
152
|
+
monthsList,
|
|
153
|
+
subtractDuration,
|
|
154
|
+
weekDayList
|
|
155
|
+
};
|
|
156
|
+
//# sourceMappingURL=date.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/util/array.ts","../../src/util/date.ts"],"sourcesContent":["export const equalSizeGroups = <T >(array: T[], groupSize: number): T[][] => {\n if (groupSize <= 0) {\n console.warn(`group size should be greater than 0: groupSize = ${groupSize}`)\n return [[...array]]\n }\n\n const groups = []\n for (let i = 0; i < array.length; i += groupSize) {\n groups.push(array.slice(i, Math.min(i + groupSize, array.length)))\n }\n return groups\n}\n\n/**\n * @param start\n * @param end inclusive\n * @param allowEmptyRange Whether the range can be defined empty via end < start\n */\nexport const range = (start: number, end: number, allowEmptyRange: boolean = false): number[] => {\n if (end < start) {\n if (!allowEmptyRange) {\n console.warn(`range: end (${end}) < start (${start}) should be allowed explicitly, set allowEmptyRange to true`)\n }\n return []\n }\n return Array.from({ length: end - start + 1 }, (_, index) => index + start)\n}\n\n/** Finds the closest match\n * @param list The list of all possible matches\n * @param firstCloser Return whether item1 is closer than item2\n */\nexport const closestMatch = <T >(list: T[], firstCloser: (item1: T, item2: T) => boolean) => {\n return list.reduce((item1, item2) => {\n return firstCloser(item1, item2) ? item1 : item2\n })\n}\n\n/**\n * returns the item in middle of a list and its neighbours before and after\n * e.g. [1,2,3,4,5,6] for item = 1 would return [5,6,1,2,3]\n */\nexport const getNeighbours = <T >(list: T[], item: T, neighbourDistance: number = 2) => {\n const index = list.indexOf(item)\n const totalItems = neighbourDistance * 2 + 1\n if (list.length < totalItems) {\n console.warn('List is to short')\n return list\n }\n\n if (index === -1) {\n console.error('item not found in list')\n return list.splice(0, totalItems)\n }\n\n let start = index - neighbourDistance\n if (start < 0) {\n start += list.length\n }\n const end = (index + neighbourDistance + 1) % list.length\n\n const result: T[] = []\n let ignoreOnce = list.length === totalItems\n for (let i = start; i !== end || ignoreOnce; i = (i + 1) % list.length) {\n result.push(list[i]!)\n if (end === i && ignoreOnce) {\n ignoreOnce = false\n }\n }\n return result\n}\n\nexport const createLoopingListWithIndex = <T >(list: T[], startIndex: number = 0, length: number = 0, forwards: boolean = true) => {\n if (length < 0) {\n console.warn(`createLoopingList: length must be >= 0, given ${length}`)\n } else if (length === 0) {\n length = list.length\n }\n\n const returnList: [number, T][] = []\n\n if (forwards) {\n for (let i = startIndex; returnList.length < length; i = (i + 1) % list.length) {\n returnList.push([i, list[i]!])\n }\n } else {\n for (let i = startIndex; returnList.length < length; i = i === 0 ? i = list.length - 1 : i - 1) {\n returnList.push([i, list[i]!])\n }\n }\n\n return returnList\n}\n\nexport const createLoopingList = <T >(list: T[], startIndex: number = 0, length: number = 0, forwards: boolean = true) => {\n return createLoopingListWithIndex(list, startIndex, length, forwards).map(([_, item]) => item)\n}\n\nexport const ArrayUtil = {\n unique: <T>(list: T[]): T[] => {\n const seen = new Set<T>()\n return list.filter((item) => {\n if (seen.has(item)) {\n return false\n }\n seen.add(item)\n return true\n })\n },\n\n difference: <T>(list: T[], removeList: T[]): T[] => {\n const remove = new Set<T>(removeList)\n return list.filter((item) => !remove.has(item))\n }\n}\n","import { equalSizeGroups } from './array'\n\nexport const monthsList = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'] as const\nexport type Month = typeof monthsList[number]\n\nexport const weekDayList = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'] as const\nexport type WeekDay = typeof weekDayList[number]\n\nexport const formatDate = (date: Date) => {\n const year = date.getFullYear().toString().padStart(4, '0')\n const month = (date.getMonth() + 1).toString().padStart(2, '0')\n const day = (date.getDate()).toString().padStart(2, '0')\n return `${year}-${month}-${day}`\n}\n\nexport const formatDateTime = (date: Date) => {\n const dateString = formatDate(date)\n const hours = date.getHours().toString().padStart(2, '0')\n const minutes = date.getMinutes().toString().padStart(2, '0')\n return `${dateString}T${hours}:${minutes}`\n}\n\nexport const getDaysInMonth = (year: number, month: number): number => {\n const lastDayOfMonth = new Date(year, month + 1, 0)\n return lastDayOfMonth.getDate()\n}\n\nexport type Duration = {\n years?: number,\n months?: number,\n days?: number,\n hours?: number,\n minutes?: number,\n seconds?: number,\n milliseconds?: number,\n}\n\nexport const changeDuration = (date: Date, duration: Duration, isAdding?: boolean): Date => {\n const {\n years = 0,\n months = 0,\n days = 0,\n hours = 0,\n minutes = 0,\n seconds = 0,\n milliseconds = 0,\n } = duration\n\n // Check ranges\n if (years < 0) {\n console.error(`Range error years must be greater than 0: received ${years}`)\n return new Date(date)\n }\n if (months < 0 || months > 11) {\n console.error(`Range error month must be 0 <= month <= 11: received ${months}`)\n return new Date(date)\n }\n if (days < 0) {\n console.error(`Range error days must be greater than 0: received ${days}`)\n return new Date(date)\n }\n if (hours < 0 || hours > 23) {\n console.error(`Range error hours must be 0 <= hours <= 23: received ${hours}`)\n return new Date(date)\n }\n if (minutes < 0 || minutes > 59) {\n console.error(`Range error minutes must be 0 <= minutes <= 59: received ${minutes}`)\n return new Date(date)\n }\n if (seconds < 0 || seconds > 59) {\n console.error(`Range error seconds must be 0 <= seconds <= 59: received ${seconds}`)\n return new Date(date)\n }\n if (milliseconds < 0) {\n console.error(`Range error seconds must be greater than 0: received ${milliseconds}`)\n return new Date(date)\n }\n\n const multiplier = isAdding ? 1 : -1\n\n const newDate = new Date(date)\n\n newDate.setFullYear(newDate.getFullYear() + multiplier * years)\n\n newDate.setMonth(newDate.getMonth() + multiplier * months)\n\n newDate.setDate(newDate.getDate() + multiplier * days)\n\n newDate.setHours(newDate.getHours() + multiplier * hours)\n\n newDate.setMinutes(newDate.getMinutes() + multiplier * minutes)\n\n newDate.setSeconds(newDate.getSeconds() + multiplier * seconds)\n\n newDate.setMilliseconds(newDate.getMilliseconds() + multiplier * milliseconds)\n\n return newDate\n}\n\nexport const addDuration = (date: Date, duration: Duration): Date => {\n return changeDuration(date, duration, true)\n}\n\nexport const subtractDuration = (date: Date, duration: Duration): Date => {\n return changeDuration(date, duration, false)\n}\n\nexport const getBetweenDuration = (startDate: Date, endDate: Date): Duration => {\n const durationInMilliseconds = endDate.getTime() - startDate.getTime()\n\n const millisecondsInSecond = 1000\n const millisecondsInMinute = 60 * millisecondsInSecond\n const millisecondsInHour = 60 * millisecondsInMinute\n const millisecondsInDay = 24 * millisecondsInHour\n const millisecondsInMonth = 30 * millisecondsInDay // Rough estimation, can be adjusted\n\n const years = Math.floor(durationInMilliseconds / (365.25 * millisecondsInDay))\n const months = Math.floor(durationInMilliseconds / millisecondsInMonth)\n const days = Math.floor(durationInMilliseconds / millisecondsInDay)\n const hours = Math.floor((durationInMilliseconds % millisecondsInDay) / millisecondsInHour)\n const seconds = Math.floor((durationInMilliseconds % millisecondsInHour) / millisecondsInSecond)\n const milliseconds = durationInMilliseconds % millisecondsInSecond\n\n return {\n years,\n months,\n days,\n hours,\n seconds,\n milliseconds,\n }\n}\n\n/** Checks if a given date is in the range of two dates\n *\n * An undefined value for startDate or endDate means no bound for the start or end respectively\n */\nexport const isInTimeSpan = (value: Date, startDate?: Date, endDate?: Date): boolean => {\n if(startDate && endDate) {\n console.assert(startDate <= endDate)\n return startDate <= value && value <= endDate\n } else if (startDate) {\n return startDate <= value\n } else if(endDate) {\n return endDate >= value\n } else {\n return true\n }\n}\n\n/** Compare two dates on the year, month, day */\nexport const equalDate = (date1: Date, date2: Date) => {\n return date1.getFullYear() === date2.getFullYear()\n && date1.getMonth() === date2.getMonth()\n && date1.getDate() === date2.getDate()\n}\n\nexport const getWeeksForCalenderMonth = (date: Date, weekStart: WeekDay, weeks: number = 6) => {\n const month = date.getMonth()\n const year = date.getFullYear()\n\n const dayList: Date[] = []\n let currentDate = new Date(year, month, 1) // Start of month\n const weekStartIndex = weekDayList.indexOf(weekStart)\n\n // Move the current day to the week before\n while (currentDate.getDay() !== weekStartIndex) {\n currentDate = subtractDuration(currentDate, { days: 1 })\n }\n\n while (dayList.length < 7 * weeks) {\n const date = new Date(currentDate)\n date.setHours(date.getHours(), date.getMinutes()) // To make sure we are not overwriting the time\n dayList.push(date)\n currentDate = addDuration(currentDate, { days: 1 })\n }\n\n // weeks\n return equalSizeGroups(dayList, 7)\n}\n"],"mappings":";AAAO,IAAM,kBAAkB,CAAK,OAAY,cAA6B;AAC3E,MAAI,aAAa,GAAG;AAClB,YAAQ,KAAK,oDAAoD,SAAS,EAAE;AAC5E,WAAO,CAAC,CAAC,GAAG,KAAK,CAAC;AAAA,EACpB;AAEA,QAAM,SAAS,CAAC;AAChB,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK,WAAW;AAChD,WAAO,KAAK,MAAM,MAAM,GAAG,KAAK,IAAI,IAAI,WAAW,MAAM,MAAM,CAAC,CAAC;AAAA,EACnE;AACA,SAAO;AACT;;;ACTO,IAAM,aAAa,CAAC,WAAW,YAAY,SAAS,SAAS,OAAO,QAAQ,QAAQ,UAAU,aAAa,WAAW,YAAY,UAAU;AAG5I,IAAM,cAAc,CAAC,UAAU,UAAU,WAAW,aAAa,YAAY,UAAU,UAAU;AAGjG,IAAM,aAAa,CAAC,SAAe;AACxC,QAAM,OAAO,KAAK,YAAY,EAAE,SAAS,EAAE,SAAS,GAAG,GAAG;AAC1D,QAAM,SAAS,KAAK,SAAS,IAAI,G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,aAAa,EAAE,MAAM,EAAE,CAAC;AAAA,EACpD;AAGA,SAAO,gBAAgB,SAAS,CAAC;AACnC;","names":["date"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type EaseFunction = (t: number) => number;
|
|
2
|
+
declare class EaseFunctions {
|
|
3
|
+
static cubicBezierGeneric(x1: number, y1: number, x2: number, y2: number): {
|
|
4
|
+
x: EaseFunction;
|
|
5
|
+
y: EaseFunction;
|
|
6
|
+
};
|
|
7
|
+
static cubicBezier(x1: number, y1: number, x2: number, y2: number): EaseFunction;
|
|
8
|
+
static easeInEaseOut(t: number): number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { type EaseFunction, EaseFunctions };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
type EaseFunction = (t: number) => number;
|
|
2
|
+
declare class EaseFunctions {
|
|
3
3
|
static cubicBezierGeneric(x1: number, y1: number, x2: number, y2: number): {
|
|
4
4
|
x: EaseFunction;
|
|
5
5
|
y: EaseFunction;
|
|
@@ -7,3 +7,5 @@ export declare class EaseFunctions {
|
|
|
7
7
|
static cubicBezier(x1: number, y1: number, x2: number, y2: number): EaseFunction;
|
|
8
8
|
static easeInEaseOut(t: number): number;
|
|
9
9
|
}
|
|
10
|
+
|
|
11
|
+
export { type EaseFunction, EaseFunctions };
|