@taiga-ui/cdk 3.0.0-rc.0 → 3.0.0-rc.3
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/abstract/control.d.ts +2 -1
- package/abstract/dialog.service.d.ts +1 -1
- package/abstract/portal-host.d.ts +5 -3
- package/abstract/portal-service.d.ts +3 -2
- package/abstract/theme-switcher.d.ts +0 -1
- package/bundles/taiga-ui-cdk-abstract.umd.js +25 -16
- package/bundles/taiga-ui-cdk-abstract.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-classes.umd.js +0 -8
- package/bundles/taiga-ui-cdk-classes.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-components-dialog-host.umd.js +0 -1
- package/bundles/taiga-ui-cdk-components-dialog-host.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-components-dropdown-host.umd.js +3 -1
- package/bundles/taiga-ui-cdk-components-dropdown-host.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-constants.umd.js +18 -1
- package/bundles/taiga-ui-cdk-constants.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-date-time.umd.js +3 -29
- package/bundles/taiga-ui-cdk-date-time.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-active-zone.umd.js +5 -6
- package/bundles/taiga-ui-cdk-directives-active-zone.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-auto-focus.umd.js +8 -9
- package/bundles/taiga-ui-cdk-directives-auto-focus.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-autofilled.umd.js +1 -1
- package/bundles/taiga-ui-cdk-directives-autofilled.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-copy-processor.umd.js +0 -1
- package/bundles/taiga-ui-cdk-directives-copy-processor.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-drag.umd.js +1 -1
- package/bundles/taiga-ui-cdk-directives-drag.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-droppable.umd.js +5 -6
- package/bundles/taiga-ui-cdk-directives-droppable.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-focus-trap.umd.js +11 -9
- package/bundles/taiga-ui-cdk-directives-focus-trap.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-focus-visible.umd.js +0 -1
- package/bundles/taiga-ui-cdk-directives-focus-visible.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-focused.umd.js +1 -1
- package/bundles/taiga-ui-cdk-directives-focused.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-high-dpi.umd.js +0 -1
- package/bundles/taiga-ui-cdk-directives-high-dpi.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-hovered.umd.js +7 -10
- package/bundles/taiga-ui-cdk-directives-hovered.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-media.umd.js +4 -11
- package/bundles/taiga-ui-cdk-directives-media.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-overscroll.umd.js +10 -12
- package/bundles/taiga-ui-cdk-directives-overscroll.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-pan.umd.js +0 -1
- package/bundles/taiga-ui-cdk-directives-pan.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-pressed.umd.js +1 -1
- package/bundles/taiga-ui-cdk-directives-pressed.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-prevent-default.umd.js +1 -2
- package/bundles/taiga-ui-cdk-directives-prevent-default.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-repeat-times.umd.js +1 -1
- package/bundles/taiga-ui-cdk-directives-repeat-times.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-resize.umd.js +0 -1
- package/bundles/taiga-ui-cdk-directives-resize.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-swipe.umd.js +0 -1
- package/bundles/taiga-ui-cdk-directives-swipe.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-zoom.umd.js +0 -1
- package/bundles/taiga-ui-cdk-directives-zoom.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-observables.umd.js +20 -76
- package/bundles/taiga-ui-cdk-observables.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-pipes-keys.umd.js +68 -0
- package/bundles/taiga-ui-cdk-pipes-keys.umd.js.map +1 -0
- package/bundles/taiga-ui-cdk-pipes.umd.js +10 -4
- package/bundles/taiga-ui-cdk-pipes.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-services.umd.js +37 -72
- package/bundles/taiga-ui-cdk-services.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-tokens.umd.js +46 -20
- package/bundles/taiga-ui-cdk-tokens.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-browser.umd.js +3 -26
- package/bundles/taiga-ui-cdk-utils-browser.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-color.umd.js +81 -0
- package/bundles/taiga-ui-cdk-utils-color.umd.js.map +1 -0
- package/bundles/taiga-ui-cdk-utils-dom.umd.js +57 -87
- package/bundles/taiga-ui-cdk-utils-dom.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-focus.umd.js +24 -67
- package/bundles/taiga-ui-cdk-utils-focus.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-format.umd.js +0 -1
- package/bundles/taiga-ui-cdk-utils-format.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-math.umd.js +8 -48
- package/bundles/taiga-ui-cdk-utils-math.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-miscellaneous.umd.js +349 -84
- package/bundles/taiga-ui-cdk-utils-miscellaneous.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-os.umd.js +5 -21
- package/bundles/taiga-ui-cdk-utils-os.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-svg.umd.js +1 -5
- package/bundles/taiga-ui-cdk-utils-svg.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils.umd.js +10 -4
- package/bundles/taiga-ui-cdk-utils.umd.js.map +1 -1
- package/classes/assert.d.ts +0 -3
- package/constants/browser.d.ts +4 -0
- package/constants/index.d.ts +1 -0
- package/constants/unicode-chars.d.ts +8 -0
- package/constants/version.d.ts +1 -0
- package/constants/version.js +4 -0
- package/date-time/day-range.d.ts +0 -5
- package/date-time/day.d.ts +1 -2
- package/date-time/month.d.ts +1 -2
- package/date-time/year.d.ts +1 -1
- package/directives/auto-focus/autofocus.directive.d.ts +2 -2
- package/directives/focus-visible/focus-visible.directive.d.ts +0 -1
- package/directives/high-dpi/high-dpi.directive.d.ts +0 -1
- package/directives/media/media.directive.d.ts +0 -2
- package/directives/overscroll/overscroll.directive.d.ts +0 -1
- package/directives/prevent-default/prevent-default.directive.d.ts +0 -1
- package/esm2015/abstract/control.js +7 -1
- package/esm2015/abstract/dialog.service.js +1 -1
- package/esm2015/abstract/portal-host.js +18 -15
- package/esm2015/abstract/portal-service.js +4 -4
- package/esm2015/abstract/theme-switcher.js +1 -2
- package/esm2015/classes/assert.js +1 -8
- package/esm2015/components/dialog-host/dialog-host.component.js +1 -2
- package/esm2015/components/dropdown-host/dropdown-host.component.js +4 -2
- package/esm2015/constants/browser.js +5 -1
- package/esm2015/constants/index.js +2 -1
- package/esm2015/constants/parent-animation.js +2 -2
- package/esm2015/constants/unicode-chars.js +9 -1
- package/esm2015/constants/version.js +2 -0
- package/esm2015/date-time/day-range.js +1 -6
- package/esm2015/date-time/day.js +2 -9
- package/esm2015/date-time/month.js +2 -8
- package/esm2015/date-time/year.js +2 -6
- package/esm2015/directives/active-zone/active-zone.directive.js +3 -6
- package/esm2015/directives/auto-focus/autofocus.directive.js +6 -5
- package/esm2015/directives/auto-focus/handlers/ios.handler.js +1 -2
- package/esm2015/directives/autofilled/autofilled-style.component.js +1 -1
- package/esm2015/directives/copy-processor/copy-processor.directive.js +1 -2
- package/esm2015/directives/drag/drag.directive.js +3 -3
- package/esm2015/directives/droppable/droppable.directive.js +7 -8
- package/esm2015/directives/focus-trap/focus-trap.directive.js +14 -12
- package/esm2015/directives/focus-visible/focus-visible.directive.js +1 -2
- package/esm2015/directives/focused/focused.directive.js +3 -3
- package/esm2015/directives/high-dpi/high-dpi.directive.js +1 -2
- package/esm2015/directives/hovered/hovered.service.js +5 -8
- package/esm2015/directives/media/media.directive.js +5 -10
- package/esm2015/directives/overscroll/overscroll.directive.js +13 -15
- package/esm2015/directives/pan/pan.directive.js +1 -2
- package/esm2015/directives/pressed/pressed.directive.js +3 -3
- package/esm2015/directives/prevent-default/prevent-default.directive.js +3 -4
- package/esm2015/directives/repeat-times/repeat-times.directive.js +3 -3
- package/esm2015/directives/resize/resize.directive.js +1 -2
- package/esm2015/directives/swipe/swipe.directive.js +1 -2
- package/esm2015/directives/zoom/zoom.directive.js +1 -2
- package/esm2015/observables/drag-and-drop-from.js +6 -11
- package/esm2015/observables/focus-visible-observable.js +7 -12
- package/esm2015/observables/items-query-list-observable.js +4 -7
- package/esm2015/observables/mouse-drag-finish-from.js +4 -7
- package/esm2015/observables/must-be-present.js +4 -9
- package/esm2015/observables/pressed-observable.js +5 -10
- package/esm2015/observables/prevent-default.js +2 -7
- package/esm2015/observables/stop-propagation.js +2 -7
- package/esm2015/observables/typed-from-event.js +2 -7
- package/esm2015/observables/watch.js +2 -7
- package/esm2015/pipes/index.js +2 -1
- package/esm2015/pipes/keys/index.js +3 -0
- package/esm2015/pipes/keys/keys.module.js +16 -0
- package/esm2015/pipes/keys/keys.pipe.js +14 -0
- package/esm2015/pipes/keys/taiga-ui-cdk-pipes-keys.js +5 -0
- package/esm2015/services/directive-styles.service.js +3 -26
- package/esm2015/services/focus-visible.service.js +3 -4
- package/esm2015/services/obscured.service.js +3 -5
- package/esm2015/services/pan.service.js +6 -9
- package/esm2015/services/parents-scroll.service.js +3 -5
- package/esm2015/services/resize.service.js +1 -2
- package/esm2015/services/scroll.service.js +4 -5
- package/esm2015/services/swipe.service.js +6 -9
- package/esm2015/services/zoom.service.js +8 -9
- package/esm2015/tokens/active-element.js +16 -16
- package/esm2015/tokens/alerts.js +8 -1
- package/esm2015/tokens/dialogs.js +8 -1
- package/esm2015/tokens/focusable-item-accessor.js +7 -1
- package/esm2015/tokens/index.js +2 -2
- package/esm2015/tokens/is-apple.js +3 -3
- package/esm2015/tokens/is-cypress.js +1 -1
- package/esm2015/tokens/is-ios.js +3 -3
- package/esm2015/tokens/range.js +8 -0
- package/esm2015/tokens/window-height.js +3 -3
- package/esm2015/utils/browser/index.js +1 -2
- package/esm2015/utils/browser/is-edge.js +2 -7
- package/esm2015/utils/browser/is-firefox.js +2 -7
- package/esm2015/utils/browser/is-safari.js +2 -7
- package/esm2015/utils/color/hex-to-rgb.js +12 -0
- package/esm2015/utils/color/hsv-to-rgb.js +11 -0
- package/esm2015/utils/color/index.js +6 -0
- package/esm2015/utils/color/parse-color.js +27 -0
- package/esm2015/utils/color/rgb-to-hex.js +4 -0
- package/esm2015/utils/color/rgb-to-hsv.js +7 -0
- package/esm2015/utils/color/taiga-ui-cdk-utils-color.js +5 -0
- package/esm2015/utils/dom/can-scroll.js +2 -7
- package/esm2015/utils/dom/contains-or-after.js +2 -7
- package/esm2015/utils/dom/element-checks.js +21 -0
- package/esm2015/utils/dom/get-actual-target.js +2 -5
- package/esm2015/utils/dom/get-clipboard-data-text.js +2 -5
- package/esm2015/utils/dom/get-document-or-shadow-root.js +2 -7
- package/esm2015/utils/dom/get-element-obscurers.js +14 -17
- package/esm2015/utils/dom/get-element-offset.js +4 -7
- package/esm2015/utils/dom/get-scroll-parent.js +3 -6
- package/esm2015/utils/dom/get-selected-text.js +3 -3
- package/esm2015/utils/dom/index.js +3 -2
- package/esm2015/utils/dom/is-current-target.js +2 -7
- package/esm2015/utils/dom/is-element-editable.js +5 -0
- package/esm2015/utils/dom/is-inside-iframe.js +2 -5
- package/esm2015/utils/dom/is-node-in.js +5 -7
- package/esm2015/utils/focus/blur-native-focused.js +4 -7
- package/esm2015/utils/focus/get-closest-focusable.js +26 -0
- package/esm2015/utils/focus/get-native-focused.js +3 -3
- package/esm2015/utils/focus/index.js +2 -3
- package/esm2015/utils/focus/is-native-focused-in.js +1 -2
- package/esm2015/utils/focus/is-native-focused.js +1 -2
- package/esm2015/utils/focus/is-native-keyboard-focusable.js +3 -3
- package/esm2015/utils/focus/is-native-mouse-focusable.js +1 -4
- package/esm2015/utils/focus/move-focus.js +2 -4
- package/esm2015/utils/focus/set-native-mouse-focused.js +8 -7
- package/esm2015/utils/format/px.js +1 -2
- package/esm2015/utils/index.js +2 -1
- package/esm2015/utils/math/clamp.js +2 -5
- package/esm2015/utils/math/quantize.js +2 -5
- package/esm2015/utils/math/round.js +4 -19
- package/esm2015/utils/math/sum.js +2 -5
- package/esm2015/utils/math/to-int.js +2 -7
- package/esm2015/utils/math/to-radians.js +2 -5
- package/esm2015/utils/miscellaneous/array-remove.js +4 -0
- package/esm2015/utils/miscellaneous/array-toggle.js +6 -0
- package/esm2015/utils/miscellaneous/distance-between-touches.js +2 -7
- package/esm2015/utils/miscellaneous/ease-in-out-quad.js +2 -7
- package/esm2015/utils/miscellaneous/flat-length.js +2 -5
- package/esm2015/utils/miscellaneous/get-original-array-from-query-list.js +2 -5
- package/esm2015/utils/miscellaneous/get-swipe-direction.js +2 -7
- package/esm2015/utils/miscellaneous/index.js +3 -3
- package/esm2015/utils/miscellaneous/is-number.js +2 -7
- package/esm2015/utils/miscellaneous/is-present.js +2 -7
- package/esm2015/utils/miscellaneous/mark-control-as-touched-and-validate.js +4 -9
- package/esm2015/utils/miscellaneous/uniq-by.js +2 -7
- package/esm2015/utils/os/is-apple-platform.js +2 -5
- package/esm2015/utils/os/is-apple.js +4 -9
- package/esm2015/utils/os/is-ios.js +4 -9
- package/esm2015/utils/svg/svg-linear-gradient-processor.js +2 -5
- package/fesm2015/taiga-ui-cdk-abstract.js +26 -18
- package/fesm2015/taiga-ui-cdk-abstract.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-classes.js +1 -8
- package/fesm2015/taiga-ui-cdk-classes.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-components-dialog-host.js +0 -1
- package/fesm2015/taiga-ui-cdk-components-dialog-host.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-components-dropdown-host.js +3 -1
- package/fesm2015/taiga-ui-cdk-components-dropdown-host.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-constants.js +16 -2
- package/fesm2015/taiga-ui-cdk-constants.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-date-time.js +4 -26
- package/fesm2015/taiga-ui-cdk-date-time.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-active-zone.js +2 -5
- package/fesm2015/taiga-ui-cdk-directives-active-zone.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-auto-focus.js +5 -5
- package/fesm2015/taiga-ui-cdk-directives-auto-focus.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-autofilled.js +1 -1
- package/fesm2015/taiga-ui-cdk-directives-autofilled.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-copy-processor.js +0 -1
- package/fesm2015/taiga-ui-cdk-directives-copy-processor.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-drag.js +2 -2
- package/fesm2015/taiga-ui-cdk-directives-drag.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-droppable.js +6 -7
- package/fesm2015/taiga-ui-cdk-directives-droppable.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-focus-trap.js +13 -11
- package/fesm2015/taiga-ui-cdk-directives-focus-trap.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-focus-visible.js +0 -1
- package/fesm2015/taiga-ui-cdk-directives-focus-visible.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-focused.js +2 -2
- package/fesm2015/taiga-ui-cdk-directives-focused.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-high-dpi.js +0 -1
- package/fesm2015/taiga-ui-cdk-directives-high-dpi.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-hovered.js +4 -7
- package/fesm2015/taiga-ui-cdk-directives-hovered.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-media.js +5 -10
- package/fesm2015/taiga-ui-cdk-directives-media.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-overscroll.js +12 -14
- package/fesm2015/taiga-ui-cdk-directives-overscroll.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-pan.js +0 -1
- package/fesm2015/taiga-ui-cdk-directives-pan.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-pressed.js +2 -2
- package/fesm2015/taiga-ui-cdk-directives-pressed.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-prevent-default.js +2 -3
- package/fesm2015/taiga-ui-cdk-directives-prevent-default.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-repeat-times.js +2 -2
- package/fesm2015/taiga-ui-cdk-directives-repeat-times.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-resize.js +0 -1
- package/fesm2015/taiga-ui-cdk-directives-resize.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-swipe.js +0 -1
- package/fesm2015/taiga-ui-cdk-directives-swipe.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-zoom.js +0 -1
- package/fesm2015/taiga-ui-cdk-directives-zoom.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-observables.js +21 -67
- package/fesm2015/taiga-ui-cdk-observables.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-pipes-keys.js +34 -0
- package/fesm2015/taiga-ui-cdk-pipes-keys.js.map +1 -0
- package/fesm2015/taiga-ui-cdk-pipes.js +1 -0
- package/fesm2015/taiga-ui-cdk-pipes.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-services.js +25 -60
- package/fesm2015/taiga-ui-cdk-services.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-tokens.js +46 -23
- package/fesm2015/taiga-ui-cdk-tokens.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-browser.js +4 -23
- package/fesm2015/taiga-ui-cdk-utils-browser.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-color.js +67 -0
- package/fesm2015/taiga-ui-cdk-utils-color.js.map +1 -0
- package/fesm2015/taiga-ui-cdk-utils-dom.js +53 -78
- package/fesm2015/taiga-ui-cdk-utils-dom.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-focus.js +21 -57
- package/fesm2015/taiga-ui-cdk-utils-focus.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-format.js +0 -1
- package/fesm2015/taiga-ui-cdk-utils-format.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-math.js +9 -41
- package/fesm2015/taiga-ui-cdk-utils-math.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-miscellaneous.js +21 -73
- package/fesm2015/taiga-ui-cdk-utils-miscellaneous.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-os.js +6 -19
- package/fesm2015/taiga-ui-cdk-utils-os.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-svg.js +2 -5
- package/fesm2015/taiga-ui-cdk-utils-svg.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils.js +1 -0
- package/fesm2015/taiga-ui-cdk-utils.js.map +1 -1
- package/observables/drag-and-drop-from.d.ts +1 -5
- package/observables/focus-visible-observable.d.ts +1 -5
- package/observables/items-query-list-observable.d.ts +1 -3
- package/observables/mouse-drag-finish-from.d.ts +1 -3
- package/observables/must-be-present.d.ts +1 -5
- package/observables/pressed-observable.d.ts +1 -5
- package/observables/prevent-default.d.ts +1 -5
- package/observables/stop-propagation.d.ts +1 -5
- package/observables/typed-from-event.d.ts +5 -21
- package/observables/watch.d.ts +1 -5
- package/package.json +7 -3
- package/pipes/index.d.ts +1 -0
- package/pipes/keys/index.d.ts +2 -0
- package/pipes/keys/keys.module.d.ts +7 -0
- package/pipes/keys/keys.pipe.d.ts +7 -0
- package/pipes/keys/package.json +10 -0
- package/pipes/keys/taiga-ui-cdk-pipes-keys.d.ts +5 -0
- package/schematics/collection.json +6 -0
- package/schematics/constants/file-globs.d.ts +2 -0
- package/schematics/constants/file-globs.js +11 -0
- package/schematics/constants/index.d.ts +1 -0
- package/schematics/constants/index.js +4 -0
- package/schematics/constants/taiga-styles.d.ts +2 -1
- package/schematics/constants/taiga-styles.js +3 -2
- package/schematics/ng-add/constants/versions.js +2 -2
- package/schematics/ng-add/index.js +6 -0
- package/schematics/ng-add/schema.d.ts +8 -0
- package/schematics/ng-add/schema.json +9 -0
- package/schematics/ng-add/steps/add-taiga-icons.js +5 -3
- package/schematics/ng-add/steps/add-taiga-modules.js +4 -0
- package/schematics/ng-add/steps/add-taiga-styles.js +6 -3
- package/schematics/ng-add/steps/wrap-with-tui-root.js +3 -0
- package/schematics/ng-update/constants/breakpoints.d.ts +82 -0
- package/schematics/ng-update/constants/breakpoints.js +34 -0
- package/schematics/ng-update/constants/consts.d.ts +1 -1
- package/schematics/ng-update/constants/consts.js +170 -0
- package/schematics/ng-update/constants/deprecated-functions.js +1 -36
- package/schematics/ng-update/constants/services.js +1 -1
- package/schematics/ng-update/constants/templates.d.ts +16 -0
- package/schematics/ng-update/constants/templates.js +261 -1
- package/schematics/ng-update/constants/warnings.js +10 -0
- package/schematics/ng-update/index.js +21 -10
- package/schematics/ng-update/schema.json +13 -0
- package/schematics/ng-update/steps/migrate-date-time.js +45 -1
- package/schematics/ng-update/steps/migrate-progress.d.ts +1 -1
- package/schematics/ng-update/steps/migrate-progress.js +2 -1
- package/schematics/ng-update/steps/migrate-sliders/index.d.ts +1 -1
- package/schematics/ng-update/steps/migrate-sliders/index.js +2 -0
- package/schematics/ng-update/steps/migrate-sliders/migrate-input-range.d.ts +1 -1
- package/schematics/ng-update/steps/migrate-sliders/migrate-input-range.js +4 -3
- package/schematics/ng-update/steps/migrate-sliders/migrate-input-slider.d.ts +1 -1
- package/schematics/ng-update/steps/migrate-sliders/migrate-input-slider.js +3 -2
- package/schematics/ng-update/steps/migrate-taiga-proprietary-icons.d.ts +3 -0
- package/schematics/ng-update/steps/migrate-taiga-proprietary-icons.js +51 -0
- package/schematics/ng-update/steps/migrate-templates.d.ts +1 -1
- package/schematics/ng-update/steps/migrate-templates.js +77 -5
- package/schematics/ng-update/steps/replace-deep-import.js +2 -1
- package/schematics/ng-update/steps/replace-enums.js +2 -1
- package/schematics/ng-update/steps/replace-functions.js +42 -2
- package/schematics/ng-update/steps/replace-styles.d.ts +1 -0
- package/schematics/ng-update/steps/replace-styles.js +18 -0
- package/schematics/ng-update/steps/show-warnings.js +2 -1
- package/schematics/utils/add-import-to-closest-module.d.ts +1 -0
- package/schematics/utils/add-import-to-closest-module.js +18 -0
- package/schematics/utils/add-styles.d.ts +6 -2
- package/schematics/utils/add-styles.js +32 -4
- package/schematics/utils/angular/ng-component.d.ts +1 -2
- package/schematics/utils/angular/ng-module.d.ts +1 -2
- package/schematics/utils/angular/ng-module.js +2 -1
- package/schematics/utils/colored-log.d.ts +1 -0
- package/schematics/utils/colored-log.js +5 -1
- package/schematics/utils/get-execution-time.d.ts +1 -0
- package/schematics/utils/get-execution-time.js +8 -0
- package/schematics/utils/get-named-import-references.js +2 -1
- package/schematics/utils/get-project.d.ts +1 -1
- package/schematics/utils/get-project.js +0 -4
- package/schematics/utils/insert-todo.d.ts +1 -0
- package/schematics/utils/insert-todo.js +3 -2
- package/schematics/utils/progress.d.ts +1 -0
- package/schematics/utils/progress.js +13 -0
- package/schematics/utils/templates/get-component-templates.d.ts +1 -2
- package/schematics/utils/templates/get-component-templates.js +1 -1
- package/schematics/utils/templates/ng-component-input-manipulations.js +2 -12
- package/schematics/utils/templates/template-resource.d.ts +1 -1
- package/services/directive-styles.service.d.ts +2 -9
- package/services/focus-visible.service.d.ts +0 -1
- package/services/pan.service.d.ts +0 -3
- package/services/swipe.service.d.ts +0 -3
- package/tokens/alerts.d.ts +2 -1
- package/tokens/dialogs.d.ts +2 -1
- package/tokens/focusable-item-accessor.d.ts +2 -1
- package/tokens/index.d.ts +1 -1
- package/tokens/is-cypress.d.ts +0 -3
- package/tokens/range.d.ts +2 -0
- package/utils/browser/index.d.ts +0 -1
- package/utils/browser/is-edge.d.ts +1 -5
- package/utils/browser/is-firefox.d.ts +1 -5
- package/utils/browser/is-safari.d.ts +1 -5
- package/utils/color/hex-to-rgb.d.ts +1 -0
- package/utils/color/hsv-to-rgb.d.ts +4 -0
- package/utils/color/index.d.ts +5 -0
- package/utils/color/package.json +10 -0
- package/utils/color/parse-color.d.ts +1 -0
- package/utils/color/rgb-to-hex.d.ts +1 -0
- package/utils/color/rgb-to-hsv.d.ts +1 -0
- package/utils/color/taiga-ui-cdk-utils-color.d.ts +5 -0
- package/utils/dom/can-scroll.d.ts +1 -5
- package/utils/dom/contains-or-after.d.ts +1 -5
- package/utils/dom/element-checks.d.ts +6 -0
- package/utils/dom/get-actual-target.d.ts +1 -3
- package/utils/dom/get-clipboard-data-text.d.ts +1 -3
- package/utils/dom/get-document-or-shadow-root.d.ts +1 -5
- package/utils/dom/get-element-obscurers.d.ts +1 -3
- package/utils/dom/get-element-offset.d.ts +1 -3
- package/utils/dom/get-scroll-parent.d.ts +1 -3
- package/utils/dom/index.d.ts +2 -1
- package/utils/dom/is-current-target.d.ts +1 -5
- package/utils/dom/is-element-editable.d.ts +1 -0
- package/utils/dom/is-inside-iframe.d.ts +1 -3
- package/utils/dom/is-node-in.d.ts +1 -3
- package/utils/focus/blur-native-focused.d.ts +1 -3
- package/utils/focus/get-closest-focusable.d.ts +27 -0
- package/utils/focus/index.d.ts +1 -2
- package/utils/focus/is-native-mouse-focusable.d.ts +0 -2
- package/utils/focus/set-native-mouse-focused.d.ts +1 -3
- package/utils/index.d.ts +1 -0
- package/utils/math/clamp.d.ts +1 -3
- package/utils/math/quantize.d.ts +1 -3
- package/utils/math/round.d.ts +3 -15
- package/utils/math/sum.d.ts +1 -3
- package/utils/math/to-int.d.ts +1 -5
- package/utils/math/to-radians.d.ts +1 -3
- package/utils/miscellaneous/array-remove.d.ts +1 -0
- package/utils/miscellaneous/array-toggle.d.ts +1 -0
- package/utils/miscellaneous/distance-between-touches.d.ts +1 -5
- package/utils/miscellaneous/ease-in-out-quad.d.ts +1 -5
- package/utils/miscellaneous/flat-length.d.ts +1 -3
- package/utils/miscellaneous/get-original-array-from-query-list.d.ts +1 -3
- package/utils/miscellaneous/get-swipe-direction.d.ts +1 -5
- package/utils/miscellaneous/index.d.ts +2 -2
- package/utils/miscellaneous/is-number.d.ts +1 -5
- package/utils/miscellaneous/is-present.d.ts +1 -5
- package/utils/miscellaneous/mark-control-as-touched-and-validate.d.ts +1 -5
- package/utils/miscellaneous/uniq-by.d.ts +1 -5
- package/utils/os/is-apple-platform.d.ts +1 -3
- package/utils/os/is-apple.d.ts +1 -5
- package/utils/os/is-ios.d.ts +1 -5
- package/utils/svg/svg-linear-gradient-processor.d.ts +1 -3
- package/esm2015/tokens/sanitizer.js +0 -4
- package/esm2015/utils/browser/is-ie.js +0 -4
- package/esm2015/utils/dom/is-form-field.js +0 -8
- package/esm2015/utils/focus/get-closest-keyboard-focusable.js +0 -34
- package/esm2015/utils/focus/set-native-focused.js +0 -19
- package/esm2015/utils/miscellaneous/identity.js +0 -8
- package/esm2015/utils/miscellaneous/is-element-editable.js +0 -12
- package/tokens/sanitizer.d.ts +0 -2
- package/utils/browser/is-ie.d.ts +0 -1
- package/utils/dom/is-form-field.d.ts +0 -1
- package/utils/focus/get-closest-keyboard-focusable.d.ts +0 -10
- package/utils/focus/set-native-focused.d.ts +0 -10
- package/utils/miscellaneous/identity.d.ts +0 -4
- package/utils/miscellaneous/is-element-editable.d.ts +0 -5
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { tuiIsHTMLElement } from '@taiga-ui/cdk/utils/dom';
|
|
1
2
|
import { svgNodeFilter } from '@taiga-ui/cdk/constants';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -5,9 +6,9 @@ import { svgNodeFilter } from '@taiga-ui/cdk/constants';
|
|
|
5
6
|
*
|
|
6
7
|
* @return element or null
|
|
7
8
|
*/
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
9
9
|
function tuiGetNativeFocused(documentRef) {
|
|
10
|
-
|
|
10
|
+
var _a;
|
|
11
|
+
if (!((_a = documentRef.activeElement) === null || _a === void 0 ? void 0 : _a.shadowRoot)) {
|
|
11
12
|
return documentRef.activeElement;
|
|
12
13
|
}
|
|
13
14
|
let element = documentRef.activeElement.shadowRoot.activeElement;
|
|
@@ -18,18 +19,14 @@ function tuiGetNativeFocused(documentRef) {
|
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
|
-
* @deprecated: use {@link tuiBlurNativeFocused} instead
|
|
22
22
|
* Finds and blurs current active element, including shadow DOM
|
|
23
23
|
*/
|
|
24
|
-
|
|
25
|
-
function blurNativeFocused(documentRef) {
|
|
24
|
+
function tuiBlurNativeFocused(documentRef) {
|
|
26
25
|
const activeElement = tuiGetNativeFocused(documentRef);
|
|
27
|
-
|
|
28
|
-
if (activeElement instanceof HTMLElement) {
|
|
26
|
+
if (tuiIsHTMLElement(activeElement)) {
|
|
29
27
|
activeElement.blur();
|
|
30
28
|
}
|
|
31
29
|
}
|
|
32
|
-
const tuiBlurNativeFocused = blurNativeFocused;
|
|
33
30
|
|
|
34
31
|
/**
|
|
35
32
|
* Checks for signs that element can be focused with keyboard. tabIndex above 0 is ignored to
|
|
@@ -41,8 +38,7 @@ function tuiIsNativeKeyboardFocusable(element) {
|
|
|
41
38
|
if (element.hasAttribute(`disabled`) || element.getAttribute(`tabIndex`) === `-1`) {
|
|
42
39
|
return false;
|
|
43
40
|
}
|
|
44
|
-
|
|
45
|
-
if ((element instanceof HTMLElement && element.isContentEditable) ||
|
|
41
|
+
if ((tuiIsHTMLElement(element) && element.isContentEditable) ||
|
|
46
42
|
element.getAttribute(`tabIndex`) === `0`) {
|
|
47
43
|
return true;
|
|
48
44
|
}
|
|
@@ -64,9 +60,6 @@ function tuiIsNativeKeyboardFocusable(element) {
|
|
|
64
60
|
}
|
|
65
61
|
}
|
|
66
62
|
|
|
67
|
-
/**
|
|
68
|
-
*/
|
|
69
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
70
63
|
function tuiIsNativeMouseFocusable(element) {
|
|
71
64
|
return (!element.hasAttribute(`disabled`) &&
|
|
72
65
|
(element.getAttribute(`tabIndex`) === `-1` ||
|
|
@@ -74,30 +67,21 @@ function tuiIsNativeMouseFocusable(element) {
|
|
|
74
67
|
}
|
|
75
68
|
|
|
76
69
|
/**
|
|
70
|
+
* @description:
|
|
77
71
|
* Finds the closest element that can be focused with a keyboard or mouse in theory
|
|
78
|
-
*
|
|
79
|
-
* @param initial current HTML element
|
|
80
|
-
* @param prev should it look backwards instead (find item that will be focused with Shift + Tab)
|
|
81
|
-
* @param root top Node limiting the search area
|
|
82
|
-
* @param keyboard determine if only keyboard focus is of interest
|
|
83
|
-
*
|
|
84
72
|
*/
|
|
85
|
-
function tuiGetClosestFocusable(initial,
|
|
73
|
+
function tuiGetClosestFocusable({ initial, root, previous = false, keyboard = true, }) {
|
|
86
74
|
if (!root.ownerDocument) {
|
|
87
75
|
return null;
|
|
88
76
|
}
|
|
89
77
|
const check = keyboard ? tuiIsNativeKeyboardFocusable : tuiIsNativeMouseFocusable;
|
|
90
|
-
|
|
91
|
-
// Filter must be a function in IE, other modern browsers are compliant to this format
|
|
92
|
-
const treeWalker = root.ownerDocument.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, svgNodeFilter, false);
|
|
78
|
+
const treeWalker = root.ownerDocument.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, svgNodeFilter);
|
|
93
79
|
treeWalker.currentNode = initial;
|
|
94
|
-
while (
|
|
95
|
-
|
|
96
|
-
if (treeWalker.currentNode instanceof HTMLElement) {
|
|
80
|
+
while (previous ? treeWalker.previousNode() : treeWalker.nextNode()) {
|
|
81
|
+
if (tuiIsHTMLElement(treeWalker.currentNode)) {
|
|
97
82
|
initial = treeWalker.currentNode;
|
|
98
83
|
}
|
|
99
|
-
|
|
100
|
-
if (check(initial) && initial instanceof HTMLElement) {
|
|
84
|
+
if (tuiIsHTMLElement(initial) && check(initial)) {
|
|
101
85
|
return initial;
|
|
102
86
|
}
|
|
103
87
|
}
|
|
@@ -112,7 +96,6 @@ function tuiGetClosestFocusable(initial, prev = false, root, keyboard = true) {
|
|
|
112
96
|
* @param node or null (as a common return value of DOM nodes walking)
|
|
113
97
|
* @return true if focused
|
|
114
98
|
*/
|
|
115
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
116
99
|
function tuiIsNativeFocused(node) {
|
|
117
100
|
return !!(node === null || node === void 0 ? void 0 : node.ownerDocument) && tuiGetNativeFocused(node.ownerDocument) === node;
|
|
118
101
|
}
|
|
@@ -123,7 +106,6 @@ function tuiIsNativeFocused(node) {
|
|
|
123
106
|
* @param node
|
|
124
107
|
* @return true if focused node is contained within element
|
|
125
108
|
*/
|
|
126
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
127
109
|
function tuiIsNativeFocusedIn(node) {
|
|
128
110
|
// !node.contains - check for IE11
|
|
129
111
|
if (!node.ownerDocument || !node.contains) {
|
|
@@ -133,25 +115,6 @@ function tuiIsNativeFocusedIn(node) {
|
|
|
133
115
|
return nativeFocused !== null && node.contains(nativeFocused);
|
|
134
116
|
}
|
|
135
117
|
|
|
136
|
-
/**
|
|
137
|
-
* @deprecated: use native element.focus()
|
|
138
|
-
* TODO: remove in v3.0
|
|
139
|
-
* Focuses or blurs and element
|
|
140
|
-
*
|
|
141
|
-
* @param element native element
|
|
142
|
-
* @param focused boolean focused state
|
|
143
|
-
* @param preventScroll optional flag to prevent native scroll to the element
|
|
144
|
-
*/
|
|
145
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
146
|
-
function setNativeFocused(element, focused = true, preventScroll = false) {
|
|
147
|
-
if (focused) {
|
|
148
|
-
element.focus({ preventScroll });
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
element.blur();
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
118
|
/**
|
|
156
119
|
* Utility method for moving focus in a list of elements
|
|
157
120
|
*
|
|
@@ -159,11 +122,10 @@ function setNativeFocused(element, focused = true, preventScroll = false) {
|
|
|
159
122
|
* @param elements array of focusable elements
|
|
160
123
|
* @param step a step to move focus by, typically -1 or 1
|
|
161
124
|
*/
|
|
162
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
163
125
|
function tuiMoveFocus(currentIndex, elements, step) {
|
|
164
126
|
currentIndex += step;
|
|
165
127
|
while (currentIndex >= 0 && currentIndex < elements.length) {
|
|
166
|
-
|
|
128
|
+
elements[currentIndex].focus();
|
|
167
129
|
if (tuiIsNativeFocused(elements[currentIndex])) {
|
|
168
130
|
return;
|
|
169
131
|
}
|
|
@@ -172,15 +134,13 @@ function tuiMoveFocus(currentIndex, elements, step) {
|
|
|
172
134
|
}
|
|
173
135
|
|
|
174
136
|
/**
|
|
175
|
-
* @deprecated: use {@link tuiSetNativeMouseFocused} instead
|
|
176
137
|
* Focuses or blurs element with mouse action imitation (to spoof {@link TuiFocusVisibleService})
|
|
177
138
|
*
|
|
178
139
|
* @param element
|
|
179
140
|
* @param focused desired focused state
|
|
180
141
|
* @param preventScroll optionally prevent native browser scroll after focus
|
|
181
142
|
*/
|
|
182
|
-
|
|
183
|
-
function setNativeMouseFocused(element, focused = true, preventScroll = false) {
|
|
143
|
+
function tuiSetNativeMouseFocused(element, focused = true, preventScroll = false) {
|
|
184
144
|
if (!element.ownerDocument) {
|
|
185
145
|
return;
|
|
186
146
|
}
|
|
@@ -192,13 +152,17 @@ function setNativeMouseFocused(element, focused = true, preventScroll = false) {
|
|
|
192
152
|
event.initEvent(`mousedown`, true, true);
|
|
193
153
|
element.dispatchEvent(event);
|
|
194
154
|
}
|
|
195
|
-
|
|
155
|
+
if (focused) {
|
|
156
|
+
element.focus({ preventScroll });
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
element.blur();
|
|
160
|
+
}
|
|
196
161
|
}
|
|
197
|
-
const tuiSetNativeMouseFocused = setNativeMouseFocused;
|
|
198
162
|
|
|
199
163
|
/**
|
|
200
164
|
* Generated bundle index. Do not edit.
|
|
201
165
|
*/
|
|
202
166
|
|
|
203
|
-
export {
|
|
167
|
+
export { tuiBlurNativeFocused, tuiGetClosestFocusable, tuiGetNativeFocused, tuiIsNativeFocused, tuiIsNativeFocusedIn, tuiIsNativeKeyboardFocusable, tuiIsNativeMouseFocusable, tuiMoveFocus, tuiSetNativeMouseFocused };
|
|
204
168
|
//# sourceMappingURL=taiga-ui-cdk-utils-focus.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-cdk-utils-focus.js","sources":["../../../projects/cdk/utils/focus/get-native-focused.ts","../../../projects/cdk/utils/focus/blur-native-focused.ts","../../../projects/cdk/utils/focus/is-native-keyboard-focusable.ts","../../../projects/cdk/utils/focus/is-native-mouse-focusable.ts","../../../projects/cdk/utils/focus/get-closest-keyboard-focusable.ts","../../../projects/cdk/utils/focus/is-native-focused.ts","../../../projects/cdk/utils/focus/is-native-focused-in.ts","../../../projects/cdk/utils/focus/set-native-focused.ts","../../../projects/cdk/utils/focus/move-focus.ts","../../../projects/cdk/utils/focus/set-native-mouse-focused.ts","../../../projects/cdk/utils/focus/taiga-ui-cdk-utils-focus.ts"],"sourcesContent":["/**\n * Returns current active element, including shadow dom\n *\n * @return element or null\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function tuiGetNativeFocused(documentRef: Document): Element | null {\n if (!documentRef.activeElement || !documentRef.activeElement.shadowRoot) {\n return documentRef.activeElement;\n }\n\n let element = documentRef.activeElement.shadowRoot.activeElement;\n\n while (element?.shadowRoot) {\n element = element.shadowRoot.activeElement;\n }\n\n return element;\n}\n","import {tuiGetNativeFocused} from './get-native-focused';\n\n/**\n * @deprecated: use {@link tuiBlurNativeFocused} instead\n * Finds and blurs current active element, including shadow DOM\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function blurNativeFocused(documentRef: Document): void {\n const activeElement = tuiGetNativeFocused(documentRef);\n\n // TODO: iframe warning\n if (activeElement instanceof HTMLElement) {\n activeElement.blur();\n }\n}\n\nexport const tuiBlurNativeFocused = blurNativeFocused;\n","/**\n * Checks for signs that element can be focused with keyboard. tabIndex above 0 is ignored to\n * only target natural focus order. Not checking the possibility of an element to\n * be focused, for example element can have display: none applied to it or any other\n * circumstances could prevent actual focus.\n */\nexport function tuiIsNativeKeyboardFocusable(element: Element): boolean {\n if (element.hasAttribute(`disabled`) || element.getAttribute(`tabIndex`) === `-1`) {\n return false;\n }\n\n // TODO: iframe warning\n if (\n (element instanceof HTMLElement && element.isContentEditable) ||\n element.getAttribute(`tabIndex`) === `0`\n ) {\n return true;\n }\n\n switch (element.tagName) {\n case `BUTTON`:\n case `SELECT`:\n case `TEXTAREA`:\n return true;\n case `VIDEO`:\n case `AUDIO`:\n return element.hasAttribute(`controls`);\n case `INPUT`:\n return element.getAttribute(`type`) !== `hidden`;\n case `A`:\n case `LINK`:\n return element.hasAttribute(`href`);\n default:\n return false;\n }\n}\n","import {tuiIsNativeKeyboardFocusable} from './is-native-keyboard-focusable';\n\n/**\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function tuiIsNativeMouseFocusable(element: Element): boolean {\n return (\n !element.hasAttribute(`disabled`) &&\n (element.getAttribute(`tabIndex`) === `-1` ||\n tuiIsNativeKeyboardFocusable(element))\n );\n}\n","import {svgNodeFilter} from '@taiga-ui/cdk/constants';\n\nimport {tuiIsNativeKeyboardFocusable} from './is-native-keyboard-focusable';\nimport {tuiIsNativeMouseFocusable} from './is-native-mouse-focusable';\n\n/**\n * Finds the closest element that can be focused with a keyboard or mouse in theory\n *\n * @param initial current HTML element\n * @param prev should it look backwards instead (find item that will be focused with Shift + Tab)\n * @param root top Node limiting the search area\n * @param keyboard determine if only keyboard focus is of interest\n *\n */\nexport function tuiGetClosestFocusable(\n initial: Element,\n prev: boolean = false,\n root: Node,\n keyboard: boolean = true,\n): HTMLElement | null {\n if (!root.ownerDocument) {\n return null;\n }\n\n const check = keyboard ? tuiIsNativeKeyboardFocusable : tuiIsNativeMouseFocusable;\n\n // Deprecated but ony this overload works in IE\n // Filter must be a function in IE, other modern browsers are compliant to this format\n const treeWalker = root.ownerDocument.createTreeWalker(\n root,\n NodeFilter.SHOW_ELEMENT,\n svgNodeFilter,\n false,\n );\n\n treeWalker.currentNode = initial;\n\n while (prev ? treeWalker.previousNode() : treeWalker.nextNode()) {\n // TODO: iframe warning\n if (treeWalker.currentNode instanceof HTMLElement) {\n initial = treeWalker.currentNode;\n }\n\n // TODO: iframe warning\n if (check(initial) && initial instanceof HTMLElement) {\n return initial;\n }\n }\n\n return null;\n}\n","import {tuiGetNativeFocused} from './get-native-focused';\n\n/**\n * Checks if element is focused.\n *\n * Could return true even after blur since element remains focused if you switch away from a browser tab.\n *\n * @param node or null (as a common return value of DOM nodes walking)\n * @return true if focused\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function tuiIsNativeFocused(node: Node | null): boolean {\n return !!node?.ownerDocument && tuiGetNativeFocused(node.ownerDocument) === node;\n}\n","import {tuiGetNativeFocused} from './get-native-focused';\n\n/**\n * Checks if focused element is within given element.\n *\n * @param node\n * @return true if focused node is contained within element\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function tuiIsNativeFocusedIn(node: Node): boolean {\n // !node.contains - check for IE11\n if (!node.ownerDocument || !node.contains) {\n return false;\n }\n\n const nativeFocused = tuiGetNativeFocused(node.ownerDocument);\n\n return nativeFocused !== null && node.contains(nativeFocused);\n}\n","/**\n * @deprecated: use native element.focus()\n * TODO: remove in v3.0\n * Focuses or blurs and element\n *\n * @param element native element\n * @param focused boolean focused state\n * @param preventScroll optional flag to prevent native scroll to the element\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function setNativeFocused(\n element: HTMLOrSVGElement,\n focused: boolean = true,\n preventScroll: boolean = false,\n): void {\n if (focused) {\n element.focus({preventScroll});\n } else {\n element.blur();\n }\n}\n","import {tuiIsNativeFocused} from './is-native-focused';\nimport {setNativeFocused} from './set-native-focused';\n\n/**\n * Utility method for moving focus in a list of elements\n *\n * @param currentIndex currently focused index\n * @param elements array of focusable elements\n * @param step a step to move focus by, typically -1 or 1\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function tuiMoveFocus(\n currentIndex: number,\n elements: readonly HTMLElement[],\n step: number,\n): void {\n currentIndex += step;\n\n while (currentIndex >= 0 && currentIndex < elements.length) {\n setNativeFocused(elements[currentIndex]);\n\n if (tuiIsNativeFocused(elements[currentIndex])) {\n return;\n }\n\n currentIndex += step;\n }\n}\n","import {setNativeFocused} from './set-native-focused';\n\n/**\n * @deprecated: use {@link tuiSetNativeMouseFocused} instead\n * Focuses or blurs element with mouse action imitation (to spoof {@link TuiFocusVisibleService})\n *\n * @param element\n * @param focused desired focused state\n * @param preventScroll optionally prevent native browser scroll after focus\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function setNativeMouseFocused(\n element: HTMLOrSVGElement & Element,\n focused: boolean = true,\n preventScroll: boolean = false,\n): void {\n if (!element.ownerDocument) {\n return;\n }\n\n if (typeof Event === `function`) {\n element.dispatchEvent(new Event(`mousedown`, {bubbles: true, cancelable: true}));\n } else {\n const event = element.ownerDocument.createEvent(`Event`);\n\n event.initEvent(`mousedown`, true, true);\n element.dispatchEvent(event);\n }\n\n setNativeFocused(element, focused, preventScroll);\n}\n\nexport const tuiSetNativeMouseFocused = setNativeMouseFocused;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAAA;;;;AAIG;AACH;AACM,SAAU,mBAAmB,CAAC,WAAqB,EAAA;IACrD,IAAI,CAAC,WAAW,CAAC,aAAa,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,UAAU,EAAE;QACrE,O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Q,CAAC,YAAY,CAAC,CAAC,CAAC;AAEzC,QAAA,IAAI,kBAAkB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,EAAE;YAC5C,OAAO;AACV,SAAA;QAED,YAAY,IAAI,IAAI,CAAC;AACxB,KAAA;AACL;;ACzBA;;;;;;;AAOG;AACH;AACM,SAAU,qBAAqB,CACjC,OAAmC,EACnC,OAAmB,GAAA,IAAI,EACvB,aAAA,GAAyB,KAAK,EAAA;AAE9B,IAAA,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE;QACxB,OAAO;AACV,KAAA;AAED,IAAA,IAAI,OAAO,KAAK,KAAK,CAAA,QAAA,CAAU,EAAE;AAC7B,QAAA,OAAO,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,WAAW,EAAE,EAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAC,CAAC,CAAC,CAAC;AACpF,KAAA;AAAM,SAAA;QACH,MAAM,KAAK,GAAG,OAAO,CAAC,aAAa,CAAC,WAAW,CAAC,CAAO,KAAA,CAAA,CAAC,CAAC;QAEzD,KAAK,CAAC,SAAS,CAAC,CAAA,SAAA,CAAW,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACzC,QAAA,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAChC,KAAA;AAED,IAAA,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;AACtD,CAAC;AAEM,MAAM,wBAAwB,GAAG;;AChCxC;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"taiga-ui-cdk-utils-focus.js","sources":["../../../projects/cdk/utils/focus/get-native-focused.ts","../../../projects/cdk/utils/focus/blur-native-focused.ts","../../../projects/cdk/utils/focus/is-native-keyboard-focusable.ts","../../../projects/cdk/utils/focus/is-native-mouse-focusable.ts","../../../projects/cdk/utils/focus/get-closest-focusable.ts","../../../projects/cdk/utils/focus/is-native-focused.ts","../../../projects/cdk/utils/focus/is-native-focused-in.ts","../../../projects/cdk/utils/focus/move-focus.ts","../../../projects/cdk/utils/focus/set-native-mouse-focused.ts","../../../projects/cdk/utils/focus/taiga-ui-cdk-utils-focus.ts"],"sourcesContent":["/**\n * Returns current active element, including shadow dom\n *\n * @return element or null\n */\nexport function tuiGetNativeFocused(documentRef: Document): Element | null {\n if (!documentRef.activeElement?.shadowRoot) {\n return documentRef.activeElement;\n }\n\n let element = documentRef.activeElement.shadowRoot.activeElement;\n\n while (element?.shadowRoot) {\n element = element.shadowRoot.activeElement;\n }\n\n return element;\n}\n","import {tuiIsHTMLElement} from '@taiga-ui/cdk/utils/dom';\n\nimport {tuiGetNativeFocused} from './get-native-focused';\n\n/**\n * Finds and blurs current active element, including shadow DOM\n */\nexport function tuiBlurNativeFocused(documentRef: Document): void {\n const activeElement = tuiGetNativeFocused(documentRef);\n\n if (tuiIsHTMLElement(activeElement)) {\n activeElement.blur();\n }\n}\n","import {tuiIsHTMLElement} from '@taiga-ui/cdk/utils/dom';\n\n/**\n * Checks for signs that element can be focused with keyboard. tabIndex above 0 is ignored to\n * only target natural focus order. Not checking the possibility of an element to\n * be focused, for example element can have display: none applied to it or any other\n * circumstances could prevent actual focus.\n */\nexport function tuiIsNativeKeyboardFocusable(element: Element): boolean {\n if (element.hasAttribute(`disabled`) || element.getAttribute(`tabIndex`) === `-1`) {\n return false;\n }\n\n if (\n (tuiIsHTMLElement(element) && element.isContentEditable) ||\n element.getAttribute(`tabIndex`) === `0`\n ) {\n return true;\n }\n\n switch (element.tagName) {\n case `BUTTON`:\n case `SELECT`:\n case `TEXTAREA`:\n return true;\n case `VIDEO`:\n case `AUDIO`:\n return element.hasAttribute(`controls`);\n case `INPUT`:\n return element.getAttribute(`type`) !== `hidden`;\n case `A`:\n case `LINK`:\n return element.hasAttribute(`href`);\n default:\n return false;\n }\n}\n","import {tuiIsNativeKeyboardFocusable} from './is-native-keyboard-focusable';\n\nexport function tuiIsNativeMouseFocusable(element: Element): boolean {\n return (\n !element.hasAttribute(`disabled`) &&\n (element.getAttribute(`tabIndex`) === `-1` ||\n tuiIsNativeKeyboardFocusable(element))\n );\n}\n","import {svgNodeFilter} from '@taiga-ui/cdk/constants';\nimport {tuiIsHTMLElement} from '@taiga-ui/cdk/utils/dom';\n\nimport {tuiIsNativeKeyboardFocusable} from './is-native-keyboard-focusable';\nimport {tuiIsNativeMouseFocusable} from './is-native-mouse-focusable';\n\nexport interface TuiGetClosestFocusableOptions {\n /**\n * @description:\n * current HTML element\n */\n initial: Element;\n\n /**\n * @description:\n * top Node limiting the search area\n */\n root: Node;\n\n /**\n * @description:\n * should it look backwards instead (find item that will be focused with Shift + Tab)\n */\n previous?: boolean;\n\n /**\n * @description:\n * determine if only keyboard focus is of interest\n */\n keyboard?: boolean;\n}\n\n/**\n * @description:\n * Finds the closest element that can be focused with a keyboard or mouse in theory\n */\nexport function tuiGetClosestFocusable({\n initial,\n root,\n previous = false,\n keyboard = true,\n}: TuiGetClosestFocusableOptions): HTMLElement | null {\n if (!root.ownerDocument) {\n return null;\n }\n\n const check = keyboard ? tuiIsNativeKeyboardFocusable : tuiIsNativeMouseFocusable;\n const treeWalker = root.ownerDocument.createTreeWalker(\n root,\n NodeFilter.SHOW_ELEMENT,\n svgNodeFilter,\n );\n\n treeWalker.currentNode = initial;\n\n while (previous ? treeWalker.previousNode() : treeWalker.nextNode()) {\n if (tuiIsHTMLElement(treeWalker.currentNode)) {\n initial = treeWalker.currentNode;\n }\n\n if (tuiIsHTMLElement(initial) && check(initial)) {\n return initial;\n }\n }\n\n return null;\n}\n","import {tuiGetNativeFocused} from './get-native-focused';\n\n/**\n * Checks if element is focused.\n *\n * Could return true even after blur since element remains focused if you switch away from a browser tab.\n *\n * @param node or null (as a common return value of DOM nodes walking)\n * @return true if focused\n */\nexport function tuiIsNativeFocused(node: Node | null): boolean {\n return !!node?.ownerDocument && tuiGetNativeFocused(node.ownerDocument) === node;\n}\n","import {tuiGetNativeFocused} from './get-native-focused';\n\n/**\n * Checks if focused element is within given element.\n *\n * @param node\n * @return true if focused node is contained within element\n */\nexport function tuiIsNativeFocusedIn(node: Node): boolean {\n // !node.contains - check for IE11\n if (!node.ownerDocument || !node.contains) {\n return false;\n }\n\n const nativeFocused = tuiGetNativeFocused(node.ownerDocument);\n\n return nativeFocused !== null && node.contains(nativeFocused);\n}\n","import {tuiIsNativeFocused} from './is-native-focused';\n\n/**\n * Utility method for moving focus in a list of elements\n *\n * @param currentIndex currently focused index\n * @param elements array of focusable elements\n * @param step a step to move focus by, typically -1 or 1\n */\nexport function tuiMoveFocus(\n currentIndex: number,\n elements: readonly HTMLElement[],\n step: number,\n): void {\n currentIndex += step;\n\n while (currentIndex >= 0 && currentIndex < elements.length) {\n elements[currentIndex].focus();\n\n if (tuiIsNativeFocused(elements[currentIndex])) {\n return;\n }\n\n currentIndex += step;\n }\n}\n","/**\n * Focuses or blurs element with mouse action imitation (to spoof {@link TuiFocusVisibleService})\n *\n * @param element\n * @param focused desired focused state\n * @param preventScroll optionally prevent native browser scroll after focus\n */\nexport function tuiSetNativeMouseFocused(\n element: HTMLOrSVGElement & Element,\n focused: boolean = true,\n preventScroll: boolean = false,\n): void {\n if (!element.ownerDocument) {\n return;\n }\n\n if (typeof Event === `function`) {\n element.dispatchEvent(new Event(`mousedown`, {bubbles: true, cancelable: true}));\n } else {\n const event = element.ownerDocument.createEvent(`Event`);\n\n event.initEvent(`mousedown`, true, true);\n element.dispatchEvent(event);\n }\n\n if (focused) {\n element.focus({preventScroll});\n } else {\n element.blur();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAAA;;;;AAIG;AACG,SAAU,mBAAmB,CAAC,WAAqB,EAAA;;IACrD,IAAI,EAAC,CAAA,EAAA,GAAA,WAAW,CAAC,aAAa,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,UAAU,CAAA,EAAE;QACxC,OAAO,WAA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ACV,KAAA;AAED,IAAA,IAAI,OAAO,KAAK,KAAK,CAAA,QAAA,CAAU,EAAE;AAC7B,QAAA,OAAO,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,WAAW,EAAE,EAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAC,CAAC,CAAC,CAAC;AACpF,KAAA;AAAM,SAAA;QACH,MAAM,KAAK,GAAG,OAAO,CAAC,aAAa,CAAC,WAAW,CAAC,CAAO,KAAA,CAAA,CAAC,CAAC;QAEzD,KAAK,CAAC,SAAS,CAAC,CAAA,SAAA,CAAW,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACzC,QAAA,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAChC,KAAA;AAED,IAAA,IAAI,OAAO,EAAE;AACT,QAAA,OAAO,CAAC,KAAK,CAAC,EAAC,aAAa,EAAC,CAAC,CAAC;AAClC,KAAA;AAAM,SAAA;QACH,OAAO,CAAC,IAAI,EAAE,CAAC;AAClB,KAAA;AACL;;AC9BA;;AAEG;;;;"}
|
|
@@ -3,7 +3,6 @@ import { tuiAssert } from '@taiga-ui/cdk/classes';
|
|
|
3
3
|
/**
|
|
4
4
|
* Adds 'px' to the number and turns it into a string
|
|
5
5
|
*/
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
6
|
function tuiPx(value) {
|
|
8
7
|
tuiAssert.assert(Number.isFinite(value), `Value must be finite number`);
|
|
9
8
|
return `${value}px`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-cdk-utils-format.js","sources":["../../../projects/cdk/utils/format/px.ts","../../../projects/cdk/utils/format/taiga-ui-cdk-utils-format.ts"],"sourcesContent":["import {tuiAssert} from '@taiga-ui/cdk/classes';\n\n/**\n * Adds 'px' to the number and turns it into a string\n */\
|
|
1
|
+
{"version":3,"file":"taiga-ui-cdk-utils-format.js","sources":["../../../projects/cdk/utils/format/px.ts","../../../projects/cdk/utils/format/taiga-ui-cdk-utils-format.ts"],"sourcesContent":["import {tuiAssert} from '@taiga-ui/cdk/classes';\n\n/**\n * Adds 'px' to the number and turns it into a string\n */\nexport function tuiPx(value: number): string {\n tuiAssert.assert(Number.isFinite(value), `Value must be finite number`);\n\n return `${value}px`;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAEA;;AAEG;AACG,SAAU,KAAK,CAAC,KAAa,EAAA;AAC/B,IAAA,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAA6B,2BAAA,CAAA,CAAC,CAAC;IAExE,OAAO,CAAA,EAAG,KAAK,CAAA,EAAA,CAAI,CAAC;AACxB;;ACTA;;AAEG;;;;"}
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
import { tuiAssert } from '@taiga-ui/cdk/classes';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @deprecated: use {@link tuiClamp} instead
|
|
5
4
|
* Clamps a value between two inclusive limits
|
|
6
5
|
*
|
|
7
6
|
* @param value
|
|
8
7
|
* @param min lower limit
|
|
9
8
|
* @param max upper limit
|
|
10
9
|
*/
|
|
11
|
-
|
|
12
|
-
function clamp(value, min, max) {
|
|
10
|
+
function tuiClamp(value, min, max) {
|
|
13
11
|
tuiAssert.assert(!isNaN(value));
|
|
14
12
|
tuiAssert.assert(!isNaN(min));
|
|
15
13
|
tuiAssert.assert(!isNaN(max));
|
|
16
14
|
tuiAssert.assert(max >= min);
|
|
17
15
|
return Math.min(max, Math.max(min, value));
|
|
18
16
|
}
|
|
19
|
-
const tuiClamp = clamp;
|
|
20
17
|
|
|
21
18
|
function tuiInRange(value, fromInclude, toExclude) {
|
|
22
19
|
tuiAssert.assert(!isNaN(value));
|
|
@@ -48,47 +45,29 @@ function tuiNormalizeToIntNumber(value, min, max) {
|
|
|
48
45
|
}
|
|
49
46
|
|
|
50
47
|
/**
|
|
51
|
-
* @deprecated: use {@link tuiQuantize} instead
|
|
52
48
|
* Rounds a number to the closest value in a fixed discrete series
|
|
53
49
|
*
|
|
54
50
|
* @param value
|
|
55
51
|
* @param quantum series step
|
|
56
52
|
*/
|
|
57
|
-
|
|
58
|
-
function quantize(value, quantum) {
|
|
53
|
+
function tuiQuantize(value, quantum) {
|
|
59
54
|
tuiAssert.assert(Number.isFinite(value));
|
|
60
55
|
tuiAssert.assert(Number.isFinite(quantum));
|
|
61
56
|
tuiAssert.assert(quantum > 0);
|
|
62
57
|
const remainder = value % quantum;
|
|
63
58
|
return remainder < quantum / 2 ? value - remainder : value + quantum - remainder;
|
|
64
59
|
}
|
|
65
|
-
const tuiQuantize = quantize;
|
|
66
60
|
|
|
67
61
|
const MAX_PRECISION = 292;
|
|
68
|
-
|
|
69
|
-
* @deprecated: use {@link tuiRound} instead
|
|
70
|
-
*/
|
|
71
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
72
|
-
function round(value, precision = 0) {
|
|
62
|
+
function tuiRound(value, precision = 0) {
|
|
73
63
|
return calculate(value, precision, Math.round);
|
|
74
64
|
}
|
|
75
|
-
|
|
76
|
-
* @deprecated: use {@link tuiCeil} instead
|
|
77
|
-
*/
|
|
78
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
79
|
-
function ceil(value, precision = 0) {
|
|
65
|
+
function tuiCeil(value, precision = 0) {
|
|
80
66
|
return calculate(value, precision, Math.ceil);
|
|
81
67
|
}
|
|
82
|
-
|
|
83
|
-
* @deprecated: use {@link tuiFloor} instead
|
|
84
|
-
*/
|
|
85
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
86
|
-
function floor(value, precision = 0) {
|
|
68
|
+
function tuiFloor(value, precision = 0) {
|
|
87
69
|
return calculate(value, precision, Math.floor);
|
|
88
70
|
}
|
|
89
|
-
const tuiRound = round;
|
|
90
|
-
const tuiCeil = ceil;
|
|
91
|
-
const tuiFloor = floor;
|
|
92
71
|
/**
|
|
93
72
|
* Rounding number to the set precision
|
|
94
73
|
*
|
|
@@ -110,37 +89,26 @@ function calculate(value, precision, func) {
|
|
|
110
89
|
}
|
|
111
90
|
|
|
112
91
|
/**
|
|
113
|
-
* @deprecated: use {@link tuiSum} instead
|
|
114
92
|
* Calculates sum of any number of passed arguments
|
|
115
93
|
*/
|
|
116
|
-
|
|
117
|
-
function sum(...args) {
|
|
94
|
+
function tuiSum(...args) {
|
|
118
95
|
return args.reduce((a, b) => a + b, 0);
|
|
119
96
|
}
|
|
120
|
-
const tuiSum = sum;
|
|
121
97
|
|
|
122
|
-
|
|
123
|
-
* @deprecated: use {@link tuiToInt} instead
|
|
124
|
-
*/
|
|
125
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
126
|
-
function toInt(bool) {
|
|
98
|
+
function tuiToInt(bool) {
|
|
127
99
|
return bool ? 1 : 0;
|
|
128
100
|
}
|
|
129
|
-
const tuiToInt = toInt;
|
|
130
101
|
|
|
131
102
|
/**
|
|
132
|
-
* @deprecated: use {@link tuiToRadians} instead
|
|
133
103
|
* Converts angle in degrees to radians
|
|
134
104
|
*/
|
|
135
|
-
|
|
136
|
-
function toRadians(deg) {
|
|
105
|
+
function tuiToRadians(deg) {
|
|
137
106
|
return (deg * Math.PI) / 180;
|
|
138
107
|
}
|
|
139
|
-
const tuiToRadians = toRadians;
|
|
140
108
|
|
|
141
109
|
/**
|
|
142
110
|
* Generated bundle index. Do not edit.
|
|
143
111
|
*/
|
|
144
112
|
|
|
145
|
-
export {
|
|
113
|
+
export { tuiCeil, tuiClamp, tuiFloor, tuiInRange, tuiNormalizeToIntNumber, tuiQuantize, tuiRound, tuiSum, tuiToInt, tuiToRadians };
|
|
146
114
|
//# sourceMappingURL=taiga-ui-cdk-utils-math.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-cdk-utils-math.js","sources":["../../../projects/cdk/utils/math/clamp.ts","../../../projects/cdk/utils/math/in-range.ts","../../../projects/cdk/utils/math/normalize-to-int-number.ts","../../../projects/cdk/utils/math/quantize.ts","../../../projects/cdk/utils/math/round.ts","../../../projects/cdk/utils/math/sum.ts","../../../projects/cdk/utils/math/to-int.ts","../../../projects/cdk/utils/math/to-radians.ts","../../../projects/cdk/utils/math/taiga-ui-cdk-utils-math.ts"],"sourcesContent":["import {tuiAssert} from '@taiga-ui/cdk/classes';\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"taiga-ui-cdk-utils-math.js","sources":["../../../projects/cdk/utils/math/clamp.ts","../../../projects/cdk/utils/math/in-range.ts","../../../projects/cdk/utils/math/normalize-to-int-number.ts","../../../projects/cdk/utils/math/quantize.ts","../../../projects/cdk/utils/math/round.ts","../../../projects/cdk/utils/math/sum.ts","../../../projects/cdk/utils/math/to-int.ts","../../../projects/cdk/utils/math/to-radians.ts","../../../projects/cdk/utils/math/taiga-ui-cdk-utils-math.ts"],"sourcesContent":["import {tuiAssert} from '@taiga-ui/cdk/classes';\n\n/**\n * Clamps a value between two inclusive limits\n *\n * @param value\n * @param min lower limit\n * @param max upper limit\n */\nexport function tuiClamp(value: number, min: number, max: number): number {\n tuiAssert.assert(!isNaN(value));\n tuiAssert.assert(!isNaN(min));\n tuiAssert.assert(!isNaN(max));\n tuiAssert.assert(max >= min);\n\n return Math.min(max, Math.max(min, value));\n}\n","import {tuiAssert} from '@taiga-ui/cdk/classes';\n\nexport function tuiInRange(\n value: number,\n fromInclude: number,\n toExclude: number,\n): boolean {\n tuiAssert.assert(!isNaN(value));\n tuiAssert.assert(!isNaN(fromInclude));\n tuiAssert.assert(!isNaN(toExclude));\n tuiAssert.assert(fromInclude < toExclude);\n\n return value >= fromInclude && value < toExclude;\n}\n","import {tuiAssert} from '@taiga-ui/cdk/classes';\n\n/**\n * Normalizes any number to an integer within inclusive range\n *\n * @param value\n * @param min lower inclusive integer\n * @param max upper inclusive integer\n * @return an integer between min and max inclusive\n */\nexport function tuiNormalizeToIntNumber(value: number, min: number, max: number): number {\n tuiAssert.assert(Number.isInteger(min));\n tuiAssert.assert(Number.isInteger(max));\n tuiAssert.assert(min <= max);\n\n if (isNaN(value) || value <= min) {\n return min;\n }\n\n if (value >= max) {\n return max;\n }\n\n return Math.round(value);\n}\n","import {tuiAssert} from '@taiga-ui/cdk/classes';\n\n/**\n * Rounds a number to the closest value in a fixed discrete series\n *\n * @param value\n * @param quantum series step\n */\nexport function tuiQuantize(value: number, quantum: number): number {\n tuiAssert.assert(Number.isFinite(value));\n tuiAssert.assert(Number.isFinite(quantum));\n tuiAssert.assert(quantum > 0);\n\n const remainder = value % quantum;\n\n return remainder < quantum / 2 ? value - remainder : value + quantum - remainder;\n}\n","import {tuiAssert} from '@taiga-ui/cdk/classes';\n\nconst MAX_PRECISION = 292;\n\nexport function tuiRound(value: number, precision: number = 0): number {\n return calculate(value, precision, Math.round);\n}\n\nexport function tuiCeil(value: number, precision: number = 0): number {\n return calculate(value, precision, Math.ceil);\n}\n\nexport function tuiFloor(value: number, precision: number = 0): number {\n return calculate(value, precision, Math.floor);\n}\n\n/**\n * Rounding number to the set precision\n *\n * @param value\n * @param precision number of digits in a float part\n * @param func rounding function (round, floor, ceil)\n */\nfunction calculate(\n value: number,\n precision: number,\n func: (x: number) => number,\n): number {\n if (value === Infinity) {\n return value;\n }\n\n tuiAssert.assert(!isNaN(value), `Value must be number`);\n tuiAssert.assert(Number.isInteger(precision), `Precision must be integer`);\n\n precision = Math.min(precision, MAX_PRECISION);\n\n const pair = `${value}e`.split(`e`);\n const tempValue = func(Number(`${pair[0]}e${Number(pair[1]) + precision}`));\n const processedPair = `${tempValue}e`.split(`e`);\n\n return Number(`${processedPair[0]}e${Number(processedPair[1]) - precision}`);\n}\n","/**\n * Calculates sum of any number of passed arguments\n */\nexport function tuiSum(...args: number[]): number {\n return args.reduce((a, b) => a + b, 0);\n}\n","export function tuiToInt(bool: boolean): 1 | 0 {\n return bool ? 1 : 0;\n}\n","/**\n * Converts angle in degrees to radians\n */\nexport function tuiToRadians(deg: number): number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OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;AACxB;;ACFA;;AAEG;AACG,SAAU,YAAY,CAAC,GAAW,EAAA;IACpC,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,IAAI,GAAG,CAAC;AACjC;;ACLA;;AAEG;;;;"}
|
|
@@ -1,46 +1,40 @@
|
|
|
1
1
|
import { tuiAssert } from '@taiga-ui/cdk/classes';
|
|
2
2
|
import { FormArray, FormGroup } from '@angular/forms';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function
|
|
4
|
+
function tuiArrayRemove(array, index) {
|
|
5
|
+
return array.slice(0, Math.max(index, 0)).concat(array.slice(Math.max(index + 1, 0)));
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function tuiArrayToggle(array, item) {
|
|
9
|
+
const index = array.indexOf(item);
|
|
10
|
+
return index === -1 ? [...array, item] : tuiArrayRemove(array, index);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function tuiDistanceBetweenTouches({ touches }) {
|
|
9
14
|
return Math.hypot(touches[0].clientX - touches[1].clientX, touches[0].clientY - touches[1].clientY);
|
|
10
15
|
}
|
|
11
|
-
const tuiDistanceBetweenTouches = distanceBetweenTouches;
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
* @deprecated: use {@link tuiEaseInOutQuad} instead
|
|
15
|
-
*/
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
17
|
-
function easeInOutQuad(t) {
|
|
17
|
+
function tuiEaseInOutQuad(t) {
|
|
18
18
|
tuiAssert.assert(0 <= t && t <= 1, `Input must be between 0 and 1 inclusive but received `, t);
|
|
19
19
|
return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
|
|
20
20
|
}
|
|
21
|
-
const tuiEaseInOutQuad = easeInOutQuad;
|
|
22
21
|
|
|
23
22
|
/**
|
|
24
|
-
* @deprecated: use {@link tuiFlatLength} instead
|
|
25
23
|
* Flattens two-dimensional array and calculates resulting length
|
|
26
24
|
*
|
|
27
25
|
* @param array twi dimensional array
|
|
28
26
|
*/
|
|
29
|
-
|
|
30
|
-
function flatLength(array) {
|
|
27
|
+
function tuiFlatLength(array) {
|
|
31
28
|
return array.reduce((count, section) => count + section.length, 0);
|
|
32
29
|
}
|
|
33
|
-
const tuiFlatLength = flatLength;
|
|
34
30
|
|
|
35
31
|
/**
|
|
36
|
-
* @deprecated: use {@link tuiGetOriginalArrayFromQueryList} instead
|
|
37
32
|
* Extracts original array from {@link QueryList} rather than
|
|
38
33
|
* creating a copy like {@link QueryList.toArray} does.
|
|
39
34
|
* @param queryList
|
|
40
35
|
* @returns original array from {@link QueryList}.
|
|
41
36
|
*/
|
|
42
|
-
|
|
43
|
-
function getOriginalArrayFromQueryList(queryList) {
|
|
37
|
+
function tuiGetOriginalArrayFromQueryList(queryList) {
|
|
44
38
|
let array = [];
|
|
45
39
|
queryList.find((_item, _index, originalArray) => {
|
|
46
40
|
array = originalArray;
|
|
@@ -48,13 +42,8 @@ function getOriginalArrayFromQueryList(queryList) {
|
|
|
48
42
|
});
|
|
49
43
|
return array;
|
|
50
44
|
}
|
|
51
|
-
const tuiGetOriginalArrayFromQueryList = getOriginalArrayFromQueryList;
|
|
52
45
|
|
|
53
|
-
|
|
54
|
-
* @deprecated: use {@link tuiGetSwipeDirection} instead
|
|
55
|
-
*/
|
|
56
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
57
|
-
function getSwipeDirection(deltaX, deltaY) {
|
|
46
|
+
function tuiGetSwipeDirection(deltaX, deltaY) {
|
|
58
47
|
if (Math.abs(deltaY) > Math.abs(deltaX)) {
|
|
59
48
|
return deltaY > 0 ? `top` : `bottom`;
|
|
60
49
|
}
|
|
@@ -62,69 +51,33 @@ function getSwipeDirection(deltaX, deltaY) {
|
|
|
62
51
|
return deltaX > 0 ? `left` : `right`;
|
|
63
52
|
}
|
|
64
53
|
}
|
|
65
|
-
const tuiGetSwipeDirection = getSwipeDirection;
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* @deprecated: use identity from rxjs
|
|
69
|
-
*/
|
|
70
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
71
|
-
function identity(item) {
|
|
72
|
-
return item;
|
|
73
|
-
}
|
|
74
54
|
|
|
75
|
-
|
|
76
|
-
* @deprecated: use {@link tuiIsElementEditable} instead
|
|
77
|
-
*/
|
|
78
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
79
|
-
function isElementEditable(element) {
|
|
80
|
-
// TODO: iframe warning
|
|
81
|
-
return ((element instanceof HTMLInputElement && !element.readOnly) ||
|
|
82
|
-
(element instanceof HTMLTextAreaElement && !element.readOnly) ||
|
|
83
|
-
element.isContentEditable);
|
|
84
|
-
}
|
|
85
|
-
const tuiIsElementEditable = isElementEditable;
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* @deprecated: use {@link tuiIsNumber} instead
|
|
89
|
-
*/
|
|
90
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
91
|
-
function isNumber(value) {
|
|
55
|
+
function tuiIsNumber(value) {
|
|
92
56
|
return typeof value === `number`;
|
|
93
57
|
}
|
|
94
|
-
const tuiIsNumber = isNumber;
|
|
95
58
|
|
|
96
|
-
|
|
97
|
-
* @deprecated: use {@link tuiIsPresent} instead
|
|
98
|
-
*/
|
|
99
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
100
|
-
function isPresent(value) {
|
|
59
|
+
function tuiIsPresent(value) {
|
|
101
60
|
return value !== null && value !== undefined;
|
|
102
61
|
}
|
|
103
|
-
const tuiIsPresent = isPresent;
|
|
104
62
|
|
|
105
63
|
function tuiIsString(value) {
|
|
106
64
|
return typeof value === `string`;
|
|
107
65
|
}
|
|
108
66
|
|
|
109
|
-
|
|
110
|
-
* @deprecated: use {@link tuiMarkControlAsTouchedAndValidate} instead
|
|
111
|
-
*/
|
|
112
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
113
|
-
function markControlAsTouchedAndValidate(control) {
|
|
67
|
+
function tuiMarkControlAsTouchedAndValidate(control) {
|
|
114
68
|
if (control instanceof FormArray) {
|
|
115
69
|
control.controls.forEach(nestedControl => {
|
|
116
|
-
|
|
70
|
+
tuiMarkControlAsTouchedAndValidate(nestedControl);
|
|
117
71
|
});
|
|
118
72
|
}
|
|
119
73
|
if (control instanceof FormGroup) {
|
|
120
74
|
Object.values(control.controls).forEach(nestedControl => {
|
|
121
|
-
|
|
75
|
+
tuiMarkControlAsTouchedAndValidate(nestedControl);
|
|
122
76
|
});
|
|
123
77
|
}
|
|
124
78
|
control.markAsTouched();
|
|
125
79
|
control.updateValueAndValidity();
|
|
126
80
|
}
|
|
127
|
-
const tuiMarkControlAsTouchedAndValidate = markControlAsTouchedAndValidate;
|
|
128
81
|
|
|
129
82
|
/**
|
|
130
83
|
* Checks identity for nullable elements.
|
|
@@ -144,20 +97,15 @@ function tuiNullableSame(a, b, handler) {
|
|
|
144
97
|
return handler(a, b);
|
|
145
98
|
}
|
|
146
99
|
|
|
147
|
-
|
|
148
|
-
* @deprecated: use {@link tuiUniqBy} instead
|
|
149
|
-
*/
|
|
150
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
151
|
-
function uniqBy(array, key) {
|
|
100
|
+
function tuiUniqBy(array, key) {
|
|
152
101
|
return Array.from(array
|
|
153
102
|
.reduce((map, item) => (map.has(item[key]) ? map : map.set(item[key], item)), new Map())
|
|
154
103
|
.values());
|
|
155
104
|
}
|
|
156
|
-
const tuiUniqBy = uniqBy;
|
|
157
105
|
|
|
158
106
|
/**
|
|
159
107
|
* Generated bundle index. Do not edit.
|
|
160
108
|
*/
|
|
161
109
|
|
|
162
|
-
export {
|
|
110
|
+
export { tuiArrayRemove, tuiArrayToggle, tuiDistanceBetweenTouches, tuiEaseInOutQuad, tuiFlatLength, tuiGetOriginalArrayFromQueryList, tuiGetSwipeDirection, tuiIsNumber, tuiIsPresent, tuiIsString, tuiMarkControlAsTouchedAndValidate, tuiNullableSame, tuiUniqBy };
|
|
163
111
|
//# sourceMappingURL=taiga-ui-cdk-utils-miscellaneous.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-cdk-utils-miscellaneous.js","sources":["../../../projects/cdk/utils/miscellaneous/distance-between-touches.ts","../../../projects/cdk/utils/miscellaneous/ease-in-out-quad.ts","../../../projects/cdk/utils/miscellaneous/flat-length.ts","../../../projects/cdk/utils/miscellaneous/get-original-array-from-query-list.ts","../../../projects/cdk/utils/miscellaneous/get-swipe-direction.ts","../../../projects/cdk/utils/miscellaneous/identity.ts","../../../projects/cdk/utils/miscellaneous/is-element-editable.ts","../../../projects/cdk/utils/miscellaneous/is-number.ts","../../../projects/cdk/utils/miscellaneous/is-present.ts","../../../projects/cdk/utils/miscellaneous/is-string.ts","../../../projects/cdk/utils/miscellaneous/mark-control-as-touched-and-validate.ts","../../../projects/cdk/utils/miscellaneous/nullable-same.ts","../../../projects/cdk/utils/miscellaneous/uniq-by.ts","../../../projects/cdk/utils/miscellaneous/taiga-ui-cdk-utils-miscellaneous.ts"],"sourcesContent":["/**\n * @deprecated: use {@link tuiDistanceBetweenTouches} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function distanceBetweenTouches({touches}: TouchEvent): number {\n return Math.hypot(\n touches[0].clientX - touches[1].clientX,\n touches[0].clientY - touches[1].clientY,\n );\n}\n\nexport const tuiDistanceBetweenTouches = distanceBetweenTouches;\n","import {tuiAssert} from '@taiga-ui/cdk/classes';\n\n/**\n * @deprecated: use {@link tuiEaseInOutQuad} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function easeInOutQuad(t: number): number {\n tuiAssert.assert(\n 0 <= t && t <= 1,\n `Input must be between 0 and 1 inclusive but received `,\n t,\n );\n\n return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;\n}\n\nexport const tuiEaseInOutQuad = easeInOutQuad;\n","/**\n * @deprecated: use {@link tuiFlatLength} instead\n * Flattens two-dimensional array and calculates resulting length\n *\n * @param array twi dimensional array\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function flatLength(array: ReadonlyArray<readonly unknown[]>): number {\n return array.reduce((count, section) => count + section.length, 0);\n}\n\nexport const tuiFlatLength = flatLength;\n","import {QueryList} from '@angular/core';\n\n/**\n * @deprecated: use {@link tuiGetOriginalArrayFromQueryList} instead\n * Extracts original array from {@link QueryList} rather than\n * creating a copy like {@link QueryList.toArray} does.\n * @param queryList\n * @returns original array from {@link QueryList}.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function getOriginalArrayFromQueryList<T>(queryList: QueryList<T>): readonly T[] {\n let array: readonly T[] = [];\n\n queryList.find((_item, _index, originalArray) => {\n array = originalArray;\n\n return true;\n });\n\n return array;\n}\n\nexport const tuiGetOriginalArrayFromQueryList = getOriginalArrayFromQueryList;\n","import {TuiSwipeDirection} from '@taiga-ui/cdk/interfaces';\n\n/**\n * @deprecated: use {@link tuiGetSwipeDirection} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function getSwipeDirection(deltaX: number, deltaY: number): TuiSwipeDirection {\n if (Math.abs(deltaY) > Math.abs(deltaX)) {\n return deltaY > 0 ? `top` : `bottom`;\n } else {\n return deltaX > 0 ? `left` : `right`;\n }\n}\n\nexport const tuiGetSwipeDirection = getSwipeDirection;\n","/**\n * @deprecated: use identity from rxjs\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function identity<T>(item: T): T {\n return item;\n}\n","/**\n * @deprecated: use {@link tuiIsElementEditable} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function isElementEditable(element: HTMLElement): boolean {\n // TODO: iframe warning\n return (\n (element instanceof HTMLInputElement && !element.readOnly) ||\n (element instanceof HTMLTextAreaElement && !element.readOnly) ||\n element.isContentEditable\n );\n}\n\nexport const tuiIsElementEditable = isElementEditable;\n","/**\n * @deprecated: use {@link tuiIsNumber} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function isNumber(value: unknown): value is number {\n return typeof value === `number`;\n}\n\nexport const tuiIsNumber = isNumber;\n","/**\n * @deprecated: use {@link tuiIsPresent} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function isPresent<T>(value?: T | null): value is T {\n return value !== null && value !== undefined;\n}\n\nexport const tuiIsPresent = isPresent;\n","export function tuiIsString(value: unknown): value is string {\n return typeof value === `string`;\n}\n","import {AbstractControl, FormArray, FormGroup} from '@angular/forms';\n\n/**\n * @deprecated: use {@link tuiMarkControlAsTouchedAndValidate} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function markControlAsTouchedAndValidate(control: AbstractControl): void {\n if (control instanceof FormArray) {\n control.controls.forEach(nestedControl => {\n markControlAsTouchedAndValidate(nestedControl);\n });\n }\n\n if (control instanceof FormGroup) {\n Object.values(control.controls).forEach(nestedControl => {\n markControlAsTouchedAndValidate(nestedControl);\n });\n }\n\n control.markAsTouched();\n control.updateValueAndValidity();\n}\n\nexport const tuiMarkControlAsTouchedAndValidate = markControlAsTouchedAndValidate;\n","import {TuiIdentityMatcher} from '@taiga-ui/cdk/types';\n\n/**\n * Checks identity for nullable elements.\n *\n * @param a element a\n * @param b element b\n * @param handler called if both elements are not null\n * @return true if either both are null or they pass identity handler\n */\nexport function tuiNullableSame<T>(\n a: T | null,\n b: T | null,\n handler: TuiIdentityMatcher<T>,\n): boolean {\n if (a === null) {\n return b === null;\n }\n\n if (b === null) {\n return false;\n }\n\n return handler(a, b);\n}\n","/**\n * @deprecated: use {@link tuiUniqBy} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function uniqBy<T extends object>(\n array: readonly T[],\n key: keyof T,\n): readonly T[] {\n return Array.from(\n array\n .reduce(\n (map, item) => (map.has(item[key]) ? map : map.set(item[key], item)),\n new Map<T[keyof T], T>(),\n )\n .values(),\n );\n}\n\n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AG,EAAiB,CAC3B;SACA,MAAM,EAAE,CAChB,CAAC;AACN,CAAC;AAEM,MAAM,SAAS,GAAG;;AClBzB;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"taiga-ui-cdk-utils-miscellaneous.js","sources":["../../../projects/cdk/utils/miscellaneous/array-remove.ts","../../../projects/cdk/utils/miscellaneous/array-toggle.ts","../../../projects/cdk/utils/miscellaneous/distance-between-touches.ts","../../../projects/cdk/utils/miscellaneous/ease-in-out-quad.ts","../../../projects/cdk/utils/miscellaneous/flat-length.ts","../../../projects/cdk/utils/miscellaneous/get-original-array-from-query-list.ts","../../../projects/cdk/utils/miscellaneous/get-swipe-direction.ts","../../../projects/cdk/utils/miscellaneous/is-number.ts","../../../projects/cdk/utils/miscellaneous/is-present.ts","../../../projects/cdk/utils/miscellaneous/is-string.ts","../../../projects/cdk/utils/miscellaneous/mark-control-as-touched-and-validate.ts","../../../projects/cdk/utils/miscellaneous/nullable-same.ts","../../../projects/cdk/utils/miscellaneous/uniq-by.ts","../../../projects/cdk/utils/miscellaneous/taiga-ui-cdk-utils-miscellaneous.ts"],"sourcesContent":["export function tuiArrayRemove<T>(array: readonly T[], index: number): T[] {\n return array.slice(0, Math.max(index, 0)).concat(array.slice(Math.max(index + 1, 0)));\n}\n","import {tuiArrayRemove} from './array-remove';\n\nexport function tuiArrayToggle<T>(array: readonly T[], item: T): T[] {\n const index = array.indexOf(item);\n\n return index === -1 ? [...array, item] : tuiArrayRemove(array, index);\n}\n","export function tuiDistanceBetweenTouches({touches}: TouchEvent): number {\n return Math.hypot(\n touches[0].clientX - touches[1].clientX,\n touches[0].clientY - touches[1].clientY,\n );\n}\n","import {tuiAssert} from '@taiga-ui/cdk/classes';\n\nexport function tuiEaseInOutQuad(t: number): number {\n tuiAssert.assert(\n 0 <= t && t <= 1,\n `Input must be between 0 and 1 inclusive but received `,\n t,\n );\n\n return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;\n}\n","/**\n * Flattens two-dimensional array and calculates resulting length\n *\n * @param array twi dimensional array\n */\nexport function tuiFlatLength(array: ReadonlyArray<readonly unknown[]>): number {\n return array.reduce((count, section) => count + section.length, 0);\n}\n","import {QueryList} from '@angular/core';\n\n/**\n * Extracts original array from {@link QueryList} rather than\n * creating a copy like {@link QueryList.toArray} does.\n * @param queryList\n * @returns original array from {@link QueryList}.\n */\nexport function tuiGetOriginalArrayFromQueryList<T>(\n queryList: QueryList<T>,\n): readonly T[] {\n let array: readonly T[] = [];\n\n queryList.find((_item, _index, originalArray) => {\n array = originalArray;\n\n return true;\n });\n\n return array;\n}\n","import {TuiSwipeDirection} from '@taiga-ui/cdk/interfaces';\n\nexport function tuiGetSwipeDirection(deltaX: number, deltaY: number): TuiSwipeDirection {\n if (Math.abs(deltaY) > Math.abs(deltaX)) {\n return deltaY > 0 ? `top` : `bottom`;\n } else {\n return deltaX > 0 ? `left` : `right`;\n }\n}\n","export function tuiIsNumber(value: unknown): value is number {\n return typeof value === `number`;\n}\n","export function tuiIsPresent<T>(value?: T | null): value is T {\n return value !== null && value !== undefined;\n}\n","export function tuiIsString(value: unknown): value is string {\n return typeof value === `string`;\n}\n","import {AbstractControl, FormArray, FormGroup} from '@angular/forms';\n\nexport function tuiMarkControlAsTouchedAndValidate(control: AbstractControl): void {\n if (control instanceof FormArray) {\n control.controls.forEach(nestedControl => {\n tuiMarkControlAsTouchedAndValidate(nestedControl);\n });\n }\n\n if (control instanceof FormGroup) {\n Object.values(control.controls).forEach(nestedControl => {\n tuiMarkControlAsTouchedAndValidate(nestedControl);\n });\n }\n\n control.markAsTouched();\n control.updateValueAndValidity();\n}\n","import {TuiIdentityMatcher} from '@taiga-ui/cdk/types';\n\n/**\n * Checks identity for nullable elements.\n *\n * @param a element a\n * @param b element b\n * @param handler called if both elements are not null\n * @return true if either both are null or they pass identity handler\n */\nexport function tuiNullableSame<T>(\n a: T | null,\n b: T | null,\n handler: TuiIdentityMatcher<T>,\n): boolean {\n if (a === null) {\n return b === null;\n }\n\n if (b === null) {\n return false;\n }\n\n return handler(a, b);\n}\n","export function tuiUniqBy<T extends object>(\n array: readonly T[],\n key: keyof T,\n): readonly T[] {\n return Array.from(\n array\n .reduce(\n (map, item) => (map.has(item[key]) ? map : map.set(item[key], item)),\n new Map<T[keyof T], T>(),\n )\n .values(),\n );\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAAgB,SAAA,cAAc,CAAI,KAAmB,EAAE,KAAa,EAAA;AAChE,IAAA,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1F;;ACAgB,SAAA,cAAc,CAAI,KAAmB,EAAE,IAAO,EAAA;IAC1D,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAElC,OAAO,KAAK,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,EAAE,IAAI,CAAC,GAAG,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC1E;;ACNgB,SAAA,yBAAyB,CAAC,EAAC,OAAO,EAAa,EAAA;AAC3D,IAAA,OAAO,IAAI,CAAC,KAAK,CACb,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,EACvC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAC1C,CAAC;AACN;;ACHM,SAAU,gBAAgB,CAAC,CAAS,EAAA;AACtC,IAAA,SAAS,CAAC,MAAM,CACZ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAChB,CAAA,qDAAA,CAAuD,EACvD,CA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