@homecode/ui 4.18.16 → 4.18.17
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/esm/index.js +83 -2
- package/dist/esm/node_modules/style-inject/dist/style-inject.es.js +28 -2
- package/dist/esm/src/components/AssistiveText/AssistiveText.js +10 -2
- package/dist/esm/src/components/AssistiveText/AssistiveText.styl.js +7 -2
- package/dist/esm/src/components/Button/Button.helpers.js +12 -2
- package/dist/esm/src/components/Button/Button.js +38 -2
- package/dist/esm/src/components/Button/Button.styl.js +7 -2
- package/dist/esm/src/components/ButtonGroup/ButtonGroup.js +10 -2
- package/dist/esm/src/components/ButtonGroup/ButtonGroup.styl.js +7 -2
- package/dist/esm/src/components/Calendar/Calendar.helpers.js +65 -2
- package/dist/esm/src/components/Calendar/Calendar.js +66 -2
- package/dist/esm/src/components/Calendar/Calendar.styl.js +7 -2
- package/dist/esm/src/components/Checkbox/Checkbox.js +48 -2
- package/dist/esm/src/components/Checkbox/Checkbox.styl.js +7 -2
- package/dist/esm/src/components/Container/Container.js +12 -2
- package/dist/esm/src/components/Container/Container.styl.js +7 -2
- package/dist/esm/src/components/DatePicker/DatePicker.helpers.js +31 -2
- package/dist/esm/src/components/DatePicker/DatePicker.js +47 -2
- package/dist/esm/src/components/DatePicker/DatePicker.styl.js +7 -2
- package/dist/esm/src/components/DatePickerInput/DatePickerInput.js +20 -2
- package/dist/esm/src/components/DatePickerInput/DatePickerInput.styl.js +7 -2
- package/dist/esm/src/components/DateTime/DateTime.js +17 -2
- package/dist/esm/src/components/Draggable/Draggable.js +136 -2
- package/dist/esm/src/components/Draggable/Draggable.styl.js +7 -2
- package/dist/esm/src/components/Expand/Expand.js +24 -2
- package/dist/esm/src/components/Expand/Expand.styl.js +7 -2
- package/dist/esm/src/components/Form/Form.helpers.js +42 -2
- package/dist/esm/src/components/Form/Form.js +286 -2
- package/dist/esm/src/components/Form/Form.styl.js +7 -2
- package/dist/esm/src/components/Form/Form.types.js +0 -1
- package/dist/esm/src/components/Form/SubmitButtons/SubmitButtons.js +8 -2
- package/dist/esm/src/components/Form/SubmitButtons/SubmitButtons.styl.js +7 -2
- package/dist/esm/src/components/Form/Validator.js +24 -6
- package/dist/esm/src/components/Gallery/Dots/Dots.js +9 -2
- package/dist/esm/src/components/Gallery/Dots/Dots.styl.js +7 -2
- package/dist/esm/src/components/Gallery/Gallery.js +180 -2
- package/dist/esm/src/components/Gallery/Gallery.styl.js +7 -2
- package/dist/esm/src/components/Heading/Heading.js +37 -2
- package/dist/esm/src/components/Heading/Heading.styl.js +7 -2
- package/dist/esm/src/components/Icon/Icon.js +27 -2
- package/dist/esm/src/components/Icon/Icon.styl.js +7 -2
- package/dist/esm/src/components/Icon/icons/avatar.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/brokenImage.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/check.svg.js +19 -2
- package/dist/esm/src/components/Icon/icons/chevronDown.svg.js +20 -2
- package/dist/esm/src/components/Icon/icons/chevronLeft.svg.js +20 -2
- package/dist/esm/src/components/Icon/icons/chevronRight.svg.js +20 -2
- package/dist/esm/src/components/Icon/icons/chevronUp.svg.js +20 -2
- package/dist/esm/src/components/Icon/icons/close.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/colors.svg.js +60 -2
- package/dist/esm/src/components/Icon/icons/copy.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/delete.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/draft.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/edit.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/email.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/externalLink.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/eye.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/fullscreen.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/fullscreenExit.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/function.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/gear.svg.js +21 -2
- package/dist/esm/src/components/Icon/icons/group.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/history.svg.js +17 -2
- package/dist/esm/src/components/Icon/icons/home.svg.js +19 -2
- package/dist/esm/src/components/Icon/icons/index.js +46 -2
- package/dist/esm/src/components/Icon/icons/instagram.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/link.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/loader.svg.js +45 -2
- package/dist/esm/src/components/Icon/icons/menu.svg.js +18 -2
- package/dist/esm/src/components/Icon/icons/mic.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/minus.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/moreHorizontal.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/moreVertical.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/output.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/plus.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/redo.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/requiredStar.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/save.svg.js +17 -2
- package/dist/esm/src/components/Icon/icons/send.svg.js +16 -2
- package/dist/esm/src/components/Icon/icons/settings.svg.js +52 -2
- package/dist/esm/src/components/Icon/icons/shoppingBag.svg.js +17 -2
- package/dist/esm/src/components/Icon/icons/table.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/telegram.svg.js +19 -2
- package/dist/esm/src/components/Icon/icons/undo.svg.js +15 -2
- package/dist/esm/src/components/Input/Input.js +343 -2
- package/dist/esm/src/components/Input/Input.styl.js +7 -2
- package/dist/esm/src/components/InputFile/InputFile.js +295 -2
- package/dist/esm/src/components/InputFile/InputFile.styl.js +7 -2
- package/dist/esm/src/components/InputFile/InputFile.types.js +0 -1
- package/dist/esm/src/components/InputFile/Item/Item.js +18 -2
- package/dist/esm/src/components/InputFile/Item/Item.styl.js +7 -2
- package/dist/esm/src/components/Label/Label.constants.json.js +8 -2
- package/dist/esm/src/components/Label/Label.helpers.js +35 -2
- package/dist/esm/src/components/Label/Label.js +58 -2
- package/dist/esm/src/components/Label/Label.styl.js +7 -2
- package/dist/esm/src/components/Lazy/Lazy.js +65 -2
- package/dist/esm/src/components/LightBox/LightBox.js +28 -2
- package/dist/esm/src/components/LightBox/LightBox.styl.js +7 -2
- package/dist/esm/src/components/Notifications/Notifications.constants.json.js +6 -2
- package/dist/esm/src/components/Notifications/Notifications.js +67 -2
- package/dist/esm/src/components/Notifications/Notifications.styl.js +7 -2
- package/dist/esm/src/components/Notifications/store.js +62 -2
- package/dist/esm/src/components/Paranja/Paranja.js +14 -2
- package/dist/esm/src/components/Paranja/Paranja.styl.js +7 -2
- package/dist/esm/src/components/Popup/Popup.helpers.js +31 -2
- package/dist/esm/src/components/Popup/Popup.js +397 -2
- package/dist/esm/src/components/Popup/Popup.styl.js +7 -2
- package/dist/esm/src/components/PopupMenu/PopupMenu.js +15 -2
- package/dist/esm/src/components/PopupMenu/PopupMenu.styl.js +7 -2
- package/dist/esm/src/components/Portal/Portal.js +19 -2
- package/dist/esm/src/components/RequiredStar/RequiredStar.js +12 -2
- package/dist/esm/src/components/RequiredStar/RequiredStar.styl.js +7 -2
- package/dist/esm/src/components/Router/Link/Link.js +61 -2
- package/dist/esm/src/components/Router/Link/Link.styl.js +7 -2
- package/dist/esm/src/components/Router/Redirect.js +12 -2
- package/dist/esm/src/components/Router/Route.js +4 -2
- package/dist/esm/src/components/Router/Router.helpers.js +33 -2
- package/dist/esm/src/components/Router/Router.js +68 -2
- package/dist/esm/src/components/Router/context.js +5 -2
- package/dist/esm/src/components/Router/store.js +55 -2
- package/dist/esm/src/components/Scroll/Scroll.js +274 -2
- package/dist/esm/src/components/Scroll/Scroll.styl.js +7 -2
- package/dist/esm/src/components/Select/Select.helpers.js +37 -2
- package/dist/esm/src/components/Select/Select.js +585 -2
- package/dist/esm/src/components/Select/Select.styl.js +7 -2
- package/dist/esm/src/components/Spinner/Spinner.js +11 -2
- package/dist/esm/src/components/Spinner/Spinner.styl.js +7 -2
- package/dist/esm/src/components/Spinner/spinner.svg.js +24 -2
- package/dist/esm/src/components/Table/Table.js +24 -2
- package/dist/esm/src/components/Table/Table.styl.js +7 -2
- package/dist/esm/src/components/Tabs/Tabs.js +43 -2
- package/dist/esm/src/components/Tabs/Tabs.styl.js +7 -2
- package/dist/esm/src/components/Text/Text.js +44 -2
- package/dist/esm/src/components/Text/Text.styl.js +7 -2
- package/dist/esm/src/components/Theme/Theme.defaults.js +50 -2
- package/dist/esm/src/components/Theme/Theme.helpers.js +67 -2
- package/dist/esm/src/components/Theme/Theme.js +13 -2
- package/dist/esm/src/components/VH/VH.js +33 -2
- package/dist/esm/src/components/Virtualized/List/List.js +124 -2
- package/dist/esm/src/components/Virtualized/List/List.styl.js +7 -2
- package/dist/esm/src/components/Virtualized/List/ListScroll.js +21 -2
- package/dist/esm/src/components/Virtualized/List/ListScroll.styl.js +7 -2
- package/dist/esm/src/components/Virtualized/Virtualized.helpers.js +14 -2
- package/dist/esm/src/components/Virtualized/Virtualized.js +200 -2
- package/dist/esm/src/components/Virtualized/Virtualized.styl.js +7 -2
- package/dist/esm/src/components/Virtualized/Virtualized.types.js +0 -1
- package/dist/esm/src/services/i18n.js +68 -2
- package/dist/esm/src/tools/array.js +60 -2
- package/dist/esm/src/tools/config.js +9 -2
- package/dist/esm/src/tools/date.js +11 -2
- package/dist/esm/src/tools/debounce.js +11 -2
- package/dist/esm/src/tools/dom.js +46 -2
- package/dist/esm/src/tools/env.js +3 -2
- package/dist/esm/src/tools/file.js +11 -2
- package/dist/esm/src/tools/localStorage.js +31 -2
- package/dist/esm/src/tools/number.js +27 -2
- package/dist/esm/src/tools/object.js +5 -2
- package/dist/esm/src/tools/queryParams.js +20 -2
- package/dist/esm/src/tools/rangeMap.js +3 -2
- package/dist/esm/src/tools/resizeObserver.js +68 -2
- package/dist/esm/src/tools/scroll.js +41 -2
- package/dist/esm/src/tools/string.js +7 -2
- package/dist/esm/src/tools/throttle.js +30 -2
- package/dist/esm/src/tools/uid.js +7 -2
- package/dist/esm/types/src/components/Icon/Icon.d.ts +3 -9
- package/dist/esm/types/src/components/Icon/Icon.example.d.ts +1 -0
- package/package.json +1 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/node_modules/style-inject/dist/style-inject.es.js.map +0 -1
- package/dist/esm/src/components/AssistiveText/AssistiveText.js.map +0 -1
- package/dist/esm/src/components/AssistiveText/AssistiveText.styl.js.map +0 -1
- package/dist/esm/src/components/Button/Button.helpers.js.map +0 -1
- package/dist/esm/src/components/Button/Button.js.map +0 -1
- package/dist/esm/src/components/Button/Button.styl.js.map +0 -1
- package/dist/esm/src/components/ButtonGroup/ButtonGroup.js.map +0 -1
- package/dist/esm/src/components/ButtonGroup/ButtonGroup.styl.js.map +0 -1
- package/dist/esm/src/components/Calendar/Calendar.helpers.js.map +0 -1
- package/dist/esm/src/components/Calendar/Calendar.js.map +0 -1
- package/dist/esm/src/components/Calendar/Calendar.styl.js.map +0 -1
- package/dist/esm/src/components/Checkbox/Checkbox.js.map +0 -1
- package/dist/esm/src/components/Checkbox/Checkbox.styl.js.map +0 -1
- package/dist/esm/src/components/Container/Container.js.map +0 -1
- package/dist/esm/src/components/Container/Container.styl.js.map +0 -1
- package/dist/esm/src/components/DatePicker/DatePicker.helpers.js.map +0 -1
- package/dist/esm/src/components/DatePicker/DatePicker.js.map +0 -1
- package/dist/esm/src/components/DatePicker/DatePicker.styl.js.map +0 -1
- package/dist/esm/src/components/DatePickerInput/DatePickerInput.js.map +0 -1
- package/dist/esm/src/components/DatePickerInput/DatePickerInput.styl.js.map +0 -1
- package/dist/esm/src/components/DateTime/DateTime.js.map +0 -1
- package/dist/esm/src/components/Draggable/Draggable.js.map +0 -1
- package/dist/esm/src/components/Draggable/Draggable.styl.js.map +0 -1
- package/dist/esm/src/components/Expand/Expand.js.map +0 -1
- package/dist/esm/src/components/Expand/Expand.styl.js.map +0 -1
- package/dist/esm/src/components/Form/Form.helpers.js.map +0 -1
- package/dist/esm/src/components/Form/Form.js.map +0 -1
- package/dist/esm/src/components/Form/Form.styl.js.map +0 -1
- package/dist/esm/src/components/Form/Form.types.js.map +0 -1
- package/dist/esm/src/components/Form/SubmitButtons/SubmitButtons.js.map +0 -1
- package/dist/esm/src/components/Form/SubmitButtons/SubmitButtons.styl.js.map +0 -1
- package/dist/esm/src/components/Form/Validator.js.map +0 -1
- package/dist/esm/src/components/Gallery/Dots/Dots.js.map +0 -1
- package/dist/esm/src/components/Gallery/Dots/Dots.styl.js.map +0 -1
- package/dist/esm/src/components/Gallery/Gallery.js.map +0 -1
- package/dist/esm/src/components/Gallery/Gallery.styl.js.map +0 -1
- package/dist/esm/src/components/Heading/Heading.js.map +0 -1
- package/dist/esm/src/components/Heading/Heading.styl.js.map +0 -1
- package/dist/esm/src/components/Icon/Icon.js.map +0 -1
- package/dist/esm/src/components/Icon/Icon.styl.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/avatar.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/brokenImage.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/check.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/chevronDown.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/chevronLeft.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/chevronRight.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/chevronUp.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/close.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/colors.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/copy.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/delete.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/draft.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/edit.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/email.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/externalLink.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/eye.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/fullscreen.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/fullscreenExit.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/function.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/gear.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/group.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/history.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/home.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/index.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/instagram.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/link.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/loader.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/menu.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/mic.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/minus.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/moreHorizontal.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/moreVertical.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/output.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/plus.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/redo.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/requiredStar.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/save.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/send.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/settings.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/shoppingBag.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/table.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/telegram.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/undo.svg.js.map +0 -1
- package/dist/esm/src/components/Input/Input.js.map +0 -1
- package/dist/esm/src/components/Input/Input.styl.js.map +0 -1
- package/dist/esm/src/components/InputFile/InputFile.js.map +0 -1
- package/dist/esm/src/components/InputFile/InputFile.styl.js.map +0 -1
- package/dist/esm/src/components/InputFile/InputFile.types.js.map +0 -1
- package/dist/esm/src/components/InputFile/Item/Item.js.map +0 -1
- package/dist/esm/src/components/InputFile/Item/Item.styl.js.map +0 -1
- package/dist/esm/src/components/Label/Label.constants.json.js.map +0 -1
- package/dist/esm/src/components/Label/Label.helpers.js.map +0 -1
- package/dist/esm/src/components/Label/Label.js.map +0 -1
- package/dist/esm/src/components/Label/Label.styl.js.map +0 -1
- package/dist/esm/src/components/Lazy/Lazy.js.map +0 -1
- package/dist/esm/src/components/LightBox/LightBox.js.map +0 -1
- package/dist/esm/src/components/LightBox/LightBox.styl.js.map +0 -1
- package/dist/esm/src/components/Notifications/Notifications.constants.json.js.map +0 -1
- package/dist/esm/src/components/Notifications/Notifications.js.map +0 -1
- package/dist/esm/src/components/Notifications/Notifications.styl.js.map +0 -1
- package/dist/esm/src/components/Notifications/store.js.map +0 -1
- package/dist/esm/src/components/Paranja/Paranja.js.map +0 -1
- package/dist/esm/src/components/Paranja/Paranja.styl.js.map +0 -1
- package/dist/esm/src/components/Popup/Popup.helpers.js.map +0 -1
- package/dist/esm/src/components/Popup/Popup.js.map +0 -1
- package/dist/esm/src/components/Popup/Popup.styl.js.map +0 -1
- package/dist/esm/src/components/PopupMenu/PopupMenu.js.map +0 -1
- package/dist/esm/src/components/PopupMenu/PopupMenu.styl.js.map +0 -1
- package/dist/esm/src/components/Portal/Portal.js.map +0 -1
- package/dist/esm/src/components/RequiredStar/RequiredStar.js.map +0 -1
- package/dist/esm/src/components/RequiredStar/RequiredStar.styl.js.map +0 -1
- package/dist/esm/src/components/Router/Link/Link.js.map +0 -1
- package/dist/esm/src/components/Router/Link/Link.styl.js.map +0 -1
- package/dist/esm/src/components/Router/Redirect.js.map +0 -1
- package/dist/esm/src/components/Router/Route.js.map +0 -1
- package/dist/esm/src/components/Router/Router.helpers.js.map +0 -1
- package/dist/esm/src/components/Router/Router.js.map +0 -1
- package/dist/esm/src/components/Router/context.js.map +0 -1
- package/dist/esm/src/components/Router/store.js.map +0 -1
- package/dist/esm/src/components/Scroll/Scroll.js.map +0 -1
- package/dist/esm/src/components/Scroll/Scroll.styl.js.map +0 -1
- package/dist/esm/src/components/Select/Select.helpers.js.map +0 -1
- package/dist/esm/src/components/Select/Select.js.map +0 -1
- package/dist/esm/src/components/Select/Select.styl.js.map +0 -1
- package/dist/esm/src/components/Spinner/Spinner.js.map +0 -1
- package/dist/esm/src/components/Spinner/Spinner.styl.js.map +0 -1
- package/dist/esm/src/components/Spinner/spinner.svg.js.map +0 -1
- package/dist/esm/src/components/Table/Table.js.map +0 -1
- package/dist/esm/src/components/Table/Table.styl.js.map +0 -1
- package/dist/esm/src/components/Tabs/Tabs.js.map +0 -1
- package/dist/esm/src/components/Tabs/Tabs.styl.js.map +0 -1
- package/dist/esm/src/components/Text/Text.js.map +0 -1
- package/dist/esm/src/components/Text/Text.styl.js.map +0 -1
- package/dist/esm/src/components/Theme/Theme.defaults.js.map +0 -1
- package/dist/esm/src/components/Theme/Theme.helpers.js.map +0 -1
- package/dist/esm/src/components/Theme/Theme.js.map +0 -1
- package/dist/esm/src/components/VH/VH.js.map +0 -1
- package/dist/esm/src/components/Virtualized/List/List.js.map +0 -1
- package/dist/esm/src/components/Virtualized/List/List.styl.js.map +0 -1
- package/dist/esm/src/components/Virtualized/List/ListScroll.js.map +0 -1
- package/dist/esm/src/components/Virtualized/List/ListScroll.styl.js.map +0 -1
- package/dist/esm/src/components/Virtualized/Virtualized.helpers.js.map +0 -1
- package/dist/esm/src/components/Virtualized/Virtualized.js.map +0 -1
- package/dist/esm/src/components/Virtualized/Virtualized.styl.js.map +0 -1
- package/dist/esm/src/components/Virtualized/Virtualized.types.js.map +0 -1
- package/dist/esm/src/services/i18n.js.map +0 -1
- package/dist/esm/src/tools/array.js.map +0 -1
- package/dist/esm/src/tools/config.js.map +0 -1
- package/dist/esm/src/tools/date.js.map +0 -1
- package/dist/esm/src/tools/debounce.js.map +0 -1
- package/dist/esm/src/tools/dom.js.map +0 -1
- package/dist/esm/src/tools/env.js.map +0 -1
- package/dist/esm/src/tools/file.js.map +0 -1
- package/dist/esm/src/tools/localStorage.js.map +0 -1
- package/dist/esm/src/tools/number.js.map +0 -1
- package/dist/esm/src/tools/object.js.map +0 -1
- package/dist/esm/src/tools/queryParams.js.map +0 -1
- package/dist/esm/src/tools/rangeMap.js.map +0 -1
- package/dist/esm/src/tools/resizeObserver.js.map +0 -1
- package/dist/esm/src/tools/scroll.js.map +0 -1
- package/dist/esm/src/tools/string.js.map +0 -1
- package/dist/esm/src/tools/throttle.js.map +0 -1
- package/dist/esm/src/tools/uid.js.map +0 -1
|
@@ -1,2 +1,200 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { Component } from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import pick from 'lodash.pick';
|
|
4
|
+
import compare from 'compareq';
|
|
5
|
+
import Time from 'timen';
|
|
6
|
+
import debounce from '../../tools/debounce.js';
|
|
7
|
+
import { getHeight, getIndexes } from './Virtualized.helpers.js';
|
|
8
|
+
import S from './Virtualized.styl.js';
|
|
9
|
+
|
|
10
|
+
class Virtualized extends Component {
|
|
11
|
+
clearUnfreezeTimer;
|
|
12
|
+
scrollTopInited = false;
|
|
13
|
+
scrollElem;
|
|
14
|
+
lastScrollEndIndex = 0;
|
|
15
|
+
static defaultProps = {
|
|
16
|
+
overlapCount: 10,
|
|
17
|
+
pageSize: 20,
|
|
18
|
+
};
|
|
19
|
+
constructor(props) {
|
|
20
|
+
super(props);
|
|
21
|
+
this.state = {
|
|
22
|
+
id: null,
|
|
23
|
+
height: getHeight(props),
|
|
24
|
+
first: 0,
|
|
25
|
+
last: 0,
|
|
26
|
+
isFreezed: false,
|
|
27
|
+
};
|
|
28
|
+
this.onScroll = debounce(this.onScroll, 150);
|
|
29
|
+
this.checkIfEnd = debounce(this.checkIfEnd, 200);
|
|
30
|
+
}
|
|
31
|
+
static getDerivedStateFromProps(props, { height }) {
|
|
32
|
+
const newHeight = getHeight(props);
|
|
33
|
+
if (newHeight !== height)
|
|
34
|
+
return { height: newHeight };
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
componentDidMount() {
|
|
38
|
+
// Time.after(100, () => {
|
|
39
|
+
const indexes = this.getIndexes();
|
|
40
|
+
this.setState(indexes); // eslint-disable-line
|
|
41
|
+
// });
|
|
42
|
+
// document.addEventListener('scroll', this.onScroll, true);
|
|
43
|
+
}
|
|
44
|
+
getSnapshotBeforeUpdate(prevProps) {
|
|
45
|
+
const { itemHeight, itemsCount } = this.props;
|
|
46
|
+
if (itemsCount === 0 && itemsCount !== prevProps.itemsCount)
|
|
47
|
+
return 0;
|
|
48
|
+
if (this.scrollElem) {
|
|
49
|
+
if (itemHeight !== prevProps.itemHeight)
|
|
50
|
+
return (itemHeight / prevProps.itemHeight) * this.scrollElem.scrollTop;
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
shouldComponentUpdate(nextProps, nextState) {
|
|
55
|
+
if (nextProps.id !== this.props.id)
|
|
56
|
+
return true;
|
|
57
|
+
if (nextProps.itemsCount !== this.props.itemsCount)
|
|
58
|
+
return true;
|
|
59
|
+
if (nextProps.wrapElem !== this.props.wrapElem)
|
|
60
|
+
return true;
|
|
61
|
+
if (!compare(nextState, this.state))
|
|
62
|
+
return true;
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
componentDidUpdate(prevProps, prevState, snapshot) {
|
|
66
|
+
const state = {};
|
|
67
|
+
const scrollElemUpdated = this.scrollElem !== this.props.wrapElem;
|
|
68
|
+
if (scrollElemUpdated)
|
|
69
|
+
this.scrollElem = this.props.wrapElem;
|
|
70
|
+
if (this.scrollElem) {
|
|
71
|
+
const newScrollTop = this.getNewScrollTop(prevProps, snapshot);
|
|
72
|
+
if (typeof newScrollTop === 'number')
|
|
73
|
+
this.scrollElem.scrollTop = newScrollTop;
|
|
74
|
+
}
|
|
75
|
+
if (prevProps.id !== this.props.id)
|
|
76
|
+
state.id = this.props.id;
|
|
77
|
+
if (scrollElemUpdated || this.needUpdateIndexes(prevProps))
|
|
78
|
+
Object.assign(state, this.getIndexes());
|
|
79
|
+
if (this.needUpdateHeight(prevProps))
|
|
80
|
+
state.height = getHeight(this.props);
|
|
81
|
+
if (Object.keys(state).length)
|
|
82
|
+
this.setState(state);
|
|
83
|
+
}
|
|
84
|
+
componentWillUnmount() {
|
|
85
|
+
this.clearUnfreezeTimer?.();
|
|
86
|
+
}
|
|
87
|
+
needUpdateIndexes(prevProps) {
|
|
88
|
+
// const { wrapElem } = this.props;
|
|
89
|
+
// if (!prevProps.wrapElem && wrapElem) return true;
|
|
90
|
+
return ['id', 'itemsCount', 'totalCount', 'overlapCount'].some(key => prevProps[key] !== this.props[key]);
|
|
91
|
+
}
|
|
92
|
+
needUpdateHeight(prevProps) {
|
|
93
|
+
return ['totalCount', 'offsetAfter'].some(key => prevProps[key] !== this.props[key]);
|
|
94
|
+
}
|
|
95
|
+
getNewScrollTop(prevProps, snapshot) {
|
|
96
|
+
const { initialScrollTop, scrollTop, itemsCount } = this.props;
|
|
97
|
+
if (!this.scrollTopInited) {
|
|
98
|
+
const scrollValue = initialScrollTop ?? scrollTop;
|
|
99
|
+
if (scrollValue && prevProps.itemsCount && itemsCount) {
|
|
100
|
+
this.scrollTopInited = true;
|
|
101
|
+
return scrollValue;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (prevProps.initialScrollTop > 0 && initialScrollTop === 0)
|
|
105
|
+
return 0;
|
|
106
|
+
if (typeof scrollTop === 'number' && scrollTop !== prevProps.scrollTop)
|
|
107
|
+
return scrollTop;
|
|
108
|
+
if (typeof snapshot === 'number')
|
|
109
|
+
return snapshot;
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
getIndexes() {
|
|
113
|
+
// const { wrapElem } = this.props;
|
|
114
|
+
if (!this.scrollElem)
|
|
115
|
+
return null;
|
|
116
|
+
const { scrollTop, clientHeight } = this.scrollElem;
|
|
117
|
+
return getIndexes({
|
|
118
|
+
scrollTop,
|
|
119
|
+
clientHeight,
|
|
120
|
+
...pick(this.props, [
|
|
121
|
+
'itemsCount',
|
|
122
|
+
'totalCount',
|
|
123
|
+
'itemHeight',
|
|
124
|
+
'overlapCount',
|
|
125
|
+
]),
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
onScroll = e => {
|
|
129
|
+
this.scrollElem = e.target;
|
|
130
|
+
const { onScroll } = this.props;
|
|
131
|
+
const indexes = this.getIndexes();
|
|
132
|
+
const { scrollTop } = this.scrollElem;
|
|
133
|
+
if (onScroll)
|
|
134
|
+
onScroll({ scrollTop, ...indexes });
|
|
135
|
+
this.checkIfEnd();
|
|
136
|
+
if (!compare(indexes, pick(this.state, ['first', 'last'])))
|
|
137
|
+
this.setState({ ...indexes });
|
|
138
|
+
this.unfreeze();
|
|
139
|
+
};
|
|
140
|
+
checkIfEnd = () => {
|
|
141
|
+
const { itemsCount, totalCount, pageSize, onScrollEnd } = this.props;
|
|
142
|
+
if (itemsCount === totalCount)
|
|
143
|
+
return;
|
|
144
|
+
if (itemsCount < this.lastScrollEndIndex)
|
|
145
|
+
return;
|
|
146
|
+
this.lastScrollEndIndex = Math.min(itemsCount + pageSize, totalCount);
|
|
147
|
+
onScrollEnd?.();
|
|
148
|
+
};
|
|
149
|
+
unfreeze = () => {
|
|
150
|
+
this.clearUnfreezeTimer?.();
|
|
151
|
+
this.clearUnfreezeTimer = Time.after(200, () => {
|
|
152
|
+
this.setState({ isFreezed: false });
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
getItemProps = (index) => {
|
|
156
|
+
const { getItemProps, offsetBefore, offsetAfter } = this.props;
|
|
157
|
+
const props = {
|
|
158
|
+
className: S.item,
|
|
159
|
+
key: index,
|
|
160
|
+
};
|
|
161
|
+
if (getItemProps) {
|
|
162
|
+
const { className, ...rest } = getItemProps({
|
|
163
|
+
index,
|
|
164
|
+
offsetBefore,
|
|
165
|
+
offsetAfter,
|
|
166
|
+
});
|
|
167
|
+
props.className = cn(props.className, className);
|
|
168
|
+
Object.assign(props, rest);
|
|
169
|
+
}
|
|
170
|
+
return props;
|
|
171
|
+
};
|
|
172
|
+
renderItems() {
|
|
173
|
+
const { itemsCount, renderItem } = this.props;
|
|
174
|
+
const { first, last } = this.state;
|
|
175
|
+
const items = [];
|
|
176
|
+
if (itemsCount > 0) {
|
|
177
|
+
for (let i = first; i <= last; i++) {
|
|
178
|
+
items.push(renderItem(this.getItemProps(i)));
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return items;
|
|
182
|
+
}
|
|
183
|
+
render() {
|
|
184
|
+
const { children, className, pageSize, ...rest } = this.props;
|
|
185
|
+
const { isFreezed } = this.state;
|
|
186
|
+
const state = {
|
|
187
|
+
...pick(this.state, ['first', 'last', 'height']),
|
|
188
|
+
...pick(this.props, ['offsetBefore', 'offsetAfter']),
|
|
189
|
+
};
|
|
190
|
+
return children({
|
|
191
|
+
...rest,
|
|
192
|
+
state,
|
|
193
|
+
className: cn(S.root, isFreezed && S.freezeClicks, className),
|
|
194
|
+
onScroll: this.onScroll,
|
|
195
|
+
items: this.renderItems(),
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export { Virtualized as default };
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
import styleInject from
|
|
2
|
-
|
|
1
|
+
import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
|
+
|
|
3
|
+
var css_248z = ".Virtualized_root__SX71a{display:block;height:100%;max-height:100%;overflow-y:auto;position:relative}.Virtualized_item__1vSN0{animation:Virtualized_show__2WhkK .1s ease-out;-webkit-backface-visibility:hidden;backface-visibility:hidden;transform:translateZ(0)}.Virtualized_freezeClicks__SCBdy .Virtualized_item__1vSN0{pointer-events:none}@keyframes Virtualized_show__2WhkK{0%{opacity:0}to{opacity:1}}";
|
|
4
|
+
var S = {"root":"Virtualized_root__SX71a","item":"Virtualized_item__1vSN0","show":"Virtualized_show__2WhkK","freezeClicks":"Virtualized_freezeClicks__SCBdy"};
|
|
5
|
+
styleInject(css_248z);
|
|
6
|
+
|
|
7
|
+
export { S as default };
|
|
@@ -1,2 +1,68 @@
|
|
|
1
|
-
import{jsx,Fragment}from
|
|
2
|
-
|
|
1
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { nanoid } from 'nanoid';
|
|
4
|
+
import { createStore, withStore } from 'justorm/react';
|
|
5
|
+
import _i18n from 'roddeh-i18n';
|
|
6
|
+
import LS from '../tools/localStorage.js';
|
|
7
|
+
import { queryParams } from '../tools/queryParams.js';
|
|
8
|
+
|
|
9
|
+
const DEFAULT_LANG = 'en';
|
|
10
|
+
const modules = {};
|
|
11
|
+
const queryLang = queryParams.lang;
|
|
12
|
+
if (queryLang)
|
|
13
|
+
LS.set('lang', queryLang);
|
|
14
|
+
const store = createStore('i18n', {
|
|
15
|
+
lang: LS.get('lang') ?? DEFAULT_LANG,
|
|
16
|
+
async changeLang(lang) {
|
|
17
|
+
// TODO: use WebWorker for requests?
|
|
18
|
+
const requests = modules[lang].map(loader => loader());
|
|
19
|
+
await Promise.all(requests);
|
|
20
|
+
modules[lang] = [];
|
|
21
|
+
this.lang = lang;
|
|
22
|
+
LS.set('lang', lang);
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
function init(config) {
|
|
26
|
+
const langs = Object.keys(config);
|
|
27
|
+
const texts = langs.reduce((acc, lang) => ({ ...acc, [lang]: _i18n.create({ values: {} }) }), {});
|
|
28
|
+
const _getText = (lang, key, props) => {
|
|
29
|
+
if (texts[lang]?.translator.data.values[key]) {
|
|
30
|
+
return texts[lang](key, ...props);
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
};
|
|
34
|
+
function getTrans(key, props = []) {
|
|
35
|
+
return _getText(store.lang, key, props) || key;
|
|
36
|
+
}
|
|
37
|
+
const storeName = `i18n-${nanoid()}`;
|
|
38
|
+
const componentStore = createStore(storeName, { _updated: '' });
|
|
39
|
+
const callLoader = async (loader, lang) => {
|
|
40
|
+
const values = typeof loader === 'function' ? (await loader()).default : loader;
|
|
41
|
+
texts[lang].translator.add({ values });
|
|
42
|
+
componentStore._updated = nanoid();
|
|
43
|
+
};
|
|
44
|
+
Object.entries(config).forEach(([lang, loader]) => {
|
|
45
|
+
if (!modules[lang])
|
|
46
|
+
modules[lang] = [];
|
|
47
|
+
if (lang === store.lang)
|
|
48
|
+
return callLoader(loader, lang);
|
|
49
|
+
modules[lang].push(() => callLoader(loader, lang));
|
|
50
|
+
});
|
|
51
|
+
// TODO: revert ability to register modules
|
|
52
|
+
return {
|
|
53
|
+
storeName,
|
|
54
|
+
componentStore,
|
|
55
|
+
// hook (update when componentStore._updated changed)
|
|
56
|
+
withI18N: Component => withStore(storeName)(Component),
|
|
57
|
+
i18n: (key, props) => getTrans(key, props),
|
|
58
|
+
I18N: memo(withStore({
|
|
59
|
+
i18n: ['lang'],
|
|
60
|
+
[storeName]: true,
|
|
61
|
+
})(function I18N({ id, children, props }) {
|
|
62
|
+
const key = id ?? children;
|
|
63
|
+
return jsx(Fragment, { children: getTrans(key, props) });
|
|
64
|
+
})),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { init, store };
|
|
@@ -1,2 +1,60 @@
|
|
|
1
|
-
function indexWhere(
|
|
2
|
-
|
|
1
|
+
function indexWhere(arr, val, fieldName) {
|
|
2
|
+
if (!fieldName) {
|
|
3
|
+
return arr.indexOf(val);
|
|
4
|
+
}
|
|
5
|
+
const isValObj = typeof val === 'object';
|
|
6
|
+
let index = -1;
|
|
7
|
+
arr.some((d, i) => {
|
|
8
|
+
const dVal = isValObj ? val?.[fieldName] : val;
|
|
9
|
+
if (d?.[fieldName] === dVal) {
|
|
10
|
+
index = i;
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
return false;
|
|
14
|
+
});
|
|
15
|
+
return index;
|
|
16
|
+
}
|
|
17
|
+
function sliceWhere([...arr], val, fieldName) {
|
|
18
|
+
spliceWhere(arr, val, fieldName);
|
|
19
|
+
return arr;
|
|
20
|
+
}
|
|
21
|
+
function spliceWhere(arr, val, fieldName) {
|
|
22
|
+
const index = indexWhere(arr, val, fieldName);
|
|
23
|
+
if (index > -1)
|
|
24
|
+
arr.splice(index, 1);
|
|
25
|
+
}
|
|
26
|
+
function _addUniq({ arr, val, fieldName }, action) {
|
|
27
|
+
if (Array.isArray(val)) {
|
|
28
|
+
val.forEach(v => addUniq(arr, v, fieldName));
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const index = indexWhere(arr, val, fieldName);
|
|
32
|
+
if (index === -1)
|
|
33
|
+
action(val);
|
|
34
|
+
}
|
|
35
|
+
function addUniq(arr, val, fieldName) {
|
|
36
|
+
_addUniq({ arr, val, fieldName }, value => arr.push(value));
|
|
37
|
+
}
|
|
38
|
+
function unshiftUniq(arr, val, fieldName) {
|
|
39
|
+
_addUniq({ arr, val, fieldName }, value => arr.unshift(value));
|
|
40
|
+
}
|
|
41
|
+
function insert(baseArr, targetArr, startIndex) {
|
|
42
|
+
return [
|
|
43
|
+
...baseArr.slice(0, startIndex),
|
|
44
|
+
...targetArr,
|
|
45
|
+
...baseArr.slice(startIndex + targetArr.length),
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
function getIndexCircular(arr, index) {
|
|
49
|
+
const l = arr.length;
|
|
50
|
+
return arr[((index % l) + l) % l];
|
|
51
|
+
}
|
|
52
|
+
function circularSlice(arr, startIndex, count) {
|
|
53
|
+
const newArr = [];
|
|
54
|
+
for (let i = 0; i < count; i++) {
|
|
55
|
+
newArr.push(getIndexCircular(arr, startIndex + i));
|
|
56
|
+
}
|
|
57
|
+
return newArr;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { addUniq, circularSlice, getIndexCircular, indexWhere, insert, sliceWhere, spliceWhere, unshiftUniq };
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
const config={
|
|
2
|
-
|
|
1
|
+
const config = {
|
|
2
|
+
appRootId: 'app-root',
|
|
3
|
+
appOverlayId: 'app-modal',
|
|
4
|
+
configure(params) {
|
|
5
|
+
Object.assign(this, params);
|
|
6
|
+
},
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { config };
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Convert ISO 8601 format ("YYYY-MM-DD") to Date object
|
|
3
|
+
* @param str
|
|
4
|
+
* @returns Date
|
|
5
|
+
*/
|
|
6
|
+
const strToDate = (str) => {
|
|
7
|
+
const [year, month, day] = str.split('-').map(Number);
|
|
8
|
+
return new Date(year, month - 1, day);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { strToDate };
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
import Time from
|
|
2
|
-
|
|
1
|
+
import Time from 'timen';
|
|
2
|
+
|
|
3
|
+
function debounce(fn, ms) {
|
|
4
|
+
let unsubscribeFn;
|
|
5
|
+
return function debounced(...args) {
|
|
6
|
+
unsubscribeFn?.();
|
|
7
|
+
unsubscribeFn = Time.after(ms, () => fn.apply(this, args));
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { debounce as default };
|
|
@@ -1,2 +1,46 @@
|
|
|
1
|
-
import{isBrowser}from
|
|
2
|
-
|
|
1
|
+
import { isBrowser } from './env.js';
|
|
2
|
+
import 'nanoid';
|
|
3
|
+
import 'timen';
|
|
4
|
+
import 'compareq';
|
|
5
|
+
import 'lodash.pick';
|
|
6
|
+
import './queryParams.js';
|
|
7
|
+
|
|
8
|
+
function getCoords(elem) {
|
|
9
|
+
const box = elem.getBoundingClientRect();
|
|
10
|
+
return {
|
|
11
|
+
top: box.top + window.pageYOffset,
|
|
12
|
+
left: box.left + window.pageXOffset,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function hasParent(elem, parentElem) {
|
|
16
|
+
const isEqual = elem === parentElem;
|
|
17
|
+
if (isEqual || elem.nodeName === 'HTML') {
|
|
18
|
+
return isEqual;
|
|
19
|
+
}
|
|
20
|
+
return hasParent(elem.parentNode, parentElem);
|
|
21
|
+
}
|
|
22
|
+
var INTERACTION_MODE;
|
|
23
|
+
(function (INTERACTION_MODE) {
|
|
24
|
+
INTERACTION_MODE["POINTER"] = "pointer";
|
|
25
|
+
INTERACTION_MODE["KEYBOARD"] = "keyboard";
|
|
26
|
+
})(INTERACTION_MODE || (INTERACTION_MODE = {}));
|
|
27
|
+
let interactionMode = INTERACTION_MODE.POINTER;
|
|
28
|
+
const getInteractionMode = () => interactionMode;
|
|
29
|
+
function watchControllerFlag() {
|
|
30
|
+
const classes = document.body.classList;
|
|
31
|
+
const onPointerMove = () => {
|
|
32
|
+
classes.remove(INTERACTION_MODE.KEYBOARD);
|
|
33
|
+
classes.add(INTERACTION_MODE.POINTER);
|
|
34
|
+
};
|
|
35
|
+
['pointerdown', 'pointermove'].forEach(event => {
|
|
36
|
+
document.addEventListener(event, onPointerMove, true);
|
|
37
|
+
});
|
|
38
|
+
document.addEventListener('keydown', () => {
|
|
39
|
+
classes.remove(INTERACTION_MODE.POINTER);
|
|
40
|
+
classes.add(INTERACTION_MODE.KEYBOARD);
|
|
41
|
+
});
|
|
42
|
+
classes.add(interactionMode);
|
|
43
|
+
}
|
|
44
|
+
const isTouch = () => isBrowser && 'ontouchstart' in window;
|
|
45
|
+
|
|
46
|
+
export { INTERACTION_MODE, getCoords, getInteractionMode, hasParent, isTouch, watchControllerFlag };
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
const isBrowser=
|
|
2
|
-
|
|
1
|
+
const isBrowser = typeof window !== 'undefined';
|
|
2
|
+
|
|
3
|
+
export { isBrowser };
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
function toBase64(
|
|
2
|
-
|
|
1
|
+
function toBase64(file) {
|
|
2
|
+
return new Promise(resolve => {
|
|
3
|
+
const reader = new FileReader();
|
|
4
|
+
reader.readAsDataURL(file);
|
|
5
|
+
reader.onload = () => resolve(reader.result);
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
reader.onerror = error => resolve({ error });
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { toBase64 };
|
|
@@ -1,2 +1,31 @@
|
|
|
1
|
-
import{isBrowser}from
|
|
2
|
-
|
|
1
|
+
import { isBrowser } from './env.js';
|
|
2
|
+
|
|
3
|
+
const ls = isBrowser && window.localStorage;
|
|
4
|
+
var LS = isBrowser
|
|
5
|
+
? {
|
|
6
|
+
get(key) {
|
|
7
|
+
let result = ls.getItem(key);
|
|
8
|
+
try {
|
|
9
|
+
result = JSON.parse(result);
|
|
10
|
+
}
|
|
11
|
+
catch (e) { }
|
|
12
|
+
return result;
|
|
13
|
+
},
|
|
14
|
+
set(key, val) {
|
|
15
|
+
if (!val) {
|
|
16
|
+
this.remove(key);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const item = typeof val === 'object' ? JSON.stringify(val) : val;
|
|
20
|
+
ls.setItem(key, item);
|
|
21
|
+
},
|
|
22
|
+
remove(key) {
|
|
23
|
+
ls.removeItem(key);
|
|
24
|
+
},
|
|
25
|
+
clear() {
|
|
26
|
+
ls.clear();
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
: { get() { }, set() { }, remove() { }, clear() { } };
|
|
30
|
+
|
|
31
|
+
export { LS as default };
|
|
@@ -1,2 +1,27 @@
|
|
|
1
|
-
const LABEL
|
|
2
|
-
|
|
1
|
+
const LABEL = ['', 'k', 'M', 'B'];
|
|
2
|
+
function stringify(number) {
|
|
3
|
+
if (typeof number === 'string')
|
|
4
|
+
return number.match(/\d/g).join('');
|
|
5
|
+
return String(number);
|
|
6
|
+
}
|
|
7
|
+
const format = {
|
|
8
|
+
short(number, lv = 0) {
|
|
9
|
+
const numStr = stringify(number);
|
|
10
|
+
const level = Math.floor((numStr.length - 1) / 3);
|
|
11
|
+
if (level === 0)
|
|
12
|
+
return numStr;
|
|
13
|
+
const label = LABEL[level];
|
|
14
|
+
const num = numStr.slice(0, -level * 3);
|
|
15
|
+
return `${num}${label}`;
|
|
16
|
+
},
|
|
17
|
+
sections(number, splitter = ' ') {
|
|
18
|
+
const [whole, fractional] = stringify(number).split('.');
|
|
19
|
+
let result = whole.replace(/\B(?=(\d{3})+(?!\d))/g, splitter);
|
|
20
|
+
if (fractional !== undefined)
|
|
21
|
+
result = `${result}.${fractional}`;
|
|
22
|
+
return result;
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
const zero = num => num || 0;
|
|
26
|
+
|
|
27
|
+
export { format, zero };
|
|
@@ -1,2 +1,20 @@
|
|
|
1
|
-
import{isBrowser}from
|
|
2
|
-
|
|
1
|
+
import { isBrowser } from './env.js';
|
|
2
|
+
|
|
3
|
+
const SSRQueryParams = {};
|
|
4
|
+
function parseQueryParams(qs) {
|
|
5
|
+
const queryString = qs || isBrowser ? location?.search : '';
|
|
6
|
+
if (!queryString)
|
|
7
|
+
return {};
|
|
8
|
+
return [...new URLSearchParams(queryString).entries()].reduce((acc, [key, value]) => {
|
|
9
|
+
acc[key] = value;
|
|
10
|
+
return acc;
|
|
11
|
+
}, {});
|
|
12
|
+
}
|
|
13
|
+
const setSSRQueryParams = (params) => {
|
|
14
|
+
Object.assign(SSRQueryParams, params);
|
|
15
|
+
};
|
|
16
|
+
const queryParams = isBrowser
|
|
17
|
+
? parseQueryParams()
|
|
18
|
+
: SSRQueryParams;
|
|
19
|
+
|
|
20
|
+
export { parseQueryParams, queryParams, setSSRQueryParams };
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
var rangeMap=(
|
|
2
|
-
|
|
1
|
+
var rangeMap = (value, x1, y1, x2, y2) => ((value - x1) * (y2 - x2)) / (y1 - x1) + x2;
|
|
2
|
+
|
|
3
|
+
export { rangeMap as default };
|
|
@@ -1,2 +1,68 @@
|
|
|
1
|
-
import Time from
|
|
2
|
-
|
|
1
|
+
import Time from 'timen';
|
|
2
|
+
import compare from 'compareq';
|
|
3
|
+
import pick from 'lodash.pick';
|
|
4
|
+
import { addUniq, spliceWhere } from './array.js';
|
|
5
|
+
import { isBrowser } from './env.js';
|
|
6
|
+
|
|
7
|
+
const ITEMS = new Map();
|
|
8
|
+
const NATIVE_OBSERVERS = new Map();
|
|
9
|
+
const IS_NATIVE = isBrowser && 'ResizeObserver' in window;
|
|
10
|
+
const TIMEOUT = 500;
|
|
11
|
+
const SIZE_FIELDS = ['offsetWidth', 'offsetHeight'];
|
|
12
|
+
function check() {
|
|
13
|
+
ITEMS.forEach((item, elem) => {
|
|
14
|
+
const { sizes, listeners } = item;
|
|
15
|
+
const newSizes = pick(elem, SIZE_FIELDS);
|
|
16
|
+
if (!compare(newSizes, sizes)) {
|
|
17
|
+
item.sizes = newSizes;
|
|
18
|
+
listeners.forEach(cb => cb(newSizes, elem));
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
run();
|
|
22
|
+
}
|
|
23
|
+
function run() {
|
|
24
|
+
if (ITEMS.size > 0)
|
|
25
|
+
Time.after(TIMEOUT, check);
|
|
26
|
+
}
|
|
27
|
+
function observe(elem, cb) {
|
|
28
|
+
if (!elem) {
|
|
29
|
+
console.warn('ResizeObserver: elem is not defined');
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (IS_NATIVE) {
|
|
33
|
+
const observer = new ResizeObserver(cb);
|
|
34
|
+
observer.observe(elem);
|
|
35
|
+
NATIVE_OBSERVERS.set(elem, observer);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const data = ITEMS.get(elem);
|
|
39
|
+
if (data) {
|
|
40
|
+
addUniq(data.listeners, cb);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
ITEMS.set(elem, {
|
|
44
|
+
sizes: pick(elem, SIZE_FIELDS),
|
|
45
|
+
listeners: [cb],
|
|
46
|
+
});
|
|
47
|
+
if (ITEMS.size === 1)
|
|
48
|
+
run();
|
|
49
|
+
}
|
|
50
|
+
function unobserve(elem, cb) {
|
|
51
|
+
if (IS_NATIVE) {
|
|
52
|
+
const observer = NATIVE_OBSERVERS.get(elem);
|
|
53
|
+
if (!observer)
|
|
54
|
+
return;
|
|
55
|
+
observer.unobserve(elem);
|
|
56
|
+
NATIVE_OBSERVERS.delete(elem);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const data = ITEMS.get(elem);
|
|
60
|
+
if (!cb || data?.listeners.indexOf(cb) === -1)
|
|
61
|
+
return;
|
|
62
|
+
if (data.listeners.length === 1)
|
|
63
|
+
ITEMS.delete(elem);
|
|
64
|
+
else
|
|
65
|
+
spliceWhere(data.listeners, cb);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { observe, unobserve };
|