@taiga-ui/cdk 3.0.0-rc.0 → 3.0.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/abstract/control.d.ts +2 -1
- package/abstract/dialog.service.d.ts +1 -1
- package/abstract/portal-host.d.ts +5 -3
- package/abstract/portal-service.d.ts +3 -2
- package/abstract/theme-switcher.d.ts +0 -1
- package/bundles/taiga-ui-cdk-abstract.umd.js +25 -16
- package/bundles/taiga-ui-cdk-abstract.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-classes.umd.js +0 -8
- package/bundles/taiga-ui-cdk-classes.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-components-dialog-host.umd.js +0 -1
- package/bundles/taiga-ui-cdk-components-dialog-host.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-components-dropdown-host.umd.js +3 -1
- package/bundles/taiga-ui-cdk-components-dropdown-host.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-constants.umd.js +18 -1
- package/bundles/taiga-ui-cdk-constants.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-date-time.umd.js +3 -29
- package/bundles/taiga-ui-cdk-date-time.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-active-zone.umd.js +5 -6
- package/bundles/taiga-ui-cdk-directives-active-zone.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-auto-focus.umd.js +8 -9
- package/bundles/taiga-ui-cdk-directives-auto-focus.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-autofilled.umd.js +1 -1
- package/bundles/taiga-ui-cdk-directives-autofilled.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-copy-processor.umd.js +0 -1
- package/bundles/taiga-ui-cdk-directives-copy-processor.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-drag.umd.js +1 -1
- package/bundles/taiga-ui-cdk-directives-drag.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-droppable.umd.js +5 -6
- package/bundles/taiga-ui-cdk-directives-droppable.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-focus-trap.umd.js +11 -9
- package/bundles/taiga-ui-cdk-directives-focus-trap.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-focus-visible.umd.js +0 -1
- package/bundles/taiga-ui-cdk-directives-focus-visible.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-focused.umd.js +1 -1
- package/bundles/taiga-ui-cdk-directives-focused.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-high-dpi.umd.js +0 -1
- package/bundles/taiga-ui-cdk-directives-high-dpi.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-hovered.umd.js +7 -10
- package/bundles/taiga-ui-cdk-directives-hovered.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-media.umd.js +4 -11
- package/bundles/taiga-ui-cdk-directives-media.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-overscroll.umd.js +10 -12
- package/bundles/taiga-ui-cdk-directives-overscroll.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-pan.umd.js +0 -1
- package/bundles/taiga-ui-cdk-directives-pan.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-pressed.umd.js +1 -1
- package/bundles/taiga-ui-cdk-directives-pressed.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-prevent-default.umd.js +1 -2
- package/bundles/taiga-ui-cdk-directives-prevent-default.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-repeat-times.umd.js +1 -1
- package/bundles/taiga-ui-cdk-directives-repeat-times.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-resize.umd.js +0 -1
- package/bundles/taiga-ui-cdk-directives-resize.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-swipe.umd.js +0 -1
- package/bundles/taiga-ui-cdk-directives-swipe.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-zoom.umd.js +0 -1
- package/bundles/taiga-ui-cdk-directives-zoom.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-observables.umd.js +20 -76
- package/bundles/taiga-ui-cdk-observables.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-pipes-keys.umd.js +68 -0
- package/bundles/taiga-ui-cdk-pipes-keys.umd.js.map +1 -0
- package/bundles/taiga-ui-cdk-pipes.umd.js +10 -4
- package/bundles/taiga-ui-cdk-pipes.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-services.umd.js +37 -72
- package/bundles/taiga-ui-cdk-services.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-tokens.umd.js +46 -20
- package/bundles/taiga-ui-cdk-tokens.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-browser.umd.js +3 -26
- package/bundles/taiga-ui-cdk-utils-browser.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-color.umd.js +81 -0
- package/bundles/taiga-ui-cdk-utils-color.umd.js.map +1 -0
- package/bundles/taiga-ui-cdk-utils-dom.umd.js +57 -87
- package/bundles/taiga-ui-cdk-utils-dom.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-focus.umd.js +24 -67
- package/bundles/taiga-ui-cdk-utils-focus.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-format.umd.js +0 -1
- package/bundles/taiga-ui-cdk-utils-format.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-math.umd.js +8 -48
- package/bundles/taiga-ui-cdk-utils-math.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-miscellaneous.umd.js +349 -84
- package/bundles/taiga-ui-cdk-utils-miscellaneous.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-os.umd.js +5 -21
- package/bundles/taiga-ui-cdk-utils-os.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-svg.umd.js +1 -5
- package/bundles/taiga-ui-cdk-utils-svg.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils.umd.js +10 -4
- package/bundles/taiga-ui-cdk-utils.umd.js.map +1 -1
- package/classes/assert.d.ts +0 -3
- package/constants/browser.d.ts +4 -0
- package/constants/index.d.ts +1 -0
- package/constants/unicode-chars.d.ts +8 -0
- package/constants/version.d.ts +1 -0
- package/constants/version.js +4 -0
- package/date-time/day-range.d.ts +0 -5
- package/date-time/day.d.ts +1 -2
- package/date-time/month.d.ts +1 -2
- package/date-time/year.d.ts +1 -1
- package/directives/auto-focus/autofocus.directive.d.ts +2 -2
- package/directives/focus-visible/focus-visible.directive.d.ts +0 -1
- package/directives/high-dpi/high-dpi.directive.d.ts +0 -1
- package/directives/media/media.directive.d.ts +0 -2
- package/directives/overscroll/overscroll.directive.d.ts +0 -1
- package/directives/prevent-default/prevent-default.directive.d.ts +0 -1
- package/esm2015/abstract/control.js +7 -1
- package/esm2015/abstract/dialog.service.js +1 -1
- package/esm2015/abstract/portal-host.js +18 -15
- package/esm2015/abstract/portal-service.js +4 -4
- package/esm2015/abstract/theme-switcher.js +1 -2
- package/esm2015/classes/assert.js +1 -8
- package/esm2015/components/dialog-host/dialog-host.component.js +1 -2
- package/esm2015/components/dropdown-host/dropdown-host.component.js +4 -2
- package/esm2015/constants/browser.js +5 -1
- package/esm2015/constants/index.js +2 -1
- package/esm2015/constants/parent-animation.js +2 -2
- package/esm2015/constants/unicode-chars.js +9 -1
- package/esm2015/constants/version.js +2 -0
- package/esm2015/date-time/day-range.js +1 -6
- package/esm2015/date-time/day.js +2 -9
- package/esm2015/date-time/month.js +2 -8
- package/esm2015/date-time/year.js +2 -6
- package/esm2015/directives/active-zone/active-zone.directive.js +3 -6
- package/esm2015/directives/auto-focus/autofocus.directive.js +6 -5
- package/esm2015/directives/auto-focus/handlers/ios.handler.js +1 -2
- package/esm2015/directives/autofilled/autofilled-style.component.js +1 -1
- package/esm2015/directives/copy-processor/copy-processor.directive.js +1 -2
- package/esm2015/directives/drag/drag.directive.js +3 -3
- package/esm2015/directives/droppable/droppable.directive.js +7 -8
- package/esm2015/directives/focus-trap/focus-trap.directive.js +14 -12
- package/esm2015/directives/focus-visible/focus-visible.directive.js +1 -2
- package/esm2015/directives/focused/focused.directive.js +3 -3
- package/esm2015/directives/high-dpi/high-dpi.directive.js +1 -2
- package/esm2015/directives/hovered/hovered.service.js +5 -8
- package/esm2015/directives/media/media.directive.js +5 -10
- package/esm2015/directives/overscroll/overscroll.directive.js +13 -15
- package/esm2015/directives/pan/pan.directive.js +1 -2
- package/esm2015/directives/pressed/pressed.directive.js +3 -3
- package/esm2015/directives/prevent-default/prevent-default.directive.js +3 -4
- package/esm2015/directives/repeat-times/repeat-times.directive.js +3 -3
- package/esm2015/directives/resize/resize.directive.js +1 -2
- package/esm2015/directives/swipe/swipe.directive.js +1 -2
- package/esm2015/directives/zoom/zoom.directive.js +1 -2
- package/esm2015/observables/drag-and-drop-from.js +6 -11
- package/esm2015/observables/focus-visible-observable.js +7 -12
- package/esm2015/observables/items-query-list-observable.js +4 -7
- package/esm2015/observables/mouse-drag-finish-from.js +4 -7
- package/esm2015/observables/must-be-present.js +4 -9
- package/esm2015/observables/pressed-observable.js +5 -10
- package/esm2015/observables/prevent-default.js +2 -7
- package/esm2015/observables/stop-propagation.js +2 -7
- package/esm2015/observables/typed-from-event.js +2 -7
- package/esm2015/observables/watch.js +2 -7
- package/esm2015/pipes/index.js +2 -1
- package/esm2015/pipes/keys/index.js +3 -0
- package/esm2015/pipes/keys/keys.module.js +16 -0
- package/esm2015/pipes/keys/keys.pipe.js +14 -0
- package/esm2015/pipes/keys/taiga-ui-cdk-pipes-keys.js +5 -0
- package/esm2015/services/directive-styles.service.js +3 -26
- package/esm2015/services/focus-visible.service.js +3 -4
- package/esm2015/services/obscured.service.js +3 -5
- package/esm2015/services/pan.service.js +6 -9
- package/esm2015/services/parents-scroll.service.js +3 -5
- package/esm2015/services/resize.service.js +1 -2
- package/esm2015/services/scroll.service.js +4 -5
- package/esm2015/services/swipe.service.js +6 -9
- package/esm2015/services/zoom.service.js +8 -9
- package/esm2015/tokens/active-element.js +16 -16
- package/esm2015/tokens/alerts.js +8 -1
- package/esm2015/tokens/dialogs.js +8 -1
- package/esm2015/tokens/focusable-item-accessor.js +7 -1
- package/esm2015/tokens/index.js +2 -2
- package/esm2015/tokens/is-apple.js +3 -3
- package/esm2015/tokens/is-cypress.js +1 -1
- package/esm2015/tokens/is-ios.js +3 -3
- package/esm2015/tokens/range.js +8 -0
- package/esm2015/tokens/window-height.js +3 -3
- package/esm2015/utils/browser/index.js +1 -2
- package/esm2015/utils/browser/is-edge.js +2 -7
- package/esm2015/utils/browser/is-firefox.js +2 -7
- package/esm2015/utils/browser/is-safari.js +2 -7
- package/esm2015/utils/color/hex-to-rgb.js +12 -0
- package/esm2015/utils/color/hsv-to-rgb.js +11 -0
- package/esm2015/utils/color/index.js +6 -0
- package/esm2015/utils/color/parse-color.js +27 -0
- package/esm2015/utils/color/rgb-to-hex.js +4 -0
- package/esm2015/utils/color/rgb-to-hsv.js +7 -0
- package/esm2015/utils/color/taiga-ui-cdk-utils-color.js +5 -0
- package/esm2015/utils/dom/can-scroll.js +2 -7
- package/esm2015/utils/dom/contains-or-after.js +2 -7
- package/esm2015/utils/dom/element-checks.js +21 -0
- package/esm2015/utils/dom/get-actual-target.js +2 -5
- package/esm2015/utils/dom/get-clipboard-data-text.js +2 -5
- package/esm2015/utils/dom/get-document-or-shadow-root.js +2 -7
- package/esm2015/utils/dom/get-element-obscurers.js +14 -17
- package/esm2015/utils/dom/get-element-offset.js +4 -7
- package/esm2015/utils/dom/get-scroll-parent.js +3 -6
- package/esm2015/utils/dom/get-selected-text.js +3 -3
- package/esm2015/utils/dom/index.js +3 -2
- package/esm2015/utils/dom/is-current-target.js +2 -7
- package/esm2015/utils/dom/is-element-editable.js +5 -0
- package/esm2015/utils/dom/is-inside-iframe.js +2 -5
- package/esm2015/utils/dom/is-node-in.js +5 -7
- package/esm2015/utils/focus/blur-native-focused.js +4 -7
- package/esm2015/utils/focus/get-closest-focusable.js +26 -0
- package/esm2015/utils/focus/get-native-focused.js +3 -3
- package/esm2015/utils/focus/index.js +2 -3
- package/esm2015/utils/focus/is-native-focused-in.js +1 -2
- package/esm2015/utils/focus/is-native-focused.js +1 -2
- package/esm2015/utils/focus/is-native-keyboard-focusable.js +3 -3
- package/esm2015/utils/focus/is-native-mouse-focusable.js +1 -4
- package/esm2015/utils/focus/move-focus.js +2 -4
- package/esm2015/utils/focus/set-native-mouse-focused.js +8 -7
- package/esm2015/utils/format/px.js +1 -2
- package/esm2015/utils/index.js +2 -1
- package/esm2015/utils/math/clamp.js +2 -5
- package/esm2015/utils/math/quantize.js +2 -5
- package/esm2015/utils/math/round.js +4 -19
- package/esm2015/utils/math/sum.js +2 -5
- package/esm2015/utils/math/to-int.js +2 -7
- package/esm2015/utils/math/to-radians.js +2 -5
- package/esm2015/utils/miscellaneous/array-remove.js +4 -0
- package/esm2015/utils/miscellaneous/array-toggle.js +6 -0
- package/esm2015/utils/miscellaneous/distance-between-touches.js +2 -7
- package/esm2015/utils/miscellaneous/ease-in-out-quad.js +2 -7
- package/esm2015/utils/miscellaneous/flat-length.js +2 -5
- package/esm2015/utils/miscellaneous/get-original-array-from-query-list.js +2 -5
- package/esm2015/utils/miscellaneous/get-swipe-direction.js +2 -7
- package/esm2015/utils/miscellaneous/index.js +3 -3
- package/esm2015/utils/miscellaneous/is-number.js +2 -7
- package/esm2015/utils/miscellaneous/is-present.js +2 -7
- package/esm2015/utils/miscellaneous/mark-control-as-touched-and-validate.js +4 -9
- package/esm2015/utils/miscellaneous/uniq-by.js +2 -7
- package/esm2015/utils/os/is-apple-platform.js +2 -5
- package/esm2015/utils/os/is-apple.js +4 -9
- package/esm2015/utils/os/is-ios.js +4 -9
- package/esm2015/utils/svg/svg-linear-gradient-processor.js +2 -5
- package/fesm2015/taiga-ui-cdk-abstract.js +26 -18
- package/fesm2015/taiga-ui-cdk-abstract.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-classes.js +1 -8
- package/fesm2015/taiga-ui-cdk-classes.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-components-dialog-host.js +0 -1
- package/fesm2015/taiga-ui-cdk-components-dialog-host.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-components-dropdown-host.js +3 -1
- package/fesm2015/taiga-ui-cdk-components-dropdown-host.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-constants.js +16 -2
- package/fesm2015/taiga-ui-cdk-constants.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-date-time.js +4 -26
- package/fesm2015/taiga-ui-cdk-date-time.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-active-zone.js +2 -5
- package/fesm2015/taiga-ui-cdk-directives-active-zone.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-auto-focus.js +5 -5
- package/fesm2015/taiga-ui-cdk-directives-auto-focus.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-autofilled.js +1 -1
- package/fesm2015/taiga-ui-cdk-directives-autofilled.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-copy-processor.js +0 -1
- package/fesm2015/taiga-ui-cdk-directives-copy-processor.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-drag.js +2 -2
- package/fesm2015/taiga-ui-cdk-directives-drag.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-droppable.js +6 -7
- package/fesm2015/taiga-ui-cdk-directives-droppable.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-focus-trap.js +13 -11
- package/fesm2015/taiga-ui-cdk-directives-focus-trap.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-focus-visible.js +0 -1
- package/fesm2015/taiga-ui-cdk-directives-focus-visible.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-focused.js +2 -2
- package/fesm2015/taiga-ui-cdk-directives-focused.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-high-dpi.js +0 -1
- package/fesm2015/taiga-ui-cdk-directives-high-dpi.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-hovered.js +4 -7
- package/fesm2015/taiga-ui-cdk-directives-hovered.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-media.js +5 -10
- package/fesm2015/taiga-ui-cdk-directives-media.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-overscroll.js +12 -14
- package/fesm2015/taiga-ui-cdk-directives-overscroll.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-pan.js +0 -1
- package/fesm2015/taiga-ui-cdk-directives-pan.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-pressed.js +2 -2
- package/fesm2015/taiga-ui-cdk-directives-pressed.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-prevent-default.js +2 -3
- package/fesm2015/taiga-ui-cdk-directives-prevent-default.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-repeat-times.js +2 -2
- package/fesm2015/taiga-ui-cdk-directives-repeat-times.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-resize.js +0 -1
- package/fesm2015/taiga-ui-cdk-directives-resize.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-swipe.js +0 -1
- package/fesm2015/taiga-ui-cdk-directives-swipe.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-zoom.js +0 -1
- package/fesm2015/taiga-ui-cdk-directives-zoom.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-observables.js +21 -67
- package/fesm2015/taiga-ui-cdk-observables.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-pipes-keys.js +34 -0
- package/fesm2015/taiga-ui-cdk-pipes-keys.js.map +1 -0
- package/fesm2015/taiga-ui-cdk-pipes.js +1 -0
- package/fesm2015/taiga-ui-cdk-pipes.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-services.js +25 -60
- package/fesm2015/taiga-ui-cdk-services.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-tokens.js +46 -23
- package/fesm2015/taiga-ui-cdk-tokens.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-browser.js +4 -23
- package/fesm2015/taiga-ui-cdk-utils-browser.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-color.js +67 -0
- package/fesm2015/taiga-ui-cdk-utils-color.js.map +1 -0
- package/fesm2015/taiga-ui-cdk-utils-dom.js +53 -78
- package/fesm2015/taiga-ui-cdk-utils-dom.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-focus.js +21 -57
- package/fesm2015/taiga-ui-cdk-utils-focus.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-format.js +0 -1
- package/fesm2015/taiga-ui-cdk-utils-format.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-math.js +9 -41
- package/fesm2015/taiga-ui-cdk-utils-math.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-miscellaneous.js +21 -73
- package/fesm2015/taiga-ui-cdk-utils-miscellaneous.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-os.js +6 -19
- package/fesm2015/taiga-ui-cdk-utils-os.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-svg.js +2 -5
- package/fesm2015/taiga-ui-cdk-utils-svg.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils.js +1 -0
- package/fesm2015/taiga-ui-cdk-utils.js.map +1 -1
- package/observables/drag-and-drop-from.d.ts +1 -5
- package/observables/focus-visible-observable.d.ts +1 -5
- package/observables/items-query-list-observable.d.ts +1 -3
- package/observables/mouse-drag-finish-from.d.ts +1 -3
- package/observables/must-be-present.d.ts +1 -5
- package/observables/pressed-observable.d.ts +1 -5
- package/observables/prevent-default.d.ts +1 -5
- package/observables/stop-propagation.d.ts +1 -5
- package/observables/typed-from-event.d.ts +5 -21
- package/observables/watch.d.ts +1 -5
- package/package.json +7 -3
- package/pipes/index.d.ts +1 -0
- package/pipes/keys/index.d.ts +2 -0
- package/pipes/keys/keys.module.d.ts +7 -0
- package/pipes/keys/keys.pipe.d.ts +7 -0
- package/pipes/keys/package.json +10 -0
- package/pipes/keys/taiga-ui-cdk-pipes-keys.d.ts +5 -0
- package/schematics/collection.json +6 -0
- package/schematics/constants/file-globs.d.ts +2 -0
- package/schematics/constants/file-globs.js +11 -0
- package/schematics/constants/index.d.ts +1 -0
- package/schematics/constants/index.js +4 -0
- package/schematics/constants/taiga-styles.d.ts +2 -1
- package/schematics/constants/taiga-styles.js +3 -2
- package/schematics/ng-add/constants/versions.js +2 -2
- package/schematics/ng-add/index.js +6 -0
- package/schematics/ng-add/schema.d.ts +8 -0
- package/schematics/ng-add/schema.json +9 -0
- package/schematics/ng-add/steps/add-taiga-icons.js +5 -3
- package/schematics/ng-add/steps/add-taiga-modules.js +4 -0
- package/schematics/ng-add/steps/add-taiga-styles.js +6 -3
- package/schematics/ng-add/steps/wrap-with-tui-root.js +3 -0
- package/schematics/ng-update/constants/breakpoints.d.ts +82 -0
- package/schematics/ng-update/constants/breakpoints.js +34 -0
- package/schematics/ng-update/constants/consts.d.ts +1 -1
- package/schematics/ng-update/constants/consts.js +170 -0
- package/schematics/ng-update/constants/deprecated-functions.js +1 -36
- package/schematics/ng-update/constants/services.js +1 -1
- package/schematics/ng-update/constants/templates.d.ts +16 -0
- package/schematics/ng-update/constants/templates.js +261 -1
- package/schematics/ng-update/constants/warnings.js +10 -0
- package/schematics/ng-update/index.js +21 -10
- package/schematics/ng-update/schema.json +13 -0
- package/schematics/ng-update/steps/migrate-date-time.js +45 -1
- package/schematics/ng-update/steps/migrate-progress.d.ts +1 -1
- package/schematics/ng-update/steps/migrate-progress.js +2 -1
- package/schematics/ng-update/steps/migrate-sliders/index.d.ts +1 -1
- package/schematics/ng-update/steps/migrate-sliders/index.js +2 -0
- package/schematics/ng-update/steps/migrate-sliders/migrate-input-range.d.ts +1 -1
- package/schematics/ng-update/steps/migrate-sliders/migrate-input-range.js +4 -3
- package/schematics/ng-update/steps/migrate-sliders/migrate-input-slider.d.ts +1 -1
- package/schematics/ng-update/steps/migrate-sliders/migrate-input-slider.js +3 -2
- package/schematics/ng-update/steps/migrate-taiga-proprietary-icons.d.ts +3 -0
- package/schematics/ng-update/steps/migrate-taiga-proprietary-icons.js +51 -0
- package/schematics/ng-update/steps/migrate-templates.d.ts +1 -1
- package/schematics/ng-update/steps/migrate-templates.js +77 -5
- package/schematics/ng-update/steps/replace-deep-import.js +2 -1
- package/schematics/ng-update/steps/replace-enums.js +2 -1
- package/schematics/ng-update/steps/replace-functions.js +42 -2
- package/schematics/ng-update/steps/replace-styles.d.ts +1 -0
- package/schematics/ng-update/steps/replace-styles.js +18 -0
- package/schematics/ng-update/steps/show-warnings.js +2 -1
- package/schematics/utils/add-import-to-closest-module.d.ts +1 -0
- package/schematics/utils/add-import-to-closest-module.js +18 -0
- package/schematics/utils/add-styles.d.ts +6 -2
- package/schematics/utils/add-styles.js +32 -4
- package/schematics/utils/angular/ng-component.d.ts +1 -2
- package/schematics/utils/angular/ng-module.d.ts +1 -2
- package/schematics/utils/angular/ng-module.js +2 -1
- package/schematics/utils/colored-log.d.ts +1 -0
- package/schematics/utils/colored-log.js +5 -1
- package/schematics/utils/get-execution-time.d.ts +1 -0
- package/schematics/utils/get-execution-time.js +8 -0
- package/schematics/utils/get-named-import-references.js +2 -1
- package/schematics/utils/get-project.d.ts +1 -1
- package/schematics/utils/get-project.js +0 -4
- package/schematics/utils/insert-todo.d.ts +1 -0
- package/schematics/utils/insert-todo.js +3 -2
- package/schematics/utils/progress.d.ts +1 -0
- package/schematics/utils/progress.js +13 -0
- package/schematics/utils/templates/get-component-templates.d.ts +1 -2
- package/schematics/utils/templates/get-component-templates.js +1 -1
- package/schematics/utils/templates/ng-component-input-manipulations.js +2 -12
- package/schematics/utils/templates/template-resource.d.ts +1 -1
- package/services/directive-styles.service.d.ts +2 -9
- package/services/focus-visible.service.d.ts +0 -1
- package/services/pan.service.d.ts +0 -3
- package/services/swipe.service.d.ts +0 -3
- package/tokens/alerts.d.ts +2 -1
- package/tokens/dialogs.d.ts +2 -1
- package/tokens/focusable-item-accessor.d.ts +2 -1
- package/tokens/index.d.ts +1 -1
- package/tokens/is-cypress.d.ts +0 -3
- package/tokens/range.d.ts +2 -0
- package/utils/browser/index.d.ts +0 -1
- package/utils/browser/is-edge.d.ts +1 -5
- package/utils/browser/is-firefox.d.ts +1 -5
- package/utils/browser/is-safari.d.ts +1 -5
- package/utils/color/hex-to-rgb.d.ts +1 -0
- package/utils/color/hsv-to-rgb.d.ts +4 -0
- package/utils/color/index.d.ts +5 -0
- package/utils/color/package.json +10 -0
- package/utils/color/parse-color.d.ts +1 -0
- package/utils/color/rgb-to-hex.d.ts +1 -0
- package/utils/color/rgb-to-hsv.d.ts +1 -0
- package/utils/color/taiga-ui-cdk-utils-color.d.ts +5 -0
- package/utils/dom/can-scroll.d.ts +1 -5
- package/utils/dom/contains-or-after.d.ts +1 -5
- package/utils/dom/element-checks.d.ts +6 -0
- package/utils/dom/get-actual-target.d.ts +1 -3
- package/utils/dom/get-clipboard-data-text.d.ts +1 -3
- package/utils/dom/get-document-or-shadow-root.d.ts +1 -5
- package/utils/dom/get-element-obscurers.d.ts +1 -3
- package/utils/dom/get-element-offset.d.ts +1 -3
- package/utils/dom/get-scroll-parent.d.ts +1 -3
- package/utils/dom/index.d.ts +2 -1
- package/utils/dom/is-current-target.d.ts +1 -5
- package/utils/dom/is-element-editable.d.ts +1 -0
- package/utils/dom/is-inside-iframe.d.ts +1 -3
- package/utils/dom/is-node-in.d.ts +1 -3
- package/utils/focus/blur-native-focused.d.ts +1 -3
- package/utils/focus/get-closest-focusable.d.ts +27 -0
- package/utils/focus/index.d.ts +1 -2
- package/utils/focus/is-native-mouse-focusable.d.ts +0 -2
- package/utils/focus/set-native-mouse-focused.d.ts +1 -3
- package/utils/index.d.ts +1 -0
- package/utils/math/clamp.d.ts +1 -3
- package/utils/math/quantize.d.ts +1 -3
- package/utils/math/round.d.ts +3 -15
- package/utils/math/sum.d.ts +1 -3
- package/utils/math/to-int.d.ts +1 -5
- package/utils/math/to-radians.d.ts +1 -3
- package/utils/miscellaneous/array-remove.d.ts +1 -0
- package/utils/miscellaneous/array-toggle.d.ts +1 -0
- package/utils/miscellaneous/distance-between-touches.d.ts +1 -5
- package/utils/miscellaneous/ease-in-out-quad.d.ts +1 -5
- package/utils/miscellaneous/flat-length.d.ts +1 -3
- package/utils/miscellaneous/get-original-array-from-query-list.d.ts +1 -3
- package/utils/miscellaneous/get-swipe-direction.d.ts +1 -5
- package/utils/miscellaneous/index.d.ts +2 -2
- package/utils/miscellaneous/is-number.d.ts +1 -5
- package/utils/miscellaneous/is-present.d.ts +1 -5
- package/utils/miscellaneous/mark-control-as-touched-and-validate.d.ts +1 -5
- package/utils/miscellaneous/uniq-by.d.ts +1 -5
- package/utils/os/is-apple-platform.d.ts +1 -3
- package/utils/os/is-apple.d.ts +1 -5
- package/utils/os/is-ios.d.ts +1 -5
- package/utils/svg/svg-linear-gradient-processor.d.ts +1 -3
- package/esm2015/tokens/sanitizer.js +0 -4
- package/esm2015/utils/browser/is-ie.js +0 -4
- package/esm2015/utils/dom/is-form-field.js +0 -8
- package/esm2015/utils/focus/get-closest-keyboard-focusable.js +0 -34
- package/esm2015/utils/focus/set-native-focused.js +0 -19
- package/esm2015/utils/miscellaneous/identity.js +0 -8
- package/esm2015/utils/miscellaneous/is-element-editable.js +0 -12
- package/tokens/sanitizer.d.ts +0 -2
- package/utils/browser/is-ie.d.ts +0 -1
- package/utils/dom/is-form-field.d.ts +0 -1
- package/utils/focus/get-closest-keyboard-focusable.d.ts +0 -10
- package/utils/focus/set-native-focused.d.ts +0 -10
- package/utils/miscellaneous/identity.d.ts +0 -4
- package/utils/miscellaneous/is-element-editable.d.ts +0 -5
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "taiga-ui-ng-update-v3",
|
|
4
|
+
"title": "Taiga UI ng-update v3",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"skip-deep-imports": {
|
|
8
|
+
"description": "Ignore deep imports replacements",
|
|
9
|
+
"type": "boolean",
|
|
10
|
+
"default": false
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -5,14 +5,19 @@ const ng_morph_1 = require("ng-morph");
|
|
|
5
5
|
const get_named_import_references_1 = require("../../utils/get-named-import-references");
|
|
6
6
|
const insert_todo_1 = require("../../utils/insert-todo");
|
|
7
7
|
const colored_log_1 = require("../../utils/colored-log");
|
|
8
|
+
const get_execution_time_1 = require("../../utils/get-execution-time");
|
|
8
9
|
function dateTimeMigrations() {
|
|
9
10
|
colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} migrating taiga date/time...`);
|
|
11
|
+
let start = performance.now();
|
|
10
12
|
migrateProperty({
|
|
11
13
|
namedImport: 'TuiDay',
|
|
12
14
|
moduleSpecifier: '@taiga-ui/cdk',
|
|
13
15
|
from: 'formattedDay',
|
|
14
16
|
callback: node => node.replaceWithText(node.getText().replace('formattedDay', 'getFormattedDay("DMY", ".")')),
|
|
15
17
|
});
|
|
18
|
+
colored_log_1.processLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.PROCESSING_SYMBOL}TuiDay.formattedDay ` +
|
|
19
|
+
`(${get_execution_time_1.getExecutionTime(start, performance.now())})`);
|
|
20
|
+
start = performance.now();
|
|
16
21
|
migrateProperty({
|
|
17
22
|
namedImport: 'TuiDayRange',
|
|
18
23
|
moduleSpecifier: '@taiga-ui/cdk',
|
|
@@ -21,6 +26,9 @@ function dateTimeMigrations() {
|
|
|
21
26
|
.getText()
|
|
22
27
|
.replace('formattedDayRange', 'getFormattedDayRange("DMY", ".")')),
|
|
23
28
|
});
|
|
29
|
+
colored_log_1.processLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.PROCESSING_SYMBOL}TuiDayRange.formattedDayRange ` +
|
|
30
|
+
`(${get_execution_time_1.getExecutionTime(start, performance.now())})`);
|
|
31
|
+
start = performance.now();
|
|
24
32
|
migrateProperty({
|
|
25
33
|
namedImport: 'TuiDayRange',
|
|
26
34
|
moduleSpecifier: '@taiga-ui/cdk',
|
|
@@ -32,6 +40,8 @@ function dateTimeMigrations() {
|
|
|
32
40
|
}
|
|
33
41
|
},
|
|
34
42
|
});
|
|
43
|
+
colored_log_1.processLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.PROCESSING_SYMBOL}TuiDayRange.normalizeParse ` +
|
|
44
|
+
`(${get_execution_time_1.getExecutionTime(start, performance.now())})`);
|
|
35
45
|
[
|
|
36
46
|
{
|
|
37
47
|
namedImport: 'TuiMonthRange',
|
|
@@ -69,12 +79,15 @@ function dateTimeMigrations() {
|
|
|
69
79
|
message: 'weeksRowsCount has been removed in 3.0. If you need this utils check out this pipe https://github.com/Tinkoff/taiga-ui/tree/main/projects/core/pipes/calendar-sheet',
|
|
70
80
|
},
|
|
71
81
|
].forEach(({ namedImport, field, message }) => {
|
|
82
|
+
start = performance.now();
|
|
72
83
|
migrateProperty({
|
|
73
84
|
namedImport,
|
|
74
85
|
moduleSpecifier: '@taiga-ui/cdk',
|
|
75
86
|
from: field,
|
|
76
87
|
callback: node => insertTodoBeforeNode(node, message),
|
|
77
88
|
});
|
|
89
|
+
colored_log_1.processLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.PROCESSING_SYMBOL}${namedImport}.${field} ` +
|
|
90
|
+
`(${get_execution_time_1.getExecutionTime(start, performance.now())})`);
|
|
78
91
|
});
|
|
79
92
|
colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} date/time migrated \n`);
|
|
80
93
|
}
|
|
@@ -118,12 +131,39 @@ function replaceIdentifier(node, from, callback) {
|
|
|
118
131
|
}
|
|
119
132
|
}
|
|
120
133
|
function replaceIdentifierReferences(identifier, from, callback) {
|
|
121
|
-
identifier
|
|
134
|
+
identifier
|
|
135
|
+
.findReferencesAsNodes()
|
|
136
|
+
/**
|
|
137
|
+
* `findReferencesAsNodes` has strange behavior.
|
|
138
|
+
* Imagine schematics run on the following file:
|
|
139
|
+
* ```
|
|
140
|
+
* class Dummy {
|
|
141
|
+
* var = 5;
|
|
142
|
+
* method1() {
|
|
143
|
+
* const {var} = this; // (1)
|
|
144
|
+
* return var; // (2)
|
|
145
|
+
* }
|
|
146
|
+
* method2() {
|
|
147
|
+
* const {var} = this; // (3)
|
|
148
|
+
* }
|
|
149
|
+
* }
|
|
150
|
+
* ```
|
|
151
|
+
* If `identifier` is equal to `var` from `method1` (1),
|
|
152
|
+
* then `identifier.findReferencesAsNodes` will return array with 2 references: (2) and (3).
|
|
153
|
+
*/
|
|
154
|
+
.filter(ref => !areBothObjectDestructuring(ref, identifier))
|
|
155
|
+
.forEach(ref => {
|
|
156
|
+
if (ref.wasForgotten()) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
122
159
|
let parent = ref.getParent();
|
|
123
160
|
if ((parent === null || parent === void 0 ? void 0 : parent.getText()) === `this.${identifier.getText()}` ||
|
|
124
161
|
(parent === null || parent === void 0 ? void 0 : parent.getText()) === identifier.getText()) {
|
|
125
162
|
replaceIdentifier(parent, from, callback);
|
|
126
163
|
}
|
|
164
|
+
if (parent === null || parent === void 0 ? void 0 : parent.wasForgotten()) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
127
167
|
if (parent === null || parent === void 0 ? void 0 : parent.getText().startsWith('this')) {
|
|
128
168
|
parent = parent === null || parent === void 0 ? void 0 : parent.getParent();
|
|
129
169
|
}
|
|
@@ -154,3 +194,7 @@ function insertTodoBeforeNode(node, message) {
|
|
|
154
194
|
insert_todo_1.insertTodo(identifier, message);
|
|
155
195
|
}
|
|
156
196
|
}
|
|
197
|
+
function areBothObjectDestructuring(ref, identifier) {
|
|
198
|
+
return Boolean(identifier.getFirstAncestorByKind(ng_morph_1.SyntaxKind.BindingElement) &&
|
|
199
|
+
ref.getFirstAncestorByKind(ng_morph_1.SyntaxKind.BindingElement));
|
|
200
|
+
}
|
|
@@ -6,11 +6,12 @@ const get_component_templates_1 = require("../../utils/templates/get-component-t
|
|
|
6
6
|
const elements_1 = require("../../utils/templates/elements");
|
|
7
7
|
const template_resource_1 = require("../../utils/templates/template-resource");
|
|
8
8
|
const colored_log_1 = require("../../utils/colored-log");
|
|
9
|
+
const constants_1 = require("../../constants");
|
|
9
10
|
exports.DEPRECATED_PROGRESS_PIPES_REG = /\s*\|\s*tuiProgressColorSegments(Async\s*\|\s*async)?/gi;
|
|
10
11
|
const PROPERTY_FOR_DEPRECATED_PIPES = '[color]';
|
|
11
12
|
function migrateProgress(fileSystem) {
|
|
12
13
|
colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} migrating progress bars...`);
|
|
13
|
-
const templateResources = get_component_templates_1.getComponentTemplates(
|
|
14
|
+
const templateResources = get_component_templates_1.getComponentTemplates(constants_1.ALL_TS_FILES);
|
|
14
15
|
for (const templateResource of templateResources) {
|
|
15
16
|
replaceProgressColorSegmentsPipe(templateResource, fileSystem);
|
|
16
17
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { DevkitFileSystem } from 'ng-morph
|
|
1
|
+
import { DevkitFileSystem } from 'ng-morph';
|
|
2
2
|
export declare function migrateSliders(fileSystem: DevkitFileSystem): void;
|
|
@@ -6,7 +6,9 @@ const migrate_input_range_1 = require("./migrate-input-range");
|
|
|
6
6
|
const colored_log_1 = require("../../../utils/colored-log");
|
|
7
7
|
function migrateSliders(fileSystem) {
|
|
8
8
|
colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} migrating sliders...`);
|
|
9
|
+
colored_log_1.processLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.PROCESSING_SYMBOL}InputSlider...`);
|
|
9
10
|
migrate_input_slider_1.migrateInputSlider(fileSystem);
|
|
11
|
+
colored_log_1.processLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.PROCESSING_SYMBOL}InputRange...`);
|
|
10
12
|
migrate_input_range_1.migrateInputRange(fileSystem);
|
|
11
13
|
colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} sliders migrated \n`);
|
|
12
14
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { DevkitFileSystem } from 'ng-morph
|
|
1
|
+
import { DevkitFileSystem } from 'ng-morph';
|
|
2
2
|
export declare function migrateInputRange(fileSystem: DevkitFileSystem): void;
|
|
@@ -6,10 +6,11 @@ const ng_component_input_manipulations_1 = require("../../../utils/templates/ng-
|
|
|
6
6
|
const ng_morph_1 = require("ng-morph");
|
|
7
7
|
const ng_component_1 = require("../../../utils/angular/ng-component");
|
|
8
8
|
const add_unique_import_1 = require("../../../utils/add-unique-import");
|
|
9
|
+
const constants_1 = require("../../../constants");
|
|
9
10
|
const MIN_LABELS_MIGRATION_METHOD_NAME = 'tuiMigrationInputRangeMinLabel';
|
|
10
11
|
const MAX_LABELS_MIGRATION_METHOD_NAME = 'tuiMigrationInputRangeMaxLabel';
|
|
11
12
|
function migrateInputRange(fileSystem) {
|
|
12
|
-
const templateResources = get_component_templates_1.getComponentTemplates(
|
|
13
|
+
const templateResources = get_component_templates_1.getComponentTemplates(constants_1.ALL_TS_FILES);
|
|
13
14
|
const COMPONENTS_WITH_MIN_LABELS = new Set();
|
|
14
15
|
const COMPONENTS_WITH_MAX_LABELS = new Set();
|
|
15
16
|
for (const templateResource of templateResources) {
|
|
@@ -17,7 +18,7 @@ function migrateInputRange(fileSystem) {
|
|
|
17
18
|
replaceMaxLabel(templateResource, fileSystem, COMPONENTS_WITH_MAX_LABELS);
|
|
18
19
|
}
|
|
19
20
|
save(fileSystem);
|
|
20
|
-
for (const componentPath of COMPONENTS_WITH_MIN_LABELS) {
|
|
21
|
+
for (const componentPath of Array.from(COMPONENTS_WITH_MIN_LABELS)) {
|
|
21
22
|
addMinMaxLabelMethod(componentPath, MIN_LABELS_MIGRATION_METHOD_NAME, [
|
|
22
23
|
'const currentValue = context.$implicit;',
|
|
23
24
|
'const minValue = 0; // TODO: (Taiga UI migration) replace with the MIN value of the input-range',
|
|
@@ -26,7 +27,7 @@ function migrateInputRange(fileSystem) {
|
|
|
26
27
|
'return String(currentValue);',
|
|
27
28
|
]);
|
|
28
29
|
}
|
|
29
|
-
for (const componentPath of COMPONENTS_WITH_MAX_LABELS) {
|
|
30
|
+
for (const componentPath of Array.from(COMPONENTS_WITH_MAX_LABELS)) {
|
|
30
31
|
addMinMaxLabelMethod(componentPath, MAX_LABELS_MIGRATION_METHOD_NAME, [
|
|
31
32
|
'const currentValue = context.$implicit;',
|
|
32
33
|
'const maxValue = 100; // TODO: (Taiga UI migration) replace with the MAX value of the input',
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { DevkitFileSystem } from 'ng-morph
|
|
1
|
+
import { DevkitFileSystem } from 'ng-morph';
|
|
2
2
|
export declare function migrateInputSlider(fileSystem: DevkitFileSystem): void;
|
|
@@ -7,8 +7,9 @@ const ng_component_1 = require("../../../utils/angular/ng-component");
|
|
|
7
7
|
const add_unique_import_1 = require("../../../utils/add-unique-import");
|
|
8
8
|
const get_component_templates_1 = require("../../../utils/templates/get-component-templates");
|
|
9
9
|
const elements_1 = require("../../../utils/templates/elements");
|
|
10
|
+
const constants_1 = require("../../../constants");
|
|
10
11
|
function migrateInputSlider(fileSystem) {
|
|
11
|
-
const templateResources = get_component_templates_1.getComponentTemplates(
|
|
12
|
+
const templateResources = get_component_templates_1.getComponentTemplates(constants_1.ALL_TS_FILES);
|
|
12
13
|
const COMPONENTS_WITH_MIN_MAX_LABELS = new Set();
|
|
13
14
|
for (const templateResource of templateResources) {
|
|
14
15
|
replaceMinMaxLabels(templateResource, fileSystem, COMPONENTS_WITH_MIN_MAX_LABELS);
|
|
@@ -20,7 +21,7 @@ function migrateInputSlider(fileSystem) {
|
|
|
20
21
|
fileSystem.commitEdits();
|
|
21
22
|
ng_morph_1.saveActiveProject();
|
|
22
23
|
ng_morph_1.setActiveProject(ng_morph_1.createProject(fileSystem.tree, '/', '**/**'));
|
|
23
|
-
for (const componentPath of COMPONENTS_WITH_MIN_MAX_LABELS) {
|
|
24
|
+
for (const componentPath of Array.from(COMPONENTS_WITH_MIN_MAX_LABELS)) {
|
|
24
25
|
addMinMaxLabelMethod(componentPath);
|
|
25
26
|
}
|
|
26
27
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.migrateTaigaProprietaryIcons = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
6
|
+
const get_project_target_options_1 = require("../../utils/get-project-target-options");
|
|
7
|
+
const get_project_1 = require("../../utils/get-project");
|
|
8
|
+
const ng_morph_1 = require("ng-morph");
|
|
9
|
+
const PROPRIETARY_TDS_ICON_ASSETS = {
|
|
10
|
+
glob: '**/*',
|
|
11
|
+
input: 'node_modules/@taiga-ui/proprietary-tds-icons/src',
|
|
12
|
+
output: 'assets/taiga-ui/icons',
|
|
13
|
+
};
|
|
14
|
+
function migrateTaigaProprietaryIcons(options) {
|
|
15
|
+
return (tree, context) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
var _a;
|
|
17
|
+
let proprietaryIcons = null;
|
|
18
|
+
try {
|
|
19
|
+
proprietaryIcons =
|
|
20
|
+
((_a = ng_morph_1.getPackageJsonDependency(tree, '@taiga-ui/proprietary-icons')) === null || _a === void 0 ? void 0 : _a.version) ||
|
|
21
|
+
null;
|
|
22
|
+
}
|
|
23
|
+
catch (_b) {
|
|
24
|
+
// noop
|
|
25
|
+
}
|
|
26
|
+
return ng_morph_1.getSourceFiles('**/angular.json').length > 0
|
|
27
|
+
? workspace_1.updateWorkspace(workspace => {
|
|
28
|
+
if (proprietaryIcons === null) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const project = get_project_1.getProject(options, workspace);
|
|
32
|
+
if (!project) {
|
|
33
|
+
context.logger.warn(`[WARNING]: Target project not found. Add ${JSON.stringify(PROPRIETARY_TDS_ICON_ASSETS, null, 4)} to angular.json manually`);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const targetOptions = get_project_target_options_1.getProjectTargetOptions(project, 'build');
|
|
37
|
+
if (Array.isArray(targetOptions === null || targetOptions === void 0 ? void 0 : targetOptions.assets)) {
|
|
38
|
+
const hasIcons = targetOptions.assets.find(asset => {
|
|
39
|
+
var _a;
|
|
40
|
+
return (_a = asset) === null || _a === void 0 ? void 0 : _a.input.includes('@taiga-ui/proprietary-tds-icons/src');
|
|
41
|
+
});
|
|
42
|
+
if (hasIcons) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
targetOptions.assets.push(PROPRIETARY_TDS_ICON_ASSETS);
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
: () => { };
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
exports.migrateTaigaProprietaryIcons = migrateTaigaProprietaryIcons;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { DevkitFileSystem } from 'ng-morph
|
|
1
|
+
import { DevkitFileSystem } from 'ng-morph';
|
|
2
2
|
export declare function migrateTemplates(fileSystem: DevkitFileSystem): void;
|
|
@@ -4,17 +4,21 @@ exports.migrateTemplates = void 0;
|
|
|
4
4
|
const get_component_templates_1 = require("../../utils/templates/get-component-templates");
|
|
5
5
|
const templates_1 = require("../constants/templates");
|
|
6
6
|
const elements_1 = require("../../utils/templates/elements");
|
|
7
|
+
const ng_morph_1 = require("ng-morph");
|
|
7
8
|
const ng_component_input_manipulations_1 = require("../../utils/templates/ng-component-input-manipulations");
|
|
8
9
|
const template_resource_1 = require("../../utils/templates/template-resource");
|
|
9
|
-
const ng_morph_1 = require("ng-morph");
|
|
10
10
|
const ng_component_1 = require("../../utils/angular/ng-component");
|
|
11
11
|
const add_unique_import_1 = require("../../utils/add-unique-import");
|
|
12
12
|
const colored_log_1 = require("../../utils/colored-log");
|
|
13
|
+
const constants_1 = require("../../constants");
|
|
13
14
|
const replace_tag_1 = require("../../utils/replace-tag");
|
|
15
|
+
const progress_1 = require("../../utils/progress");
|
|
14
16
|
const migrate_polymorpheus_1 = require("./migrate-polymorpheus");
|
|
17
|
+
const add_import_to_closest_module_1 = require("../../utils/add-import-to-closest-module");
|
|
18
|
+
const insert_todo_1 = require("../../utils/insert-todo");
|
|
15
19
|
function migrateTemplates(fileSystem) {
|
|
16
20
|
colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} migrating templates...`);
|
|
17
|
-
const componentWithTemplatesPaths = get_component_templates_1.getComponentTemplates(
|
|
21
|
+
const componentWithTemplatesPaths = get_component_templates_1.getComponentTemplates(constants_1.ALL_TS_FILES);
|
|
18
22
|
const actions = [
|
|
19
23
|
replaceTags,
|
|
20
24
|
replaceAttrs,
|
|
@@ -26,11 +30,18 @@ function migrateTemplates(fileSystem) {
|
|
|
26
30
|
migrateTuiHideSelectedPipe,
|
|
27
31
|
removeInputs,
|
|
28
32
|
migrate_polymorpheus_1.migratePolymorpheus,
|
|
33
|
+
replaceInputValues,
|
|
34
|
+
migrateBinaryAttributes,
|
|
35
|
+
addWarningForFormatNumberPipe,
|
|
29
36
|
];
|
|
30
|
-
componentWithTemplatesPaths.forEach(resource => {
|
|
37
|
+
componentWithTemplatesPaths.forEach((resource, templateIndex, templates) => {
|
|
31
38
|
const path = fileSystem.resolve(template_resource_1.getPathFromTemplateResource(resource));
|
|
32
39
|
const recorder = fileSystem.edit(path);
|
|
33
|
-
|
|
40
|
+
const isLastTemplate = templateIndex === templates.length - 1;
|
|
41
|
+
actions.forEach((action, actionIndex) => {
|
|
42
|
+
const isLastAction = actionIndex === actions.length - 1;
|
|
43
|
+
const progressLog = `${templateIndex + 1} / ${templates.length} (${action.name}...)`;
|
|
44
|
+
progress_1.printProgress(`${colored_log_1.SMALL_TAB_SYMBOL.repeat(2)}${progressLog}`, isLastTemplate && isLastAction);
|
|
34
45
|
action({ resource, fileSystem, recorder });
|
|
35
46
|
});
|
|
36
47
|
});
|
|
@@ -87,7 +98,7 @@ function addHTMLCommentTags({ resource, recorder, fileSystem, }) {
|
|
|
87
98
|
.filter(el => el.tagName === tag)
|
|
88
99
|
.map(el => { var _a; return (((_a = el.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.startOffset) || 0) + templateOffset; });
|
|
89
100
|
elementStartOffsets.forEach(offset => {
|
|
90
|
-
recorder.insertRight(offset, `<!--
|
|
101
|
+
recorder.insertRight(offset, `<!-- ${insert_todo_1.TODO_MARK} ${comment} -->\n`);
|
|
91
102
|
});
|
|
92
103
|
});
|
|
93
104
|
}
|
|
@@ -132,6 +143,9 @@ function replaceFieldError({ resource, recorder, fileSystem, }) {
|
|
|
132
143
|
const input = `[error]="${orderVal !== null && orderVal !== void 0 ? orderVal : '[]'} | tuiFieldError | async"`;
|
|
133
144
|
replace_tag_1.replaceTag(recorder, element.sourceCodeLocation, 'tui-field-error', 'tui-error', templateOffset, [input]);
|
|
134
145
|
});
|
|
146
|
+
if (elements.length) {
|
|
147
|
+
add_import_to_closest_module_1.addImportToClosestModule(resource.componentPath, 'TuiErrorModule', '@taiga-ui/core');
|
|
148
|
+
}
|
|
135
149
|
}
|
|
136
150
|
function addEditorProviders({ resource, fileSystem, }) {
|
|
137
151
|
const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
|
|
@@ -167,6 +181,64 @@ function migrateTuiHideSelectedPipe({ resource, fileSystem, recorder, }) {
|
|
|
167
181
|
recorder.insertRight(valueOffset, newValue);
|
|
168
182
|
});
|
|
169
183
|
}
|
|
184
|
+
function migrateBinaryAttributes({ resource, fileSystem, recorder, }) {
|
|
185
|
+
const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
|
|
186
|
+
const templateOffset = template_resource_1.getTemplateOffset(resource);
|
|
187
|
+
templates_1.TRUTHY_BOOLEAN_INPUT_TO_HTML_BINARY_ATTRIBUTE.forEach(attrName => {
|
|
188
|
+
const elements = elements_1.findElementsInTemplateByFn(template, el => {
|
|
189
|
+
var _a;
|
|
190
|
+
return (_a = el.attrs) === null || _a === void 0 ? void 0 : _a.some(attr => attr.value === 'true' && attr.name.includes(attrName.toLowerCase()));
|
|
191
|
+
});
|
|
192
|
+
elements.forEach(el => {
|
|
193
|
+
var _a;
|
|
194
|
+
const attrLocations = (_a = el.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.attrs;
|
|
195
|
+
if (!attrLocations) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
const { startOffset, endOffset } = attrLocations[`[${attrName.toLowerCase()}]`] ||
|
|
199
|
+
attrLocations[attrName.toLowerCase()];
|
|
200
|
+
recorder.remove(templateOffset + startOffset, endOffset - startOffset);
|
|
201
|
+
recorder.insertRight(templateOffset + startOffset, attrName);
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
function addWarningForFormatNumberPipe({ resource, fileSystem, recorder, }) {
|
|
206
|
+
const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
|
|
207
|
+
const templateOffset = template_resource_1.getTemplateOffset(resource);
|
|
208
|
+
if (template.match(/\|\s*tuiFormatNumber\s*:\s/gi)) {
|
|
209
|
+
recorder.insertLeft(templateOffset && templateOffset + 1, `<!-- ${insert_todo_1.TODO_MARK} tuiFormatNumber pipe has new API. See https://taiga-ui.dev/pipes/format-number -->`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
function replaceInputValues({ resource, recorder, fileSystem, }) {
|
|
213
|
+
const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
|
|
214
|
+
const templateOffset = template_resource_1.getTemplateOffset(resource);
|
|
215
|
+
const ATTR_VALUES = [
|
|
216
|
+
{
|
|
217
|
+
attrName: 'tuiHintDirection',
|
|
218
|
+
values: [
|
|
219
|
+
{ from: 'bottom-middle', to: 'bottom' },
|
|
220
|
+
{ from: 'top-middle', to: 'top' },
|
|
221
|
+
],
|
|
222
|
+
},
|
|
223
|
+
];
|
|
224
|
+
ATTR_VALUES.forEach(({ attrName, values }) => {
|
|
225
|
+
const elements = [...elements_1.findElementsWithAttribute(template, attrName)];
|
|
226
|
+
elements.forEach(element => {
|
|
227
|
+
const { name, value } = element.attrs.find(attr => attr.name === attrName.toLowerCase()) || {};
|
|
228
|
+
if (!name || !value) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
values.forEach(({ from, to }) => {
|
|
232
|
+
var _a, _b;
|
|
233
|
+
if (value === from) {
|
|
234
|
+
const { startOffset, endOffset } = ((_b = (_a = element.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.attrs) === null || _b === void 0 ? void 0 : _b[name]) || { startOffset: 0, endOffset: 0 };
|
|
235
|
+
recorder.remove(templateOffset + startOffset, endOffset - startOffset);
|
|
236
|
+
recorder.insertRight(templateOffset + startOffset, `${attrName}="${to}"`);
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
}
|
|
170
242
|
function removeInputs({ resource, fileSystem, recorder, }) {
|
|
171
243
|
const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
|
|
172
244
|
const templateOffset = template_resource_1.getTemplateOffset(resource);
|
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.replaceDeepImports = void 0;
|
|
4
4
|
const ng_morph_1 = require("ng-morph");
|
|
5
5
|
const colored_log_1 = require("../../utils/colored-log");
|
|
6
|
+
const constants_1 = require("../../constants");
|
|
6
7
|
const DEEP_REGEX = /(@taiga-ui\/\w+)\/.*/;
|
|
7
8
|
function replaceDeepImports() {
|
|
8
9
|
colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} replacing deep imports...`);
|
|
9
|
-
const deepImports = ng_morph_1.getImports(
|
|
10
|
+
const deepImports = ng_morph_1.getImports(constants_1.ALL_TS_FILES).filter(imp => DEEP_REGEX.test(imp.getModuleSpecifier().getLiteralValue()));
|
|
10
11
|
ng_morph_1.editImports(deepImports, deepImport => {
|
|
11
12
|
const specifier = deepImport.moduleSpecifier.replace(DEEP_REGEX, '$1');
|
|
12
13
|
return { moduleSpecifier: specifier };
|
|
@@ -13,6 +13,7 @@ function replaceEnums() {
|
|
|
13
13
|
}
|
|
14
14
|
exports.replaceEnums = replaceEnums;
|
|
15
15
|
function replaceEnumWithString(enumName, replaceValues, keepAsType = true) {
|
|
16
|
+
var _a;
|
|
16
17
|
const references = get_named_import_references_1.getNamedImportReferences(enumName);
|
|
17
18
|
for (let ref of references) {
|
|
18
19
|
const parent = ref.getParent();
|
|
@@ -22,7 +23,7 @@ function replaceEnumWithString(enumName, replaceValues, keepAsType = true) {
|
|
|
22
23
|
}
|
|
23
24
|
if (ng_morph_1.Node.isTypeReferenceNode(parent) && !keepAsType) {
|
|
24
25
|
const declaration = parent.getParent();
|
|
25
|
-
declaration.removeType();
|
|
26
|
+
(_a = declaration.removeType) === null || _a === void 0 ? void 0 : _a.call(declaration);
|
|
26
27
|
continue;
|
|
27
28
|
}
|
|
28
29
|
if (!ng_morph_1.Node.isPropertyAccessExpression(parent)) {
|
|
@@ -13,15 +13,20 @@ function replaceFunctions() {
|
|
|
13
13
|
replaceCustomEvent(get_named_import_references_1.getNamedImportReferences('tuiCustomEvent', '@taiga-ui/cdk'));
|
|
14
14
|
replaceClosestElement(get_named_import_references_1.getNamedImportReferences('getClosestElement', '@taiga-ui/cdk'));
|
|
15
15
|
replaceDeprecatedFunction();
|
|
16
|
+
modifyFormatNumberArgs();
|
|
17
|
+
modifyClosestFocusable();
|
|
16
18
|
colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} functions replaced \n`);
|
|
17
19
|
}
|
|
18
20
|
exports.replaceFunctions = replaceFunctions;
|
|
19
21
|
function replaceDeprecatedFunction() {
|
|
20
22
|
deprecated_functions_1.DEPRECATED_FUNCTIONS.forEach(({ from, to, moduleSpecifier }) => {
|
|
21
23
|
get_named_import_references_1.getNamedImportReferences(from, moduleSpecifier).forEach(ref => {
|
|
24
|
+
if (ref.wasForgotten()) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
22
27
|
const parent = ref.getParent();
|
|
23
28
|
if (ng_morph_1.Node.isImportSpecifier(parent) || ng_morph_1.Node.isCallExpression(parent)) {
|
|
24
|
-
parent === null || parent === void 0 ? void 0 : parent.replaceWithText(parent === null || parent === void 0 ? void 0 : parent.
|
|
29
|
+
parent === null || parent === void 0 ? void 0 : parent.replaceWithText(parent === null || parent === void 0 ? void 0 : parent.getText({ includeJsDocComments: false }).trim().replace(from, to !== null && to !== void 0 ? to : from));
|
|
25
30
|
}
|
|
26
31
|
});
|
|
27
32
|
});
|
|
@@ -47,7 +52,11 @@ function replaceClosestElement(references) {
|
|
|
47
52
|
}
|
|
48
53
|
else if (ng_morph_1.Node.isCallExpression(parent)) {
|
|
49
54
|
const [firstArg, secondArg] = parent.getArguments();
|
|
50
|
-
|
|
55
|
+
const firstArgText = firstArg.getText();
|
|
56
|
+
const element = firstArgText.includes(' as ') // e.g, `getClosestElement(el as Element, ...)`
|
|
57
|
+
? `(${firstArgText})`
|
|
58
|
+
: firstArgText;
|
|
59
|
+
parent.replaceWithText(`${element}.closest(${secondArg.getText()})`);
|
|
51
60
|
}
|
|
52
61
|
});
|
|
53
62
|
}
|
|
@@ -75,3 +84,34 @@ function replaceFallbackValue(references) {
|
|
|
75
84
|
}
|
|
76
85
|
});
|
|
77
86
|
}
|
|
87
|
+
function modifyFormatNumberArgs() {
|
|
88
|
+
[
|
|
89
|
+
...get_named_import_references_1.getNamedImportReferences('formatNumber', '@taiga-ui/core'),
|
|
90
|
+
...get_named_import_references_1.getNamedImportReferences('tuiFormatNumber', '@taiga-ui/core'),
|
|
91
|
+
]
|
|
92
|
+
.map(ref => ref.getParent())
|
|
93
|
+
.filter(ng_morph_1.Node.isCallExpression)
|
|
94
|
+
.forEach(fn => {
|
|
95
|
+
const args = fn.getArguments();
|
|
96
|
+
if (args.length > 1) {
|
|
97
|
+
const [value, decimalLimit = `Infinity`, decimalSeparator = `','`, thousandSeparator = `'\u00A0'`, zeroPadding = true,] = args.map(arg => arg.getText());
|
|
98
|
+
const notNullDecimalLimit = decimalLimit === `null` ? `Infinity` : decimalLimit;
|
|
99
|
+
const conditionalDecimalLimit = !Number.isNaN(+notNullDecimalLimit)
|
|
100
|
+
? notNullDecimalLimit
|
|
101
|
+
: `${decimalLimit} === null ? Infinity : ${decimalLimit}`;
|
|
102
|
+
fn.replaceWithText(`tuiFormatNumber(${value}, {decimalLimit: ${conditionalDecimalLimit}, decimalSeparator: ${decimalSeparator}, thousandSeparator: ${thousandSeparator}, zeroPadding: ${zeroPadding}})`);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function modifyClosestFocusable() {
|
|
107
|
+
get_named_import_references_1.getNamedImportReferences('tuiGetClosestFocusable', '@taiga-ui/cdk')
|
|
108
|
+
.map(ref => ref.getParent())
|
|
109
|
+
.filter(ng_morph_1.Node.isCallExpression)
|
|
110
|
+
.forEach(fn => {
|
|
111
|
+
const args = fn.getArguments();
|
|
112
|
+
if (args.length > 1) {
|
|
113
|
+
const [initial, prev = false, root, keyboard = true] = args.map(arg => arg.getText());
|
|
114
|
+
fn.replaceWithText(`tuiGetClosestFocusable({initial: ${initial}, root: ${root}, previous: ${prev}, keyboard: ${keyboard}})`);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function replaceStyles(): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.replaceStyles = void 0;
|
|
4
|
+
const ng_morph_1 = require("ng-morph");
|
|
5
|
+
const breakpoints_1 = require("../constants/breakpoints");
|
|
6
|
+
function replaceStyles() {
|
|
7
|
+
var _a;
|
|
8
|
+
(_a = ng_morph_1.getActiveProject()) === null || _a === void 0 ? void 0 : _a.getSourceFiles('**/**.less').forEach(sourceFile => {
|
|
9
|
+
let fullText = sourceFile.getFullText();
|
|
10
|
+
if (fullText.includes(`taiga-ui-local`)) {
|
|
11
|
+
breakpoints_1.DEPRECATED_BREAKPOINTS.forEach(({ from, to }) => {
|
|
12
|
+
fullText = fullText.replaceAll(new RegExp(`(?<=@media.*)(${from})(?=[\\s,{])`, 'g'), to);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
sourceFile.replaceWithText(fullText.replace(`@import '~@taiga-ui/core/styles/taiga-ui-global';`, `@import '~@taiga-ui/styles/taiga-ui-global';`));
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
exports.replaceStyles = replaceStyles;
|
|
@@ -3,12 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.showWarnings = void 0;
|
|
4
4
|
const ng_morph_1 = require("ng-morph");
|
|
5
5
|
const warnings_1 = require("../constants/warnings");
|
|
6
|
+
const constants_1 = require("../../constants");
|
|
6
7
|
function showWarnings(context) {
|
|
7
8
|
warnings_1.MIGRATION_WARNINGS.forEach(warning => showWarning(warning, context));
|
|
8
9
|
}
|
|
9
10
|
exports.showWarnings = showWarnings;
|
|
10
11
|
function showWarning({ name, message, moduleSpecifier = '**/**' }, { logger }) {
|
|
11
|
-
const references = ng_morph_1.getImports(
|
|
12
|
+
const references = ng_morph_1.getImports(constants_1.ALL_TS_FILES, {
|
|
12
13
|
moduleSpecifier,
|
|
13
14
|
namedImports: [name],
|
|
14
15
|
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function addImportToClosestModule(componentPath: string, moduleName: string, moduleSpecifier: string): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addImportToClosestModule = void 0;
|
|
4
|
+
const ng_component_1 = require("./angular/ng-component");
|
|
5
|
+
const ng_module_1 = require("./angular/ng-module");
|
|
6
|
+
const ng_morph_1 = require("ng-morph");
|
|
7
|
+
const add_unique_import_1 = require("./add-unique-import");
|
|
8
|
+
function addImportToClosestModule(componentPath, moduleName, moduleSpecifier) {
|
|
9
|
+
const [ngComponent] = ng_component_1.getNgComponents(componentPath);
|
|
10
|
+
const ngModule = ngComponent ? ng_module_1.findNgModule(ngComponent) : null;
|
|
11
|
+
if (ngModule) {
|
|
12
|
+
ng_morph_1.addImportToNgModule(ngModule, moduleName, {
|
|
13
|
+
unique: true,
|
|
14
|
+
});
|
|
15
|
+
add_unique_import_1.addUniqueImport(ngModule.getSourceFile().getFilePath(), moduleName, moduleSpecifier);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.addImportToClosestModule = addImportToClosestModule;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { Schema } from '../ng-add/schema';
|
|
2
|
-
import { Rule } from '@angular-devkit/schematics';
|
|
3
|
-
|
|
2
|
+
import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
|
|
3
|
+
import { JsonArray } from '@angular-devkit/core';
|
|
4
|
+
export declare function addStylesToAngularJson(options: Schema, context: SchematicContext, taigaStyles: string[], filter?: (styles: JsonArray | undefined) => boolean, stylesToReplace?: {
|
|
5
|
+
from: string;
|
|
6
|
+
to: string[];
|
|
7
|
+
}, tree?: Tree): Rule;
|
|
@@ -4,14 +4,42 @@ exports.addStylesToAngularJson = void 0;
|
|
|
4
4
|
const get_project_1 = require("./get-project");
|
|
5
5
|
const get_project_target_options_1 = require("./get-project-target-options");
|
|
6
6
|
const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
7
|
-
|
|
7
|
+
const ng_morph_1 = require("ng-morph");
|
|
8
|
+
const versions_1 = require("../ng-add/constants/versions");
|
|
9
|
+
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
10
|
+
function addStylesToAngularJson(options, context, taigaStyles, filter, stylesToReplace, tree) {
|
|
8
11
|
return workspace_1.updateWorkspace(workspace => {
|
|
9
12
|
const project = get_project_1.getProject(options, workspace);
|
|
13
|
+
if (!project) {
|
|
14
|
+
context.logger.warn(`[WARNING]: Target project not found. Add styles ${taigaStyles.join(',')} to angular.json manually.`);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
10
17
|
const targetOptions = get_project_target_options_1.getProjectTargetOptions(project, 'build');
|
|
11
18
|
const styles = targetOptions.styles;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
if (filter && filter(styles)) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (!styles) {
|
|
23
|
+
targetOptions.styles = taigaStyles;
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (tree &&
|
|
27
|
+
stylesToReplace &&
|
|
28
|
+
styles.find(style => style === stylesToReplace.from)) {
|
|
29
|
+
targetOptions.styles = Array.from(new Set([
|
|
30
|
+
...taigaStyles,
|
|
31
|
+
...stylesToReplace.to,
|
|
32
|
+
...styles.filter(style => style !== stylesToReplace.from),
|
|
33
|
+
]));
|
|
34
|
+
ng_morph_1.addPackageJsonDependency(tree, {
|
|
35
|
+
name: `@taiga-ui/styles`,
|
|
36
|
+
version: versions_1.TAIGA_VERSION,
|
|
37
|
+
});
|
|
38
|
+
context.addTask(new tasks_1.NodePackageInstallTask());
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
targetOptions.styles = Array.from(new Set([...taigaStyles, ...styles]));
|
|
42
|
+
}
|
|
15
43
|
});
|
|
16
44
|
}
|
|
17
45
|
exports.addStylesToAngularJson = addStylesToAngularJson;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { ClassDeclaration, Pattern, Query } from 'ng-morph';
|
|
2
|
-
import { StructureType } from 'ng-morph/utils/types/structure-type';
|
|
1
|
+
import { ClassDeclaration, Pattern, Query, StructureType } from 'ng-morph';
|
|
3
2
|
export declare function getNgComponents(pattern: Pattern, query?: Query<Omit<StructureType<ClassDeclaration>, 'kind'>>): ClassDeclaration[];
|