@taiga-ui/cdk 4.65.0 → 5.0.0-canary.2e92594
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/README.md +1 -1
- package/classes/control.d.ts +3 -5
- package/classes/index.d.ts +0 -1
- package/constants/empty.d.ts +0 -9
- package/constants/handlers.d.ts +2 -0
- package/constants/index.d.ts +0 -1
- package/constants/used-icons.d.ts +2 -2
- package/constants/version.d.ts +1 -1
- package/constants/version.js +1 -1
- package/constants/version.js.map +1 -1
- package/date-time/date-fillers.d.ts +5 -5
- package/date-time/date-time.d.ts +1 -1
- package/date-time/day-range.d.ts +1 -1
- package/date-time/day.d.ts +4 -4
- package/date-time/time.d.ts +2 -2
- package/date-time/types.d.ts +1 -12
- package/directives/active-zone/active-zone.directive.d.ts +3 -5
- package/directives/animated/animated.directive.d.ts +1 -3
- package/directives/animated/index.d.ts +0 -1
- package/directives/auto-focus/autofocus.directive.d.ts +2 -3
- package/directives/auto-focus/autofocus.options.d.ts +2 -2
- package/directives/copy-processor/copy-processor.directive.d.ts +2 -2
- package/directives/hovered/hovered.directive.d.ts +1 -2
- package/directives/index.d.ts +1 -6
- package/directives/media/media.directive.d.ts +8 -12
- package/directives/native-validator/native-validator.directive.d.ts +2 -2
- package/directives/obscured/obscured.directive.d.ts +4 -4
- package/directives/pan/pan.directive.d.ts +1 -2
- package/directives/platform/platform.directive.d.ts +2 -2
- package/directives/resizer/resizer.directive.d.ts +3 -4
- package/directives/swipe/swipe.directive.d.ts +1 -2
- package/directives/transitioned/transitioned.directive.d.ts +1 -0
- package/directives/value-changes/value-changes.directive.d.ts +3 -3
- package/directives/with-styles/index.d.ts +1 -0
- package/directives/with-styles/with-styles.directive.d.ts +10 -0
- package/fesm2022/taiga-ui-cdk-classes.mjs +9 -93
- package/fesm2022/taiga-ui-cdk-classes.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-constants.mjs +16 -38
- package/fesm2022/taiga-ui-cdk-constants.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-date-time.mjs +22 -22
- package/fesm2022/taiga-ui-cdk-date-time.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-active-zone.mjs +27 -42
- package/fesm2022/taiga-ui-cdk-directives-active-zone.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-animated.mjs +24 -71
- package/fesm2022/taiga-ui-cdk-directives-animated.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-auto-focus.mjs +15 -17
- package/fesm2022/taiga-ui-cdk-directives-auto-focus.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-control.mjs +3 -4
- package/fesm2022/taiga-ui-cdk-directives-control.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-copy-processor.mjs +8 -11
- package/fesm2022/taiga-ui-cdk-directives-copy-processor.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-element.mjs +5 -6
- package/fesm2022/taiga-ui-cdk-directives-element.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-focus-trap.mjs +8 -13
- package/fesm2022/taiga-ui-cdk-directives-focus-trap.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-font-size.mjs +4 -7
- package/fesm2022/taiga-ui-cdk-directives-font-size.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-high-dpi.mjs +3 -4
- package/fesm2022/taiga-ui-cdk-directives-high-dpi.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-hovered.mjs +14 -17
- package/fesm2022/taiga-ui-cdk-directives-hovered.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-item.mjs +3 -4
- package/fesm2022/taiga-ui-cdk-directives-item.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-media.mjs +33 -58
- package/fesm2022/taiga-ui-cdk-directives-media.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-native-validator.mjs +9 -11
- package/fesm2022/taiga-ui-cdk-directives-native-validator.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-obscured.mjs +15 -23
- package/fesm2022/taiga-ui-cdk-directives-obscured.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-pan.mjs +11 -13
- package/fesm2022/taiga-ui-cdk-directives-pan.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-platform.mjs +9 -12
- package/fesm2022/taiga-ui-cdk-directives-platform.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-resizer.mjs +19 -23
- package/fesm2022/taiga-ui-cdk-directives-resizer.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-swipe.mjs +11 -13
- package/fesm2022/taiga-ui-cdk-directives-swipe.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-transitioned.mjs +9 -16
- package/fesm2022/taiga-ui-cdk-directives-transitioned.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-validator.mjs +4 -5
- package/fesm2022/taiga-ui-cdk-directives-validator.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-value-changes.mjs +12 -12
- package/fesm2022/taiga-ui-cdk-directives-value-changes.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-visual-viewport.mjs +7 -7
- package/fesm2022/taiga-ui-cdk-directives-visual-viewport.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-with-styles.mjs +29 -0
- package/fesm2022/taiga-ui-cdk-directives-with-styles.mjs.map +1 -0
- package/fesm2022/taiga-ui-cdk-directives-zoom.mjs +9 -9
- package/fesm2022/taiga-ui-cdk-directives-zoom.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives.mjs +1 -6
- package/fesm2022/taiga-ui-cdk-directives.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-observables.mjs +2 -24
- package/fesm2022/taiga-ui-cdk-observables.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-pipes-filter.mjs +3 -4
- package/fesm2022/taiga-ui-cdk-pipes-filter.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-pipes-mapper.mjs +3 -4
- package/fesm2022/taiga-ui-cdk-pipes-mapper.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-pipes-obfuscate.mjs +5 -5
- package/fesm2022/taiga-ui-cdk-pipes-obfuscate.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-pipes.mjs +0 -6
- package/fesm2022/taiga-ui-cdk-pipes.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-portals.mjs +126 -0
- package/fesm2022/taiga-ui-cdk-portals.mjs.map +1 -0
- package/fesm2022/taiga-ui-cdk-tokens.mjs +23 -88
- package/fesm2022/taiga-ui-cdk-tokens.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-utils-di.mjs +46 -6
- package/fesm2022/taiga-ui-cdk-utils-di.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-utils-dom.mjs +4 -82
- package/fesm2022/taiga-ui-cdk-utils-dom.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-utils-focus.mjs +22 -39
- package/fesm2022/taiga-ui-cdk-utils-focus.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-utils-math.mjs +13 -21
- package/fesm2022/taiga-ui-cdk-utils-math.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-utils-miscellaneous.mjs +18 -197
- package/fesm2022/taiga-ui-cdk-utils-miscellaneous.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-utils.mjs +0 -2
- package/fesm2022/taiga-ui-cdk-utils.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk.mjs +1 -1
- package/index.d.ts +1 -1
- package/observables/index.d.ts +0 -2
- package/package.json +43 -206
- package/pipes/index.d.ts +0 -6
- package/pipes/obfuscate/obfuscate.options.d.ts +2 -2
- package/portals/directive.d.ts +11 -0
- package/portals/index.d.ts +4 -0
- package/portals/portal.d.ts +24 -0
- package/portals/portals.d.ts +12 -0
- package/portals/service.d.ts +15 -0
- package/schematics/constants/file-globs.js +1 -1
- package/schematics/constants/file-globs.js.map +1 -1
- package/schematics/index.d.ts +5 -0
- package/schematics/index.js +4 -0
- package/schematics/index.js.map +1 -1
- package/schematics/ng-add/constants/versions.d.ts +1 -1
- package/schematics/ng-add/index.js +1 -2
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics/ng-add/setup-project.js +1 -1
- package/schematics/ng-add/setup-project.js.map +1 -1
- package/schematics/ng-add/steps/add-taiga-icons.js +2 -3
- package/schematics/ng-add/steps/add-taiga-icons.js.map +1 -1
- package/schematics/ng-add/steps/add-taiga-modules.js +1 -17
- package/schematics/ng-add/steps/add-taiga-modules.js.map +1 -1
- package/schematics/ng-add/steps/add-taiga-styles.js +1 -2
- package/schematics/ng-add/steps/add-taiga-styles.js.map +1 -1
- package/schematics/ng-add/steps/wrap-with-tui-root.js +1 -2
- package/schematics/ng-add/steps/wrap-with-tui-root.js.map +1 -1
- package/schematics/ng-update/interfaces/html-comment.d.ts +1 -1
- package/schematics/ng-update/interfaces/removable-input.d.ts +1 -1
- package/schematics/ng-update/interfaces/replacement-attribute-to-directive.d.ts +1 -1
- package/schematics/ng-update/interfaces/replacement-attribute-value.d.ts +1 -1
- package/schematics/ng-update/interfaces/replacement-attribute.d.ts +1 -1
- package/schematics/ng-update/interfaces/replacement-tag.d.ts +1 -1
- package/schematics/ng-update/steps/icons/replace-imports.js +1 -2
- package/schematics/ng-update/steps/icons/replace-imports.js.map +1 -1
- package/schematics/ng-update/steps/rename-types.js +1 -2
- package/schematics/ng-update/steps/rename-types.js.map +1 -1
- package/schematics/ng-update/steps/replace-deep-import.js +1 -2
- package/schematics/ng-update/steps/replace-deep-import.js.map +1 -1
- package/schematics/ng-update/steps/replace-enums.js +1 -2
- package/schematics/ng-update/steps/replace-enums.js.map +1 -1
- package/schematics/ng-update/steps/replace-identifier.js +2 -3
- package/schematics/ng-update/steps/replace-identifier.js.map +1 -1
- package/schematics/ng-update/steps/replace-package-name.js +1 -2
- package/schematics/ng-update/steps/replace-package-name.js.map +1 -1
- package/schematics/ng-update/steps/replace-services.js +1 -2
- package/schematics/ng-update/steps/replace-services.js.map +1 -1
- package/schematics/ng-update/steps/show-warnings.js +1 -2
- package/schematics/ng-update/steps/show-warnings.js.map +1 -1
- package/schematics/ng-update/utils/get-file-system.js +1 -2
- package/schematics/ng-update/utils/get-file-system.js.map +1 -1
- package/schematics/ng-update/{v4/steps → utils}/replace-functions.d.ts +1 -1
- package/schematics/ng-update/{v4/steps → utils}/replace-functions.js +2 -3
- package/schematics/ng-update/utils/replace-functions.js.map +1 -0
- package/schematics/ng-update/utils/replace-text.js +1 -2
- package/schematics/ng-update/utils/replace-text.js.map +1 -1
- package/schematics/ng-update/utils/templates/remove-inputs.js +1 -2
- package/schematics/ng-update/utils/templates/remove-inputs.js.map +1 -1
- package/schematics/ng-update/utils/templates/replace-attr-values.js +1 -2
- package/schematics/ng-update/utils/templates/replace-attr-values.js.map +1 -1
- package/schematics/ng-update/utils/templates/replace-attrs-by-directives.js +1 -2
- package/schematics/ng-update/utils/templates/replace-attrs-by-directives.js.map +1 -1
- package/schematics/ng-update/utils/templates/replace-attrs.js +1 -2
- package/schematics/ng-update/utils/templates/replace-attrs.js.map +1 -1
- package/schematics/ng-update/utils/templates/replace-tag.js +1 -2
- package/schematics/ng-update/utils/templates/replace-tag.js.map +1 -1
- package/schematics/ng-update/utils/templates/replace-tags.js +1 -2
- package/schematics/ng-update/utils/templates/replace-tags.js.map +1 -1
- package/schematics/ng-update/utils/templates/template-comments.js +1 -2
- package/schematics/ng-update/utils/templates/template-comments.js.map +1 -1
- package/schematics/ng-update/v4/index.js +2 -3
- package/schematics/ng-update/v4/index.js.map +1 -1
- package/schematics/ng-update/v4/migrate-addon-doc/index.js +1 -2
- package/schematics/ng-update/v4/migrate-addon-doc/index.js.map +1 -1
- package/schematics/ng-update/v4/migrate-css-vars/index.js +1 -2
- package/schematics/ng-update/v4/migrate-css-vars/index.js.map +1 -1
- package/schematics/ng-update/v4/migrate-css-vars/palette.d.ts +4 -4
- package/schematics/ng-update/v4/migrate-css-vars/palette.js +4 -4
- package/schematics/ng-update/v4/migrate-css-vars/palette.js.map +1 -1
- package/schematics/ng-update/v4/migrate-css-vars/rename-css-vars.d.ts +0 -1
- package/schematics/ng-update/v4/migrate-css-vars/rename-css-vars.js +2 -3
- package/schematics/ng-update/v4/migrate-css-vars/rename-css-vars.js.map +1 -1
- package/schematics/ng-update/v4/migrate-icons/index.js +1 -2
- package/schematics/ng-update/v4/migrate-icons/index.js.map +1 -1
- package/schematics/ng-update/v4/migrate-icons/rename-icons.d.ts +0 -1
- package/schematics/ng-update/v4/migrate-icons/rename-icons.js +1 -2
- package/schematics/ng-update/v4/migrate-icons/rename-icons.js.map +1 -1
- package/schematics/ng-update/v4/migrate-icons/rename-proprietary-icons.d.ts +0 -1
- package/schematics/ng-update/v4/migrate-icons/rename-proprietary-icons.js +1 -2
- package/schematics/ng-update/v4/migrate-icons/rename-proprietary-icons.js.map +1 -1
- package/schematics/ng-update/v4/steps/constants/identifiers-to-replace.js +37 -38
- package/schematics/ng-update/v4/steps/constants/identifiers-to-replace.js.map +1 -1
- package/schematics/ng-update/v4/steps/drop-universal-mock.js +1 -2
- package/schematics/ng-update/v4/steps/drop-universal-mock.js.map +1 -1
- package/schematics/ng-update/v4/steps/migrate-alert-service.js +1 -2
- package/schematics/ng-update/v4/steps/migrate-alert-service.js.map +1 -1
- package/schematics/ng-update/v4/steps/migrate-all-country-iso-codes.js +1 -2
- package/schematics/ng-update/v4/steps/migrate-all-country-iso-codes.js.map +1 -1
- package/schematics/ng-update/v4/steps/migrate-destroy-service.js +1 -2
- package/schematics/ng-update/v4/steps/migrate-destroy-service.js.map +1 -1
- package/schematics/ng-update/v4/steps/migrate-editor.d.ts +0 -1
- package/schematics/ng-update/v4/steps/migrate-editor.js +2 -2
- package/schematics/ng-update/v4/steps/migrate-editor.js.map +1 -1
- package/schematics/ng-update/v4/steps/migrate-legacy-mask.js +1 -2
- package/schematics/ng-update/v4/steps/migrate-legacy-mask.js.map +1 -1
- package/schematics/ng-update/v4/steps/migrate-month-context.js +1 -2
- package/schematics/ng-update/v4/steps/migrate-month-context.js.map +1 -1
- package/schematics/ng-update/v4/steps/migrate-number-format-settings.js +1 -2
- package/schematics/ng-update/v4/steps/migrate-number-format-settings.js.map +1 -1
- package/schematics/ng-update/v4/steps/migrate-option-providers.js +1 -2
- package/schematics/ng-update/v4/steps/migrate-option-providers.js.map +1 -1
- package/schematics/ng-update/v4/steps/migrate-proprietary.d.ts +0 -1
- package/schematics/ng-update/v4/steps/migrate-proprietary.js +2 -3
- package/schematics/ng-update/v4/steps/migrate-proprietary.js.map +1 -1
- package/schematics/ng-update/v4/steps/migrate-providers-from.js +1 -2
- package/schematics/ng-update/v4/steps/migrate-providers-from.js.map +1 -1
- package/schematics/ng-update/v4/steps/migrate-root.js +1 -2
- package/schematics/ng-update/v4/steps/migrate-root.js.map +1 -1
- package/schematics/ng-update/v4/steps/migrate-templates.d.ts +2 -2
- package/schematics/ng-update/v4/steps/migrate-templates.js +2 -3
- package/schematics/ng-update/v4/steps/migrate-templates.js.map +1 -1
- package/schematics/ng-update/v4/steps/remove-duplicates.js +1 -2
- package/schematics/ng-update/v4/steps/remove-duplicates.js.map +1 -1
- package/schematics/ng-update/v4/steps/restore-tui-mapper.js +2 -3
- package/schematics/ng-update/v4/steps/restore-tui-mapper.js.map +1 -1
- package/schematics/ng-update/v4/steps/restore-tui-matcher.js +2 -3
- package/schematics/ng-update/v4/steps/restore-tui-matcher.js.map +1 -1
- package/schematics/ng-update/v4/steps/styles/index.d.ts +0 -1
- package/schematics/ng-update/v4/steps/styles/index.js +2 -2
- package/schematics/ng-update/v4/steps/styles/index.js.map +1 -1
- package/schematics/ng-update/v4/steps/styles/migrate-legacy-mixins.js +1 -2
- package/schematics/ng-update/v4/steps/styles/migrate-legacy-mixins.js.map +1 -1
- package/schematics/ng-update/v4/steps/styles/migrate-less-scss-constants.js +1 -2
- package/schematics/ng-update/v4/steps/styles/migrate-less-scss-constants.js.map +1 -1
- package/schematics/ng-update/v4/steps/styles/migrate-mixins.js +1 -2
- package/schematics/ng-update/v4/steps/styles/migrate-mixins.js.map +1 -1
- package/schematics/ng-update/v4/steps/styles/migrate-shadow-mixins.js +1 -2
- package/schematics/ng-update/v4/steps/styles/migrate-shadow-mixins.js.map +1 -1
- package/schematics/ng-update/v4/steps/styles/migrate-space-mixins.js +2 -3
- package/schematics/ng-update/v4/steps/styles/migrate-space-mixins.js.map +1 -1
- package/schematics/ng-update/v4/steps/styles/migrate-text-mixins.js +14 -15
- package/schematics/ng-update/v4/steps/styles/migrate-text-mixins.js.map +1 -1
- package/schematics/ng-update/v4/steps/templates/dropdown-ref-comment.js +1 -2
- package/schematics/ng-update/v4/steps/templates/dropdown-ref-comment.js.map +1 -1
- package/schematics/ng-update/v4/steps/templates/migrate-active-zone.js +1 -2
- package/schematics/ng-update/v4/steps/templates/migrate-active-zone.js.map +1 -1
- package/schematics/ng-update/v4/steps/templates/migrate-avatar.js +1 -2
- package/schematics/ng-update/v4/steps/templates/migrate-avatar.js.map +1 -1
- package/schematics/ng-update/v4/steps/templates/migrate-axes.js +1 -2
- package/schematics/ng-update/v4/steps/templates/migrate-axes.js.map +1 -1
- package/schematics/ng-update/v4/steps/templates/migrate-badge.js +1 -2
- package/schematics/ng-update/v4/steps/templates/migrate-badge.js.map +1 -1
- package/schematics/ng-update/v4/steps/templates/migrate-badged-content.js +1 -2
- package/schematics/ng-update/v4/steps/templates/migrate-badged-content.js.map +1 -1
- package/schematics/ng-update/v4/steps/templates/migrate-blocked.js +1 -2
- package/schematics/ng-update/v4/steps/templates/migrate-blocked.js.map +1 -1
- package/schematics/ng-update/v4/steps/templates/migrate-button-appearance.js +1 -2
- package/schematics/ng-update/v4/steps/templates/migrate-button-appearance.js.map +1 -1
- package/schematics/ng-update/v4/steps/templates/migrate-expandable.js +1 -2
- package/schematics/ng-update/v4/steps/templates/migrate-expandable.js.map +1 -1
- package/schematics/ng-update/v4/steps/templates/migrate-filter-pipe.js +1 -2
- package/schematics/ng-update/v4/steps/templates/migrate-filter-pipe.js.map +1 -1
- package/schematics/ng-update/v4/steps/templates/migrate-focusable.js +1 -2
- package/schematics/ng-update/v4/steps/templates/migrate-focusable.js.map +1 -1
- package/schematics/ng-update/v4/steps/templates/migrate-label.js +1 -2
- package/schematics/ng-update/v4/steps/templates/migrate-label.js.map +1 -1
- package/schematics/ng-update/v4/steps/templates/migrate-labeled.js +1 -2
- package/schematics/ng-update/v4/steps/templates/migrate-labeled.js.map +1 -1
- package/schematics/ng-update/v4/steps/templates/migrate-mobile-tabs.js +1 -2
- package/schematics/ng-update/v4/steps/templates/migrate-mobile-tabs.js.map +1 -1
- package/schematics/ng-update/v4/steps/templates/migrate-money.js +1 -2
- package/schematics/ng-update/v4/steps/templates/migrate-money.js.map +1 -1
- package/schematics/ng-update/v4/steps/templates/migrate-notification.js +1 -2
- package/schematics/ng-update/v4/steps/templates/migrate-notification.js.map +1 -1
- package/schematics/ng-update/v4/steps/templates/migrate-number-precision.js +1 -2
- package/schematics/ng-update/v4/steps/templates/migrate-number-precision.js.map +1 -1
- package/schematics/ng-update/v4/steps/templates/migrate-overscroll.js +1 -2
- package/schematics/ng-update/v4/steps/templates/migrate-overscroll.js.map +1 -1
- package/schematics/ng-update/v4/steps/templates/migrate-prevent-default.js +1 -2
- package/schematics/ng-update/v4/steps/templates/migrate-prevent-default.js.map +1 -1
- package/schematics/ng-update/v4/steps/templates/migrate-progress-segmented.js +1 -2
- package/schematics/ng-update/v4/steps/templates/migrate-progress-segmented.js.map +1 -1
- package/schematics/ng-update/v4/steps/templates/migrate-thumbnail-card.js +1 -2
- package/schematics/ng-update/v4/steps/templates/migrate-thumbnail-card.js.map +1 -1
- package/schematics/ng-update/v4/steps/templates/toggles/common.js +4 -5
- package/schematics/ng-update/v4/steps/templates/toggles/common.js.map +1 -1
- package/schematics/ng-update/v4/steps/templates/toggles/migrate-checkbox.js +1 -2
- package/schematics/ng-update/v4/steps/templates/toggles/migrate-checkbox.js.map +1 -1
- package/schematics/ng-update/v4/steps/templates/toggles/migrate-radio.js +1 -2
- package/schematics/ng-update/v4/steps/templates/toggles/migrate-radio.js.map +1 -1
- package/schematics/ng-update/v4/steps/templates/toggles/migrate-toggle.js +1 -2
- package/schematics/ng-update/v4/steps/templates/toggles/migrate-toggle.js.map +1 -1
- package/schematics/ng-update/v4/steps/update-packages.d.ts +0 -1
- package/schematics/ng-update/v4/steps/update-packages.js +2 -2
- package/schematics/ng-update/v4/steps/update-packages.js.map +1 -1
- package/schematics/ng-update/v4/steps/utils/clean-object.js +1 -2
- package/schematics/ng-update/v4/steps/utils/clean-object.js.map +1 -1
- package/schematics/ng-update/v4/steps/utils/normalize-attr-value.js +1 -2
- package/schematics/ng-update/v4/steps/utils/normalize-attr-value.js.map +1 -1
- package/schematics/ng-update/v4/steps/utils/remove-attrs.js +1 -2
- package/schematics/ng-update/v4/steps/utils/remove-attrs.js.map +1 -1
- package/schematics/ng-update/v4/steps/utils/replace-modules-with-providers.js.map +1 -1
- package/schematics/ng-update/v4/steps/utils/replace-substrings.js +1 -2
- package/schematics/ng-update/v4/steps/utils/replace-substrings.js.map +1 -1
- package/schematics/ng-update/v4/tests/migrate-destroy-service/utils.js +1 -2
- package/schematics/ng-update/v4/tests/migrate-destroy-service/utils.js.map +1 -1
- package/schematics/ng-update/v5/index.js +17 -2
- package/schematics/ng-update/v5/index.js.map +1 -1
- package/schematics/ng-update/v5/steps/constants/attrs-to-replace.d.ts +2 -0
- package/schematics/ng-update/v5/steps/constants/attrs-to-replace.js +26 -0
- package/schematics/ng-update/v5/steps/constants/attrs-to-replace.js.map +1 -0
- package/schematics/ng-update/v5/steps/constants/functions.d.ts +2 -0
- package/schematics/ng-update/v5/steps/constants/functions.js +67 -0
- package/schematics/ng-update/v5/steps/constants/functions.js.map +1 -0
- package/schematics/ng-update/v5/steps/constants/html-comments.d.ts +2 -0
- package/schematics/ng-update/v5/steps/constants/html-comments.js +11 -0
- package/schematics/ng-update/v5/steps/constants/html-comments.js.map +1 -0
- package/schematics/ng-update/v5/steps/constants/identifiers-to-replace.d.ts +2 -0
- package/schematics/ng-update/v5/steps/constants/identifiers-to-replace.js +32 -0
- package/schematics/ng-update/v5/steps/constants/identifiers-to-replace.js.map +1 -0
- package/schematics/ng-update/v5/steps/migrate-css-variables.d.ts +3 -0
- package/schematics/ng-update/v5/steps/migrate-css-variables.js +30 -0
- package/schematics/ng-update/v5/steps/migrate-css-variables.js.map +1 -0
- package/schematics/ng-update/v5/steps/migrate-templates.d.ts +17 -0
- package/schematics/ng-update/v5/steps/migrate-templates.js +48 -0
- package/schematics/ng-update/v5/steps/migrate-templates.js.map +1 -0
- package/schematics/ng-update/v5/steps/migrate-tokens/migrate-tokens.js +1 -2
- package/schematics/ng-update/v5/steps/migrate-tokens/migrate-tokens.js.map +1 -1
- package/schematics/ng-update/v5/steps/migrate-tokens/update-tsconfig.js +1 -2
- package/schematics/ng-update/v5/steps/migrate-tokens/update-tsconfig.js.map +1 -1
- package/schematics/ng-update/v5/steps/migrate-tui-let.d.ts +3 -0
- package/schematics/ng-update/v5/steps/migrate-tui-let.js +95 -0
- package/schematics/ng-update/v5/steps/migrate-tui-let.js.map +1 -0
- package/schematics/ng-update/v5/steps/templates/migrate-avatar.d.ts +8 -0
- package/schematics/ng-update/v5/steps/templates/migrate-avatar.js +111 -0
- package/schematics/ng-update/v5/steps/templates/migrate-avatar.js.map +1 -0
- package/schematics/ng-update/v5/steps/templates/migrate-input-year.d.ts +8 -0
- package/schematics/ng-update/v5/steps/templates/migrate-input-year.js +52 -0
- package/schematics/ng-update/v5/steps/templates/migrate-input-year.js.map +1 -0
- package/schematics/ng-update/v5/steps/templates/migrate-notification.d.ts +8 -0
- package/schematics/ng-update/v5/steps/templates/migrate-notification.js +45 -0
- package/schematics/ng-update/v5/steps/templates/migrate-notification.js.map +1 -0
- package/schematics/ng-update/v5/tests/migrate-tokens/utils.js +1 -2
- package/schematics/ng-update/v5/tests/migrate-tokens/utils.js.map +1 -1
- package/schematics/utils/add-import-to-closest-module.js +2 -3
- package/schematics/utils/add-import-to-closest-module.js.map +1 -1
- package/schematics/utils/add-unique-import.js +1 -2
- package/schematics/utils/add-unique-import.js.map +1 -1
- package/schematics/utils/angular-json-manipulations.js +2 -5
- package/schematics/utils/angular-json-manipulations.js.map +1 -1
- package/schematics/utils/create-angular-json.js +1 -2
- package/schematics/utils/create-angular-json.js.map +1 -1
- package/schematics/utils/get-component-from-identifier.js +1 -2
- package/schematics/utils/get-component-from-identifier.js.map +1 -1
- package/schematics/utils/get-execution-time.js +1 -2
- package/schematics/utils/get-execution-time.js.map +1 -1
- package/schematics/utils/get-named-import-references.js +1 -2
- package/schematics/utils/get-named-import-references.js.map +1 -1
- package/schematics/utils/get-project-target-options.js +1 -2
- package/schematics/utils/get-project-target-options.js.map +1 -1
- package/schematics/utils/get-projects.js +1 -2
- package/schematics/utils/get-projects.js.map +1 -1
- package/schematics/utils/get-standalone-bootstrap-function.d.ts +1 -1
- package/schematics/utils/get-standalone-bootstrap-function.js +2 -5
- package/schematics/utils/get-standalone-bootstrap-function.js.map +1 -1
- package/schematics/utils/import-manipulations.js +2 -3
- package/schematics/utils/import-manipulations.js.map +1 -1
- package/schematics/utils/insert-todo.js +2 -2
- package/schematics/utils/insert-todo.js.map +1 -1
- package/schematics/utils/is-ci.js +1 -2
- package/schematics/utils/is-ci.js.map +1 -1
- package/schematics/utils/make-angular-json-with-assets.js +1 -2
- package/schematics/utils/make-angular-json-with-assets.js.map +1 -1
- package/schematics/utils/progress.js +1 -2
- package/schematics/utils/progress.js.map +1 -1
- package/schematics/utils/push-to-array-property.js +1 -2
- package/schematics/utils/push-to-array-property.js.map +1 -1
- package/schematics/utils/remove-module.js +2 -3
- package/schematics/utils/remove-module.js.map +1 -1
- package/schematics/utils/run-migration.d.ts +14 -0
- package/schematics/utils/run-migration.js +27 -0
- package/schematics/utils/run-migration.js.map +1 -0
- package/schematics/utils/templates/elements.d.ts +4 -1
- package/schematics/utils/templates/elements.js +15 -24
- package/schematics/utils/templates/elements.js.map +1 -1
- package/schematics/utils/templates/get-component-templates.js +1 -2
- package/schematics/utils/templates/get-component-templates.js.map +1 -1
- package/schematics/utils/templates/inputs.js +2 -3
- package/schematics/utils/templates/inputs.js.map +1 -1
- package/schematics/utils/templates/ng-component-input-manipulations.d.ts +3 -3
- package/schematics/utils/templates/ng-component-input-manipulations.js +6 -9
- package/schematics/utils/templates/ng-component-input-manipulations.js.map +1 -1
- package/schematics/utils/templates/template-resource.js +3 -4
- package/schematics/utils/templates/template-resource.js.map +1 -1
- package/tokens/index.d.ts +1 -3
- package/tokens/platform.d.ts +2 -0
- package/tokens/removed-element.d.ts +0 -3
- package/types/index.d.ts +0 -3
- package/utils/di/create-options.d.ts +2 -2
- package/utils/di/index.d.ts +3 -0
- package/utils/di/provide-options.d.ts +2 -0
- package/utils/dom/index.d.ts +0 -6
- package/utils/focus/get-closest-focusable.d.ts +1 -6
- package/utils/focus/{get-native-focused.d.ts → get-focused.d.ts} +0 -5
- package/utils/focus/index.d.ts +4 -6
- package/utils/focus/{is-native-keyboard-focusable.d.ts → is-focusable.d.ts} +1 -6
- package/utils/focus/{is-native-focused-in.d.ts → is-focused-in.d.ts} +0 -5
- package/utils/focus/{is-native-focused.d.ts → is-focused.d.ts} +0 -5
- package/utils/index.d.ts +0 -2
- package/utils/math/clamp.d.ts +1 -5
- package/utils/math/index.d.ts +0 -2
- package/utils/miscellaneous/generate-id.d.ts +1 -0
- package/utils/miscellaneous/index.d.ts +2 -12
- package/utils/miscellaneous/is-string.js +1 -2
- package/utils/miscellaneous/is-string.js.map +1 -1
- package/utils/miscellaneous/set-signal.d.ts +2 -0
- package/classes/portals.d.ts +0 -33
- package/constants/allow-signal-writes.d.ts +0 -2
- package/directives/animated/animated-parent.directive.d.ts +0 -10
- package/directives/click-outside/click-outside.directive.d.ts +0 -14
- package/directives/click-outside/index.d.ts +0 -1
- package/directives/droppable/droppable.directive.d.ts +0 -8
- package/directives/droppable/index.d.ts +0 -1
- package/directives/for/for.directive.d.ts +0 -15
- package/directives/for/index.d.ts +0 -1
- package/directives/let/index.d.ts +0 -2
- package/directives/let/let-context.d.ts +0 -11
- package/directives/let/let.directive.d.ts +0 -18
- package/directives/popover/index.d.ts +0 -1
- package/directives/popover/popover.directive.d.ts +0 -14
- package/directives/repeat-times/index.d.ts +0 -1
- package/directives/repeat-times/repeat-times.directive.d.ts +0 -22
- package/esm2022/classes/control.mjs +0 -96
- package/esm2022/classes/index.mjs +0 -5
- package/esm2022/classes/portals.mjs +0 -77
- package/esm2022/classes/taiga-ui-cdk-classes.mjs +0 -5
- package/esm2022/classes/validation-error.mjs +0 -7
- package/esm2022/classes/value-transformer.mjs +0 -25
- package/esm2022/constants/allow-signal-writes.mjs +0 -3
- package/esm2022/constants/empty.mjs +0 -25
- package/esm2022/constants/handlers.mjs +0 -11
- package/esm2022/constants/index.mjs +0 -10
- package/esm2022/constants/matchers.mjs +0 -26
- package/esm2022/constants/regexp.mjs +0 -4
- package/esm2022/constants/svg-node-filter.mjs +0 -8
- package/esm2022/constants/taiga-ui-cdk-constants.mjs +0 -5
- package/esm2022/constants/unicode-chars.mjs +0 -64
- package/esm2022/constants/used-icons.mjs +0 -76
- package/esm2022/constants/version.mjs +0 -2
- package/esm2022/date-time/date-clamp.mjs +0 -10
- package/esm2022/date-time/date-fillers.mjs +0 -15
- package/esm2022/date-time/date-time.mjs +0 -20
- package/esm2022/date-time/day-of-week.mjs +0 -10
- package/esm2022/date-time/day-range.mjs +0 -84
- package/esm2022/date-time/day.mjs +0 -306
- package/esm2022/date-time/days.const.mjs +0 -6
- package/esm2022/date-time/index.mjs +0 -13
- package/esm2022/date-time/month-number.mjs +0 -15
- package/esm2022/date-time/month-range.mjs +0 -27
- package/esm2022/date-time/month.mjs +0 -152
- package/esm2022/date-time/taiga-ui-cdk-date-time.mjs +0 -5
- package/esm2022/date-time/time.mjs +0 -160
- package/esm2022/date-time/types.mjs +0 -2
- package/esm2022/date-time/year.mjs +0 -111
- package/esm2022/directives/active-zone/active-zone.directive.mjs +0 -73
- package/esm2022/directives/active-zone/index.mjs +0 -2
- package/esm2022/directives/active-zone/taiga-ui-cdk-directives-active-zone.mjs +0 -5
- package/esm2022/directives/animated/animated-parent.directive.mjs +0 -39
- package/esm2022/directives/animated/animated.directive.mjs +0 -82
- package/esm2022/directives/animated/index.mjs +0 -3
- package/esm2022/directives/animated/taiga-ui-cdk-directives-animated.mjs +0 -5
- package/esm2022/directives/auto-focus/autofocus.directive.mjs +0 -46
- package/esm2022/directives/auto-focus/autofocus.options.mjs +0 -31
- package/esm2022/directives/auto-focus/handlers/abstract.handler.mjs +0 -17
- package/esm2022/directives/auto-focus/handlers/default.handler.mjs +0 -21
- package/esm2022/directives/auto-focus/handlers/ios.handler.mjs +0 -125
- package/esm2022/directives/auto-focus/handlers/sync.handler.mjs +0 -7
- package/esm2022/directives/auto-focus/index.mjs +0 -7
- package/esm2022/directives/auto-focus/taiga-ui-cdk-directives-auto-focus.mjs +0 -5
- package/esm2022/directives/click-outside/click-outside.directive.mjs +0 -33
- package/esm2022/directives/click-outside/index.mjs +0 -2
- package/esm2022/directives/click-outside/taiga-ui-cdk-directives-click-outside.mjs +0 -5
- package/esm2022/directives/control/control.directive.mjs +0 -23
- package/esm2022/directives/control/index.mjs +0 -2
- package/esm2022/directives/control/taiga-ui-cdk-directives-control.mjs +0 -5
- package/esm2022/directives/copy-processor/copy-processor.directive.mjs +0 -33
- package/esm2022/directives/copy-processor/index.mjs +0 -2
- package/esm2022/directives/copy-processor/taiga-ui-cdk-directives-copy-processor.mjs +0 -5
- package/esm2022/directives/droppable/droppable.directive.mjs +0 -31
- package/esm2022/directives/droppable/index.mjs +0 -2
- package/esm2022/directives/droppable/taiga-ui-cdk-directives-droppable.mjs +0 -5
- package/esm2022/directives/element/element.directive.mjs +0 -35
- package/esm2022/directives/element/index.mjs +0 -2
- package/esm2022/directives/element/taiga-ui-cdk-directives-element.mjs +0 -5
- package/esm2022/directives/focus-trap/focus-trap.directive.mjs +0 -61
- package/esm2022/directives/focus-trap/index.mjs +0 -2
- package/esm2022/directives/focus-trap/taiga-ui-cdk-directives-focus-trap.mjs +0 -5
- package/esm2022/directives/font-size/font-size.directive.mjs +0 -27
- package/esm2022/directives/font-size/index.mjs +0 -2
- package/esm2022/directives/font-size/taiga-ui-cdk-directives-font-size.mjs +0 -5
- package/esm2022/directives/for/for.directive.mjs +0 -37
- package/esm2022/directives/for/index.mjs +0 -2
- package/esm2022/directives/for/taiga-ui-cdk-directives-for.mjs +0 -5
- package/esm2022/directives/high-dpi/high-dpi.directive.mjs +0 -23
- package/esm2022/directives/high-dpi/index.mjs +0 -2
- package/esm2022/directives/high-dpi/taiga-ui-cdk-directives-high-dpi.mjs +0 -5
- package/esm2022/directives/hovered/hovered.directive.mjs +0 -22
- package/esm2022/directives/hovered/hovered.service.mjs +0 -35
- package/esm2022/directives/hovered/index.mjs +0 -3
- package/esm2022/directives/hovered/taiga-ui-cdk-directives-hovered.mjs +0 -5
- package/esm2022/directives/index.mjs +0 -30
- package/esm2022/directives/item/index.mjs +0 -2
- package/esm2022/directives/item/item.directive.mjs +0 -18
- package/esm2022/directives/item/taiga-ui-cdk-directives-item.mjs +0 -5
- package/esm2022/directives/let/index.mjs +0 -3
- package/esm2022/directives/let/let-context.mjs +0 -15
- package/esm2022/directives/let/let.directive.mjs +0 -33
- package/esm2022/directives/let/taiga-ui-cdk-directives-let.mjs +0 -5
- package/esm2022/directives/media/index.mjs +0 -2
- package/esm2022/directives/media/media.directive.mjs +0 -89
- package/esm2022/directives/media/taiga-ui-cdk-directives-media.mjs +0 -5
- package/esm2022/directives/native-validator/index.mjs +0 -2
- package/esm2022/directives/native-validator/native-validator.directive.mjs +0 -43
- package/esm2022/directives/native-validator/taiga-ui-cdk-directives-native-validator.mjs +0 -5
- package/esm2022/directives/obscured/index.mjs +0 -3
- package/esm2022/directives/obscured/obscured.directive.mjs +0 -38
- package/esm2022/directives/obscured/obscured.service.mjs +0 -24
- package/esm2022/directives/obscured/taiga-ui-cdk-directives-obscured.mjs +0 -5
- package/esm2022/directives/pan/index.mjs +0 -3
- package/esm2022/directives/pan/pan.directive.mjs +0 -22
- package/esm2022/directives/pan/pan.service.mjs +0 -28
- package/esm2022/directives/pan/taiga-ui-cdk-directives-pan.mjs +0 -5
- package/esm2022/directives/platform/index.mjs +0 -2
- package/esm2022/directives/platform/platform.directive.mjs +0 -35
- package/esm2022/directives/platform/taiga-ui-cdk-directives-platform.mjs +0 -5
- package/esm2022/directives/popover/index.mjs +0 -2
- package/esm2022/directives/popover/popover.directive.mjs +0 -26
- package/esm2022/directives/popover/taiga-ui-cdk-directives-popover.mjs +0 -5
- package/esm2022/directives/repeat-times/index.mjs +0 -2
- package/esm2022/directives/repeat-times/repeat-times.directive.mjs +0 -55
- package/esm2022/directives/repeat-times/taiga-ui-cdk-directives-repeat-times.mjs +0 -5
- package/esm2022/directives/resizer/index.mjs +0 -3
- package/esm2022/directives/resizer/resizable.directive.mjs +0 -16
- package/esm2022/directives/resizer/resizer.directive.mjs +0 -83
- package/esm2022/directives/resizer/taiga-ui-cdk-directives-resizer.mjs +0 -5
- package/esm2022/directives/swipe/index.mjs +0 -4
- package/esm2022/directives/swipe/swipe.directive.mjs +0 -22
- package/esm2022/directives/swipe/swipe.options.mjs +0 -8
- package/esm2022/directives/swipe/swipe.service.mjs +0 -50
- package/esm2022/directives/swipe/swipe.types.mjs +0 -2
- package/esm2022/directives/swipe/taiga-ui-cdk-directives-swipe.mjs +0 -5
- package/esm2022/directives/taiga-ui-cdk-directives.mjs +0 -5
- package/esm2022/directives/transitioned/index.mjs +0 -2
- package/esm2022/directives/transitioned/taiga-ui-cdk-directives-transitioned.mjs +0 -5
- package/esm2022/directives/transitioned/transitioned.directive.mjs +0 -27
- package/esm2022/directives/validator/index.mjs +0 -2
- package/esm2022/directives/validator/taiga-ui-cdk-directives-validator.mjs +0 -5
- package/esm2022/directives/validator/validator.directive.mjs +0 -30
- package/esm2022/directives/value-changes/index.mjs +0 -2
- package/esm2022/directives/value-changes/taiga-ui-cdk-directives-value-changes.mjs +0 -5
- package/esm2022/directives/value-changes/value-changes.directive.mjs +0 -28
- package/esm2022/directives/visual-viewport/index.mjs +0 -2
- package/esm2022/directives/visual-viewport/taiga-ui-cdk-directives-visual-viewport.mjs +0 -5
- package/esm2022/directives/visual-viewport/visual-viewport.directive.mjs +0 -34
- package/esm2022/directives/zoom/index.mjs +0 -4
- package/esm2022/directives/zoom/taiga-ui-cdk-directives-zoom.mjs +0 -5
- package/esm2022/directives/zoom/zoom.directive.mjs +0 -24
- package/esm2022/directives/zoom/zoom.options.mjs +0 -10
- package/esm2022/directives/zoom/zoom.service.mjs +0 -46
- package/esm2022/directives/zoom/zoom.types.mjs +0 -2
- package/esm2022/index.mjs +0 -10
- package/esm2022/observables/close-watcher.mjs +0 -26
- package/esm2022/observables/control-value.mjs +0 -8
- package/esm2022/observables/drag-and-drop-from.mjs +0 -14
- package/esm2022/observables/events.mjs +0 -8
- package/esm2022/observables/if-map.mjs +0 -5
- package/esm2022/observables/index.mjs +0 -14
- package/esm2022/observables/must-be-present.mjs +0 -17
- package/esm2022/observables/query-list-observable.mjs +0 -9
- package/esm2022/observables/scroll-from.mjs +0 -10
- package/esm2022/observables/taiga-ui-cdk-observables.mjs +0 -5
- package/esm2022/observables/take-until-destroyed.mjs +0 -9
- package/esm2022/observables/typed-from-event.mjs +0 -9
- package/esm2022/observables/untracked-scheduler.mjs +0 -11
- package/esm2022/observables/watch.mjs +0 -6
- package/esm2022/observables/zone.mjs +0 -34
- package/esm2022/pipes/animation/animation.pipe.mjs +0 -27
- package/esm2022/pipes/animation/index.mjs +0 -2
- package/esm2022/pipes/animation/taiga-ui-cdk-pipes-animation.mjs +0 -5
- package/esm2022/pipes/filter/filter.pipe.mjs +0 -25
- package/esm2022/pipes/filter/index.mjs +0 -2
- package/esm2022/pipes/filter/taiga-ui-cdk-pipes-filter.mjs +0 -5
- package/esm2022/pipes/index.mjs +0 -10
- package/esm2022/pipes/is-present/index.mjs +0 -2
- package/esm2022/pipes/is-present/is-present.pipe.mjs +0 -19
- package/esm2022/pipes/is-present/taiga-ui-cdk-pipes-is-present.mjs +0 -5
- package/esm2022/pipes/keys/index.mjs +0 -2
- package/esm2022/pipes/keys/keys.pipe.mjs +0 -18
- package/esm2022/pipes/keys/taiga-ui-cdk-pipes-keys.mjs +0 -5
- package/esm2022/pipes/mapper/index.mjs +0 -2
- package/esm2022/pipes/mapper/mapper.pipe.mjs +0 -25
- package/esm2022/pipes/mapper/taiga-ui-cdk-pipes-mapper.mjs +0 -5
- package/esm2022/pipes/obfuscate/index.mjs +0 -3
- package/esm2022/pipes/obfuscate/obfuscate.options.mjs +0 -10
- package/esm2022/pipes/obfuscate/obfuscate.pipe.mjs +0 -44
- package/esm2022/pipes/obfuscate/taiga-ui-cdk-pipes-obfuscate.mjs +0 -5
- package/esm2022/pipes/repeat-times/index.mjs +0 -19
- package/esm2022/pipes/repeat-times/taiga-ui-cdk-pipes-repeat-times.mjs +0 -5
- package/esm2022/pipes/replace/index.mjs +0 -2
- package/esm2022/pipes/replace/replace.pipe.mjs +0 -20
- package/esm2022/pipes/replace/taiga-ui-cdk-pipes-replace.mjs +0 -5
- package/esm2022/pipes/taiga-ui-cdk-pipes.mjs +0 -5
- package/esm2022/pipes/to-array/index.mjs +0 -2
- package/esm2022/pipes/to-array/taiga-ui-cdk-pipes-to-array.mjs +0 -5
- package/esm2022/pipes/to-array/to-array.pipe.mjs +0 -18
- package/esm2022/services/id.service.mjs +0 -21
- package/esm2022/services/index.mjs +0 -5
- package/esm2022/services/popover.service.mjs +0 -45
- package/esm2022/services/scroll.service.mjs +0 -58
- package/esm2022/services/taiga-ui-cdk-services.mjs +0 -5
- package/esm2022/services/theme-color.service.mjs +0 -33
- package/esm2022/taiga-ui-cdk.mjs +0 -5
- package/esm2022/tokens/active-element.mjs +0 -56
- package/esm2022/tokens/base-href.mjs +0 -6
- package/esm2022/tokens/environment.mjs +0 -65
- package/esm2022/tokens/fallback-value.mjs +0 -11
- package/esm2022/tokens/index.mjs +0 -8
- package/esm2022/tokens/range.mjs +0 -9
- package/esm2022/tokens/removed-element.mjs +0 -20
- package/esm2022/tokens/taiga-ui-cdk-tokens.mjs +0 -5
- package/esm2022/tokens/window-size.mjs +0 -28
- package/esm2022/types/context.mjs +0 -2
- package/esm2022/types/handler.mjs +0 -2
- package/esm2022/types/index.mjs +0 -2
- package/esm2022/types/loose-union.mjs +0 -2
- package/esm2022/types/mapper.mjs +0 -2
- package/esm2022/types/matcher.mjs +0 -2
- package/esm2022/types/rounding.mjs +0 -2
- package/esm2022/types/safe-html.mjs +0 -2
- package/esm2022/types/taiga-ui-cdk-types.mjs +0 -5
- package/esm2022/types/values-of.mjs +0 -2
- package/esm2022/utils/browser/index.mjs +0 -6
- package/esm2022/utils/browser/is-apple.mjs +0 -14
- package/esm2022/utils/browser/is-edge.mjs +0 -4
- package/esm2022/utils/browser/is-firefox.mjs +0 -4
- package/esm2022/utils/browser/is-ios.mjs +0 -7
- package/esm2022/utils/browser/is-safari.mjs +0 -12
- package/esm2022/utils/browser/taiga-ui-cdk-utils-browser.mjs +0 -5
- package/esm2022/utils/color/get-gradient-data.mjs +0 -6
- package/esm2022/utils/color/hex-to-rgb.mjs +0 -12
- package/esm2022/utils/color/hex-to-rgba.mjs +0 -29
- package/esm2022/utils/color/hsv-to-rgb.mjs +0 -11
- package/esm2022/utils/color/index.mjs +0 -10
- package/esm2022/utils/color/parse-color.mjs +0 -27
- package/esm2022/utils/color/parse-gradient.mjs +0 -70
- package/esm2022/utils/color/rgb-to-hex.mjs +0 -4
- package/esm2022/utils/color/rgb-to-hsv.mjs +0 -8
- package/esm2022/utils/color/rgba-to-hex.mjs +0 -23
- package/esm2022/utils/color/taiga-ui-cdk-utils-color.mjs +0 -5
- package/esm2022/utils/di/create-options.mjs +0 -10
- package/esm2022/utils/di/index.mjs +0 -3
- package/esm2022/utils/di/taiga-ui-cdk-utils-di.mjs +0 -5
- package/esm2022/utils/dom/contains-or-after.mjs +0 -10
- package/esm2022/utils/dom/element-checks.mjs +0 -20
- package/esm2022/utils/dom/event-checks.mjs +0 -4
- package/esm2022/utils/dom/get-actual-target.mjs +0 -7
- package/esm2022/utils/dom/get-clipboard-data-text.mjs +0 -11
- package/esm2022/utils/dom/get-document-or-shadow-root.mjs +0 -6
- package/esm2022/utils/dom/get-element-obscurers.mjs +0 -36
- package/esm2022/utils/dom/get-element-offset.mjs +0 -20
- package/esm2022/utils/dom/get-element-point.mjs +0 -6
- package/esm2022/utils/dom/get-selected-text.mjs +0 -15
- package/esm2022/utils/dom/index.mjs +0 -20
- package/esm2022/utils/dom/inject-element.mjs +0 -5
- package/esm2022/utils/dom/is-current-target.mjs +0 -4
- package/esm2022/utils/dom/is-element-editable.mjs +0 -6
- package/esm2022/utils/dom/is-inside-iframe.mjs +0 -7
- package/esm2022/utils/dom/is-node-in.mjs +0 -14
- package/esm2022/utils/dom/point-to-client-rect.mjs +0 -17
- package/esm2022/utils/dom/retarget-boundary-crossing.mjs +0 -16
- package/esm2022/utils/dom/taiga-ui-cdk-utils-dom.mjs +0 -5
- package/esm2022/utils/dom/value-binding.mjs +0 -29
- package/esm2022/utils/dom/value.mjs +0 -83
- package/esm2022/utils/focus/blur-native-focused.mjs +0 -17
- package/esm2022/utils/focus/focused-in.mjs +0 -8
- package/esm2022/utils/focus/get-closest-focusable.mjs +0 -26
- package/esm2022/utils/focus/get-native-focused.mjs +0 -21
- package/esm2022/utils/focus/index.mjs +0 -10
- package/esm2022/utils/focus/is-native-focused-in.mjs +0 -17
- package/esm2022/utils/focus/is-native-focused.mjs +0 -20
- package/esm2022/utils/focus/is-native-keyboard-focusable.mjs +0 -38
- package/esm2022/utils/focus/is-native-mouse-focusable.mjs +0 -12
- package/esm2022/utils/focus/move-focus.mjs +0 -19
- package/esm2022/utils/focus/taiga-ui-cdk-utils-focus.mjs +0 -5
- package/esm2022/utils/index.mjs +0 -8
- package/esm2022/utils/math/clamp.mjs +0 -16
- package/esm2022/utils/math/in-range.mjs +0 -9
- package/esm2022/utils/math/index.mjs +0 -11
- package/esm2022/utils/math/normalize-to-int-number.mjs +0 -22
- package/esm2022/utils/math/quantize.mjs +0 -15
- package/esm2022/utils/math/round-with.mjs +0 -14
- package/esm2022/utils/math/round.mjs +0 -42
- package/esm2022/utils/math/sum.mjs +0 -7
- package/esm2022/utils/math/taiga-ui-cdk-utils-math.mjs +0 -5
- package/esm2022/utils/math/to-int.mjs +0 -4
- package/esm2022/utils/math/to-integer.mjs +0 -4
- package/esm2022/utils/math/to-radians.mjs +0 -7
- package/esm2022/utils/miscellaneous/array-remove.mjs +0 -4
- package/esm2022/utils/miscellaneous/array-shallow-equals.mjs +0 -4
- package/esm2022/utils/miscellaneous/array-toggle.mjs +0 -8
- package/esm2022/utils/miscellaneous/change-date-separator.mjs +0 -3
- package/esm2022/utils/miscellaneous/count-filled-controls.mjs +0 -13
- package/esm2022/utils/miscellaneous/create-token.mjs +0 -16
- package/esm2022/utils/miscellaneous/default-sort.mjs +0 -11
- package/esm2022/utils/miscellaneous/directive-binding.mjs +0 -26
- package/esm2022/utils/miscellaneous/directive-listener.mjs +0 -8
- package/esm2022/utils/miscellaneous/distance-between-touches.mjs +0 -4
- package/esm2022/utils/miscellaneous/ease-in-out-quad.mjs +0 -7
- package/esm2022/utils/miscellaneous/flat-length.mjs +0 -9
- package/esm2022/utils/miscellaneous/font-size-watcher.mjs +0 -30
- package/esm2022/utils/miscellaneous/get-original-array-from-query-list.mjs +0 -15
- package/esm2022/utils/miscellaneous/index.mjs +0 -32
- package/esm2022/utils/miscellaneous/is-control-empty.mjs +0 -4
- package/esm2022/utils/miscellaneous/is-falsy.mjs +0 -4
- package/esm2022/utils/miscellaneous/is-number.mjs +0 -4
- package/esm2022/utils/miscellaneous/is-object.mjs +0 -4
- package/esm2022/utils/miscellaneous/is-present.mjs +0 -4
- package/esm2022/utils/miscellaneous/is-string.mjs +0 -4
- package/esm2022/utils/miscellaneous/is-valid-url.mjs +0 -13
- package/esm2022/utils/miscellaneous/mark-control-as-touched-and-validate.mjs +0 -16
- package/esm2022/utils/miscellaneous/nullable-same.mjs +0 -18
- package/esm2022/utils/miscellaneous/obfuscate.mjs +0 -53
- package/esm2022/utils/miscellaneous/provide-options.mjs +0 -14
- package/esm2022/utils/miscellaneous/provide.mjs +0 -4
- package/esm2022/utils/miscellaneous/pure.mjs +0 -83
- package/esm2022/utils/miscellaneous/px.mjs +0 -9
- package/esm2022/utils/miscellaneous/sanitize-text.mjs +0 -29
- package/esm2022/utils/miscellaneous/taiga-ui-cdk-utils-miscellaneous.mjs +0 -5
- package/esm2022/utils/miscellaneous/uniq-by.mjs +0 -6
- package/esm2022/utils/miscellaneous/with-styles.mjs +0 -17
- package/esm2022/utils/taiga-ui-cdk-utils.mjs +0 -5
- package/fesm2022/taiga-ui-cdk-directives-click-outside.mjs +0 -39
- package/fesm2022/taiga-ui-cdk-directives-click-outside.mjs.map +0 -1
- package/fesm2022/taiga-ui-cdk-directives-droppable.mjs +0 -37
- package/fesm2022/taiga-ui-cdk-directives-droppable.mjs.map +0 -1
- package/fesm2022/taiga-ui-cdk-directives-for.mjs +0 -43
- package/fesm2022/taiga-ui-cdk-directives-for.mjs.map +0 -1
- package/fesm2022/taiga-ui-cdk-directives-let.mjs +0 -53
- package/fesm2022/taiga-ui-cdk-directives-let.mjs.map +0 -1
- package/fesm2022/taiga-ui-cdk-directives-popover.mjs +0 -32
- package/fesm2022/taiga-ui-cdk-directives-popover.mjs.map +0 -1
- package/fesm2022/taiga-ui-cdk-directives-repeat-times.mjs +0 -61
- package/fesm2022/taiga-ui-cdk-directives-repeat-times.mjs.map +0 -1
- package/fesm2022/taiga-ui-cdk-pipes-animation.mjs +0 -33
- package/fesm2022/taiga-ui-cdk-pipes-animation.mjs.map +0 -1
- package/fesm2022/taiga-ui-cdk-pipes-is-present.mjs +0 -25
- package/fesm2022/taiga-ui-cdk-pipes-is-present.mjs.map +0 -1
- package/fesm2022/taiga-ui-cdk-pipes-keys.mjs +0 -24
- package/fesm2022/taiga-ui-cdk-pipes-keys.mjs.map +0 -1
- package/fesm2022/taiga-ui-cdk-pipes-repeat-times.mjs +0 -25
- package/fesm2022/taiga-ui-cdk-pipes-repeat-times.mjs.map +0 -1
- package/fesm2022/taiga-ui-cdk-pipes-replace.mjs +0 -26
- package/fesm2022/taiga-ui-cdk-pipes-replace.mjs.map +0 -1
- package/fesm2022/taiga-ui-cdk-pipes-to-array.mjs +0 -24
- package/fesm2022/taiga-ui-cdk-pipes-to-array.mjs.map +0 -1
- package/fesm2022/taiga-ui-cdk-services.mjs +0 -152
- package/fesm2022/taiga-ui-cdk-services.mjs.map +0 -1
- package/fesm2022/taiga-ui-cdk-utils-browser.mjs +0 -48
- package/fesm2022/taiga-ui-cdk-utils-browser.mjs.map +0 -1
- package/fesm2022/taiga-ui-cdk-utils-color.mjs +0 -195
- package/fesm2022/taiga-ui-cdk-utils-color.mjs.map +0 -1
- package/observables/must-be-present.d.ts +0 -5
- package/observables/query-list-observable.d.ts +0 -6
- package/pipes/animation/animation.pipe.d.ts +0 -13
- package/pipes/animation/index.d.ts +0 -1
- package/pipes/is-present/index.d.ts +0 -1
- package/pipes/is-present/is-present.pipe.d.ts +0 -7
- package/pipes/keys/index.d.ts +0 -1
- package/pipes/keys/keys.pipe.d.ts +0 -7
- package/pipes/repeat-times/index.d.ts +0 -7
- package/pipes/replace/index.d.ts +0 -1
- package/pipes/replace/replace.pipe.d.ts +0 -7
- package/pipes/to-array/index.d.ts +0 -1
- package/pipes/to-array/to-array.pipe.d.ts +0 -7
- package/schematics/migrate-tui-let/index.d.ts +0 -3
- package/schematics/migrate-tui-let/index.js +0 -72
- package/schematics/migrate-tui-let/index.js.map +0 -1
- package/schematics/migrate-tui-let/schema.json +0 -7
- package/schematics/ng-update/v4/steps/replace-functions.js.map +0 -1
- package/services/id.service.d.ts +0 -8
- package/services/index.d.ts +0 -4
- package/services/popover.service.d.ts +0 -26
- package/services/scroll.service.d.ts +0 -13
- package/services/theme-color.service.d.ts +0 -18
- package/tokens/base-href.d.ts +0 -2
- package/tokens/environment.d.ts +0 -29
- package/tokens/range.d.ts +0 -5
- package/types/loose-union.d.ts +0 -36
- package/types/safe-html.d.ts +0 -2
- package/types/values-of.d.ts +0 -1
- package/utils/browser/index.d.ts +0 -5
- package/utils/browser/is-apple.d.ts +0 -11
- package/utils/browser/is-edge.d.ts +0 -1
- package/utils/browser/is-firefox.d.ts +0 -1
- package/utils/browser/is-ios.d.ts +0 -6
- package/utils/browser/is-safari.d.ts +0 -1
- package/utils/color/get-gradient-data.d.ts +0 -1
- package/utils/color/hex-to-rgb.d.ts +0 -1
- package/utils/color/hex-to-rgba.d.ts +0 -3
- package/utils/color/hsv-to-rgb.d.ts +0 -4
- package/utils/color/index.d.ts +0 -9
- package/utils/color/parse-color.d.ts +0 -1
- package/utils/color/parse-gradient.d.ts +0 -10
- package/utils/color/rgb-to-hex.d.ts +0 -1
- package/utils/color/rgb-to-hsv.d.ts +0 -1
- package/utils/color/rgba-to-hex.d.ts +0 -2
- package/utils/dom/get-element-point.d.ts +0 -2
- package/utils/dom/is-current-target.d.ts +0 -1
- package/utils/dom/is-inside-iframe.d.ts +0 -4
- package/utils/dom/is-node-in.d.ts +0 -8
- package/utils/dom/retarget-boundary-crossing.d.ts +0 -1
- package/utils/dom/value-binding.d.ts +0 -3
- package/utils/focus/blur-native-focused.d.ts +0 -9
- package/utils/focus/is-native-mouse-focusable.d.ts +0 -6
- package/utils/math/to-integer.d.ts +0 -1
- package/utils/math/to-radians.d.ts +0 -4
- package/utils/miscellaneous/change-date-separator.d.ts +0 -1
- package/utils/miscellaneous/create-token.d.ts +0 -9
- package/utils/miscellaneous/directive-listener.d.ts +0 -9
- package/utils/miscellaneous/flat-length.d.ts +0 -6
- package/utils/miscellaneous/get-original-array-from-query-list.d.ts +0 -8
- package/utils/miscellaneous/is-falsy.d.ts +0 -1
- package/utils/miscellaneous/is-valid-url.d.ts +0 -4
- package/utils/miscellaneous/provide-options.d.ts +0 -2
- package/utils/miscellaneous/pure.d.ts +0 -22
- package/utils/miscellaneous/uniq-by.d.ts +0 -1
- /package/utils/{miscellaneous → di}/directive-binding.d.ts +0 -0
- /package/utils/{miscellaneous → di}/provide.d.ts +0 -0
|
@@ -1,19 +1,59 @@
|
|
|
1
|
-
import { InjectionToken } from '@angular/core';
|
|
2
|
-
import {
|
|
1
|
+
import { inject, InjectionToken, isSignal, signal, effect } from '@angular/core';
|
|
2
|
+
import { tuiSetSignal } from '@taiga-ui/cdk/utils/miscellaneous';
|
|
3
|
+
|
|
4
|
+
function tuiProvideOptions(provide, options, fallback) {
|
|
5
|
+
return {
|
|
6
|
+
provide,
|
|
7
|
+
useFactory: () => ({
|
|
8
|
+
...(inject(provide, { optional: true, skipSelf: true }) || fallback),
|
|
9
|
+
...(inject(options, { optional: true }) ||
|
|
10
|
+
(typeof options === 'function' ? options() : options)),
|
|
11
|
+
}),
|
|
12
|
+
};
|
|
13
|
+
}
|
|
3
14
|
|
|
4
|
-
// TODO: Drop ProviderToken in v.5
|
|
5
15
|
function tuiCreateOptions(defaults) {
|
|
6
|
-
const token = new InjectionToken(ngDevMode ? 'token' : '', {
|
|
16
|
+
const token = new InjectionToken(ngDevMode ? 'Options token' : '', {
|
|
7
17
|
factory: () => defaults,
|
|
8
18
|
});
|
|
9
19
|
return [token, (options) => tuiProvideOptions(token, options, defaults)];
|
|
10
20
|
}
|
|
11
21
|
|
|
12
|
-
// TODO:
|
|
22
|
+
// TODO: Consider {} as default options instead
|
|
23
|
+
function tuiDirectiveBinding(token, key, initial, options = { self: true }) {
|
|
24
|
+
const result = isSignal(initial) ? initial : signal(initial);
|
|
25
|
+
const directive = inject(token, options);
|
|
26
|
+
const output = directive?.[`${key.toString()}Change`];
|
|
27
|
+
if (!directive) {
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
30
|
+
// TODO: Figure out why effects are executed all the time and not just when result changes (check with Angular 18)
|
|
31
|
+
let previous;
|
|
32
|
+
effect(() => {
|
|
33
|
+
const value = result();
|
|
34
|
+
if (previous === value) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (isSignal(directive[key])) {
|
|
38
|
+
tuiSetSignal(directive[key], value);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
directive[key] = value;
|
|
42
|
+
}
|
|
43
|
+
directive.ngOnChanges?.({});
|
|
44
|
+
output?.emit?.(value);
|
|
45
|
+
previous = value;
|
|
46
|
+
});
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function tuiProvide(provide, useExisting, multi = false) {
|
|
51
|
+
return { provide, useExisting, multi };
|
|
52
|
+
}
|
|
13
53
|
|
|
14
54
|
/**
|
|
15
55
|
* Generated bundle index. Do not edit.
|
|
16
56
|
*/
|
|
17
57
|
|
|
18
|
-
export { tuiCreateOptions };
|
|
58
|
+
export { tuiCreateOptions, tuiDirectiveBinding, tuiProvide, tuiProvideOptions };
|
|
19
59
|
//# sourceMappingURL=taiga-ui-cdk-utils-di.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-cdk-utils-di.mjs","sources":["../../../projects/cdk/utils/di/create-options.ts","../../../projects/cdk/utils/di/
|
|
1
|
+
{"version":3,"file":"taiga-ui-cdk-utils-di.mjs","sources":["../../../projects/cdk/utils/di/provide-options.ts","../../../projects/cdk/utils/di/create-options.ts","../../../projects/cdk/utils/di/directive-binding.ts","../../../projects/cdk/utils/di/provide.ts","../../../projects/cdk/utils/di/taiga-ui-cdk-utils-di.ts"],"sourcesContent":["import {type FactoryProvider, inject, type InjectionToken} from '@angular/core';\n\nexport function tuiProvideOptions<T>(\n provide: InjectionToken<T>,\n options: Partial<T> | (() => Partial<T>),\n fallback: T,\n): FactoryProvider {\n return {\n provide,\n useFactory: (): T => ({\n ...(inject(provide, {optional: true, skipSelf: true}) || fallback),\n ...(inject(options as any, {optional: true}) ||\n (typeof options === 'function' ? options() : options)),\n }),\n };\n}\n","import {type FactoryProvider, InjectionToken} from '@angular/core';\n\nimport {tuiProvideOptions} from './provide-options';\n\nexport function tuiCreateOptions<T>(\n defaults: T,\n): [\n token: InjectionToken<T>,\n provider: (item: Partial<T> | (() => Partial<T>)) => FactoryProvider,\n] {\n const token = new InjectionToken(ngDevMode ? 'Options token' : '', {\n factory: () => defaults,\n });\n\n return [token, (options) => tuiProvideOptions(token, options, defaults)];\n}\n","import {\n effect,\n inject,\n type InjectOptions,\n isSignal,\n type ProviderToken,\n type Signal,\n signal,\n type WritableSignal,\n} from '@angular/core';\nimport {tuiSetSignal} from '@taiga-ui/cdk/utils/miscellaneous';\n\ntype SignalLikeTypeOf<T> = T extends Signal<infer R> ? R : T;\n\ntype SignalLike<T> = Signal<T> | T;\n\n// TODO: Consider {} as default options instead\nexport function tuiDirectiveBinding<\n T,\n G extends keyof T,\n I extends SignalLike<SignalLikeTypeOf<T[G]>>,\n>(\n token: ProviderToken<T>,\n key: G,\n initial: I,\n options: InjectOptions = {self: true},\n): I extends Signal<any> ? I : WritableSignal<I> {\n const result: any = isSignal(initial) ? initial : signal(initial);\n const directive: any = inject(token, options);\n const output = directive?.[`${key.toString()}Change`];\n\n if (!directive) {\n return result;\n }\n\n // TODO: Figure out why effects are executed all the time and not just when result changes (check with Angular 18)\n let previous: any;\n\n effect(() => {\n const value: any = result();\n\n if (previous === value) {\n return;\n }\n\n if (isSignal(directive[key])) {\n tuiSetSignal(directive[key] as any, value);\n } else {\n directive[key] = value;\n }\n\n directive.ngOnChanges?.({});\n output?.emit?.(value);\n previous = value;\n });\n\n return result;\n}\n","import {type ExistingProvider, type ProviderToken} from '@angular/core';\n\nexport function tuiProvide<T>(\n provide: ProviderToken<T>,\n useExisting: ProviderToken<T>,\n): ExistingProvider;\nexport function tuiProvide<T>(\n provide: ProviderToken<T | T[]>,\n useExisting: ProviderToken<T>,\n multi: boolean,\n): ExistingProvider;\nexport function tuiProvide<T>(\n provide: ProviderToken<T>,\n useExisting: ProviderToken<T>,\n multi = false,\n): ExistingProvider {\n return {provide, useExisting, multi};\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;SAEgB,iBAAiB,CAC7B,OAA0B,EAC1B,OAAwC,EACxC,QAAW,EAAA;IAEX,OAAO;QACH,OAAO;AACP,QAAA,UAAU,EAAE,OAAU;AAClB,YAAA,IAAI,MAAM,CAAC,OAAO,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,IAAI,QAAQ,CAAC;YAClE,IAAI,MAAM,CAAC,OAAc,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;AACxC,iBAAC,OAAO,OAAO,KAAK,UAAU,GAAG,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC;SAC7D,CAAC;KACL;AACL;;ACXM,SAAU,gBAAgB,CAC5B,QAAW,EAAA;AAKX,IAAA,MAAM,KAAK,GAAG,IAAI,cAAc,CAAC,SAAS,GAAG,eAAe,GAAG,EAAE,EAAE;AAC/D,QAAA,OAAO,EAAE,MAAM,QAAQ;AAC1B,KAAA,CAAC;AAEF,IAAA,OAAO,CAAC,KAAK,EAAE,CAAC,OAAO,KAAK,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC5E;;ACCA;AACgB,SAAA,mBAAmB,CAK/B,KAAuB,EACvB,GAAM,EACN,OAAU,EACV,OAAyB,GAAA,EAAC,IAAI,EAAE,IAAI,EAAC,EAAA;AAErC,IAAA,MAAM,MAAM,GAAQ,QAAQ,CAAC,OAAO,CAAC,GAAG,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IACjE,MAAM,SAAS,GAAQ,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC;AAC7C,IAAA,MAAM,MAAM,GAAG,SAAS,GAAG,CAAA,EAAG,GAAG,CAAC,QAAQ,EAAE,CAAQ,MAAA,CAAA,CAAC;IAErD,IAAI,CAAC,SAAS,EAAE;AACZ,QAAA,OAAO,MAAM;;;AAIjB,IAAA,IAAI,QAAa;IAEjB,MAAM,CAAC,MAAK;AACR,QAAA,MAAM,KAAK,GAAQ,MAAM,EAAE;AAE3B,QAAA,IAAI,QAAQ,KAAK,KAAK,EAAE;YACpB;;QAGJ,IAAI,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE;YAC1B,YAAY,CAAC,SAAS,CAAC,GAAG,CAAQ,EAAE,KAAK,CAAC;;aACvC;AACH,YAAA,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK;;AAG1B,QAAA,SAAS,CAAC,WAAW,GAAG,EAAE,CAAC;AAC3B,QAAA,MAAM,EAAE,IAAI,GAAG,KAAK,CAAC;QACrB,QAAQ,GAAG,KAAK;AACpB,KAAC,CAAC;AAEF,IAAA,OAAO,MAAM;AACjB;;AC9CM,SAAU,UAAU,CACtB,OAAyB,EACzB,WAA6B,EAC7B,KAAK,GAAG,KAAK,EAAA;AAEb,IAAA,OAAO,EAAC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAC;AACxC;;ACjBA;;AAEG;;;;"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { tuiIsPresent } from '@taiga-ui/cdk/utils/miscellaneous';
|
|
2
|
-
import { tuiClamp } from '@taiga-ui/cdk/utils/math';
|
|
3
2
|
import { inject, ElementRef, PLATFORM_ID, isSignal, signal, untracked, DestroyRef, effect, INJECTOR } from '@angular/core';
|
|
4
3
|
import { coerceElement } from '@angular/cdk/coercion';
|
|
5
4
|
import { isPlatformBrowser } from '@angular/common';
|
|
6
5
|
import { WA_WINDOW } from '@ng-web-apis/common';
|
|
7
|
-
import { TUI_ALLOW_SIGNAL_WRITES } from '@taiga-ui/cdk/constants';
|
|
8
6
|
|
|
7
|
+
/* eslint-disable no-bitwise */
|
|
9
8
|
function tuiContainsOrAfter(current, node) {
|
|
10
9
|
try {
|
|
11
10
|
return (current.contains(node) ||
|
|
@@ -117,11 +116,6 @@ function tuiGetElementOffset(host, element) {
|
|
|
117
116
|
return { offsetTop, offsetLeft };
|
|
118
117
|
}
|
|
119
118
|
|
|
120
|
-
function tuiGetElementPoint(x, y, element) {
|
|
121
|
-
const { left, top, width, height } = element.getBoundingClientRect();
|
|
122
|
-
return [tuiClamp(x - left, 0, width) / width, tuiClamp(y - top, 0, height) / height];
|
|
123
|
-
}
|
|
124
|
-
|
|
125
119
|
/**
|
|
126
120
|
* @description:
|
|
127
121
|
* cross browser way to get selected text
|
|
@@ -140,35 +134,11 @@ function tuiInjectElement() {
|
|
|
140
134
|
return inject(ElementRef).nativeElement;
|
|
141
135
|
}
|
|
142
136
|
|
|
143
|
-
function tuiIsCurrentTarget({ target, currentTarget }) {
|
|
144
|
-
return target === currentTarget;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
137
|
function tuiIsElementEditable(element) {
|
|
148
138
|
return ((tuiIsTextfield(element) && !element.readOnly && element.inputMode !== 'none') ||
|
|
149
139
|
Boolean(element.isContentEditable));
|
|
150
140
|
}
|
|
151
141
|
|
|
152
|
-
/**
|
|
153
|
-
* Checks if an app is running inside <iframe /> tag
|
|
154
|
-
*/
|
|
155
|
-
function tuiIsInsideIframe(win) {
|
|
156
|
-
return win.parent !== win;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Checks if node is inside a specific selector
|
|
161
|
-
*
|
|
162
|
-
* @param node
|
|
163
|
-
* @param selector
|
|
164
|
-
* @return true if node is inside a particular selector
|
|
165
|
-
*/
|
|
166
|
-
function tuiIsNodeIn(node, selector) {
|
|
167
|
-
return tuiIsTextNode(node)
|
|
168
|
-
? !!node.parentElement?.closest(selector)
|
|
169
|
-
: tuiIsElement(node) && !!node.closest(selector);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
142
|
function tuiPointToClientRect(x = 0, y = 0) {
|
|
173
143
|
const rect = {
|
|
174
144
|
x,
|
|
@@ -186,22 +156,6 @@ function tuiPointToClientRect(x = 0, y = 0) {
|
|
|
186
156
|
};
|
|
187
157
|
}
|
|
188
158
|
|
|
189
|
-
function tuiRetargetedBoundaryCrossing(event) {
|
|
190
|
-
// firefox
|
|
191
|
-
if ('explicitOriginalTarget' in event) {
|
|
192
|
-
return event?.explicitOriginalTarget !== event.target;
|
|
193
|
-
}
|
|
194
|
-
// chrome
|
|
195
|
-
if ('pointerId' in event) {
|
|
196
|
-
return event.pointerId === -1;
|
|
197
|
-
}
|
|
198
|
-
// safari
|
|
199
|
-
if ('detail' in event && 'webkitForce' in event) {
|
|
200
|
-
return event?.detail === 0;
|
|
201
|
-
}
|
|
202
|
-
return false;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
159
|
function tuiValue(input, injector = inject(INJECTOR)) {
|
|
206
160
|
const win = injector.get(WA_WINDOW);
|
|
207
161
|
if (!win.tuiInputPatched && isPlatformBrowser(injector.get(PLATFORM_ID))) {
|
|
@@ -212,7 +166,7 @@ function tuiValue(input, injector = inject(INJECTOR)) {
|
|
|
212
166
|
}
|
|
213
167
|
let element = isSignal(input) ? undefined : coerceElement(input);
|
|
214
168
|
let cleanup = () => { };
|
|
215
|
-
const options = { injector
|
|
169
|
+
const options = { injector };
|
|
216
170
|
const value = signal(element?.value || '');
|
|
217
171
|
const process = (el) => {
|
|
218
172
|
const update = () => untracked(() => value.set(el.value));
|
|
@@ -251,14 +205,9 @@ function tuiValue(input, injector = inject(INJECTOR)) {
|
|
|
251
205
|
/**
|
|
252
206
|
* After programmatic updates of input's value, caret is automatically placed at the end –
|
|
253
207
|
* revert to the previous position
|
|
254
|
-
*
|
|
255
|
-
* Only the types 'text', 'search', 'password', 'tel', and 'url' support selection
|
|
256
208
|
*/
|
|
257
209
|
element.value = v;
|
|
258
|
-
|
|
259
|
-
element.setSelectionRange(selectionStart, selectionEnd);
|
|
260
|
-
}
|
|
261
|
-
catch { }
|
|
210
|
+
element.setSelectionRange(selectionStart, selectionEnd);
|
|
262
211
|
}
|
|
263
212
|
else if (element) {
|
|
264
213
|
element.value = v;
|
|
@@ -280,36 +229,9 @@ function patch(prototype) {
|
|
|
280
229
|
});
|
|
281
230
|
}
|
|
282
231
|
|
|
283
|
-
/**
|
|
284
|
-
* Host binding `host: {'[value]': 'yourSignal()'}` is not an option for our textfields –
|
|
285
|
-
* they use {@link TuiTextfieldDirective} as a host directive.
|
|
286
|
-
* `TuiTextfieldDirective` has host binding which depends on native input's value.
|
|
287
|
-
* Host bindings of the host directives are re-calculated BEFORE component's ones –
|
|
288
|
-
* native input's value should be updated SYNCHRONOUSLY before next change detection iteration.
|
|
289
|
-
* @deprecated
|
|
290
|
-
*/
|
|
291
|
-
function tuiValueBinding(value = signal(tuiInjectElement().value || '')) {
|
|
292
|
-
const el = tuiInjectElement();
|
|
293
|
-
effect(() => {
|
|
294
|
-
if (el.value === value()) {
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
const { selectionStart, selectionEnd } = el;
|
|
298
|
-
el.value = value();
|
|
299
|
-
if (el.matches(':focus')) {
|
|
300
|
-
/**
|
|
301
|
-
* After programmatic updates of input's value, caret is automatically placed at the end –
|
|
302
|
-
* revert to the previous position
|
|
303
|
-
*/
|
|
304
|
-
el.setSelectionRange(selectionStart, selectionEnd);
|
|
305
|
-
}
|
|
306
|
-
});
|
|
307
|
-
return value;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
232
|
/**
|
|
311
233
|
* Generated bundle index. Do not edit.
|
|
312
234
|
*/
|
|
313
235
|
|
|
314
|
-
export { tuiContainsOrAfter, tuiGetActualTarget, tuiGetClipboardDataText, tuiGetDocumentOrShadowRoot, tuiGetElementObscures, tuiGetElementOffset,
|
|
236
|
+
export { tuiContainsOrAfter, tuiGetActualTarget, tuiGetClipboardDataText, tuiGetDocumentOrShadowRoot, tuiGetElementObscures, tuiGetElementOffset, tuiGetSelectedText, tuiInjectElement, tuiIsElement, tuiIsElementEditable, tuiIsHTMLElement, tuiIsInput, tuiIsInputEvent, tuiIsTextNode, tuiIsTextarea, tuiIsTextfield, tuiPointToClientRect, tuiValue };
|
|
315
237
|
//# sourceMappingURL=taiga-ui-cdk-utils-dom.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-cdk-utils-dom.mjs","sources":["../../../projects/cdk/utils/dom/contains-or-after.ts","../../../projects/cdk/utils/dom/element-checks.ts","../../../projects/cdk/utils/dom/event-checks.ts","../../../projects/cdk/utils/dom/get-actual-target.ts","../../../projects/cdk/utils/dom/get-clipboard-data-text.ts","../../../projects/cdk/utils/dom/get-document-or-shadow-root.ts","../../../projects/cdk/utils/dom/get-element-obscurers.ts","../../../projects/cdk/utils/dom/get-element-offset.ts","../../../projects/cdk/utils/dom/get-element-point.ts","../../../projects/cdk/utils/dom/get-selected-text.ts","../../../projects/cdk/utils/dom/inject-element.ts","../../../projects/cdk/utils/dom/is-current-target.ts","../../../projects/cdk/utils/dom/is-element-editable.ts","../../../projects/cdk/utils/dom/is-inside-iframe.ts","../../../projects/cdk/utils/dom/is-node-in.ts","../../../projects/cdk/utils/dom/point-to-client-rect.ts","../../../projects/cdk/utils/dom/retarget-boundary-crossing.ts","../../../projects/cdk/utils/dom/value.ts","../../../projects/cdk/utils/dom/value-binding.ts","../../../projects/cdk/utils/dom/taiga-ui-cdk-utils-dom.ts"],"sourcesContent":["export function tuiContainsOrAfter(current: Node, node: Node): boolean {\n try {\n return (\n current.contains(node) ||\n !!(node.compareDocumentPosition(current) & Node.DOCUMENT_POSITION_PRECEDING)\n );\n } catch {\n return false;\n }\n}\n","export function tuiIsInput(element: Element): element is HTMLInputElement {\n return element.matches('input');\n}\n\nexport function tuiIsTextarea(element: Element): element is HTMLTextAreaElement {\n return element.matches('textarea');\n}\n\nexport function tuiIsTextfield(\n element: Element,\n): element is HTMLInputElement | HTMLTextAreaElement {\n return tuiIsInput(element) || tuiIsTextarea(element);\n}\n\nexport function tuiIsElement(\n node?: Element | EventTarget | Node | null,\n): node is Element {\n return !!node && 'nodeType' in node && node.nodeType === Node.ELEMENT_NODE;\n}\n\nexport function tuiIsHTMLElement(node: unknown): node is HTMLElement {\n const defaultView = (node as Element | undefined)?.ownerDocument.defaultView;\n\n return !!node && !!defaultView && node instanceof defaultView.HTMLElement;\n}\n\nexport function tuiIsTextNode(node: Node): node is Text {\n return node.nodeType === Node.TEXT_NODE;\n}\n","export function tuiIsInputEvent(event: Event): event is InputEvent {\n return 'data' in event && 'inputType' in event;\n}\n","/**\n * Gets actual target from open Shadow DOM if event happened within it\n */\nexport function tuiGetActualTarget(event: Event): Node {\n return event.composedPath()[0] as Node;\n}\n","const DEFAULT_FORMAT = 'text/plain';\n\n/**\n * Gets text from data of clipboardEvent, it also works in IE and Edge browsers\n */\nexport function tuiGetClipboardDataText(\n event: ClipboardEvent,\n format: string = DEFAULT_FORMAT,\n): string {\n return 'clipboardData' in event && event.clipboardData !== null\n ? event.clipboardData.getData(format) ||\n event.clipboardData.getData(DEFAULT_FORMAT)\n : (event as any).target.ownerDocument.defaultView.clipboardData.getData('text');\n}\n","export function tuiGetDocumentOrShadowRoot(node: Node): DocumentOrShadowRoot {\n return 'getRootNode' in node && node.isConnected\n ? (node.getRootNode() as Document)\n : (node.ownerDocument as DocumentOrShadowRoot);\n}\n","import {tuiIsPresent} from '@taiga-ui/cdk/utils/miscellaneous';\n\nimport {tuiGetDocumentOrShadowRoot} from './get-document-or-shadow-root';\n\n/**\n * Returns array of Elements covering edges of given element or null if at least one edge middle point is visible\n *\n * CAUTION: Empty array means element if offscreen i.e. covered by no elements, rather than not covered\n * ```ts\n * function tuiGetElementObscures(element: Element): readonly [Element, Element, Element, Element] | [] | null\n * ```\n */\nexport function tuiGetElementObscures(element: Element): readonly Element[] | null {\n if (!element.getBoundingClientRect) {\n return null;\n }\n\n const {left, right, top, bottom, width, height} = element.getBoundingClientRect();\n\n if (width === 0 && height === 0) {\n return null;\n }\n\n const doc = tuiGetDocumentOrShadowRoot(element);\n const horizontalMiddle = Math.round(left + width / 2);\n const verticalMiddle = Math.round(top + height / 2);\n const elements = [\n doc.elementFromPoint(horizontalMiddle, Math.round(top) + 2),\n doc.elementFromPoint(horizontalMiddle, Math.round(bottom) - 2),\n doc.elementFromPoint(Math.round(left) + 2, verticalMiddle),\n doc.elementFromPoint(Math.round(right) - 2, verticalMiddle),\n ].filter(tuiIsPresent);\n\n if (!elements.length) {\n return [];\n }\n\n const filtered = elements.filter(\n (el) => !element.contains(el) && !el.contains(element),\n );\n\n return filtered.length === 4\n ? (filtered as [Element, Element, Element, Element])\n : null;\n}\n","/// <reference types=\"@taiga-ui/tsconfig/ng-dev-mode\" />\n\nimport {tuiIsHTMLElement} from './element-checks';\n\n/**\n * Calculates offset for an element relative to it's parent several levels above\n *\n * @param host parent element\n * @param element\n * @return object with offsetTop and offsetLeft number properties\n */\nexport function tuiGetElementOffset(\n host: Element,\n element: HTMLElement,\n): {offsetLeft: number; offsetTop: number} {\n ngDevMode && console.assert(host.contains(element), 'Host must contain element');\n\n let {offsetTop, offsetLeft, offsetParent} = element;\n\n while (tuiIsHTMLElement(offsetParent) && offsetParent !== host) {\n offsetTop += offsetParent.offsetTop;\n offsetLeft += offsetParent.offsetLeft;\n offsetParent = offsetParent.offsetParent;\n }\n\n return {offsetTop, offsetLeft};\n}\n","import {tuiClamp} from '@taiga-ui/cdk/utils/math';\nimport {type TuiPoint} from '@taiga-ui/core/types';\n\nexport function tuiGetElementPoint(x: number, y: number, element: HTMLElement): TuiPoint {\n const {left, top, width, height} = element.getBoundingClientRect();\n\n return [tuiClamp(x - left, 0, width) / width, tuiClamp(y - top, 0, height) / height];\n}\n","import {tuiIsTextfield} from './element-checks';\n\n/**\n * @description:\n * cross browser way to get selected text\n *\n * History:\n * BUG - window.getSelection() fails when text selected in a form field\n * https://bugzilla.mozilla.org/show_bug.cgi?id=85686\n */\nexport function tuiGetSelectedText({getSelection, document}: Window): string | null {\n return document.activeElement && tuiIsTextfield(document.activeElement)\n ? document.activeElement.value.slice(\n document.activeElement.selectionStart || 0,\n document.activeElement.selectionEnd || 0,\n )\n : getSelection()?.toString() || null;\n}\n","import {ElementRef, inject} from '@angular/core';\n\nexport function tuiInjectElement<T = HTMLElement>(): T {\n return inject(ElementRef).nativeElement;\n}\n","export function tuiIsCurrentTarget({target, currentTarget}: Event): boolean {\n return target === currentTarget;\n}\n","import {tuiIsTextfield} from './element-checks';\n\nexport function tuiIsElementEditable(element: HTMLElement): boolean {\n return (\n (tuiIsTextfield(element) && !element.readOnly && element.inputMode !== 'none') ||\n Boolean(element.isContentEditable as unknown as string)\n );\n}\n","/**\n * Checks if an app is running inside <iframe /> tag\n */\nexport function tuiIsInsideIframe(win: Window): boolean {\n return win.parent !== win;\n}\n","import {tuiIsElement, tuiIsTextNode} from './element-checks';\n\n/**\n * Checks if node is inside a specific selector\n *\n * @param node\n * @param selector\n * @return true if node is inside a particular selector\n */\nexport function tuiIsNodeIn(node: Node, selector: string): boolean {\n return tuiIsTextNode(node)\n ? !!node.parentElement?.closest(selector)\n : tuiIsElement(node) && !!node.closest(selector);\n}\n","export function tuiPointToClientRect(x = 0, y = 0): DOMRect {\n const rect = {\n x,\n y,\n left: x,\n right: x,\n top: y,\n bottom: y,\n width: 0,\n height: 0,\n } as const;\n\n return {\n ...rect,\n toJSON: () => rect,\n };\n}\n","export function tuiRetargetedBoundaryCrossing(event: Event): boolean {\n // firefox\n if ('explicitOriginalTarget' in event) {\n return event?.explicitOriginalTarget !== event.target;\n }\n\n // chrome\n if ('pointerId' in event) {\n return event.pointerId === -1;\n }\n\n // safari\n if ('detail' in event && 'webkitForce' in event) {\n return event?.detail === 0;\n }\n\n return false;\n}\n","import {coerceElement} from '@angular/cdk/coercion';\nimport {isPlatformBrowser} from '@angular/common';\nimport {\n DestroyRef,\n effect,\n type ElementRef,\n inject,\n INJECTOR,\n isSignal,\n PLATFORM_ID,\n type Signal,\n signal,\n untracked,\n type WritableSignal,\n} from '@angular/core';\nimport {WA_WINDOW} from '@ng-web-apis/common';\nimport {TUI_ALLOW_SIGNAL_WRITES} from '@taiga-ui/cdk/constants';\n\ntype WithValue = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\n\nexport function tuiValue(\n input:\n | ElementRef<WithValue>\n | Signal<ElementRef<WithValue> | undefined>\n | Signal<WithValue | undefined>\n | WithValue,\n injector = inject(INJECTOR),\n): WritableSignal<string> {\n const win = injector.get<any>(WA_WINDOW);\n\n if (!win.tuiInputPatched && isPlatformBrowser(injector.get(PLATFORM_ID))) {\n win.tuiInputPatched = true;\n\n patch(win.HTMLInputElement.prototype);\n patch(win.HTMLTextAreaElement.prototype);\n patch(win.HTMLSelectElement.prototype);\n }\n\n let element = isSignal(input) ? undefined : coerceElement(input);\n let cleanup = (): void => {};\n\n const options = {injector, ...TUI_ALLOW_SIGNAL_WRITES};\n const value = signal(element?.value || '');\n const process = (el: WithValue): (() => void) => {\n const update = (): void => untracked(() => value.set(el.value));\n\n el.addEventListener('input', update, {capture: true});\n el.addEventListener('tui-input', update, {capture: true});\n\n return (): void => {\n el.removeEventListener('input', update, {capture: true});\n el.removeEventListener('tui-input', update, {capture: true});\n };\n };\n\n injector.get(DestroyRef).onDestroy(() => cleanup());\n\n if (isSignal(input)) {\n effect(() => {\n element = coerceElement(input());\n cleanup();\n\n if (element && !element.matches('select[multiple]')) {\n value.set(element.value);\n cleanup = process(element);\n }\n }, options);\n } else if (element && !element.matches('select[multiple]')) {\n cleanup = process(element);\n }\n\n effect(() => {\n const v = value();\n\n /**\n * select[multiple] elements have value of first selected option,\n * but there could be more, setting value resets other selected options\n */\n if (element?.matches('select[multiple]')) {\n return;\n }\n\n if (element?.matches(':focus') && 'selectionStart' in element) {\n const {selectionStart, selectionEnd} = element;\n\n /**\n * After programmatic updates of input's value, caret is automatically placed at the end –\n * revert to the previous position\n *\n * Only the types 'text', 'search', 'password', 'tel', and 'url' support selection\n */\n element.value = v;\n\n try {\n element.setSelectionRange(selectionStart, selectionEnd);\n } catch {}\n } else if (element) {\n element.value = v;\n }\n }, options);\n\n return value;\n}\n\nfunction patch(prototype: WithValue): void {\n const {set} = Object.getOwnPropertyDescriptor(prototype, 'value')!;\n\n Object.defineProperty(prototype, 'value', {\n set(this: WithValue, detail: string) {\n const value = this.value;\n const event = new CustomEvent('tui-input', {detail, bubbles: true});\n\n set!.call(this, detail);\n\n if (value !== detail) {\n this.dispatchEvent(event);\n }\n },\n });\n}\n","import {effect, type Signal, signal, type WritableSignal} from '@angular/core';\n\nimport {tuiInjectElement} from './inject-element';\n\nexport function tuiValueBinding(value?: WritableSignal<string>): WritableSignal<string>;\nexport function tuiValueBinding(value?: Signal<string>): Signal<string>;\n\n/**\n * Host binding `host: {'[value]': 'yourSignal()'}` is not an option for our textfields –\n * they use {@link TuiTextfieldDirective} as a host directive.\n * `TuiTextfieldDirective` has host binding which depends on native input's value.\n * Host bindings of the host directives are re-calculated BEFORE component's ones –\n * native input's value should be updated SYNCHRONOUSLY before next change detection iteration.\n * @deprecated\n */\nexport function tuiValueBinding(\n value: Signal<string> = signal(tuiInjectElement<HTMLInputElement>().value || ''),\n): Signal<string> {\n const el = tuiInjectElement<HTMLInputElement>();\n\n effect(() => {\n if (el.value === value()) {\n return;\n }\n\n const {selectionStart, selectionEnd} = el;\n\n el.value = value();\n\n if (el.matches(':focus')) {\n /**\n * After programmatic updates of input's value, caret is automatically placed at the end –\n * revert to the previous position\n */\n el.setSelectionRange(selectionStart, selectionEnd);\n }\n });\n\n return value;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAAgB,SAAA,kBAAkB,CAAC,OAAa,EAAE,IAAU,EAAA;IACxD,IAAI;AACA,QAAA,QACI,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;AACtB,YAAA,CAAC,EAAE,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,GAAG,IAAI,CAA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AE,EAAE;YACtB,OAAO;AACV,SAAA;AAED,QAAA,MAAM,EAAC,cAAc,EAAE,YAAY,EAAC,GAAG,EAAE,CAAC;AAE1C,QAAA,EAAE,CAAC,KAAK,GAAG,KAAK,EAAE,CAAC;AAEnB,QAAA,IAAI,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;AACtB;;;AAGG;AACH,YAAA,EAAE,CAAC,iBAAiB,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;AACtD,SAAA;AACL,KAAC,CAAC,CAAC;AAEH,IAAA,OAAO,KAAK,CAAC;AACjB;;ACvCA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"taiga-ui-cdk-utils-dom.mjs","sources":["../../../projects/cdk/utils/dom/contains-or-after.ts","../../../projects/cdk/utils/dom/element-checks.ts","../../../projects/cdk/utils/dom/event-checks.ts","../../../projects/cdk/utils/dom/get-actual-target.ts","../../../projects/cdk/utils/dom/get-clipboard-data-text.ts","../../../projects/cdk/utils/dom/get-document-or-shadow-root.ts","../../../projects/cdk/utils/dom/get-element-obscurers.ts","../../../projects/cdk/utils/dom/get-element-offset.ts","../../../projects/cdk/utils/dom/get-selected-text.ts","../../../projects/cdk/utils/dom/inject-element.ts","../../../projects/cdk/utils/dom/is-element-editable.ts","../../../projects/cdk/utils/dom/point-to-client-rect.ts","../../../projects/cdk/utils/dom/value.ts","../../../projects/cdk/utils/dom/taiga-ui-cdk-utils-dom.ts"],"sourcesContent":["/* eslint-disable no-bitwise */\nexport function tuiContainsOrAfter(current: Node, node: Node): boolean {\n try {\n return (\n current.contains(node) ||\n !!(node.compareDocumentPosition(current) & Node.DOCUMENT_POSITION_PRECEDING)\n );\n } catch {\n return false;\n }\n}\n","export function tuiIsInput(element: Element): element is HTMLInputElement {\n return element.matches('input');\n}\n\nexport function tuiIsTextarea(element: Element): element is HTMLTextAreaElement {\n return element.matches('textarea');\n}\n\nexport function tuiIsTextfield(\n element: Element,\n): element is HTMLInputElement | HTMLTextAreaElement {\n return tuiIsInput(element) || tuiIsTextarea(element);\n}\n\nexport function tuiIsElement(\n node?: Element | EventTarget | Node | null,\n): node is Element {\n return !!node && 'nodeType' in node && node.nodeType === Node.ELEMENT_NODE;\n}\n\nexport function tuiIsHTMLElement(node: unknown): node is HTMLElement {\n const defaultView = (node as Element | undefined)?.ownerDocument.defaultView;\n\n return !!node && !!defaultView && node instanceof defaultView.HTMLElement;\n}\n\nexport function tuiIsTextNode(node: Node): node is Text {\n return node.nodeType === Node.TEXT_NODE;\n}\n","export function tuiIsInputEvent(event: Event): event is InputEvent {\n return 'data' in event && 'inputType' in event;\n}\n","/**\n * Gets actual target from open Shadow DOM if event happened within it\n */\nexport function tuiGetActualTarget(event: Event): Node {\n return event.composedPath()[0] as Node;\n}\n","const DEFAULT_FORMAT = 'text/plain';\n\n/**\n * Gets text from data of clipboardEvent, it also works in IE and Edge browsers\n */\nexport function tuiGetClipboardDataText(\n event: ClipboardEvent,\n format: string = DEFAULT_FORMAT,\n): string {\n return 'clipboardData' in event && event.clipboardData !== null\n ? event.clipboardData.getData(format) ||\n event.clipboardData.getData(DEFAULT_FORMAT)\n : (event as any).target.ownerDocument.defaultView.clipboardData.getData('text');\n}\n","export function tuiGetDocumentOrShadowRoot(node: Node): DocumentOrShadowRoot {\n return 'getRootNode' in node && node.isConnected\n ? (node.getRootNode() as Document)\n : (node.ownerDocument as DocumentOrShadowRoot);\n}\n","import {tuiIsPresent} from '@taiga-ui/cdk/utils/miscellaneous';\n\nimport {tuiGetDocumentOrShadowRoot} from './get-document-or-shadow-root';\n\n/**\n * Returns array of Elements covering edges of given element or null if at least one edge middle point is visible\n *\n * CAUTION: Empty array means element if offscreen i.e. covered by no elements, rather than not covered\n * ```ts\n * function tuiGetElementObscures(element: Element): readonly [Element, Element, Element, Element] | [] | null\n * ```\n */\nexport function tuiGetElementObscures(element: Element): readonly Element[] | null {\n if (!element.getBoundingClientRect) {\n return null;\n }\n\n const {left, right, top, bottom, width, height} = element.getBoundingClientRect();\n\n if (width === 0 && height === 0) {\n return null;\n }\n\n const doc = tuiGetDocumentOrShadowRoot(element);\n const horizontalMiddle = Math.round(left + width / 2);\n const verticalMiddle = Math.round(top + height / 2);\n const elements = [\n doc.elementFromPoint(horizontalMiddle, Math.round(top) + 2),\n doc.elementFromPoint(horizontalMiddle, Math.round(bottom) - 2),\n doc.elementFromPoint(Math.round(left) + 2, verticalMiddle),\n doc.elementFromPoint(Math.round(right) - 2, verticalMiddle),\n ].filter(tuiIsPresent);\n\n if (!elements.length) {\n return [];\n }\n\n const filtered = elements.filter(\n (el) => !element.contains(el) && !el.contains(element),\n );\n\n return filtered.length === 4\n ? (filtered as [Element, Element, Element, Element])\n : null;\n}\n","/// <reference types=\"@taiga-ui/tsconfig/ng-dev-mode\" />\n\nimport {tuiIsHTMLElement} from './element-checks';\n\n/**\n * Calculates offset for an element relative to it's parent several levels above\n *\n * @param host parent element\n * @param element\n * @return object with offsetTop and offsetLeft number properties\n */\nexport function tuiGetElementOffset(\n host: Element,\n element: HTMLElement,\n): {offsetLeft: number; offsetTop: number} {\n ngDevMode && console.assert(host.contains(element), 'Host must contain element');\n\n let {offsetTop, offsetLeft, offsetParent} = element;\n\n while (tuiIsHTMLElement(offsetParent) && offsetParent !== host) {\n offsetTop += offsetParent.offsetTop;\n offsetLeft += offsetParent.offsetLeft;\n offsetParent = offsetParent.offsetParent;\n }\n\n return {offsetTop, offsetLeft};\n}\n","import {tuiIsTextfield} from './element-checks';\n\n/**\n * @description:\n * cross browser way to get selected text\n *\n * History:\n * BUG - window.getSelection() fails when text selected in a form field\n * https://bugzilla.mozilla.org/show_bug.cgi?id=85686\n */\nexport function tuiGetSelectedText({getSelection, document}: Window): string | null {\n return document.activeElement && tuiIsTextfield(document.activeElement)\n ? document.activeElement.value.slice(\n document.activeElement.selectionStart || 0,\n document.activeElement.selectionEnd || 0,\n )\n : getSelection()?.toString() || null;\n}\n","import {ElementRef, inject} from '@angular/core';\n\nexport function tuiInjectElement<T = HTMLElement>(): T {\n return inject(ElementRef).nativeElement;\n}\n","import {tuiIsTextfield} from './element-checks';\n\nexport function tuiIsElementEditable(element: HTMLElement): boolean {\n return (\n (tuiIsTextfield(element) && !element.readOnly && element.inputMode !== 'none') ||\n Boolean(element.isContentEditable as unknown as string)\n );\n}\n","export function tuiPointToClientRect(x = 0, y = 0): DOMRect {\n const rect = {\n x,\n y,\n left: x,\n right: x,\n top: y,\n bottom: y,\n width: 0,\n height: 0,\n } as const;\n\n return {\n ...rect,\n toJSON: () => rect,\n };\n}\n","import {coerceElement} from '@angular/cdk/coercion';\nimport {isPlatformBrowser} from '@angular/common';\nimport {\n DestroyRef,\n effect,\n type ElementRef,\n inject,\n INJECTOR,\n isSignal,\n PLATFORM_ID,\n type Signal,\n signal,\n untracked,\n type WritableSignal,\n} from '@angular/core';\nimport {WA_WINDOW} from '@ng-web-apis/common';\n\ntype WithValue = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\n\nexport function tuiValue(\n input:\n | ElementRef<WithValue>\n | Signal<ElementRef<WithValue> | undefined>\n | Signal<WithValue | undefined>\n | WithValue,\n injector = inject(INJECTOR),\n): WritableSignal<string> {\n const win = injector.get<any>(WA_WINDOW);\n\n if (!win.tuiInputPatched && isPlatformBrowser(injector.get(PLATFORM_ID))) {\n win.tuiInputPatched = true;\n\n patch(win.HTMLInputElement.prototype);\n patch(win.HTMLTextAreaElement.prototype);\n patch(win.HTMLSelectElement.prototype);\n }\n\n let element = isSignal(input) ? undefined : coerceElement(input);\n let cleanup = (): void => {};\n\n const options = {injector};\n const value = signal(element?.value || '');\n const process = (el: WithValue): (() => void) => {\n const update = (): void => untracked(() => value.set(el.value));\n\n el.addEventListener('input', update, {capture: true});\n el.addEventListener('tui-input', update, {capture: true});\n\n return (): void => {\n el.removeEventListener('input', update, {capture: true});\n el.removeEventListener('tui-input', update, {capture: true});\n };\n };\n\n injector.get(DestroyRef).onDestroy(() => cleanup());\n\n if (isSignal(input)) {\n effect(() => {\n element = coerceElement(input());\n cleanup();\n\n if (element && !element.matches('select[multiple]')) {\n value.set(element.value);\n cleanup = process(element);\n }\n }, options);\n } else if (element && !element.matches('select[multiple]')) {\n cleanup = process(element);\n }\n\n effect(() => {\n const v = value();\n\n /**\n * select[multiple] elements have value of first selected option,\n * but there could be more, setting value resets other selected options\n */\n if (element?.matches('select[multiple]')) {\n return;\n }\n\n if (element?.matches(':focus') && 'selectionStart' in element) {\n const {selectionStart, selectionEnd} = element;\n\n /**\n * After programmatic updates of input's value, caret is automatically placed at the end –\n * revert to the previous position\n */\n element.value = v;\n element.setSelectionRange(selectionStart, selectionEnd);\n } else if (element) {\n element.value = v;\n }\n }, options);\n\n return value;\n}\n\nfunction patch(prototype: WithValue): void {\n const {set} = Object.getOwnPropertyDescriptor(prototype, 'value')!;\n\n Object.defineProperty(prototype, 'value', {\n set(this: WithValue, detail: string) {\n const value = this.value;\n const event = new CustomEvent('tui-input', {detail, bubbles: true});\n\n set!.call(this, detail);\n\n if (value !== detail) {\n this.dispatchEvent(event);\n }\n },\n });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA;AACgB,SAAA,kBAAkB,CAAC,OAAa,EAAE,IAAU,EAAA;AACxD,IAAA,IAAI;AACA,QAAA,QACI,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;AACtB,YAAA,CAAC,EAAE,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,2BAA2B,CAAC;;AAElF,IAAA,MAAM;AACJ,QAAA,OAAO,KAAK;;AAEpB;;ACVM,SAAU,UAAU,CAAC,OAAgB,EAAA;AACvC,IAAA,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;AACnC;AAEM,SAAU,aAAa,CAAC,OAAgB,EAAA;AAC1C,IAAA,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;AACtC;AAEM,SAAU,cAAc,CAC1B,OAAgB,EAAA;I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
|
|
2
1
|
import { toSignal } from '@angular/core/rxjs-interop';
|
|
3
2
|
import { TUI_TRUE_HANDLER, TUI_FALSE_HANDLER, svgNodeFilter } from '@taiga-ui/cdk/constants';
|
|
4
3
|
import { tuiUntrackedScheduler } from '@taiga-ui/cdk/observables';
|
|
5
4
|
import { merge, fromEvent, map, observeOn } from 'rxjs';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Returns current active element, including shadow dom
|
|
9
|
-
*
|
|
10
|
-
* @return element or null
|
|
11
|
-
*/
|
|
12
|
-
function tuiGetFocused({ activeElement }) {
|
|
13
|
-
if (!activeElement?.shadowRoot) {
|
|
14
|
-
return activeElement;
|
|
15
|
-
}
|
|
16
|
-
let element = activeElement.shadowRoot.activeElement;
|
|
17
|
-
while (element?.shadowRoot) {
|
|
18
|
-
element = element.shadowRoot.activeElement;
|
|
19
|
-
}
|
|
20
|
-
return element;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Finds and blurs current active element, including shadow DOM
|
|
25
|
-
*/
|
|
26
|
-
function tuiBlurFocused(doc) {
|
|
27
|
-
const activeElement = tuiGetFocused(doc);
|
|
28
|
-
if (tuiIsHTMLElement(activeElement)) {
|
|
29
|
-
activeElement.blur();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
5
|
+
import { tuiIsHTMLElement } from '@taiga-ui/cdk/utils/dom';
|
|
32
6
|
|
|
33
7
|
function tuiFocusedIn(node) {
|
|
34
8
|
return toSignal(merge(fromEvent(node, 'focus', { capture: true }).pipe(map(TUI_TRUE_HANDLER)), fromEvent(node, 'blur', { capture: true }).pipe(map(TUI_FALSE_HANDLER))).pipe(observeOn(tuiUntrackedScheduler)), { initialValue: false });
|
|
@@ -40,8 +14,8 @@ function tuiFocusedIn(node) {
|
|
|
40
14
|
* be focused, for example element can have display: none applied to it or any other
|
|
41
15
|
* circumstances could prevent actual focus.
|
|
42
16
|
*/
|
|
43
|
-
function
|
|
44
|
-
if (element.
|
|
17
|
+
function tuiIsFocusable(element) {
|
|
18
|
+
if (element.matches(':disabled') || element.getAttribute('tabIndex') === '-1') {
|
|
45
19
|
return false;
|
|
46
20
|
}
|
|
47
21
|
if ((tuiIsHTMLElement(element) && element.isContentEditable) ||
|
|
@@ -66,34 +40,43 @@ function tuiIsKeyboardFocusable(element) {
|
|
|
66
40
|
}
|
|
67
41
|
}
|
|
68
42
|
|
|
69
|
-
function tuiIsMouseFocusable(element) {
|
|
70
|
-
return (!element.hasAttribute('disabled') &&
|
|
71
|
-
(element.getAttribute('tabIndex') === '-1' ||
|
|
72
|
-
tuiIsKeyboardFocusable(element)));
|
|
73
|
-
}
|
|
74
|
-
|
|
75
43
|
/**
|
|
76
44
|
* @description:
|
|
77
45
|
* Finds the closest element that can be focused with a keyboard or mouse in theory
|
|
78
46
|
*/
|
|
79
|
-
function tuiGetClosestFocusable({ initial, root, previous = false,
|
|
47
|
+
function tuiGetClosestFocusable({ initial, root, previous = false, }) {
|
|
80
48
|
if (!root.ownerDocument) {
|
|
81
49
|
return null;
|
|
82
50
|
}
|
|
83
|
-
const check = keyboard ? tuiIsKeyboardFocusable : tuiIsMouseFocusable;
|
|
84
51
|
const treeWalker = root.ownerDocument.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, svgNodeFilter);
|
|
85
52
|
treeWalker.currentNode = initial;
|
|
86
53
|
do {
|
|
87
54
|
if (tuiIsHTMLElement(treeWalker.currentNode)) {
|
|
88
55
|
initial = treeWalker.currentNode;
|
|
89
56
|
}
|
|
90
|
-
if (tuiIsHTMLElement(initial) &&
|
|
57
|
+
if (tuiIsHTMLElement(initial) && tuiIsFocusable(initial)) {
|
|
91
58
|
return initial;
|
|
92
59
|
}
|
|
93
60
|
} while (previous ? treeWalker.previousNode() : treeWalker.nextNode());
|
|
94
61
|
return null;
|
|
95
62
|
}
|
|
96
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Returns current active element, including shadow dom
|
|
66
|
+
*
|
|
67
|
+
* @return element or null
|
|
68
|
+
*/
|
|
69
|
+
function tuiGetFocused({ activeElement }) {
|
|
70
|
+
if (!activeElement?.shadowRoot) {
|
|
71
|
+
return activeElement;
|
|
72
|
+
}
|
|
73
|
+
let element = activeElement.shadowRoot.activeElement;
|
|
74
|
+
while (element?.shadowRoot) {
|
|
75
|
+
element = element.shadowRoot.activeElement;
|
|
76
|
+
}
|
|
77
|
+
return element;
|
|
78
|
+
}
|
|
79
|
+
|
|
97
80
|
/**
|
|
98
81
|
* Checks if element is focused.
|
|
99
82
|
*
|
|
@@ -141,5 +124,5 @@ function tuiMoveFocus(currentIndex, elements, step) {
|
|
|
141
124
|
* Generated bundle index. Do not edit.
|
|
142
125
|
*/
|
|
143
126
|
|
|
144
|
-
export {
|
|
127
|
+
export { tuiFocusedIn, tuiGetClosestFocusable, tuiGetFocused, tuiIsFocusable, tuiIsFocused, tuiIsFocusedIn, tuiMoveFocus };
|
|
145
128
|
//# sourceMappingURL=taiga-ui-cdk-utils-focus.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-cdk-utils-focus.mjs","sources":["../../../projects/cdk/utils/focus/get-native-focused.ts","../../../projects/cdk/utils/focus/blur-native-focused.ts","../../../projects/cdk/utils/focus/focused-in.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/taiga-ui-cdk-utils-focus.ts"],"sourcesContent":["/**\n * Returns current active element, including shadow dom\n *\n * @return element or null\n */\nexport function tuiGetFocused({activeElement}: Document): Element | null {\n if (!activeElement?.shadowRoot) {\n return activeElement;\n }\n\n let element = activeElement.shadowRoot.activeElement;\n\n while (element?.shadowRoot) {\n element = element.shadowRoot.activeElement;\n }\n\n return element;\n}\n\nexport {\n /**\n * @deprecated use {@link tuiGetFocused}\n */\n tuiGetFocused as tuiGetNativeFocused,\n};\n","import {tuiIsHTMLElement} from '@taiga-ui/cdk/utils/dom';\n\nimport {tuiGetFocused} from './get-native-focused';\n\n/**\n * Finds and blurs current active element, including shadow DOM\n */\nexport function tuiBlurFocused(doc: Document): void {\n const activeElement = tuiGetFocused(doc);\n\n if (tuiIsHTMLElement(activeElement)) {\n activeElement.blur();\n }\n}\n\nexport {\n /**\n * @deprecated use {@link tuiBlurFocused}\n */\n tuiBlurFocused as tuiBlurNativeFocused,\n};\n","import {type Signal} from '@angular/core';\nimport {toSignal} from '@angular/core/rxjs-interop';\nimport {TUI_FALSE_HANDLER, TUI_TRUE_HANDLER} from '@taiga-ui/cdk/constants';\nimport {tuiUntrackedScheduler} from '@taiga-ui/cdk/observables';\nimport {fromEvent, map, merge, observeOn} from 'rxjs';\n\nexport function tuiFocusedIn(node: Node): Signal<boolean> {\n return toSignal(\n merge(\n fromEvent(node, 'focus', {capture: true}).pipe(map(TUI_TRUE_HANDLER)),\n fromEvent(node, 'blur', {capture: true}).pipe(map(TUI_FALSE_HANDLER)),\n ).pipe(observeOn(tuiUntrackedScheduler)),\n {initialValue: false},\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 tuiIsKeyboardFocusable(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 'A':\n case 'LINK':\n return element.hasAttribute('href');\n case 'AUDIO':\n case 'VIDEO':\n return element.hasAttribute('controls');\n case 'BUTTON':\n case 'SELECT':\n case 'TEXTAREA':\n return true;\n case 'INPUT':\n return element.getAttribute('type') !== 'hidden';\n default:\n return false;\n }\n}\n\nexport {\n /**\n * @deprecated use {@link tuiIsNativeKeyboardFocusable}\n */\n tuiIsKeyboardFocusable as tuiIsNativeKeyboardFocusable,\n};\n","import {tuiIsNativeKeyboardFocusable} from './is-native-keyboard-focusable';\n\nexport function tuiIsMouseFocusable(element: Element): boolean {\n return (\n !element.hasAttribute('disabled') &&\n (element.getAttribute('tabIndex') === '-1' ||\n tuiIsNativeKeyboardFocusable(element))\n );\n}\n\nexport {\n /**\n * @deprecated use {@link tuiIsNativeMouseFocusable}\n */\n tuiIsMouseFocusable as tuiIsNativeMouseFocusable,\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 * determine if only keyboard focus is of interest\n */\n keyboard?: boolean;\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 * top Node limiting the search area\n */\n root: Node;\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 do {\n if (tuiIsHTMLElement(treeWalker.currentNode)) {\n initial = treeWalker.currentNode;\n }\n\n if (tuiIsHTMLElement(initial) && check(initial)) {\n return initial;\n }\n } while (previous ? treeWalker.previousNode() : treeWalker.nextNode());\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 tuiIsFocused(node?: Node | null): boolean {\n return (\n !!node?.ownerDocument &&\n tuiGetNativeFocused(node.ownerDocument) === node &&\n node.ownerDocument.hasFocus()\n );\n}\n\nexport {\n /**\n * @deprecated use {@link tuiIsFocused}\n */\n tuiIsFocused as tuiIsNativeFocused,\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 tuiIsFocusedIn(node?: Node | null): boolean {\n const focused = node?.ownerDocument && tuiGetNativeFocused(node.ownerDocument);\n\n return !!focused && node.contains(focused) && node.ownerDocument?.hasFocus();\n}\n\nexport {\n /**\n * @deprecated use {@link tuiIsFocusedIn}\n */\n tuiIsFocusedIn as tuiIsNativeFocusedIn,\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 * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["tuiIsNativeKeyboardFocusable","tuiIsNativeMouseFocusable","tuiGetNativeFocused","tuiIsNativeFocused"],"mappings":";;;;;;AAAA;;;;AAIG;AACa,SAAA,aAAa,CAAC,EAAC,aAAa,EAA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,IAAIC,YAAkB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,EAAE;YAC5C,OAAO;AACV,SAAA;QAED,YAAY,IAAI,IAAI,CAAC;AACxB,KAAA;AACL;;ACzBA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"taiga-ui-cdk-utils-focus.mjs","sources":["../../../projects/cdk/utils/focus/focused-in.ts","../../../projects/cdk/utils/focus/is-focusable.ts","../../../projects/cdk/utils/focus/get-closest-focusable.ts","../../../projects/cdk/utils/focus/get-focused.ts","../../../projects/cdk/utils/focus/is-focused.ts","../../../projects/cdk/utils/focus/is-focused-in.ts","../../../projects/cdk/utils/focus/move-focus.ts","../../../projects/cdk/utils/focus/taiga-ui-cdk-utils-focus.ts"],"sourcesContent":["import {type Signal} from '@angular/core';\nimport {toSignal} from '@angular/core/rxjs-interop';\nimport {TUI_FALSE_HANDLER, TUI_TRUE_HANDLER} from '@taiga-ui/cdk/constants';\nimport {tuiUntrackedScheduler} from '@taiga-ui/cdk/observables';\nimport {fromEvent, map, merge, observeOn} from 'rxjs';\n\nexport function tuiFocusedIn(node: Node): Signal<boolean> {\n return toSignal(\n merge(\n fromEvent(node, 'focus', {capture: true}).pipe(map(TUI_TRUE_HANDLER)),\n fromEvent(node, 'blur', {capture: true}).pipe(map(TUI_FALSE_HANDLER)),\n ).pipe(observeOn(tuiUntrackedScheduler)),\n {initialValue: false},\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 tuiIsFocusable(element: Element): boolean {\n if (element.matches(':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 'A':\n case 'LINK':\n return element.hasAttribute('href');\n case 'AUDIO':\n case 'VIDEO':\n return element.hasAttribute('controls');\n case 'BUTTON':\n case 'SELECT':\n case 'TEXTAREA':\n return true;\n case 'INPUT':\n return element.getAttribute('type') !== 'hidden';\n default:\n return false;\n }\n}\n","import {svgNodeFilter} from '@taiga-ui/cdk/constants';\nimport {tuiIsHTMLElement} from '@taiga-ui/cdk/utils/dom';\n\nimport {tuiIsFocusable} from './is-focusable';\n\nexport interface TuiGetClosestFocusableOptions {\n /**\n * @description:\n * current HTML element\n */\n initial: Element;\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 * top Node limiting the search area\n */\n root: Node;\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}: TuiGetClosestFocusableOptions): HTMLElement | null {\n if (!root.ownerDocument) {\n return null;\n }\n\n const treeWalker = root.ownerDocument.createTreeWalker(\n root,\n NodeFilter.SHOW_ELEMENT,\n svgNodeFilter,\n );\n\n treeWalker.currentNode = initial;\n\n do {\n if (tuiIsHTMLElement(treeWalker.currentNode)) {\n initial = treeWalker.currentNode;\n }\n\n if (tuiIsHTMLElement(initial) && tuiIsFocusable(initial)) {\n return initial;\n }\n } while (previous ? treeWalker.previousNode() : treeWalker.nextNode());\n\n return null;\n}\n","/**\n * Returns current active element, including shadow dom\n *\n * @return element or null\n */\nexport function tuiGetFocused({activeElement}: Document): Element | null {\n if (!activeElement?.shadowRoot) {\n return activeElement;\n }\n\n let element = activeElement.shadowRoot.activeElement;\n\n while (element?.shadowRoot) {\n element = element.shadowRoot.activeElement;\n }\n\n return element;\n}\n","import {tuiGetFocused} from './get-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 tuiIsFocused(node?: Node | null): boolean {\n return (\n !!node?.ownerDocument &&\n tuiGetFocused(node.ownerDocument) === node &&\n node.ownerDocument.hasFocus()\n );\n}\n","import {tuiGetFocused} from './get-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 tuiIsFocusedIn(node?: Node | null): boolean {\n const focused = node?.ownerDocument && tuiGetFocused(node.ownerDocument);\n\n return !!focused && node.contains(focused) && node.ownerDocument?.hasFocus();\n}\n","import {tuiIsFocused} from './is-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 (tuiIsFocused(elements[currentIndex])) {\n return;\n }\n\n currentIndex += step;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAMM,SAAU,YAAY,CAAC,IAAU,EAAA;AACnC,IAAA,OAAO,QAAQ,CACX,KAAK,CACD,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,EACrE,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CACxE,CAAC,IAAI,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC,EACxC,EAAC,YAAY,EAAE,KAAK,EAAC,CACxB;AACL;;ACZA;;;;;AAKG;AACG,SAAU,cAAc,CAAC,OAAgB,EAAA;AAC3C,IAAA,IAAI,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,OAAO,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AY,CAAC,CAAC,EAAE;YACtC;;QAGJ,YAAY,IAAI,IAAI;;AAE5B;;ACzBA;;AAEG;;;;"}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
/// <reference types="@taiga-ui/tsconfig/ng-dev-mode" />
|
|
2
2
|
/**
|
|
3
3
|
* Clamps a value between two inclusive limits
|
|
4
|
-
*
|
|
5
|
-
* @param value
|
|
6
|
-
* @param min lower limit
|
|
7
|
-
* @param max upper limit
|
|
8
4
|
*/
|
|
9
|
-
function tuiClamp(value,
|
|
5
|
+
function tuiClamp(value, minimum, maximum) {
|
|
10
6
|
ngDevMode && console.assert(!Number.isNaN(value));
|
|
11
|
-
ngDevMode && console.assert(!Number.isNaN(
|
|
12
|
-
ngDevMode && console.assert(!Number.isNaN(
|
|
13
|
-
ngDevMode && console.assert(
|
|
14
|
-
|
|
7
|
+
ngDevMode && console.assert(!Number.isNaN(minimum));
|
|
8
|
+
ngDevMode && console.assert(!Number.isNaN(maximum));
|
|
9
|
+
ngDevMode && maximum && minimum && console.assert(maximum >= minimum);
|
|
10
|
+
const minClamped = max(minimum ?? value, value);
|
|
11
|
+
return min(maximum ?? minClamped, minClamped);
|
|
12
|
+
}
|
|
13
|
+
function min(x, ...values) {
|
|
14
|
+
return values.reduce((a, b) => (a < b ? a : b), x);
|
|
15
|
+
}
|
|
16
|
+
function max(x, ...values) {
|
|
17
|
+
return values.reduce((a, b) => (a > b ? a : b), x);
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
/// <reference types="@taiga-ui/tsconfig/ng-dev-mode" />
|
|
@@ -126,20 +129,9 @@ function tuiToInt(bool) {
|
|
|
126
129
|
return bool ? 1 : 0;
|
|
127
130
|
}
|
|
128
131
|
|
|
129
|
-
function tuiToInteger(value) {
|
|
130
|
-
return parseInt(value, 10);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Converts angle in degrees to radians
|
|
135
|
-
*/
|
|
136
|
-
function tuiToRadians(deg) {
|
|
137
|
-
return (deg * Math.PI) / 180;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
132
|
/**
|
|
141
133
|
* Generated bundle index. Do not edit.
|
|
142
134
|
*/
|
|
143
135
|
|
|
144
|
-
export { tuiCeil, tuiClamp, tuiFloor, tuiInRange, tuiIsSafeToRound, tuiNormalizeToIntNumber, tuiQuantize, tuiRound, tuiRoundWith, tuiSum, tuiToInt,
|
|
136
|
+
export { tuiCeil, tuiClamp, tuiFloor, tuiInRange, tuiIsSafeToRound, tuiNormalizeToIntNumber, tuiQuantize, tuiRound, tuiRoundWith, tuiSum, tuiToInt, tuiTrunc };
|
|
145
137
|
//# sourceMappingURL=taiga-ui-cdk-utils-math.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-cdk-utils-math.mjs","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/round-with.ts","../../../projects/cdk/utils/math/sum.ts","../../../projects/cdk/utils/math/to-int.ts","../../../projects/cdk/utils/math/to-integer.ts","../../../projects/cdk/utils/math/to-radians.ts","../../../projects/cdk/utils/math/taiga-ui-cdk-utils-math.ts"],"sourcesContent":["/// <reference types=\"@taiga-ui/tsconfig/ng-dev-mode\" />\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 ngDevMode && console.assert(!Number.isNaN(value));\n ngDevMode && console.assert(!Number.isNaN(min));\n ngDevMode && console.assert(!Number.isNaN(max));\n ngDevMode && console.assert(max >= min);\n\n return Math.min(max, Math.max(min, value));\n}\n","/// <reference types=\"@taiga-ui/tsconfig/ng-dev-mode\" />\n\nexport function tuiInRange(\n value: number,\n fromInclude: number,\n toExclude: number,\n): boolean {\n ngDevMode && console.assert(!Number.isNaN(value));\n ngDevMode && console.assert(!Number.isNaN(fromInclude));\n ngDevMode && console.assert(!Number.isNaN(toExclude));\n ngDevMode && console.assert(fromInclude < toExclude);\n\n return value >= fromInclude && value < toExclude;\n}\n","/// <reference types=\"@taiga-ui/tsconfig/ng-dev-mode\" />\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 ngDevMode && console.assert(Number.isInteger(min));\n ngDevMode && console.assert(Number.isInteger(max));\n ngDevMode && console.assert(min <= max);\n\n if (Number.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","/// <reference types=\"@taiga-ui/tsconfig/ng-dev-mode\" />\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 ngDevMode && console.assert(Number.isFinite(value));\n ngDevMode && console.assert(Number.isFinite(quantum));\n ngDevMode && console.assert(quantum > 0);\n\n const remainder = value % quantum;\n\n return remainder < quantum / 2 ? value - remainder : value + quantum - remainder;\n}\n","/// <reference types=\"@taiga-ui/tsconfig/ng-dev-mode\" />\n\nconst MAX_PRECISION = 292;\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 ngDevMode && console.assert(!Number.isNaN(value), 'Value must be number');\n ngDevMode && console.assert(Number.isInteger(precision), 'Precision must be integer');\n\n precision = Math.min(precision, MAX_PRECISION);\n\n const [significand, exponent = ''] = `${value}`.split('e');\n const roundedInt = func(Number(`${significand}e${Number(exponent) + precision}`));\n\n /**\n * TODO: use BigInt after bumping Safari to 14+\n */\n ngDevMode &&\n console.assert(\n Number.isSafeInteger(roundedInt),\n 'Impossible to correctly round such a large number',\n );\n\n const processedPair = `${roundedInt}e`.split('e');\n\n return Number(`${processedPair[0]}e${Number(processedPair[1]) - precision}`);\n}\n\nexport function tuiRound(value: number, precision = 0): number {\n return calculate(value, precision, Math.round);\n}\n\nexport function tuiCeil(value: number, precision = 0): number {\n return calculate(value, precision, Math.ceil);\n}\n\nexport function tuiFloor(value: number, precision = 0): number {\n return calculate(value, precision, Math.floor);\n}\n\nexport function tuiTrunc(value: number, precision = 0): number {\n return calculate(value, precision, Math.trunc);\n}\n\nexport function tuiIsSafeToRound(value: number, precision = 0): boolean {\n return Number.isSafeInteger(Math.trunc(value * 10 ** precision));\n}\n","import {type TuiRounding} from '@taiga-ui/cdk/types';\n\nimport {tuiCeil, tuiFloor, tuiRound, tuiTrunc} from './round';\n\nexport function tuiRoundWith({\n value,\n precision,\n method,\n}: {\n method: TuiRounding;\n precision: number;\n value: number;\n}): number {\n switch (method) {\n case 'ceil':\n return tuiCeil(value, precision);\n case 'floor':\n return tuiFloor(value, precision);\n case 'round':\n return tuiRound(value, precision);\n default:\n return tuiTrunc(value, precision);\n }\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): 0 | 1 {\n return bool ? 1 : 0;\n}\n","export function tuiToInteger(value: number | string): number {\n return parseInt(value as unknown as string, 10);\n}\n","/**\n * Converts angle in degrees to radians\n */\nexport function tuiToRadians(deg: number): number {\n return (deg * Math.PI) / 180;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAAA;AAEA;;;;;;AAMG;SACa,QAAQ,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW,EAAA;AAC5D,IAAA,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAA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}
|
|
1
|
+
{"version":3,"file":"taiga-ui-cdk-utils-math.mjs","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/round-with.ts","../../../projects/cdk/utils/math/sum.ts","../../../projects/cdk/utils/math/to-int.ts","../../../projects/cdk/utils/math/taiga-ui-cdk-utils-math.ts"],"sourcesContent":["/// <reference types=\"@taiga-ui/tsconfig/ng-dev-mode\" />\n\n/**\n * Clamps a value between two inclusive limits\n */\nexport function tuiClamp<T extends bigint | number>(\n value: T,\n minimum: T | null,\n maximum?: T | null,\n): T {\n ngDevMode && console.assert(!Number.isNaN(value));\n ngDevMode && console.assert(!Number.isNaN(minimum));\n ngDevMode && console.assert(!Number.isNaN(maximum));\n ngDevMode && maximum && minimum && console.assert(maximum >= minimum);\n\n const minClamped = max(minimum ?? value, value);\n\n return min(maximum ?? minClamped, minClamped);\n}\n\nfunction min<T extends bigint | number>(x: T, ...values: T[]): T {\n return values.reduce((a, b) => (a < b ? a : b), x);\n}\n\nfunction max<T extends bigint | number>(x: T, ...values: T[]): T {\n return values.reduce((a, b) => (a > b ? a : b), x);\n}\n","/// <reference types=\"@taiga-ui/tsconfig/ng-dev-mode\" />\n\nexport function tuiInRange(\n value: number,\n fromInclude: number,\n toExclude: number,\n): boolean {\n ngDevMode && console.assert(!Number.isNaN(value));\n ngDevMode && console.assert(!Number.isNaN(fromInclude));\n ngDevMode && console.assert(!Number.isNaN(toExclude));\n ngDevMode && console.assert(fromInclude < toExclude);\n\n return value >= fromInclude && value < toExclude;\n}\n","/// <reference types=\"@taiga-ui/tsconfig/ng-dev-mode\" />\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 ngDevMode && console.assert(Number.isInteger(min));\n ngDevMode && console.assert(Number.isInteger(max));\n ngDevMode && console.assert(min <= max);\n\n if (Number.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","/// <reference types=\"@taiga-ui/tsconfig/ng-dev-mode\" />\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 ngDevMode && console.assert(Number.isFinite(value));\n ngDevMode && console.assert(Number.isFinite(quantum));\n ngDevMode && console.assert(quantum > 0);\n\n const remainder = value % quantum;\n\n return remainder < quantum / 2 ? value - remainder : value + quantum - remainder;\n}\n","/// <reference types=\"@taiga-ui/tsconfig/ng-dev-mode\" />\n\nconst MAX_PRECISION = 292;\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 ngDevMode && console.assert(!Number.isNaN(value), 'Value must be number');\n ngDevMode && console.assert(Number.isInteger(precision), 'Precision must be integer');\n\n precision = Math.min(precision, MAX_PRECISION);\n\n const [significand, exponent = ''] = `${value}`.split('e');\n const roundedInt = func(Number(`${significand}e${Number(exponent) + precision}`));\n\n /**\n * TODO: use BigInt after bumping Safari to 14+\n */\n ngDevMode &&\n console.assert(\n Number.isSafeInteger(roundedInt),\n 'Impossible to correctly round such a large number',\n );\n\n const processedPair = `${roundedInt}e`.split('e');\n\n return Number(`${processedPair[0]}e${Number(processedPair[1]) - precision}`);\n}\n\nexport function tuiRound(value: number, precision = 0): number {\n return calculate(value, precision, Math.round);\n}\n\nexport function tuiCeil(value: number, precision = 0): number {\n return calculate(value, precision, Math.ceil);\n}\n\nexport function tuiFloor(value: number, precision = 0): number {\n return calculate(value, precision, Math.floor);\n}\n\nexport function tuiTrunc(value: number, precision = 0): number {\n return calculate(value, precision, Math.trunc);\n}\n\nexport function tuiIsSafeToRound(value: number, precision = 0): boolean {\n return Number.isSafeInteger(Math.trunc(value * 10 ** precision));\n}\n","import {type TuiRounding} from '@taiga-ui/cdk/types';\n\nimport {tuiCeil, tuiFloor, tuiRound, tuiTrunc} from './round';\n\nexport function tuiRoundWith({\n value,\n precision,\n method,\n}: {\n method: TuiRounding;\n precision: number;\n value: number;\n}): number {\n switch (method) {\n case 'ceil':\n return tuiCeil(value, precision);\n case 'floor':\n return tuiFloor(value, precision);\n case 'round':\n return tuiRound(value, precision);\n default:\n return tuiTrunc(value, precision);\n }\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): 0 | 1 {\n return bool ? 1 : 0;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAAA;AAEA;;AAEG;SACa,QAAQ,CACpB,KAAQ,EACR,OAAiB,EACjB,OAAkB,EAAA;AAElB,IAAA,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACjD,IAAA,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACnD,IAAA,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACnD,IAAA,SAAS,IAAI,OAAO,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,OAAO,CAAC;IAErE,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,IAAI,KAAK,EAAE,KAAK,CAAC;IAE/C,OAAO,GAAG,CAAC,OAAO,IAAI,UAAU,EAAE,UAAU,CAAC;AACjD;AAEA,SAAS,GAAG,CAA4B,CAAI,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