@taiga-ui/core 2.50.1 → 2.51.1

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.
Files changed (64) hide show
  1. package/bundles/taiga-ui-core-components-dialog.umd.js +5 -5
  2. package/bundles/taiga-ui-core-components-dialog.umd.js.map +1 -1
  3. package/bundles/taiga-ui-core-components-dialog.umd.min.js +1 -1
  4. package/bundles/taiga-ui-core-components-dialog.umd.min.js.map +1 -1
  5. package/bundles/taiga-ui-core-components-dropdown-box.umd.js +1 -1
  6. package/bundles/taiga-ui-core-components-dropdown-box.umd.js.map +1 -1
  7. package/bundles/taiga-ui-core-components-dropdown-box.umd.min.js +1 -1
  8. package/bundles/taiga-ui-core-components-dropdown-box.umd.min.js.map +1 -1
  9. package/bundles/taiga-ui-core-constants.umd.js +1 -1
  10. package/bundles/taiga-ui-core-constants.umd.js.map +1 -1
  11. package/bundles/taiga-ui-core-constants.umd.min.js +1 -1
  12. package/bundles/taiga-ui-core-constants.umd.min.js.map +1 -1
  13. package/bundles/taiga-ui-core-utils-dom.umd.js +46 -0
  14. package/bundles/taiga-ui-core-utils-dom.umd.js.map +1 -1
  15. package/bundles/taiga-ui-core-utils-dom.umd.min.js +1 -1
  16. package/bundles/taiga-ui-core-utils-dom.umd.min.js.map +1 -1
  17. package/bundles/taiga-ui-core-utils-mobile.umd.js +7 -8
  18. package/bundles/taiga-ui-core-utils-mobile.umd.js.map +1 -1
  19. package/bundles/taiga-ui-core-utils-mobile.umd.min.js +1 -1
  20. package/bundles/taiga-ui-core-utils-mobile.umd.min.js.map +1 -1
  21. package/components/dropdown-box/taiga-ui-core-components-dropdown-box.metadata.json +1 -1
  22. package/constants/taiga-ui-core-constants.metadata.json +1 -1
  23. package/constants/version.d.ts +1 -1
  24. package/esm2015/components/dialog/dialog.providers.js +3 -2
  25. package/esm2015/components/dropdown-box/dropdown-box.component.js +3 -3
  26. package/esm2015/constants/version.js +2 -2
  27. package/esm2015/utils/dom/get-viewport-height.js +21 -0
  28. package/esm2015/utils/dom/get-viewport-width.js +21 -0
  29. package/esm2015/utils/dom/index.js +3 -1
  30. package/esm2015/utils/mobile/is-mobile.js +4 -3
  31. package/esm5/components/dialog/dialog.providers.js +3 -2
  32. package/esm5/components/dropdown-box/dropdown-box.component.js +3 -3
  33. package/esm5/constants/version.js +2 -2
  34. package/esm5/utils/dom/get-viewport-height.js +22 -0
  35. package/esm5/utils/dom/get-viewport-width.js +22 -0
  36. package/esm5/utils/dom/index.js +3 -1
  37. package/esm5/utils/mobile/is-mobile.js +5 -5
  38. package/fesm2015/taiga-ui-core-components-dialog.js +2 -1
  39. package/fesm2015/taiga-ui-core-components-dialog.js.map +1 -1
  40. package/fesm2015/taiga-ui-core-components-dropdown-box.js +2 -2
  41. package/fesm2015/taiga-ui-core-components-dropdown-box.js.map +1 -1
  42. package/fesm2015/taiga-ui-core-constants.js +1 -1
  43. package/fesm2015/taiga-ui-core-constants.js.map +1 -1
  44. package/fesm2015/taiga-ui-core-utils-dom.js +43 -1
  45. package/fesm2015/taiga-ui-core-utils-dom.js.map +1 -1
  46. package/fesm2015/taiga-ui-core-utils-mobile.js +4 -2
  47. package/fesm2015/taiga-ui-core-utils-mobile.js.map +1 -1
  48. package/fesm5/taiga-ui-core-components-dialog.js +2 -1
  49. package/fesm5/taiga-ui-core-components-dialog.js.map +1 -1
  50. package/fesm5/taiga-ui-core-components-dropdown-box.js +2 -2
  51. package/fesm5/taiga-ui-core-components-dropdown-box.js.map +1 -1
  52. package/fesm5/taiga-ui-core-constants.js +1 -1
  53. package/fesm5/taiga-ui-core-constants.js.map +1 -1
  54. package/fesm5/taiga-ui-core-utils-dom.js +45 -1
  55. package/fesm5/taiga-ui-core-utils-dom.js.map +1 -1
  56. package/fesm5/taiga-ui-core-utils-mobile.js +5 -4
  57. package/fesm5/taiga-ui-core-utils-mobile.js.map +1 -1
  58. package/package.json +4 -4
  59. package/utils/dom/get-viewport-height.d.ts +18 -0
  60. package/utils/dom/get-viewport-width.d.ts +18 -0
  61. package/utils/dom/index.d.ts +2 -0
  62. package/utils/dom/taiga-ui-core-utils-dom.metadata.json +1 -1
  63. package/utils/mobile/is-mobile.d.ts +1 -1
  64. package/utils/mobile/taiga-ui-core-utils-mobile.metadata.json +1 -1
@@ -37,6 +37,48 @@ function getScreenWidth(documentRef) {
37
37
  return Math.max(documentRef.documentElement.clientWidth, documentRef.defaultView ? documentRef.defaultView.innerWidth : 0);
38
38
  }
39
39
 
40
+ /**
41
+ * @description:
42
+ * Cross-browser @media (height)
43
+ *
44
+ * 1. window.innerWidth
45
+ * 1.1. gets CSS viewport @media (height) which include scrollbars
46
+ * 1.2. initial-scale and zoom variations may cause mobile values to
47
+ * wrongly scale down to what PPK calls the visual
48
+ * viewport and be smaller than the @media values
49
+ * 1.3. zoom may cause values to be 1px off due to native rounding
50
+ *
51
+ * 2. document.documentElement.clientHeight
52
+ * 2.1. equals CSS viewport width minus scrollbar width
53
+ * 2.2. matches @media (height) when there is no scrollbar
54
+ * 2.3. available cross-browser
55
+ * 2.4. inaccurate if doctype is missing
56
+ */
57
+ function tuiGetViewportHeight({ document, innerHeight }) {
58
+ return Math.max(document.documentElement.clientHeight || 0, innerHeight || 0);
59
+ }
60
+
61
+ /**
62
+ * @description:
63
+ * Cross-browser @media (width)
64
+ *
65
+ * 1. window.innerWidth
66
+ * 1.1. gets CSS viewport @media (width) which include scrollbars
67
+ * 1.2. initial-scale and zoom variations may cause mobile values to
68
+ * wrongly scale down to what PPK calls the visual
69
+ * viewport and be smaller than the @media values
70
+ * 1.3. zoom may cause values to be 1px off due to native rounding
71
+ *
72
+ * 2. document.documentElement.clientWidth
73
+ * 2.1. equals CSS viewport width minus scrollbar width
74
+ * 2.2. matches @media (width) when there is no scrollbar
75
+ * 2.3. available cross-browser
76
+ * 2.4. inaccurate if doctype is missing
77
+ */
78
+ function tuiGetViewportWidth({ document, innerWidth }) {
79
+ return Math.max(document.documentElement.clientWidth || 0, innerWidth || 0);
80
+ }
81
+
40
82
  const WIDTH_SEARCH = 'width="';
41
83
  const HEIGHT_SEARCH = 'height="';
42
84
  const START = '<svg';
@@ -74,5 +116,5 @@ function processIcon(source, name) {
74
116
  * Generated bundle index. Do not edit.
75
117
  */
76
118
 
77
- export { areCssVarsSupported, checkFixedPosition, getSafeAreaSize, getScreenWidth, processIcon };
119
+ export { areCssVarsSupported, checkFixedPosition, getSafeAreaSize, getScreenWidth, processIcon, tuiGetViewportHeight, tuiGetViewportWidth };
78
120
  //# sourceMappingURL=taiga-ui-core-utils-dom.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"taiga-ui-core-utils-dom.js","sources":["ng://@taiga-ui/core/utils/dom/are-css-vars-supported.ts","ng://@taiga-ui/core/utils/dom/check-fixed-position.ts","ng://@taiga-ui/core/utils/dom/get-safe-area-size.ts","ng://@taiga-ui/core/utils/dom/get-screen-width.ts","ng://@taiga-ui/core/utils/dom/process-icon.ts","ng://@taiga-ui/core/utils/dom/taiga-ui-core-utils-dom.ts"],"sourcesContent":["import {isEdgeOlderThan} from '@taiga-ui/cdk';\n\n/**\n * TODO: 3.0 remove this function\n */\nexport function areCssVarsSupported(cssRef: typeof CSS, userAgent: string): boolean {\n return cssRef.supports('(--a: 0)') && !isEdgeOlderThan(17, userAgent);\n}\n","export function checkFixedPosition(element: HTMLElement | null): boolean {\n if (!element || typeof getComputedStyle === 'undefined') {\n return false;\n }\n\n const style = getComputedStyle(element);\n\n return (\n style.getPropertyValue('position') === 'fixed' ||\n checkFixedPosition(element.parentElement)\n );\n}\n","/**\n * Calculates size of safe area on mobile devices (status bars)\n *\n * ATTENTION: Only use in browser environment\n */\nexport function getSafeAreaSize(): number {\n if (!CSS.supports('padding-top: env(safe-area-inset-top)')) {\n return 0;\n }\n\n const div = document.createElement('div');\n\n div.style.paddingTop = 'env(safe-area-inset-top)';\n document.body.appendChild(div);\n\n const safeAreaSize = parseInt(window.getComputedStyle(div).paddingTop!, 10) || 0;\n\n document.body.removeChild(div);\n\n return safeAreaSize;\n}\n","export function getScreenWidth(documentRef: Document): number {\n return Math.max(\n documentRef.documentElement.clientWidth,\n documentRef.defaultView ? documentRef.defaultView.innerWidth : 0,\n );\n}\n","const WIDTH_SEARCH = 'width=\"';\nconst HEIGHT_SEARCH = 'height=\"';\nconst START = '<svg';\n\nexport function processIcon(source: string, name: string): string {\n if (source.includes(`id=\"${name}\"`)) {\n return source;\n }\n\n const src = source.slice(Math.max(0, source.indexOf(START)));\n const attributes = src.slice(0, Math.max(0, src.indexOf('>')));\n\n if (\n !attributes ||\n !attributes.includes(WIDTH_SEARCH) ||\n !attributes.includes(HEIGHT_SEARCH)\n ) {\n return `${src.replace(\n START,\n `<svg xmlns=\"http://www.w3.org/2000/svg\"><g id=\"${name}\" xmlns=\"http://www.w3.org/2000/svg\"><svg`,\n )}</g></svg>`;\n }\n\n const indexOfWidth = attributes.indexOf(WIDTH_SEARCH);\n const indexOfHeight = attributes.indexOf(HEIGHT_SEARCH);\n const widthOffset = indexOfWidth + WIDTH_SEARCH.length;\n const heightOffset = indexOfHeight + HEIGHT_SEARCH.length;\n const widthString = attributes.slice(\n widthOffset,\n attributes.indexOf('\"', widthOffset),\n );\n const heightString = attributes.slice(\n heightOffset,\n attributes.indexOf('\"', heightOffset),\n );\n\n if (\n !heightString ||\n !widthString ||\n widthString.includes('%') ||\n heightString.includes('%') ||\n widthString.includes('em') ||\n heightString.includes('em')\n ) {\n return src.replace(START, `<svg id=\"${name}\"`);\n }\n\n const width = parseInt(widthString, 10);\n const height = parseInt(heightString, 10);\n\n return `<g id=\"${name}\" xmlns=\"http://www.w3.org/2000/svg\"><svg x=\"50%\" y=\"50%\" width=\"${\n width / 16\n }em\" height=\"${\n height / 16\n }em\" overflow=\"visible\" viewBox=\"0 0 ${width} ${height}\"><svg x=\"${-width / 2}\" y=\"${\n -height / 2\n }\">${src}</svg></svg></g>`;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;A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AW,CAAC,QAAQ,CAAC,GAAG,CAAC;QACzB,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC;QAC1B,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC;QAC1B,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,EAC7B;QACE,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,YAAY,IAAI,GAAG,CAAC,CAAC;KAClD;IAED,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,QAAQ,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IAE1C,OAAO,UAAU,IAAI,qEACjB,KAAK,GAAG,EACZ,eACI,MAAM,GAAG,EACb,uCAAuC,KAAK,IAAI,MAAM,aAAa,CAAC,KAAK,GAAG,CAAC,QACzE,CAAC,MAAM,GAAG,CACd,KAAK,GAAG,kBAAkB,CAAC;AAC/B;;ACzDA;;;;;;"}
1
+ {"version":3,"file":"taiga-ui-core-utils-dom.js","sources":["ng://@taiga-ui/core/utils/dom/are-css-vars-supported.ts","ng://@taiga-ui/core/utils/dom/check-fixed-position.ts","ng://@taiga-ui/core/utils/dom/get-safe-area-size.ts","ng://@taiga-ui/core/utils/dom/get-screen-width.ts","ng://@taiga-ui/core/utils/dom/get-viewport-height.ts","ng://@taiga-ui/core/utils/dom/get-viewport-width.ts","ng://@taiga-ui/core/utils/dom/process-icon.ts","ng://@taiga-ui/core/utils/dom/taiga-ui-core-utils-dom.ts"],"sourcesContent":["import {isEdgeOlderThan} from '@taiga-ui/cdk';\n\n/**\n * TODO: 3.0 remove this function\n */\nexport function areCssVarsSupported(cssRef: typeof CSS, userAgent: string): boolean {\n return cssRef.supports('(--a: 0)') && !isEdgeOlderThan(17, userAgent);\n}\n","export function checkFixedPosition(element: HTMLElement | null): boolean {\n if (!element || typeof getComputedStyle === 'undefined') {\n return false;\n }\n\n const style = getComputedStyle(element);\n\n return (\n style.getPropertyValue('position') === 'fixed' ||\n checkFixedPosition(element.parentElement)\n );\n}\n","/**\n * Calculates size of safe area on mobile devices (status bars)\n *\n * ATTENTION: Only use in browser environment\n */\nexport function getSafeAreaSize(): number {\n if (!CSS.supports('padding-top: env(safe-area-inset-top)')) {\n return 0;\n }\n\n const div = document.createElement('div');\n\n div.style.paddingTop = 'env(safe-area-inset-top)';\n document.body.appendChild(div);\n\n const safeAreaSize = parseInt(window.getComputedStyle(div).paddingTop!, 10) || 0;\n\n document.body.removeChild(div);\n\n return safeAreaSize;\n}\n","export function getScreenWidth(documentRef: Document): number {\n return Math.max(\n documentRef.documentElement.clientWidth,\n documentRef.defaultView ? documentRef.defaultView.innerWidth : 0,\n );\n}\n","/**\n * @description:\n * Cross-browser @media (height)\n *\n * 1. window.innerWidth\n * 1.1. gets CSS viewport @media (height) which include scrollbars\n * 1.2. initial-scale and zoom variations may cause mobile values to\n * wrongly scale down to what PPK calls the visual\n * viewport and be smaller than the @media values\n * 1.3. zoom may cause values to be 1px off due to native rounding\n *\n * 2. document.documentElement.clientHeight\n * 2.1. equals CSS viewport width minus scrollbar width\n * 2.2. matches @media (height) when there is no scrollbar\n * 2.3. available cross-browser\n * 2.4. inaccurate if doctype is missing\n */\nexport function tuiGetViewportHeight({document, innerHeight}: Window): number {\n return Math.max(document.documentElement.clientHeight || 0, innerHeight || 0);\n}\n","/**\n * @description:\n * Cross-browser @media (width)\n *\n * 1. window.innerWidth\n * 1.1. gets CSS viewport @media (width) which include scrollbars\n * 1.2. initial-scale and zoom variations may cause mobile values to\n * wrongly scale down to what PPK calls the visual\n * viewport and be smaller than the @media values\n * 1.3. zoom may cause values to be 1px off due to native rounding\n *\n * 2. document.documentElement.clientWidth\n * 2.1. equals CSS viewport width minus scrollbar width\n * 2.2. matches @media (width) when there is no scrollbar\n * 2.3. available cross-browser\n * 2.4. inaccurate if doctype is missing\n */\nexport function tuiGetViewportWidth({document, innerWidth}: Window): number {\n return Math.max(document.documentElement.clientWidth || 0, innerWidth || 0);\n}\n","const WIDTH_SEARCH = 'width=\"';\nconst HEIGHT_SEARCH = 'height=\"';\nconst START = '<svg';\n\nexport function processIcon(source: string, name: string): string {\n if (source.includes(`id=\"${name}\"`)) {\n return source;\n }\n\n const src = source.slice(Math.max(0, source.indexOf(START)));\n const attributes = src.slice(0, Math.max(0, src.indexOf('>')));\n\n if (\n !attributes ||\n !attributes.includes(WIDTH_SEARCH) ||\n !attributes.includes(HEIGHT_SEARCH)\n ) {\n return `${src.replace(\n START,\n `<svg xmlns=\"http://www.w3.org/2000/svg\"><g id=\"${name}\" xmlns=\"http://www.w3.org/2000/svg\"><svg`,\n )}</g></svg>`;\n }\n\n const indexOfWidth = attributes.indexOf(WIDTH_SEARCH);\n const indexOfHeight = attributes.indexOf(HEIGHT_SEARCH);\n const widthOffset = indexOfWidth + WIDTH_SEARCH.length;\n const heightOffset = indexOfHeight + HEIGHT_SEARCH.length;\n const widthString = attributes.slice(\n widthOffset,\n attributes.indexOf('\"', widthOffset),\n );\n const heightString = attributes.slice(\n heightOffset,\n attributes.indexOf('\"', heightOffset),\n );\n\n if (\n !heightString ||\n !widthString ||\n widthString.includes('%') ||\n heightString.includes('%') ||\n widthString.includes('em') ||\n heightString.includes('em')\n ) {\n return src.replace(START, `<svg id=\"${name}\"`);\n }\n\n const width = parseInt(widthString, 10);\n const height = parseInt(heightString, 10);\n\n return `<g id=\"${name}\" xmlns=\"http://www.w3.org/2000/svg\"><svg x=\"50%\" y=\"50%\" width=\"${\n width / 16\n }em\" height=\"${\n height / 16\n }em\" overflow=\"visible\" viewBox=\"0 0 ${width} ${height}\"><svg x=\"${-width / 2}\" y=\"${\n -height / 2\n }\">${src}</svg></svg></g>`;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAEA;;;SAGgB,mBAAmB,CAAC,MAAkB,EAAE,SAAiB;IACrE,OAAO,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,eAAe,CAA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IAC1D,MAAM,WAAW,GAAG,UAAU,CAAC,KAAK,CAChC,WAAW,EACX,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,WAAW,CAAC,CACvC,CAAC;IACF,MAAM,YAAY,GAAG,UAAU,CAAC,KAAK,CACjC,YAAY,EACZ,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,YAAY,CAAC,CACxC,CAAC;IAEF,IACI,CAAC,YAAY;QACb,CAAC,WAAW;QACZ,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC;QACzB,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC;QAC1B,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC;QAC1B,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,EAC7B;QACE,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,YAAY,IAAI,GAAG,CAAC,CAAC;KAClD;IAED,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,QAAQ,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IAE1C,OAAO,UAAU,IAAI,qEACjB,KAAK,GAAG,EACZ,eACI,MAAM,GAAG,EACb,uCAAuC,KAAK,IAAI,MAAM,aAAa,CAAC,KAAK,GAAG,CAAC,QACzE,CAAC,MAAM,GAAG,CACd,KAAK,GAAG,kBAAkB,CAAC;AAC/B;;ACzDA;;;;;;"}
@@ -1,5 +1,7 @@
1
- function tuiIsMobile({ innerWidth }, { mobile }) {
2
- return innerWidth <= mobile;
1
+ import { tuiGetViewportWidth } from '@taiga-ui/core/utils/dom';
2
+
3
+ function tuiIsMobile(windowRef, { mobile }) {
4
+ return tuiGetViewportWidth(windowRef) < mobile;
3
5
  }
4
6
 
5
7
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"taiga-ui-core-utils-mobile.js","sources":["ng://@taiga-ui/core/utils/mobile/is-mobile.ts","ng://@taiga-ui/core/utils/mobile/taiga-ui-core-utils-mobile.ts"],"sourcesContent":["import {TuiMedia} from '@taiga-ui/core/interfaces';\n\nexport function tuiIsMobile({innerWidth}: Window, {mobile}: TuiMedia): boolean {\n return innerWidth <= mobile;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"SAEgB,WAAW,CAAC,EAAC,UAAU,EAAS,EAAE,EAAC,MAAM,EAAW;IAChE,OAAO,UAAU,IAAI,MAAM,CAAC;AAChC;;ACJA;;;;;;"}
1
+ {"version":3,"file":"taiga-ui-core-utils-mobile.js","sources":["ng://@taiga-ui/core/utils/mobile/is-mobile.ts","ng://@taiga-ui/core/utils/mobile/taiga-ui-core-utils-mobile.ts"],"sourcesContent":["import {TuiMedia} from '@taiga-ui/core/interfaces';\nimport {tuiGetViewportWidth} from '@taiga-ui/core/utils/dom';\n\nexport function tuiIsMobile(windowRef: Window, {mobile}: TuiMedia): boolean {\n return tuiGetViewportWidth(windowRef) < mobile;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;SAGgB,WAAW,CAAC,SAAiB,EAAE,EAAC,MAAM,EAAW;IAC7D,OAAO,mBAAmB,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC;AACnD;;ACLA;;;;;;"}
@@ -1,12 +1,13 @@
1
1
  import { __decorate, __param, __extends } from 'tslib';
2
2
  import { InjectionToken, ElementRef, Inject, HostBinding, Component, ChangeDetectionStrategy, ɵɵdefineInjectable, ɵɵinject, Injectable, Directive, NgModule } from '@angular/core';
3
- import { typedFromEvent, isCurrentTarget, containsOrAfter, tuiGetViewportWidth, TuiDestroyService, TUI_IS_MOBILE, AbstractTuiDialogService, AbstractTuiDialogDirective, TuiPreventDefaultModule, TUI_DIALOGS } from '@taiga-ui/cdk';
3
+ import { typedFromEvent, isCurrentTarget, containsOrAfter, TuiDestroyService, TUI_IS_MOBILE, AbstractTuiDialogService, AbstractTuiDialogDirective, TuiPreventDefaultModule, TUI_DIALOGS } from '@taiga-ui/cdk';
4
4
  import { tuiSlideInTop, tuiFadeIn } from '@taiga-ui/core/animations';
5
5
  import { TUI_ANIMATIONS_DURATION, TUI_CLOSE_WORD } from '@taiga-ui/core/tokens';
6
6
  import { POLYMORPHEUS_CONTEXT, PolymorpheusComponent, PolymorpheusModule } from '@tinkoff/ng-polymorpheus';
7
7
  import { EMPTY, merge, Observable } from 'rxjs';
8
8
  import { DOCUMENT, CommonModule } from '@angular/common';
9
9
  import { WINDOW } from '@ng-web-apis/common';
10
+ import { tuiGetViewportWidth } from '@taiga-ui/core/utils/dom';
10
11
  import { filter, switchMapTo, take, takeUntil } from 'rxjs/operators';
11
12
  import { TuiIdService } from '@taiga-ui/cdk/services';
12
13
  import { TuiButtonModule } from '@taiga-ui/core/components/button';
@@ -1 +1 @@
1
- {"version":3,"file":"taiga-ui-core-components-dialog.js","sources":["ng://@taiga-ui/core/components/dialog/dialog.providers.ts","ng://@taiga-ui/core/components/dialog/dialog.component.ts","ng://@taiga-ui/core/components/dialog/dialog.service.ts","ng://@taiga-ui/core/components/dialog/dialog.directive.ts","ng://@taiga-ui/core/components/dialog/dialog.module.ts","ng://@taiga-ui/core/components/dialog/taiga-ui-core-components-dialog.ts"],"sourcesContent":["import {DOCUMENT} from '@angular/common';\nimport {ElementRef, InjectionToken, Provider} from '@angular/core';\nimport {WINDOW} from '@ng-web-apis/common';\nimport {\n containsOrAfter,\n isCurrentTarget,\n TuiDestroyService,\n TuiDialog,\n tuiGetViewportWidth,\n typedFromEvent,\n} from '@taiga-ui/cdk';\nimport {TuiDialogOptions} from '@taiga-ui/core/interfaces';\nimport {POLYMORPHEUS_CONTEXT} from '@tinkoff/ng-polymorpheus';\nimport {EMPTY, merge, Observable} from 'rxjs';\nimport {filter, switchMapTo, take, takeUntil} from 'rxjs/operators';\n\nexport const TUI_DIALOGS_CLOSE = new InjectionToken<Observable<unknown>>(\n 'A stream to close dialogs',\n {\n factory: () => EMPTY,\n },\n);\n\nconst SCROLLBAR_PLACEHOLDER = 17;\n\nexport function dialogCloseStreamFactory(\n documentRef: Document,\n windowRef: Window,\n {nativeElement}: ElementRef<HTMLElement>,\n close$: Observable<void>,\n destroy$: Observable<void>,\n {dismissible}: TuiDialog<TuiDialogOptions<unknown>, unknown>,\n): Observable<unknown> {\n return dismissible\n ? merge(\n typedFromEvent(nativeElement, 'click').pipe(filter(isCurrentTarget)),\n typedFromEvent(documentRef, 'keydown').pipe(\n // TODO: iframe warning\n filter(\n ({key, target}) =>\n key === 'Escape' &&\n target instanceof Element &&\n (!containsOrAfter(nativeElement, target) ||\n nativeElement.contains(target)),\n ),\n ),\n typedFromEvent(documentRef, 'mousedown').pipe(\n // TODO: iframe warning\n filter(\n ({target, clientX}) =>\n target instanceof Element &&\n tuiGetViewportWidth(windowRef) - clientX >\n SCROLLBAR_PLACEHOLDER &&\n !containsOrAfter(nativeElement, target),\n ),\n switchMapTo(\n typedFromEvent(documentRef, 'mouseup').pipe(\n take(1),\n // TODO: iframe warning\n filter(\n ({target}) =>\n target instanceof Element &&\n !containsOrAfter(nativeElement, target),\n ),\n ),\n ),\n ),\n close$,\n ).pipe(takeUntil(destroy$))\n : close$;\n}\n\nexport const TUI_DIALOG_CLOSE_STREAM = new InjectionToken<Observable<unknown>>(\n 'Dialogs closing stream',\n);\nexport const TUI_DIALOG_PROVIDERS: Provider[] = [\n TuiDestroyService,\n {\n provide: TUI_DIALOG_CLOSE_STREAM,\n deps: [\n DOCUMENT,\n WINDOW,\n ElementRef,\n TUI_DIALOGS_CLOSE,\n TuiDestroyService,\n POLYMORPHEUS_CONTEXT,\n ],\n useFactory: dialogCloseStreamFactory,\n },\n];\n","import {ChangeDetectionStrategy, Component, HostBinding, Inject} from '@angular/core';\nimport {TUI_IS_MOBILE, TuiDialog} from '@taiga-ui/cdk';\nimport {tuiFadeIn, tuiSlideInTop} from '@taiga-ui/core/animations';\nimport {TuiAnimationOptions, TuiDialogOptions} from '@taiga-ui/core/interfaces';\nimport {TUI_ANIMATIONS_DURATION, TUI_CLOSE_WORD} from '@taiga-ui/core/tokens';\nimport {TuiDialogSize} from '@taiga-ui/core/types';\nimport {POLYMORPHEUS_CONTEXT, PolymorpheusContent} from '@tinkoff/ng-polymorpheus';\nimport {Observable} from 'rxjs';\n\nimport {TUI_DIALOG_CLOSE_STREAM, TUI_DIALOG_PROVIDERS} from './dialog.providers';\n\nconst REQUIRED_ERROR = new Error('Required dialog was dismissed');\n\n// @dynamic\n@Component({\n selector: 'tui-dialog',\n templateUrl: './dialog.template.html',\n styleUrls: ['./dialog.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: TUI_DIALOG_PROVIDERS,\n animations: [tuiSlideInTop, tuiFadeIn],\n})\nexport class TuiDialogComponent<O, I> {\n private readonly animation = {\n value: '',\n params: {\n start: '40px',\n duration: this.duration,\n },\n } as const;\n\n private readonly fullscreenAnimation = {\n value: '',\n params: {\n start: '100vh',\n duration: this.duration,\n },\n } as const;\n\n constructor(\n @Inject(TUI_ANIMATIONS_DURATION) private readonly duration: number,\n @Inject(TUI_IS_MOBILE) private readonly isMobile: boolean,\n @Inject(POLYMORPHEUS_CONTEXT)\n readonly context: TuiDialog<TuiDialogOptions<I>, O>,\n @Inject(TUI_DIALOG_CLOSE_STREAM)\n close$: Observable<unknown>,\n @Inject(TUI_CLOSE_WORD) readonly closeWord$: Observable<string>,\n ) {\n close$.subscribe(() => {\n this.close();\n });\n }\n\n @HostBinding('attr.data-size')\n get size(): TuiDialogSize {\n return this.context.size;\n }\n\n @HostBinding('class._centered')\n get header(): PolymorpheusContent {\n return this.context.header;\n }\n\n @HostBinding('@tuiSlideInTop')\n @HostBinding('@tuiFadeIn')\n get slideInTop(): TuiAnimationOptions {\n return this.size === 'fullscreen' || this.size === 'page' || this.isMobile\n ? this.fullscreenAnimation\n : this.animation;\n }\n\n close(): void {\n if (this.context.required) {\n this.context.$implicit.error(REQUIRED_ERROR);\n } else {\n this.context.$implicit.complete();\n }\n }\n}\n","import {Injectable} from '@angular/core';\nimport {AbstractTuiDialogService} from '@taiga-ui/cdk';\nimport {TuiDialogOptions} from '@taiga-ui/core/interfaces';\nimport {PolymorpheusComponent} from '@tinkoff/ng-polymorpheus';\n\nimport {TuiDialogComponent} from './dialog.component';\n\nconst DIALOG = new PolymorpheusComponent(TuiDialogComponent);\nconst DEFAULT_OPTIONS = {\n size: 'm',\n required: false,\n closeable: true,\n dismissible: true,\n label: '',\n header: '',\n} as const;\n\n@Injectable({\n providedIn: 'root',\n})\nexport class TuiDialogService extends AbstractTuiDialogService<TuiDialogOptions<any>> {\n protected readonly component = DIALOG;\n protected readonly defaultOptions: TuiDialogOptions<any> = DEFAULT_OPTIONS as any;\n}\n","import {Directive} from '@angular/core';\nimport {AbstractTuiDialogDirective, AbstractTuiDialogService} from '@taiga-ui/cdk';\nimport {TuiDialogOptions} from '@taiga-ui/core/interfaces';\n\nimport {TuiDialogService} from './dialog.service';\n\n@Directive({\n selector: 'ng-template[tuiDialog]',\n providers: [\n {\n provide: AbstractTuiDialogService,\n useExisting: TuiDialogService,\n },\n ],\n inputs: ['options: tuiDialogOptions', 'open: tuiDialog'],\n outputs: ['openChange: tuiDialogChange'],\n})\nexport class TuiDialogDirective<T> extends AbstractTuiDialogDirective<\n TuiDialogOptions<T>\n> {}\n","import {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {TUI_DIALOGS, TuiPreventDefaultModule} from '@taiga-ui/cdk';\nimport {TuiButtonModule} from '@taiga-ui/core/components/button';\nimport {PolymorpheusModule} from '@tinkoff/ng-polymorpheus';\n\nimport {TuiDialogComponent} from './dialog.component';\nimport {TuiDialogDirective} from './dialog.directive';\nimport {TuiDialogService} from './dialog.service';\n\n@NgModule({\n imports: [PolymorpheusModule, TuiButtonModule, CommonModule, TuiPreventDefaultModule],\n declarations: [TuiDialogComponent, TuiDialogDirective],\n exports: [TuiDialogComponent, TuiDialogDirective],\n entryComponents: [TuiDialogComponent],\n providers: [\n {\n provide: TUI_DIALOGS,\n useExisting: TuiDialogService,\n multi: true,\n },\n ],\n})\nexport class TuiDialogModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;IAgBa,iBAAiB,GAAG,IAAI,cAAc,CAC/C,2BAA2B,EAC3B;IACI,OAAO,EAAE,cAAM,OAAA,KAAK,GAAA;CACvB,EACH;AAEF,IAAM,qBAAqB,GAAG,EAAE,CAAC;SAEjB,wBAAwB,CACpC,WAAqB,EACrB,SAAiB,EACjB,EAAwC,EACxC,MAAwB,EACxB,QAA0B,EAC1B,EAA4D;QAH3D,gCAAa;QAGb,4BAAW;IAEZ,OAAO,WAAW;UACZ,KAAK,CACD,cAAc,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EACpE,cAAc,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,IAAI;;QAEvC,MAAM,CACF,UAAC,EAAa;gBAAZ,YAAG,EAAE,kBAAM;YACT,OAAA,GAAG,KAAK,QAAQ;gBAChB,MAAM,YAAY,OAAO;iBACxB,CAAC,eAAe,CAAC,aAAa,EAAE,MAAM,CAAC;oBACpC,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;SAAA,CAC1C,CACJ,EACD,cAAc,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,IAAI;;QAEzC,MAAM,CACF,UAAC,EAAiB;gBAAhB,kBAAM,EAAE,oBAAO;YACb,OAAA,MAAM,YAAY,OAAO;gBACzB,mBAAmB,CAAC,SAAS,CAAC,GAAG,OAAO;oBACpC,qBAAqB;gBACzB,CAAC,eAAe,CAAC,aAAa,EAAE,MAAM,CAAC;SAAA,CAC9C,EACD,WAAW,CACP,cAAc,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,IAAI,CACvC,IAAI,CAAC,CAAC,CAAC;;QAEP,MAAM,CACF,UAAC,EAAQ;gBAAP,kBAAM;YACJ,OAAA,M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7B,KAAK,EAAE,IAAI;iBACd;aACJ;SACJ,CAAC;OACW,eAAe,CAAG;IAAD,sBAAC;CAA/B;;ACvBA;;;;;;"}
1
+ {"version":3,"file":"taiga-ui-core-components-dialog.js","sources":["ng://@taiga-ui/core/components/dialog/dialog.providers.ts","ng://@taiga-ui/core/components/dialog/dialog.component.ts","ng://@taiga-ui/core/components/dialog/dialog.service.ts","ng://@taiga-ui/core/components/dialog/dialog.directive.ts","ng://@taiga-ui/core/components/dialog/dialog.module.ts","ng://@taiga-ui/core/components/dialog/taiga-ui-core-components-dialog.ts"],"sourcesContent":["import {DOCUMENT} from '@angular/common';\nimport {ElementRef, InjectionToken, Provider} from '@angular/core';\nimport {WINDOW} from '@ng-web-apis/common';\nimport {\n containsOrAfter,\n isCurrentTarget,\n TuiDestroyService,\n TuiDialog,\n typedFromEvent,\n} from '@taiga-ui/cdk';\nimport {TuiDialogOptions} from '@taiga-ui/core/interfaces';\nimport {tuiGetViewportWidth} from '@taiga-ui/core/utils/dom';\nimport {POLYMORPHEUS_CONTEXT} from '@tinkoff/ng-polymorpheus';\nimport {EMPTY, merge, Observable} from 'rxjs';\nimport {filter, switchMapTo, take, takeUntil} from 'rxjs/operators';\n\nexport const TUI_DIALOGS_CLOSE = new InjectionToken<Observable<unknown>>(\n 'A stream to close dialogs',\n {\n factory: () => EMPTY,\n },\n);\n\nconst SCROLLBAR_PLACEHOLDER = 17;\n\nexport function dialogCloseStreamFactory(\n documentRef: Document,\n windowRef: Window,\n {nativeElement}: ElementRef<HTMLElement>,\n close$: Observable<void>,\n destroy$: Observable<void>,\n {dismissible}: TuiDialog<TuiDialogOptions<unknown>, unknown>,\n): Observable<unknown> {\n return dismissible\n ? merge(\n typedFromEvent(nativeElement, 'click').pipe(filter(isCurrentTarget)),\n typedFromEvent(documentRef, 'keydown').pipe(\n // TODO: iframe warning\n filter(\n ({key, target}) =>\n key === 'Escape' &&\n target instanceof Element &&\n (!containsOrAfter(nativeElement, target) ||\n nativeElement.contains(target)),\n ),\n ),\n typedFromEvent(documentRef, 'mousedown').pipe(\n // TODO: iframe warning\n filter(\n ({target, clientX}) =>\n target instanceof Element &&\n tuiGetViewportWidth(windowRef) - clientX >\n SCROLLBAR_PLACEHOLDER &&\n !containsOrAfter(nativeElement, target),\n ),\n switchMapTo(\n typedFromEvent(documentRef, 'mouseup').pipe(\n take(1),\n // TODO: iframe warning\n filter(\n ({target}) =>\n target instanceof Element &&\n !containsOrAfter(nativeElement, target),\n ),\n ),\n ),\n ),\n close$,\n ).pipe(takeUntil(destroy$))\n : close$;\n}\n\nexport const TUI_DIALOG_CLOSE_STREAM = new InjectionToken<Observable<unknown>>(\n 'Dialogs closing stream',\n);\nexport const TUI_DIALOG_PROVIDERS: Provider[] = [\n TuiDestroyService,\n {\n provide: TUI_DIALOG_CLOSE_STREAM,\n deps: [\n DOCUMENT,\n WINDOW,\n ElementRef,\n TUI_DIALOGS_CLOSE,\n TuiDestroyService,\n POLYMORPHEUS_CONTEXT,\n ],\n useFactory: dialogCloseStreamFactory,\n },\n];\n","import {ChangeDetectionStrategy, Component, HostBinding, Inject} from '@angular/core';\nimport {TUI_IS_MOBILE, TuiDialog} from '@taiga-ui/cdk';\nimport {tuiFadeIn, tuiSlideInTop} from '@taiga-ui/core/animations';\nimport {TuiAnimationOptions, TuiDialogOptions} from '@taiga-ui/core/interfaces';\nimport {TUI_ANIMATIONS_DURATION, TUI_CLOSE_WORD} from '@taiga-ui/core/tokens';\nimport {TuiDialogSize} from '@taiga-ui/core/types';\nimport {POLYMORPHEUS_CONTEXT, PolymorpheusContent} from '@tinkoff/ng-polymorpheus';\nimport {Observable} from 'rxjs';\n\nimport {TUI_DIALOG_CLOSE_STREAM, TUI_DIALOG_PROVIDERS} from './dialog.providers';\n\nconst REQUIRED_ERROR = new Error('Required dialog was dismissed');\n\n// @dynamic\n@Component({\n selector: 'tui-dialog',\n templateUrl: './dialog.template.html',\n styleUrls: ['./dialog.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: TUI_DIALOG_PROVIDERS,\n animations: [tuiSlideInTop, tuiFadeIn],\n})\nexport class TuiDialogComponent<O, I> {\n private readonly animation = {\n value: '',\n params: {\n start: '40px',\n duration: this.duration,\n },\n } as const;\n\n private readonly fullscreenAnimation = {\n value: '',\n params: {\n start: '100vh',\n duration: this.duration,\n },\n } as const;\n\n constructor(\n @Inject(TUI_ANIMATIONS_DURATION) private readonly duration: number,\n @Inject(TUI_IS_MOBILE) private readonly isMobile: boolean,\n @Inject(POLYMORPHEUS_CONTEXT)\n readonly context: TuiDialog<TuiDialogOptions<I>, O>,\n @Inject(TUI_DIALOG_CLOSE_STREAM)\n close$: Observable<unknown>,\n @Inject(TUI_CLOSE_WORD) readonly closeWord$: Observable<string>,\n ) {\n close$.subscribe(() => {\n this.close();\n });\n }\n\n @HostBinding('attr.data-size')\n get size(): TuiDialogSize {\n return this.context.size;\n }\n\n @HostBinding('class._centered')\n get header(): PolymorpheusContent {\n return this.context.header;\n }\n\n @HostBinding('@tuiSlideInTop')\n @HostBinding('@tuiFadeIn')\n get slideInTop(): TuiAnimationOptions {\n return this.size === 'fullscreen' || this.size === 'page' || this.isMobile\n ? this.fullscreenAnimation\n : this.animation;\n }\n\n close(): void {\n if (this.context.required) {\n this.context.$implicit.error(REQUIRED_ERROR);\n } else {\n this.context.$implicit.complete();\n }\n }\n}\n","import {Injectable} from '@angular/core';\nimport {AbstractTuiDialogService} from '@taiga-ui/cdk';\nimport {TuiDialogOptions} from '@taiga-ui/core/interfaces';\nimport {PolymorpheusComponent} from '@tinkoff/ng-polymorpheus';\n\nimport {TuiDialogComponent} from './dialog.component';\n\nconst DIALOG = new PolymorpheusComponent(TuiDialogComponent);\nconst DEFAULT_OPTIONS = {\n size: 'm',\n required: false,\n closeable: true,\n dismissible: true,\n label: '',\n header: '',\n} as const;\n\n@Injectable({\n providedIn: 'root',\n})\nexport class TuiDialogService extends AbstractTuiDialogService<TuiDialogOptions<any>> {\n protected readonly component = DIALOG;\n protected readonly defaultOptions: TuiDialogOptions<any> = DEFAULT_OPTIONS as any;\n}\n","import {Directive} from '@angular/core';\nimport {AbstractTuiDialogDirective, AbstractTuiDialogService} from '@taiga-ui/cdk';\nimport {TuiDialogOptions} from '@taiga-ui/core/interfaces';\n\nimport {TuiDialogService} from './dialog.service';\n\n@Directive({\n selector: 'ng-template[tuiDialog]',\n providers: [\n {\n provide: AbstractTuiDialogService,\n useExisting: TuiDialogService,\n },\n ],\n inputs: ['options: tuiDialogOptions', 'open: tuiDialog'],\n outputs: ['openChange: tuiDialogChange'],\n})\nexport class TuiDialogDirective<T> extends AbstractTuiDialogDirective<\n TuiDialogOptions<T>\n> {}\n","import {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {TUI_DIALOGS, TuiPreventDefaultModule} from '@taiga-ui/cdk';\nimport {TuiButtonModule} from '@taiga-ui/core/components/button';\nimport {PolymorpheusModule} from '@tinkoff/ng-polymorpheus';\n\nimport {TuiDialogComponent} from './dialog.component';\nimport {TuiDialogDirective} from './dialog.directive';\nimport {TuiDialogService} from './dialog.service';\n\n@NgModule({\n imports: [PolymorpheusModule, TuiButtonModule, CommonModule, TuiPreventDefaultModule],\n declarations: [TuiDialogComponent, TuiDialogDirective],\n exports: [TuiDialogComponent, TuiDialogDirective],\n entryComponents: [TuiDialogComponent],\n providers: [\n {\n provide: TUI_DIALOGS,\n useExisting: TuiDialogService,\n multi: true,\n },\n ],\n})\nexport class TuiDialogModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;IAgBa,iBAAiB,GAAG,IAAI,cAAc,CAC/C,2BAA2B,EAC3B;IACI,OAAO,EAAE,cAAM,OAAA,KAAK,GAAA;CACvB,EACH;AAEF,IAAM,qBAAqB,GAAG,EAAE,CAAC;SAEjB,wBAAwB,CACpC,WAAqB,EACrB,SAAiB,EACjB,EAAwC,EACxC,MAAwB,EACxB,QAA0B,EAC1B,E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CAAC;QACnB,oBAAc,GAA0B,eAAsB,CAAC;;KACrF;;IAHY,gBAAgB;QAH5B,UAAU,CAAC;YACR,UAAU,EAAE,MAAM;SACrB,CAAC;OACW,gBAAgB,CAG5B;2BAvBD;CAuBC,CAHqC,wBAAwB;;;ICHnB,sCAE1C;IAFD;;KAEI;IAFS,kBAAkB;QAX9B,SAAS,CAAC;YACP,QAAQ,EAAE,wBAAwB;YAClC,SAAS,EAAE;gBACP;oBACI,OAAO,EAAE,wBAAwB;oBACjC,WAAW,EAAE,gBAAgB;iBAChC;aACJ;YACD,MAAM,EAAE,CAAC,2BAA2B,EAAE,iBAAiB,CAAC;YACxD,OAAO,EAAE,CAAC,6BAA6B,CAAC;SAC3C,CAAC;OACW,kBAAkB,CAE3B;IAAD,yBAAC;CAAA,CAFuC,0BAA0B;;;ICMrE;KAA+B;IAAlB,eAAe;QAb3B,QAAQ,CAAC;YACN,OAAO,EAAE,CAAC,kBAAkB,EAAE,eAAe,EAAE,YAAY,EAAE,uBAAuB,CAAC;YACrF,YAAY,EAAE,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;YACtD,OAAO,EAAE,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;YACjD,eAAe,EAAE,CAAC,kBAAkB,CAAC;YACrC,SAAS,EAAE;gBACP;oBACI,OAAO,EAAE,WAAW;oBACpB,WAAW,EAAE,gBAAgB;oBAC7B,KAAK,EAAE,IAAI;iBACd;aACJ;SACJ,CAAC;OACW,eAAe,CAAG;IAAD,sBAAC;CAA/B;;ACvBA;;;;;;"}
@@ -1,11 +1,11 @@
1
1
  import { __assign, __decorate, __param } from 'tslib';
2
2
  import { Inject, NgZone, ElementRef, HostBinding, ViewChild, Component, ChangeDetectionStrategy, NgModule } from '@angular/core';
3
3
  import { WINDOW, ANIMATION_FRAME } from '@ng-web-apis/common';
4
- import { POLLING_TIME, tuiZonefree, tuiGetViewportWidth, inRange, px, tuiAssertIsHTMLElement, getClosestFocusable, TuiDestroyService, TuiDropdownHostComponent, AbstractTuiPortalHostComponent, tuiPure, TuiActiveZoneModule, TuiOverscrollModule } from '@taiga-ui/cdk';
4
+ import { POLLING_TIME, tuiZonefree, inRange, px, tuiAssertIsHTMLElement, getClosestFocusable, TuiDestroyService, TuiDropdownHostComponent, AbstractTuiPortalHostComponent, tuiPure, TuiActiveZoneModule, TuiOverscrollModule } from '@taiga-ui/cdk';
5
5
  import { tuiDropdownAnimation } from '@taiga-ui/core/animations';
6
6
  import { DEFAULT_MARGIN, DEFAULT_MAX_WIDTH } from '@taiga-ui/core/constants';
7
7
  import { TUI_DROPDOWN_DIRECTIVE, TUI_ANIMATION_OPTIONS } from '@taiga-ui/core/tokens';
8
- import { getScreenWidth } from '@taiga-ui/core/utils/dom';
8
+ import { getScreenWidth, tuiGetViewportWidth } from '@taiga-ui/core/utils/dom';
9
9
  import { merge, fromEvent, Observable } from 'rxjs';
10
10
  import { throttleTime, takeUntil } from 'rxjs/operators';
11
11
  import { TuiScrollbarModule } from '@taiga-ui/core/components/scrollbar';
@@ -1 +1 @@
1
- {"version":3,"file":"taiga-ui-core-components-dropdown-box.js","sources":["ng://@taiga-ui/core/components/dropdown-box/dropdown-box.component.ts","ng://@taiga-ui/core/components/dropdown-box/dropdown-box.module.ts","ng://@taiga-ui/core/components/dropdown-box/taiga-ui-core-components-dropdown-box.ts"],"sourcesContent":["import {AnimationOptions} from '@angular/animations';\nimport {\n AfterViewChecked,\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n HostBinding,\n Inject,\n NgZone,\n ViewChild,\n} from '@angular/core';\nimport {ANIMATION_FRAME, WINDOW} from '@ng-web-apis/common';\nimport {\n AbstractTuiPortalHostComponent,\n getClosestFocusable,\n inRange,\n POLLING_TIME,\n px,\n TuiActiveZoneDirective,\n tuiAssertIsHTMLElement,\n TuiDestroyService,\n TuiDropdownHostComponent,\n tuiGetViewportWidth,\n TuiOverscrollModeT,\n tuiPure,\n tuiZonefree,\n} from '@taiga-ui/cdk';\nimport {tuiDropdownAnimation} from '@taiga-ui/core/animations';\nimport {DEFAULT_MARGIN, DEFAULT_MAX_WIDTH} from '@taiga-ui/core/constants';\nimport {TuiDropdownAnimation} from '@taiga-ui/core/enums';\nimport {TuiAnimationOptions, TuiDropdown} from '@taiga-ui/core/interfaces';\nimport {TUI_ANIMATION_OPTIONS, TUI_DROPDOWN_DIRECTIVE} from '@taiga-ui/core/tokens';\nimport {TuiHorizontalDirection, TuiVerticalDirection} from '@taiga-ui/core/types';\nimport {getScreenWidth} from '@taiga-ui/core/utils/dom';\nimport {fromEvent, merge, Observable} from 'rxjs';\nimport {takeUntil, throttleTime} from 'rxjs/operators';\n\n/**\n * This component is used to show template in a portal using default style of white rounded box with a shadow\n */\n// @bad TODO: OnPush\n// Ambient type cannot be used without dynamic https://github.com/angular/angular/issues/23395\n// @dynamic\n@Component({\n selector: 'tui-dropdown-box',\n templateUrl: './dropdown-box.template.html',\n styleUrls: ['./dropdown-box.style.less'],\n changeDetection: ChangeDetectionStrategy.Default,\n providers: [TuiDestroyService],\n animations: [tuiDropdownAnimation],\n})\nexport class TuiDropdownBoxComponent implements AfterViewChecked {\n private readonly animationTop = {\n value: TuiDropdownAnimation.FadeInTop,\n ...this.options,\n };\n\n private readonly animationBottom = {\n value: TuiDropdownAnimation.FadeInBottom,\n ...this.options,\n };\n\n /**\n * Is previous position on top (to prevent jumping up and down on scroll)\n */\n private prevDirectionIsTop = false;\n\n @HostBinding('@tuiDropdownAnimation')\n dropdownAnimation!: TuiAnimationOptions;\n\n @ViewChild('content', {read: ElementRef})\n readonly contentElementRef?: ElementRef<HTMLElement>;\n\n constructor(\n @Inject(TuiDestroyService)\n destroy$: TuiDestroyService,\n @Inject(NgZone) ngZone: NgZone,\n @Inject(TUI_DROPDOWN_DIRECTIVE) readonly directive: TuiDropdown,\n @Inject(WINDOW) private readonly windowRef: Window,\n @Inject(ElementRef) private readonly elementRef: ElementRef<HTMLElement>,\n @Inject(AbstractTuiPortalHostComponent)\n private readonly portalHost: TuiDropdownHostComponent,\n @Inject(TUI_ANIMATION_OPTIONS) private readonly options: AnimationOptions,\n @Inject(ANIMATION_FRAME) animationFrame$: Observable<number>,\n ) {\n merge(\n animationFrame$.pipe(throttleTime(POLLING_TIME)),\n this.directive.refresh$,\n fromEvent(this.windowRef, 'resize'),\n )\n .pipe(tuiZonefree(ngZone), takeUntil(destroy$))\n .subscribe(() => {\n this.calculatePositionAndSize();\n });\n }\n\n get overscroll(): TuiOverscrollModeT {\n return this.inModal ? 'all' : 'scroll';\n }\n\n @tuiPure\n getContext<T extends object>(\n context?: T,\n activeZone?: TuiActiveZoneDirective,\n ):\n | (T & {activeZone?: TuiActiveZoneDirective})\n | {activeZone?: TuiActiveZoneDirective} {\n return {...context, activeZone};\n }\n\n ngAfterViewChecked(): void {\n this.calculatePositionAndSize();\n }\n\n onTopFocus(): void {\n this.moveFocusOutside(true);\n }\n\n onBottomFocus(): void {\n this.moveFocusOutside(false);\n }\n\n @tuiPure\n private get inModal(): boolean {\n // @awful TODO: get rid of component tag name dependency\n return !!this.directive.host.closest('tui-dialog-host');\n }\n\n @tuiPure\n private get inOption(): boolean {\n // @awful TODO: get rid of component tag name dependency\n return !!this.directive.host.closest('[tuiOption]');\n }\n\n private calculatePositionAndSize(): void {\n const {clientRect} = this.directive;\n const {style} = this.elementRef.nativeElement;\n const hostRect = this.directive.fixed\n ? this.portalHost.fixedPositionOffset()\n : this.portalHost.clientRect;\n\n style.position = this.directive.fixed ? 'fixed' : 'absolute';\n\n this.calculateVerticalPosition(style, clientRect, hostRect);\n this.calculateHorizontalPosition(style, clientRect, hostRect);\n this.calculateWidth(style, clientRect);\n }\n\n private getFinalAlign(\n style: CSSStyleDeclaration,\n directiveRect: ClientRect,\n ): TuiHorizontalDirection {\n const dropdownRect = this.elementRef.nativeElement.getBoundingClientRect();\n const dropdownWidth = this.elementRef.nativeElement.offsetWidth;\n const screenWidth = getScreenWidth(this.windowRef.document);\n const isDropdownSizeHypotheticallyFitsViewport =\n directiveRect.left + dropdownWidth < screenWidth ||\n directiveRect.right - dropdownWidth > 0;\n const isDropdownSizeActuallyFitsViewport =\n dropdownRect.right <= screenWidth && dropdownRect.left >= 0;\n let finalAlign: TuiHorizontalDirection = this.directive.align;\n\n switch (this.directive.align) {\n case 'left':\n if (\n isDropdownSizeHypotheticallyFitsViewport &&\n dropdownRect.right > screenWidth\n ) {\n finalAlign = 'right';\n }\n\n break;\n case 'right':\n if (isDropdownSizeHypotheticallyFitsViewport && dropdownRect.left < 0) {\n finalAlign = 'left';\n }\n\n break;\n }\n\n if (style.right === 'auto' && isDropdownSizeActuallyFitsViewport) {\n finalAlign = 'left';\n }\n\n if (style.left === 'auto' && isDropdownSizeActuallyFitsViewport) {\n finalAlign = 'right';\n }\n\n return finalAlign;\n }\n\n /**\n * Calculates horizontal position\n *\n * @param style dropdownBox elementRef styles object\n * @param directiveRect ClientRect of hosting directive\n * @param hostRect ClientRect of portal host\n */\n private calculateHorizontalPosition(\n style: CSSStyleDeclaration,\n directiveRect: ClientRect,\n hostRect: ClientRect,\n ): void {\n const offset = this.directive.sided\n ? this.elementRef.nativeElement.getBoundingClientRect().width + DEFAULT_MARGIN\n : 0;\n const left = Math.ceil(directiveRect.left - hostRect.left - offset);\n const right = Math.floor(hostRect.right - directiveRect.right - offset);\n const viewportWidth = tuiGetViewportWidth(this.windowRef);\n\n switch (this.getFinalAlign(style, directiveRect)) {\n case 'left':\n if (\n right + DEFAULT_MARGIN > viewportWidth ||\n inRange(left + DEFAULT_MARGIN, 0, viewportWidth)\n ) {\n style.left = px(left);\n style.right = 'auto';\n } else {\n style.left = 'auto';\n style.right = px(right);\n }\n\n break;\n case 'right':\n if (\n inRange(right + DEFAULT_MARGIN, 0, viewportWidth) ||\n left + DEFAULT_MARGIN > viewportWidth\n ) {\n style.left = 'auto';\n style.right = px(right);\n } else {\n style.left = px(left);\n style.right = 'auto';\n }\n\n break;\n }\n }\n\n /**\n * Calculates vertical position and height\n *\n * @param style dropdownBox elementRef styles object\n * @param directiveRect ClientRect of hosting directive\n * @param hostRect ClientRect of portal host\n */\n private calculateVerticalPosition(\n style: CSSStyleDeclaration,\n directiveRect: ClientRect,\n hostRect: ClientRect,\n ): void {\n const windowHeight = this.windowRef.innerHeight;\n // Maximum height of the box\n const boxHeightLimit = Math.min(\n this.directive.maxHeight,\n windowHeight - DEFAULT_MARGIN * 2,\n );\n const offset = this.directive.sided\n ? DEFAULT_MARGIN - directiveRect.height\n : DEFAULT_MARGIN * 2;\n const topAvailableHeight = directiveRect.top - offset;\n const bottomAvailableHeight = windowHeight - directiveRect.bottom - offset;\n const finalDirection = this.getFinalDirection(directiveRect);\n const optionOffset = this.inOption ? DEFAULT_MARGIN * 2 : 0;\n\n this.prevDirectionIsTop = finalDirection === 'top';\n\n if (finalDirection === 'top') {\n this.dropdownAnimation = this.animationBottom;\n\n style.maxHeight = px(Math.min(boxHeightLimit, topAvailableHeight));\n style.top = 'auto';\n style.bottom = px(\n hostRect.bottom -\n directiveRect.top -\n DEFAULT_MARGIN +\n offset -\n optionOffset,\n );\n } else {\n this.dropdownAnimation = this.animationTop;\n\n style.maxHeight = px(Math.min(boxHeightLimit, bottomAvailableHeight));\n style.top = px(\n directiveRect.bottom -\n hostRect.top -\n DEFAULT_MARGIN +\n offset -\n optionOffset,\n );\n style.bottom = 'auto';\n }\n }\n\n private getFinalDirection(directiveRect: ClientRect): TuiVerticalDirection | null {\n const windowHeight = this.windowRef.innerHeight;\n const offset = this.directive.sided\n ? DEFAULT_MARGIN - directiveRect.height\n : DEFAULT_MARGIN * 2;\n\n // Maximum space available on top and on the bottom in the viewport\n const topAvailableHeight = directiveRect.top - offset;\n const bottomAvailableHeight = windowHeight - directiveRect.bottom - offset;\n\n let finalDirection: TuiVerticalDirection | null = null;\n\n // Given direction is applied if we can fit the box in the limits that way\n switch (this.directive.direction) {\n case 'top':\n if (topAvailableHeight >= this.directive.minHeight) {\n finalDirection = 'top';\n }\n\n break;\n case 'bottom':\n if (bottomAvailableHeight >= this.directive.minHeight) {\n finalDirection = 'bottom';\n }\n\n break;\n }\n\n // Maximum height of the box\n const boxHeightLimit = Math.min(\n this.directive.maxHeight,\n windowHeight - DEFAULT_MARGIN * 2,\n );\n\n // Choose direction if given direction did not fit\n if (finalDirection === null && this.contentElementRef) {\n // Box height if it fits without scroll\n const visualHeight = Math.min(\n this.contentElementRef.nativeElement.getBoundingClientRect().height +\n (this.elementRef.nativeElement.offsetHeight -\n this.elementRef.nativeElement.clientHeight),\n boxHeightLimit,\n );\n\n // If there is enough space to fit below without scroll,\n // choose 'bottom', unless it was previously on the top\n if (this.prevDirectionIsTop && topAvailableHeight >= visualHeight) {\n finalDirection = 'top';\n } else if (bottomAvailableHeight >= visualHeight) {\n finalDirection = 'bottom';\n } else {\n // Corner case — select direction with more space\n finalDirection =\n bottomAvailableHeight >= topAvailableHeight ? 'bottom' : 'top';\n }\n }\n\n return finalDirection;\n }\n\n /**\n * Calculates width\n *\n * @param style dropdownBox elementRef styles object\n * @param directiveRect ClientRect of hosting directive\n */\n private calculateWidth(style: CSSStyleDeclaration, directiveRect: ClientRect): void {\n style.width =\n this.directive.limitMinWidth === 'fixed' && !this.directive.sided\n ? px(directiveRect.width)\n : '';\n\n if (this.directive.limitMinWidth === 'min' && !this.directive.sided) {\n style.minWidth = px(directiveRect.width);\n style.maxWidth = px(DEFAULT_MAX_WIDTH);\n\n return;\n }\n\n style.minWidth = '';\n style.maxWidth = '';\n }\n\n private moveFocusOutside(previous: boolean): void {\n const {host} = this.directive;\n const {ownerDocument} = host;\n const root = ownerDocument ? ownerDocument.body : host;\n\n tuiAssertIsHTMLElement(host);\n\n let focusable = getClosestFocusable(host, previous, root);\n\n while (focusable !== null && host.contains(focusable)) {\n focusable = getClosestFocusable(focusable, previous, root);\n }\n\n focusable?.focus();\n }\n}\n","import {NgModule} from '@angular/core';\nimport {TuiActiveZoneModule, TuiOverscrollModule} from '@taiga-ui/cdk';\nimport {TuiScrollbarModule} from '@taiga-ui/core/components/scrollbar';\nimport {TuiModeModule} from '@taiga-ui/core/directives/mode';\nimport {PolymorpheusModule} from '@tinkoff/ng-polymorpheus';\n\nimport {TuiDropdownBoxComponent} from './dropdown-box.component';\n\n@NgModule({\n imports: [\n TuiActiveZoneModule,\n PolymorpheusModule,\n TuiOverscrollModule,\n TuiScrollbarModule,\n TuiModeModule,\n ],\n entryComponents: [TuiDropdownBoxComponent],\n declarations: [TuiDropdownBoxComponent],\n exports: [TuiDropdownBoxComponent],\n})\nexport class TuiDropdownBoxModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAqCA;;;AAGA;AACA;AACA;;IA+BI,iCAEI,QAA2B,EACX,MAAc,EACW,SAAsB,EAC9B,SAAiB,EACb,UAAmC,EAEvD,UAAoC,EACL,OAAyB,EAChD,eAAmC;QAVhE,iBAqBC;QAjB4C,cAAS,GAAT,SAAS,CAAa;QAC9B,cAAS,GAAT,SAAS,CAAQ;QACb,eAAU,GAAV,UAAU,CAAyB;QAEvD,eAAU,GAAV,UAAU,CAA0B;QACL,YAAO,GAAP,OAAO,CAAkB;QA9B5D,iBAAY,cACzB,KAAK,iCACF,IAAI,CAAC,OAAO,EACjB;QAEe,oBAAe,cAC5B,KAAK,uCACF,IAAI,CAAC,OAAO,EACjB;;;;QAKM,uBAAkB,GAAG,KAAK,CAAC;QAoB/B,KAAK,CACD,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,EAChD,IAAI,CAAC,SAAS,CAAC,QAAQ,EACvB,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CACtC;aACI,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;aAC9C,SAAS,CAAC;YACP,KAAI,CAAC,wBAAwB,EAAE,CAAC;SACnC,CAAC,CAAC;KACV;IAED,sBAAI,+CAAU;aAAd;YACI,OAAO,IAAI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CAAC,qBAAqB,CAAC,CAAA;QAC7B,WAAA,MAAM,CAAC,eAAe,CAAC,CAAA;OAhCnB,uBAAuB,CAsVnC;IAAD,8BAAC;CAtVD;;;IC/BA;KAAoC;IAAvB,oBAAoB;QAZhC,QAAQ,CAAC;YACN,OAAO,EAAE;gBACL,mBAAmB;gBACnB,kBAAkB;gBAClB,mBAAmB;gBACnB,kBAAkB;gBAClB,aAAa;aAChB;YACD,eAAe,EAAE,CAAC,uBAAuB,CAAC;YAC1C,YAAY,EAAE,CAAC,uBAAuB,CAAC;YACvC,OAAO,EAAE,CAAC,uBAAuB,CAAC;SACrC,CAAC;OACW,oBAAoB,CAAG;IAAD,2BAAC;CAApC;;ACpBA;;;;;;"}
1
+ {"version":3,"file":"taiga-ui-core-components-dropdown-box.js","sources":["ng://@taiga-ui/core/components/dropdown-box/dropdown-box.component.ts","ng://@taiga-ui/core/components/dropdown-box/dropdown-box.module.ts","ng://@taiga-ui/core/components/dropdown-box/taiga-ui-core-components-dropdown-box.ts"],"sourcesContent":["import {AnimationOptions} from '@angular/animations';\nimport {\n AfterViewChecked,\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n HostBinding,\n Inject,\n NgZone,\n ViewChild,\n} from '@angular/core';\nimport {ANIMATION_FRAME, WINDOW} from '@ng-web-apis/common';\nimport {\n AbstractTuiPortalHostComponent,\n getClosestFocusable,\n inRange,\n POLLING_TIME,\n px,\n TuiActiveZoneDirective,\n tuiAssertIsHTMLElement,\n TuiDestroyService,\n TuiDropdownHostComponent,\n TuiOverscrollModeT,\n tuiPure,\n tuiZonefree,\n} from '@taiga-ui/cdk';\nimport {tuiDropdownAnimation} from '@taiga-ui/core/animations';\nimport {DEFAULT_MARGIN, DEFAULT_MAX_WIDTH} from '@taiga-ui/core/constants';\nimport {TuiDropdownAnimation} from '@taiga-ui/core/enums';\nimport {TuiAnimationOptions, TuiDropdown} from '@taiga-ui/core/interfaces';\nimport {TUI_ANIMATION_OPTIONS, TUI_DROPDOWN_DIRECTIVE} from '@taiga-ui/core/tokens';\nimport {TuiHorizontalDirection, TuiVerticalDirection} from '@taiga-ui/core/types';\nimport {getScreenWidth, tuiGetViewportWidth} from '@taiga-ui/core/utils/dom';\nimport {fromEvent, merge, Observable} from 'rxjs';\nimport {takeUntil, throttleTime} from 'rxjs/operators';\n\n/**\n * This component is used to show template in a portal using default style of white rounded box with a shadow\n */\n// @bad TODO: OnPush\n// Ambient type cannot be used without dynamic https://github.com/angular/angular/issues/23395\n// @dynamic\n@Component({\n selector: 'tui-dropdown-box',\n templateUrl: './dropdown-box.template.html',\n styleUrls: ['./dropdown-box.style.less'],\n changeDetection: ChangeDetectionStrategy.Default,\n providers: [TuiDestroyService],\n animations: [tuiDropdownAnimation],\n})\nexport class TuiDropdownBoxComponent implements AfterViewChecked {\n private readonly animationTop = {\n value: TuiDropdownAnimation.FadeInTop,\n ...this.options,\n };\n\n private readonly animationBottom = {\n value: TuiDropdownAnimation.FadeInBottom,\n ...this.options,\n };\n\n /**\n * Is previous position on top (to prevent jumping up and down on scroll)\n */\n private prevDirectionIsTop = false;\n\n @HostBinding('@tuiDropdownAnimation')\n dropdownAnimation!: TuiAnimationOptions;\n\n @ViewChild('content', {read: ElementRef})\n readonly contentElementRef?: ElementRef<HTMLElement>;\n\n constructor(\n @Inject(TuiDestroyService)\n destroy$: TuiDestroyService,\n @Inject(NgZone) ngZone: NgZone,\n @Inject(TUI_DROPDOWN_DIRECTIVE) readonly directive: TuiDropdown,\n @Inject(WINDOW) private readonly windowRef: Window,\n @Inject(ElementRef) private readonly elementRef: ElementRef<HTMLElement>,\n @Inject(AbstractTuiPortalHostComponent)\n private readonly portalHost: TuiDropdownHostComponent,\n @Inject(TUI_ANIMATION_OPTIONS) private readonly options: AnimationOptions,\n @Inject(ANIMATION_FRAME) animationFrame$: Observable<number>,\n ) {\n merge(\n animationFrame$.pipe(throttleTime(POLLING_TIME)),\n this.directive.refresh$,\n fromEvent(this.windowRef, 'resize'),\n )\n .pipe(tuiZonefree(ngZone), takeUntil(destroy$))\n .subscribe(() => {\n this.calculatePositionAndSize();\n });\n }\n\n get overscroll(): TuiOverscrollModeT {\n return this.inModal ? 'all' : 'scroll';\n }\n\n @tuiPure\n getContext<T extends object>(\n context?: T,\n activeZone?: TuiActiveZoneDirective,\n ):\n | (T & {activeZone?: TuiActiveZoneDirective})\n | {activeZone?: TuiActiveZoneDirective} {\n return {...context, activeZone};\n }\n\n ngAfterViewChecked(): void {\n this.calculatePositionAndSize();\n }\n\n onTopFocus(): void {\n this.moveFocusOutside(true);\n }\n\n onBottomFocus(): void {\n this.moveFocusOutside(false);\n }\n\n @tuiPure\n private get inModal(): boolean {\n // @awful TODO: get rid of component tag name dependency\n return !!this.directive.host.closest('tui-dialog-host');\n }\n\n @tuiPure\n private get inOption(): boolean {\n // @awful TODO: get rid of component tag name dependency\n return !!this.directive.host.closest('[tuiOption]');\n }\n\n private calculatePositionAndSize(): void {\n const {clientRect} = this.directive;\n const {style} = this.elementRef.nativeElement;\n const hostRect = this.directive.fixed\n ? this.portalHost.fixedPositionOffset()\n : this.portalHost.clientRect;\n\n style.position = this.directive.fixed ? 'fixed' : 'absolute';\n\n this.calculateVerticalPosition(style, clientRect, hostRect);\n this.calculateHorizontalPosition(style, clientRect, hostRect);\n this.calculateWidth(style, clientRect);\n }\n\n private getFinalAlign(\n style: CSSStyleDeclaration,\n directiveRect: ClientRect,\n ): TuiHorizontalDirection {\n const dropdownRect = this.elementRef.nativeElement.getBoundingClientRect();\n const dropdownWidth = this.elementRef.nativeElement.offsetWidth;\n const screenWidth = getScreenWidth(this.windowRef.document);\n const isDropdownSizeHypotheticallyFitsViewport =\n directiveRect.left + dropdownWidth < screenWidth ||\n directiveRect.right - dropdownWidth > 0;\n const isDropdownSizeActuallyFitsViewport =\n dropdownRect.right <= screenWidth && dropdownRect.left >= 0;\n let finalAlign: TuiHorizontalDirection = this.directive.align;\n\n switch (this.directive.align) {\n case 'left':\n if (\n isDropdownSizeHypotheticallyFitsViewport &&\n dropdownRect.right > screenWidth\n ) {\n finalAlign = 'right';\n }\n\n break;\n case 'right':\n if (isDropdownSizeHypotheticallyFitsViewport && dropdownRect.left < 0) {\n finalAlign = 'left';\n }\n\n break;\n }\n\n if (style.right === 'auto' && isDropdownSizeActuallyFitsViewport) {\n finalAlign = 'left';\n }\n\n if (style.left === 'auto' && isDropdownSizeActuallyFitsViewport) {\n finalAlign = 'right';\n }\n\n return finalAlign;\n }\n\n /**\n * Calculates horizontal position\n *\n * @param style dropdownBox elementRef styles object\n * @param directiveRect ClientRect of hosting directive\n * @param hostRect ClientRect of portal host\n */\n private calculateHorizontalPosition(\n style: CSSStyleDeclaration,\n directiveRect: ClientRect,\n hostRect: ClientRect,\n ): void {\n const offset = this.directive.sided\n ? this.elementRef.nativeElement.getBoundingClientRect().width + DEFAULT_MARGIN\n : 0;\n const left = Math.ceil(directiveRect.left - hostRect.left - offset);\n const right = Math.floor(hostRect.right - directiveRect.right - offset);\n const viewportWidth = tuiGetViewportWidth(this.windowRef);\n\n switch (this.getFinalAlign(style, directiveRect)) {\n case 'left':\n if (\n right + DEFAULT_MARGIN > viewportWidth ||\n inRange(left + DEFAULT_MARGIN, 0, viewportWidth)\n ) {\n style.left = px(left);\n style.right = 'auto';\n } else {\n style.left = 'auto';\n style.right = px(right);\n }\n\n break;\n case 'right':\n if (\n inRange(right + DEFAULT_MARGIN, 0, viewportWidth) ||\n left + DEFAULT_MARGIN > viewportWidth\n ) {\n style.left = 'auto';\n style.right = px(right);\n } else {\n style.left = px(left);\n style.right = 'auto';\n }\n\n break;\n }\n }\n\n /**\n * Calculates vertical position and height\n *\n * @param style dropdownBox elementRef styles object\n * @param directiveRect ClientRect of hosting directive\n * @param hostRect ClientRect of portal host\n */\n private calculateVerticalPosition(\n style: CSSStyleDeclaration,\n directiveRect: ClientRect,\n hostRect: ClientRect,\n ): void {\n const windowHeight = this.windowRef.innerHeight;\n // Maximum height of the box\n const boxHeightLimit = Math.min(\n this.directive.maxHeight,\n windowHeight - DEFAULT_MARGIN * 2,\n );\n const offset = this.directive.sided\n ? DEFAULT_MARGIN - directiveRect.height\n : DEFAULT_MARGIN * 2;\n const topAvailableHeight = directiveRect.top - offset;\n const bottomAvailableHeight = windowHeight - directiveRect.bottom - offset;\n const finalDirection = this.getFinalDirection(directiveRect);\n const optionOffset = this.inOption ? DEFAULT_MARGIN * 2 : 0;\n\n this.prevDirectionIsTop = finalDirection === 'top';\n\n if (finalDirection === 'top') {\n this.dropdownAnimation = this.animationBottom;\n\n style.maxHeight = px(Math.min(boxHeightLimit, topAvailableHeight));\n style.top = 'auto';\n style.bottom = px(\n hostRect.bottom -\n directiveRect.top -\n DEFAULT_MARGIN +\n offset -\n optionOffset,\n );\n } else {\n this.dropdownAnimation = this.animationTop;\n\n style.maxHeight = px(Math.min(boxHeightLimit, bottomAvailableHeight));\n style.top = px(\n directiveRect.bottom -\n hostRect.top -\n DEFAULT_MARGIN +\n offset -\n optionOffset,\n );\n style.bottom = 'auto';\n }\n }\n\n private getFinalDirection(directiveRect: ClientRect): TuiVerticalDirection | null {\n const windowHeight = this.windowRef.innerHeight;\n const offset = this.directive.sided\n ? DEFAULT_MARGIN - directiveRect.height\n : DEFAULT_MARGIN * 2;\n\n // Maximum space available on top and on the bottom in the viewport\n const topAvailableHeight = directiveRect.top - offset;\n const bottomAvailableHeight = windowHeight - directiveRect.bottom - offset;\n\n let finalDirection: TuiVerticalDirection | null = null;\n\n // Given direction is applied if we can fit the box in the limits that way\n switch (this.directive.direction) {\n case 'top':\n if (topAvailableHeight >= this.directive.minHeight) {\n finalDirection = 'top';\n }\n\n break;\n case 'bottom':\n if (bottomAvailableHeight >= this.directive.minHeight) {\n finalDirection = 'bottom';\n }\n\n break;\n }\n\n // Maximum height of the box\n const boxHeightLimit = Math.min(\n this.directive.maxHeight,\n windowHeight - DEFAULT_MARGIN * 2,\n );\n\n // Choose direction if given direction did not fit\n if (finalDirection === null && this.contentElementRef) {\n // Box height if it fits without scroll\n const visualHeight = Math.min(\n this.contentElementRef.nativeElement.getBoundingClientRect().height +\n (this.elementRef.nativeElement.offsetHeight -\n this.elementRef.nativeElement.clientHeight),\n boxHeightLimit,\n );\n\n // If there is enough space to fit below without scroll,\n // choose 'bottom', unless it was previously on the top\n if (this.prevDirectionIsTop && topAvailableHeight >= visualHeight) {\n finalDirection = 'top';\n } else if (bottomAvailableHeight >= visualHeight) {\n finalDirection = 'bottom';\n } else {\n // Corner case — select direction with more space\n finalDirection =\n bottomAvailableHeight >= topAvailableHeight ? 'bottom' : 'top';\n }\n }\n\n return finalDirection;\n }\n\n /**\n * Calculates width\n *\n * @param style dropdownBox elementRef styles object\n * @param directiveRect ClientRect of hosting directive\n */\n private calculateWidth(style: CSSStyleDeclaration, directiveRect: ClientRect): void {\n style.width =\n this.directive.limitMinWidth === 'fixed' && !this.directive.sided\n ? px(directiveRect.width)\n : '';\n\n if (this.directive.limitMinWidth === 'min' && !this.directive.sided) {\n style.minWidth = px(directiveRect.width);\n style.maxWidth = px(DEFAULT_MAX_WIDTH);\n\n return;\n }\n\n style.minWidth = '';\n style.maxWidth = '';\n }\n\n private moveFocusOutside(previous: boolean): void {\n const {host} = this.directive;\n const {ownerDocument} = host;\n const root = ownerDocument ? ownerDocument.body : host;\n\n tuiAssertIsHTMLElement(host);\n\n let focusable = getClosestFocusable(host, previous, root);\n\n while (focusable !== null && host.contains(focusable)) {\n focusable = getClosestFocusable(focusable, previous, root);\n }\n\n focusable?.focus();\n }\n}\n","import {NgModule} from '@angular/core';\nimport {TuiActiveZoneModule, TuiOverscrollModule} from '@taiga-ui/cdk';\nimport {TuiScrollbarModule} from '@taiga-ui/core/components/scrollbar';\nimport {TuiModeModule} from '@taiga-ui/core/directives/mode';\nimport {PolymorpheusModule} from '@tinkoff/ng-polymorpheus';\n\nimport {TuiDropdownBoxComponent} from './dropdown-box.component';\n\n@NgModule({\n imports: [\n TuiActiveZoneModule,\n PolymorpheusModule,\n TuiOverscrollModule,\n TuiScrollbarModule,\n TuiModeModule,\n ],\n entryComponents: [TuiDropdownBoxComponent],\n declarations: [TuiDropdownBoxComponent],\n exports: [TuiDropdownBoxComponent],\n})\nexport class TuiDropdownBoxModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAoCA;;;AAGA;AACA;AACA;;IA+BI,iCAEI,QAA2B,EACX,MAAc,EACW,SAAsB,EAC9B,SAAiB,EACb,UAAmC,EAEvD,UAAoC,EACL,OAAyB,EAChD,eAAmC;QAVhE,iBAqBC;QAjB4C,cAAS,GAAT,SAAS,CAAa;QAC9B,cAAS,GAAT,SAAS,CAAQ;QACb,eAAU,GAAV,UAAU,CAAyB;QAEvD,eAAU,GAAV,UAAU,CAA0B;QACL,YAAO,GAAP,OAAO,CAAkB;QA9B5D,iBAAY,cACzB,KAAK,iCACF,IAAI,CAAC,OAAO,EACjB;QAEe,oBAAe,cAC5B,KAAK,uCACF,IAAI,CAAC,OAAO,EACjB;;;;QAKM,uBAAkB,GAAG,KAAK,CAAC;QAoB/B,KAAK,CACD,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,EAChD,IAAI,CAAC,SAAS,CAAC,QAAQ,EACvB,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CACtC;aACI,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;aAC9C,SAAS,CAAC;YACP,KAAI,CAAC,wBAAwB,EAAE,CAAC;SACnC,CAAC,CAAC;KACV;IAED,sBAAI,+CAAU;aAAd;YACI,OAAO,IAAI,CAAC,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;SAC1C;;;OAAA;IAGD,4CAAU,GAAV,UACI,OAAW,EACX,UAAmC;QAInC,6BAAW,OAAO,KAAE,UAAU,YAAA,IAAE;KACnC;IAED,oDAAkB,GAAlB;QACI,IAAI,CAAC,wBAAwB,EAAE,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nB,kBAAkB;gBAClB,mBAAmB;gBACnB,kBAAkB;gBAClB,aAAa;aAChB;YACD,eAAe,EAAE,CAAC,uBAAuB,CAAC;YAC1C,YAAY,EAAE,CAAC,uBAAuB,CAAC;YACvC,OAAO,EAAE,CAAC,uBAAuB,CAAC;SACrC,CAAC;OACW,oBAAoB,CAAG;IAAD,2BAAC;CAApC;;ACpBA;;;;;;"}
@@ -66,7 +66,7 @@ var TUI_LAST_PUNCTUATION_MARK_REGEXP = /[.,\\/#!$%\\^&\\*;:{}=\\-_`~()]$/;
66
66
  var TUI_LATIN_REGEXP = /[A-z]/;
67
67
  var TUI_LATIN_AND_NUMBERS_REGEXP = /[A-z|0-9]/;
68
68
 
69
- var VERSION = '2.50.1';
69
+ var VERSION = '2.51.1';
70
70
 
71
71
  /**
72
72
  * Generated bundle index. Do not edit.
@@ -1 +1 @@
1
- {"version":3,"file":"taiga-ui-core-constants.js","sources":["ng://@taiga-ui/core/constants/absolute-box-sizes.ts","ng://@taiga-ui/core/constants/decimal-symbols.ts","ng://@taiga-ui/core/constants/default-icons-path.ts","ng://@taiga-ui/core/constants/default-marker-handler.ts","ng://@taiga-ui/core/constants/editing-keys.ts","ng://@taiga-ui/core/constants/events.ts","ng://@taiga-ui/core/constants/mask-caret-trap.ts","ng://@taiga-ui/core/constants/media.ts","ng://@taiga-ui/core/constants/regexp.ts","ng://@taiga-ui/core/constants/version.ts","ng://@taiga-ui/core/constants/taiga-ui-core-constants.ts"],"sourcesContent":["export const DEFAULT_MARGIN = 4;\nexport const DEFAULT_MIN_HEIGHT = 80;\nexport const DEFAULT_MAX_HEIGHT = 400;\nexport const DEFAULT_MAX_WIDTH = 600;\n","export const TUI_DECIMAL_SYMBOLS: readonly string[] = [',', '.'];\n","import {TuiStringHandler} from '@taiga-ui/cdk';\n\nexport const DEFAULT_ICONS_PATH: TuiStringHandler<string> = name =>\n name.includes('.svg#') ? name : `#${name}`;\n","import {EMPTY_ARRAY} from '@taiga-ui/cdk';\nimport {TuiMarkerHandler} from '@taiga-ui/core/types';\n\nexport const TUI_DEFAULT_MARKER_HANDLER: TuiMarkerHandler = () => EMPTY_ARRAY;\n","export const tuiEditingKeys: readonly string[] = [\n 'Spacebar',\n 'Backspace',\n 'Delete',\n 'ArrowLeft',\n 'ArrowRight',\n 'Left',\n 'Right',\n 'End',\n 'Home',\n];\n","/**\n * An event indicating that async data for expand has finished loading.\n * Dispatch to finish loading states for {@link TuiExpandComponent}.\n */\nexport const TUI_EXPAND_LOADED = 'tui-expand-loaded';\n\n/**\n * An event for scrolling an element into view within {@link TuiScrollbarComponent}.\n */\nexport const TUI_SCROLL_INTO_VIEW = 'tui-scroll-into-view';\n\n/**\n * An event to notify {@link TuiScrollbarComponent} that\n * it should control a nested element.\n */\nexport const TUI_SCROLLABLE = 'tui-scrollable';\n\n/**\n * An event indicating and error during icon loading in {@link TuiSvgComponent}.\n */\nexport const TUI_ICON_ERROR = 'tui-icon-error';\n","export const MASK_CARET_TRAP = '[]';\n","/**\n * Media constants are exact the same as css media breakpoints\n * @deprecated use TUI_MEDIA token\n */\nexport const MEDIA = {\n mobile: 320,\n tablet: 600,\n desktopSmall: 1024,\n desktopLarge: 1280,\n};\n","export const TUI_DIGIT_REGEXP = /\\d/;\nexport const TUI_NON_DIGIT_REGEXP = /\\D/;\nexport const TUI_NON_DIGITS_REGEXP = /\\D+/g;\nexport const TUI_LEADING_ZEROES_REGEXP = /^0+/;\nexport const TUI_MASK_SYMBOLS_REGEXP = /[ \\-_()]/g;\nexport const TUI_LAST_PUNCTUATION_MARK_REGEXP = /[.,\\\\/#!$%\\\\^&\\\\*;:{}=\\\\-_`~()]$/;\nexport const TUI_LATIN_REGEXP = /[A-z]/;\nexport const TUI_LATIN_AND_NUMBERS_REGEXP = /[A-z|0-9]/;\n","export const VERSION = '2.50.1';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;IAAa,cAAc,GAAG,EAAE;IACnB,kBAAkB,GAAG,GAAG;IACxB,kBAAkB,GAAG,IAAI;IACzB,iBAAiB,GAAG;;ICHpB,mBAAmB,GAAsB,CAAC,GAAG,EAAE,GAAG;;ICElD,kBAAkB,GAA6B,UAAA,IAAI;IAC5D,OAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,IAAI,GAAG,MAAI,IAAM;AAA1C;;ICAS,0BAA0B,GAAqB,cAAM,OAAA,WAAW;;ICHhE,cAAc,GAAsB;IAC7C,UAAU;IACV,WAAW;IACX,QAAQ;IACR,WAAW;IACX,YAAY;IACZ,MAAM;IACN,OAAO;IACP,KAAK;IACL,MAAM;;;ACTV;;;;IAIa,iBAAiB,GAAG,oBAAoB;AAErD;;;IAGa,oBAAoB,GAAG,uBAAuB;AAE3D;;;;IAIa,cAAc,GAAG,iBAAiB;AAE/C;;;IAGa,cAAc,GAAG;;ICpBjB,eAAe,GAAG;;ACA/B;;;;IAIa,KAAK,GAAG;IACjB,MAAM,EAAE,GAAG;IACX,MAAM,EAAE,GAAG;IACX,YAAY,EAAE,IAAI;IAClB,YAAY,EAAE,IAAI;;;ICRT,gBAAgB,GAAG,KAAK;IACxB,oBAAoB,GAAG,KAAK;IAC5B,qBAAqB,GAAG,OAAO;IAC/B,yBAAyB,GAAG,MAAM;IAClC,uBAAuB,GAAG,YAAY;IACtC,gCAAgC,GAAG,mCAAmC;IACtE,gBAAgB,GAAG,QAAQ;IAC3B,4BAA4B,GAAG;;ICP/B,OAAO,GAAG;;ACAvB;;;;;;"}
1
+ {"version":3,"file":"taiga-ui-core-constants.js","sources":["ng://@taiga-ui/core/constants/absolute-box-sizes.ts","ng://@taiga-ui/core/constants/decimal-symbols.ts","ng://@taiga-ui/core/constants/default-icons-path.ts","ng://@taiga-ui/core/constants/default-marker-handler.ts","ng://@taiga-ui/core/constants/editing-keys.ts","ng://@taiga-ui/core/constants/events.ts","ng://@taiga-ui/core/constants/mask-caret-trap.ts","ng://@taiga-ui/core/constants/media.ts","ng://@taiga-ui/core/constants/regexp.ts","ng://@taiga-ui/core/constants/version.ts","ng://@taiga-ui/core/constants/taiga-ui-core-constants.ts"],"sourcesContent":["export const DEFAULT_MARGIN = 4;\nexport const DEFAULT_MIN_HEIGHT = 80;\nexport const DEFAULT_MAX_HEIGHT = 400;\nexport const DEFAULT_MAX_WIDTH = 600;\n","export const TUI_DECIMAL_SYMBOLS: readonly string[] = [',', '.'];\n","import {TuiStringHandler} from '@taiga-ui/cdk';\n\nexport const DEFAULT_ICONS_PATH: TuiStringHandler<string> = name =>\n name.includes('.svg#') ? name : `#${name}`;\n","import {EMPTY_ARRAY} from '@taiga-ui/cdk';\nimport {TuiMarkerHandler} from '@taiga-ui/core/types';\n\nexport const TUI_DEFAULT_MARKER_HANDLER: TuiMarkerHandler = () => EMPTY_ARRAY;\n","export const tuiEditingKeys: readonly string[] = [\n 'Spacebar',\n 'Backspace',\n 'Delete',\n 'ArrowLeft',\n 'ArrowRight',\n 'Left',\n 'Right',\n 'End',\n 'Home',\n];\n","/**\n * An event indicating that async data for expand has finished loading.\n * Dispatch to finish loading states for {@link TuiExpandComponent}.\n */\nexport const TUI_EXPAND_LOADED = 'tui-expand-loaded';\n\n/**\n * An event for scrolling an element into view within {@link TuiScrollbarComponent}.\n */\nexport const TUI_SCROLL_INTO_VIEW = 'tui-scroll-into-view';\n\n/**\n * An event to notify {@link TuiScrollbarComponent} that\n * it should control a nested element.\n */\nexport const TUI_SCROLLABLE = 'tui-scrollable';\n\n/**\n * An event indicating and error during icon loading in {@link TuiSvgComponent}.\n */\nexport const TUI_ICON_ERROR = 'tui-icon-error';\n","export const MASK_CARET_TRAP = '[]';\n","/**\n * Media constants are exact the same as css media breakpoints\n * @deprecated use TUI_MEDIA token\n */\nexport const MEDIA = {\n mobile: 320,\n tablet: 600,\n desktopSmall: 1024,\n desktopLarge: 1280,\n};\n","export const TUI_DIGIT_REGEXP = /\\d/;\nexport const TUI_NON_DIGIT_REGEXP = /\\D/;\nexport const TUI_NON_DIGITS_REGEXP = /\\D+/g;\nexport const TUI_LEADING_ZEROES_REGEXP = /^0+/;\nexport const TUI_MASK_SYMBOLS_REGEXP = /[ \\-_()]/g;\nexport const TUI_LAST_PUNCTUATION_MARK_REGEXP = /[.,\\\\/#!$%\\\\^&\\\\*;:{}=\\\\-_`~()]$/;\nexport const TUI_LATIN_REGEXP = /[A-z]/;\nexport const TUI_LATIN_AND_NUMBERS_REGEXP = /[A-z|0-9]/;\n","export const VERSION = '2.51.1';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;IAAa,cAAc,GAAG,EAAE;IACnB,kBAAkB,GAAG,GAAG;IACxB,kBAAkB,GAAG,IAAI;IACzB,iBAAiB,GAAG;;ICHpB,mBAAmB,GAAsB,CAAC,GAAG,EAAE,GAAG;;ICElD,kBAAkB,GAA6B,UAAA,IAAI;IAC5D,OAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,IAAI,GAAG,MAAI,IAAM;AAA1C;;ICAS,0BAA0B,GAAqB,cAAM,OAAA,WAAW;;ICHhE,cAAc,GAAsB;IAC7C,UAAU;IACV,WAAW;IACX,QAAQ;IACR,WAAW;IACX,YAAY;IACZ,MAAM;IACN,OAAO;IACP,KAAK;IACL,MAAM;;;ACTV;;;;IAIa,iBAAiB,GAAG,oBAAoB;AAErD;;;IAGa,oBAAoB,GAAG,uBAAuB;AAE3D;;;;IAIa,cAAc,GAAG,iBAAiB;AAE/C;;;IAGa,cAAc,GAAG;;ICpBjB,eAAe,GAAG;;ACA/B;;;;IAIa,KAAK,GAAG;IACjB,MAAM,EAAE,GAAG;IACX,MAAM,EAAE,GAAG;IACX,YAAY,EAAE,IAAI;IAClB,YAAY,EAAE,IAAI;;;ICRT,gBAAgB,GAAG,KAAK;IACxB,oBAAoB,GAAG,KAAK;IAC5B,qBAAqB,GAAG,OAAO;IAC/B,yBAAyB,GAAG,MAAM;IAClC,uBAAuB,GAAG,YAAY;IACtC,gCAAgC,GAAG,mCAAmC;IACtE,gBAAgB,GAAG,QAAQ;IAC3B,4BAA4B,GAAG;;ICP/B,OAAO,GAAG;;ACAvB;;;;;;"}
@@ -37,6 +37,50 @@ function getScreenWidth(documentRef) {
37
37
  return Math.max(documentRef.documentElement.clientWidth, documentRef.defaultView ? documentRef.defaultView.innerWidth : 0);
38
38
  }
39
39
 
40
+ /**
41
+ * @description:
42
+ * Cross-browser @media (height)
43
+ *
44
+ * 1. window.innerWidth
45
+ * 1.1. gets CSS viewport @media (height) which include scrollbars
46
+ * 1.2. initial-scale and zoom variations may cause mobile values to
47
+ * wrongly scale down to what PPK calls the visual
48
+ * viewport and be smaller than the @media values
49
+ * 1.3. zoom may cause values to be 1px off due to native rounding
50
+ *
51
+ * 2. document.documentElement.clientHeight
52
+ * 2.1. equals CSS viewport width minus scrollbar width
53
+ * 2.2. matches @media (height) when there is no scrollbar
54
+ * 2.3. available cross-browser
55
+ * 2.4. inaccurate if doctype is missing
56
+ */
57
+ function tuiGetViewportHeight(_a) {
58
+ var document = _a.document, innerHeight = _a.innerHeight;
59
+ return Math.max(document.documentElement.clientHeight || 0, innerHeight || 0);
60
+ }
61
+
62
+ /**
63
+ * @description:
64
+ * Cross-browser @media (width)
65
+ *
66
+ * 1. window.innerWidth
67
+ * 1.1. gets CSS viewport @media (width) which include scrollbars
68
+ * 1.2. initial-scale and zoom variations may cause mobile values to
69
+ * wrongly scale down to what PPK calls the visual
70
+ * viewport and be smaller than the @media values
71
+ * 1.3. zoom may cause values to be 1px off due to native rounding
72
+ *
73
+ * 2. document.documentElement.clientWidth
74
+ * 2.1. equals CSS viewport width minus scrollbar width
75
+ * 2.2. matches @media (width) when there is no scrollbar
76
+ * 2.3. available cross-browser
77
+ * 2.4. inaccurate if doctype is missing
78
+ */
79
+ function tuiGetViewportWidth(_a) {
80
+ var document = _a.document, innerWidth = _a.innerWidth;
81
+ return Math.max(document.documentElement.clientWidth || 0, innerWidth || 0);
82
+ }
83
+
40
84
  var WIDTH_SEARCH = 'width="';
41
85
  var HEIGHT_SEARCH = 'height="';
42
86
  var START = '<svg';
@@ -74,5 +118,5 @@ function processIcon(source, name) {
74
118
  * Generated bundle index. Do not edit.
75
119
  */
76
120
 
77
- export { areCssVarsSupported, checkFixedPosition, getSafeAreaSize, getScreenWidth, processIcon };
121
+ export { areCssVarsSupported, checkFixedPosition, getSafeAreaSize, getScreenWidth, processIcon, tuiGetViewportHeight, tuiGetViewportWidth };
78
122
  //# sourceMappingURL=taiga-ui-core-utils-dom.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"taiga-ui-core-utils-dom.js","sources":["ng://@taiga-ui/core/utils/dom/are-css-vars-supported.ts","ng://@taiga-ui/core/utils/dom/check-fixed-position.ts","ng://@taiga-ui/core/utils/dom/get-safe-area-size.ts","ng://@taiga-ui/core/utils/dom/get-screen-width.ts","ng://@taiga-ui/core/utils/dom/process-icon.ts","ng://@taiga-ui/core/utils/dom/taiga-ui-core-utils-dom.ts"],"sourcesContent":["import {isEdgeOlderThan} from '@taiga-ui/cdk';\n\n/**\n * TODO: 3.0 remove this function\n */\nexport function areCssVarsSupported(cssRef: typeof CSS, userAgent: string): boolean {\n return cssRef.supports('(--a: 0)') && !isEdgeOlderThan(17, userAgent);\n}\n","export function checkFixedPosition(element: HTMLElement | null): boolean {\n if (!element || typeof getComputedStyle === 'undefined') {\n return false;\n }\n\n const style = getComputedStyle(element);\n\n return (\n style.getPropertyValue('position') === 'fixed' ||\n checkFixedPosition(element.parentElement)\n );\n}\n","/**\n * Calculates size of safe area on mobile devices (status bars)\n *\n * ATTENTION: Only use in browser environment\n */\nexport function getSafeAreaSize(): number {\n if (!CSS.supports('padding-top: env(safe-area-inset-top)')) {\n return 0;\n }\n\n const div = document.createElement('div');\n\n div.style.paddingTop = 'env(safe-area-inset-top)';\n document.body.appendChild(div);\n\n const safeAreaSize = parseInt(window.getComputedStyle(div).paddingTop!, 10) || 0;\n\n document.body.removeChild(div);\n\n return safeAreaSize;\n}\n","export function getScreenWidth(documentRef: Document): number {\n return Math.max(\n documentRef.documentElement.clientWidth,\n documentRef.defaultView ? documentRef.defaultView.innerWidth : 0,\n );\n}\n","const WIDTH_SEARCH = 'width=\"';\nconst HEIGHT_SEARCH = 'height=\"';\nconst START = '<svg';\n\nexport function processIcon(source: string, name: string): string {\n if (source.includes(`id=\"${name}\"`)) {\n return source;\n }\n\n const src = source.slice(Math.max(0, source.indexOf(START)));\n const attributes = src.slice(0, Math.max(0, src.indexOf('>')));\n\n if (\n !attributes ||\n !attributes.includes(WIDTH_SEARCH) ||\n !attributes.includes(HEIGHT_SEARCH)\n ) {\n return `${src.replace(\n START,\n `<svg xmlns=\"http://www.w3.org/2000/svg\"><g id=\"${name}\" xmlns=\"http://www.w3.org/2000/svg\"><svg`,\n )}</g></svg>`;\n }\n\n const indexOfWidth = attributes.indexOf(WIDTH_SEARCH);\n const indexOfHeight = attributes.indexOf(HEIGHT_SEARCH);\n const widthOffset = indexOfWidth + WIDTH_SEARCH.length;\n const heightOffset = indexOfHeight + HEIGHT_SEARCH.length;\n const widthString = attributes.slice(\n widthOffset,\n attributes.indexOf('\"', widthOffset),\n );\n const heightString = attributes.slice(\n heightOffset,\n attributes.indexOf('\"', heightOffset),\n );\n\n if (\n !heightString ||\n !widthString ||\n widthString.includes('%') ||\n heightString.includes('%') ||\n widthString.includes('em') ||\n heightString.includes('em')\n ) {\n return src.replace(START, `<svg id=\"${name}\"`);\n }\n\n const width = parseInt(widthString, 10);\n const height = parseInt(heightString, 10);\n\n return `<g id=\"${name}\" xmlns=\"http://www.w3.org/2000/svg\"><svg x=\"50%\" y=\"50%\" width=\"${\n width / 16\n }em\" height=\"${\n height / 16\n }em\" overflow=\"visible\" viewBox=\"0 0 ${width} ${height}\"><svg x=\"${-width / 2}\" y=\"${\n -height / 2\n }\">${src}</svg></svg></g>`;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAEA;;;SAGgB,mBAAmB,CAAC,M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ACzB,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC;QAC1B,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC;QAC1B,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,EAC7B;QACE,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,eAAY,IAAI,OAAG,CAAC,CAAC;KAClD;IAED,IAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACxC,IAAM,MAAM,GAAG,QAAQ,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IAE1C,OAAO,aAAU,IAAI,kFACjB,KAAK,GAAG,EAAE,sBAEV,MAAM,GAAG,EAAE,gDACwB,KAAK,SAAI,MAAM,oBAAa,CAAC,KAAK,GAAG,CAAC,eACzE,CAAC,MAAM,GAAG,CAAC,WACV,GAAG,qBAAkB,CAAC;AAC/B;;ACzDA;;;;;;"}
1
+ {"version":3,"file":"taiga-ui-core-utils-dom.js","sources":["ng://@taiga-ui/core/utils/dom/are-css-vars-supported.ts","ng://@taiga-ui/core/utils/dom/check-fixed-position.ts","ng://@taiga-ui/core/utils/dom/get-safe-area-size.ts","ng://@taiga-ui/core/utils/dom/get-screen-width.ts","ng://@taiga-ui/core/utils/dom/get-viewport-height.ts","ng://@taiga-ui/core/utils/dom/get-viewport-width.ts","ng://@taiga-ui/core/utils/dom/process-icon.ts","ng://@taiga-ui/core/utils/dom/taiga-ui-core-utils-dom.ts"],"sourcesContent":["import {isEdgeOlderThan} from '@taiga-ui/cdk';\n\n/**\n * TODO: 3.0 remove this function\n */\nexport function areCssVarsSupported(cssRef: typeof CSS, userAgent: string): boolean {\n return cssRef.supports('(--a: 0)') && !isEdgeOlderThan(17, userAgent);\n}\n","export function checkFixedPosition(element: HTMLElement | null): boolean {\n if (!element || typeof getComputedStyle === 'undefined') {\n return false;\n }\n\n const style = getComputedStyle(element);\n\n return (\n style.getPropertyValue('position') === 'fixed' ||\n checkFixedPosition(element.parentElement)\n );\n}\n","/**\n * Calculates size of safe area on mobile devices (status bars)\n *\n * ATTENTION: Only use in browser environment\n */\nexport function getSafeAreaSize(): number {\n if (!CSS.supports('padding-top: env(safe-area-inset-top)')) {\n return 0;\n }\n\n const div = document.createElement('div');\n\n div.style.paddingTop = 'env(safe-area-inset-top)';\n document.body.appendChild(div);\n\n const safeAreaSize = parseInt(window.getComputedStyle(div).paddingTop!, 10) || 0;\n\n document.body.removeChild(div);\n\n return safeAreaSize;\n}\n","export function getScreenWidth(documentRef: Document): number {\n return Math.max(\n documentRef.documentElement.clientWidth,\n documentRef.defaultView ? documentRef.defaultView.innerWidth : 0,\n );\n}\n","/**\n * @description:\n * Cross-browser @media (height)\n *\n * 1. window.innerWidth\n * 1.1. gets CSS viewport @media (height) which include scrollbars\n * 1.2. initial-scale and zoom variations may cause mobile values to\n * wrongly scale down to what PPK calls the visual\n * viewport and be smaller than the @media values\n * 1.3. zoom may cause values to be 1px off due to native rounding\n *\n * 2. document.documentElement.clientHeight\n * 2.1. equals CSS viewport width minus scrollbar width\n * 2.2. matches @media (height) when there is no scrollbar\n * 2.3. available cross-browser\n * 2.4. inaccurate if doctype is missing\n */\nexport function tuiGetViewportHeight({document, innerHeight}: Window): number {\n return Math.max(document.documentElement.clientHeight || 0, innerHeight || 0);\n}\n","/**\n * @description:\n * Cross-browser @media (width)\n *\n * 1. window.innerWidth\n * 1.1. gets CSS viewport @media (width) which include scrollbars\n * 1.2. initial-scale and zoom variations may cause mobile values to\n * wrongly scale down to what PPK calls the visual\n * viewport and be smaller than the @media values\n * 1.3. zoom may cause values to be 1px off due to native rounding\n *\n * 2. document.documentElement.clientWidth\n * 2.1. equals CSS viewport width minus scrollbar width\n * 2.2. matches @media (width) when there is no scrollbar\n * 2.3. available cross-browser\n * 2.4. inaccurate if doctype is missing\n */\nexport function tuiGetViewportWidth({document, innerWidth}: Window): number {\n return Math.max(document.documentElement.clientWidth || 0, innerWidth || 0);\n}\n","const WIDTH_SEARCH = 'width=\"';\nconst HEIGHT_SEARCH = 'height=\"';\nconst START = '<svg';\n\nexport function processIcon(source: string, name: string): string {\n if (source.includes(`id=\"${name}\"`)) {\n return source;\n }\n\n const src = source.slice(Math.max(0, source.indexOf(START)));\n const attributes = src.slice(0, Math.max(0, src.indexOf('>')));\n\n if (\n !attributes ||\n !attributes.includes(WIDTH_SEARCH) ||\n !attributes.includes(HEIGHT_SEARCH)\n ) {\n return `${src.replace(\n START,\n `<svg xmlns=\"http://www.w3.org/2000/svg\"><g id=\"${name}\" xmlns=\"http://www.w3.org/2000/svg\"><svg`,\n )}</g></svg>`;\n }\n\n const indexOfWidth = attributes.indexOf(WIDTH_SEARCH);\n const indexOfHeight = attributes.indexOf(HEIGHT_SEARCH);\n const widthOffset = indexOfWidth + WIDTH_SEARCH.length;\n const heightOffset = indexOfHeight + HEIGHT_SEARCH.length;\n const widthString = attributes.slice(\n widthOffset,\n attributes.indexOf('\"', widthOffset),\n );\n const heightString = attributes.slice(\n heightOffset,\n attributes.indexOf('\"', heightOffset),\n );\n\n if (\n !heightString ||\n !widthString ||\n widthString.includes('%') ||\n heightString.includes('%') ||\n widthString.includes('em') ||\n heightString.includes('em')\n ) {\n return src.replace(START, `<svg id=\"${name}\"`);\n }\n\n const width = parseInt(widthString, 10);\n const height = parseInt(heightString, 10);\n\n return `<g id=\"${name}\" xmlns=\"http://www.w3.org/2000/svg\"><svg x=\"50%\" y=\"50%\" width=\"${\n width / 16\n }em\" height=\"${\n height / 16\n }em\" overflow=\"visible\" viewBox=\"0 0 ${width} ${height}\"><svg x=\"${-width / 2}\" y=\"${\n -height / 2\n }\">${src}</svg></svg></g>`;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAEA;;;SAGgB,mBAAmB,CAAC,MAAkB,EAAE,SAAiB;IACrE,OAAO,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;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,CAAC,KAAK,CAChC,WAAW,EACX,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,WAAW,CAAC,CACvC,CAAC;IACF,IAAM,YAAY,GAAG,UAAU,CAAC,KAAK,CACjC,YAAY,EACZ,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,YAAY,CAAC,CACxC,CAAC;IAEF,IACI,CAAC,YAAY;QACb,CAAC,WAAW;QACZ,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC;QACzB,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC;QAC1B,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC;QAC1B,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,EAC7B;QACE,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,eAAY,IAAI,OAAG,CAAC,CAAC;KAClD;IAED,IAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACxC,IAAM,MAAM,GAAG,QAAQ,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IAE1C,OAAO,aAAU,IAAI,kFACjB,KAAK,GAAG,EAAE,sBAEV,MAAM,GAAG,EAAE,gDACwB,KAAK,SAAI,MAAM,oBAAa,CAAC,KAAK,GAAG,CAAC,eACzE,CAAC,MAAM,GAAG,CAAC,WACV,GAAG,qBAAkB,CAAC;AAC/B;;ACzDA;;;;;;"}
@@ -1,7 +1,8 @@
1
- function tuiIsMobile(_a, _b) {
2
- var innerWidth = _a.innerWidth;
3
- var mobile = _b.mobile;
4
- return innerWidth <= mobile;
1
+ import { tuiGetViewportWidth } from '@taiga-ui/core/utils/dom';
2
+
3
+ function tuiIsMobile(windowRef, _a) {
4
+ var mobile = _a.mobile;
5
+ return tuiGetViewportWidth(windowRef) < mobile;
5
6
  }
6
7
 
7
8
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"taiga-ui-core-utils-mobile.js","sources":["ng://@taiga-ui/core/utils/mobile/is-mobile.ts","ng://@taiga-ui/core/utils/mobile/taiga-ui-core-utils-mobile.ts"],"sourcesContent":["import {TuiMedia} from '@taiga-ui/core/interfaces';\n\nexport function tuiIsMobile({innerWidth}: Window, {mobile}: TuiMedia): boolean {\n return innerWidth <= mobile;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"SAEgB,WAAW,CAAC,EAAoB,EAAE,EAAkB;QAAvC,0BAAU;QAAY,kBAAM;IACrD,OAAO,UAAU,IAAI,MAAM,CAAC;AAChC;;ACJA;;;;;;"}
1
+ {"version":3,"file":"taiga-ui-core-utils-mobile.js","sources":["ng://@taiga-ui/core/utils/mobile/is-mobile.ts","ng://@taiga-ui/core/utils/mobile/taiga-ui-core-utils-mobile.ts"],"sourcesContent":["import {TuiMedia} from '@taiga-ui/core/interfaces';\nimport {tuiGetViewportWidth} from '@taiga-ui/core/utils/dom';\n\nexport function tuiIsMobile(windowRef: Window, {mobile}: TuiMedia): boolean {\n return tuiGetViewportWidth(windowRef) < mobile;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;SAGgB,WAAW,CAAC,SAAiB,EAAE,EAAkB;QAAjB,kBAAM;IAClD,OAAO,mBAAmB,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC;AACnD;;ACLA;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taiga-ui/core",
3
- "version": "2.50.1",
3
+ "version": "2.51.1",
4
4
  "description": "Core library for creating Angular components and applications using Taiga UI",
5
5
  "keywords": [
6
6
  "angular",
@@ -15,7 +15,7 @@
15
15
  "repository": "https://github.com/tinkoff/taiga-ui",
16
16
  "license": "Apache-2.0",
17
17
  "dependencies": {
18
- "@taiga-ui/i18n": "^2.50.1",
18
+ "@taiga-ui/i18n": "^2.51.1",
19
19
  "tslib": "^1.10.0"
20
20
  },
21
21
  "peerDependencies": {
@@ -27,8 +27,8 @@
27
27
  "@angular/router": ">=9.0.0",
28
28
  "@ng-web-apis/common": ">=1.12.1 < 2",
29
29
  "@ng-web-apis/mutation-observer": ">=1.1.0",
30
- "@taiga-ui/cdk": ">=2.50.1",
31
- "@taiga-ui/i18n": ">=2.50.1",
30
+ "@taiga-ui/cdk": ">=2.51.1",
31
+ "@taiga-ui/i18n": ">=2.51.1",
32
32
  "@tinkoff/ng-event-plugins": ">=2.3.2",
33
33
  "@tinkoff/ng-polymorpheus": ">=3.1.12 < 4",
34
34
  "rxjs": ">=6.0.0"
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @description:
3
+ * Cross-browser @media (height)
4
+ *
5
+ * 1. window.innerWidth
6
+ * 1.1. gets CSS viewport @media (height) which include scrollbars
7
+ * 1.2. initial-scale and zoom variations may cause mobile values to
8
+ * wrongly scale down to what PPK calls the visual
9
+ * viewport and be smaller than the @media values
10
+ * 1.3. zoom may cause values to be 1px off due to native rounding
11
+ *
12
+ * 2. document.documentElement.clientHeight
13
+ * 2.1. equals CSS viewport width minus scrollbar width
14
+ * 2.2. matches @media (height) when there is no scrollbar
15
+ * 2.3. available cross-browser
16
+ * 2.4. inaccurate if doctype is missing
17
+ */
18
+ export declare function tuiGetViewportHeight({ document, innerHeight }: Window): number;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @description:
3
+ * Cross-browser @media (width)
4
+ *
5
+ * 1. window.innerWidth
6
+ * 1.1. gets CSS viewport @media (width) which include scrollbars
7
+ * 1.2. initial-scale and zoom variations may cause mobile values to
8
+ * wrongly scale down to what PPK calls the visual
9
+ * viewport and be smaller than the @media values
10
+ * 1.3. zoom may cause values to be 1px off due to native rounding
11
+ *
12
+ * 2. document.documentElement.clientWidth
13
+ * 2.1. equals CSS viewport width minus scrollbar width
14
+ * 2.2. matches @media (width) when there is no scrollbar
15
+ * 2.3. available cross-browser
16
+ * 2.4. inaccurate if doctype is missing
17
+ */
18
+ export declare function tuiGetViewportWidth({ document, innerWidth }: Window): number;
@@ -2,4 +2,6 @@ export * from './are-css-vars-supported';
2
2
  export * from './check-fixed-position';
3
3
  export * from './get-safe-area-size';
4
4
  export * from './get-screen-width';
5
+ export * from './get-viewport-height';
6
+ export * from './get-viewport-width';
5
7
  export * from './process-icon';
@@ -1 +1 @@
1
- {"__symbolic":"module","version":4,"metadata":{"areCssVarsSupported":{"__symbolic":"function","parameters":["cssRef","userAgent"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"cssRef"},"member":"supports"},"arguments":["(--a: 0)"]},"right":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@taiga-ui/cdk","name":"isEdgeOlderThan","line":6,"character":43},"arguments":[17,{"__symbolic":"reference","name":"userAgent"}]}}}},"checkFixedPosition":{"__symbolic":"function"},"getSafeAreaSize":{"__symbolic":"function"},"getScreenWidth":{"__symbolic":"function","parameters":["documentRef"],"value":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Math"},"member":"max"},"arguments":[{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"documentRef"},"member":"documentElement"},"member":"clientWidth"},{"__symbolic":"if","condition":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"documentRef"},"member":"defaultView"},"thenExpression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"documentRef"},"member":"defaultView"},"member":"innerWidth"},"elseExpression":0}]}},"processIcon":{"__symbolic":"function"}},"origins":{"areCssVarsSupported":"./are-css-vars-supported","checkFixedPosition":"./check-fixed-position","getSafeAreaSize":"./get-safe-area-size","getScreenWidth":"./get-screen-width","processIcon":"./process-icon"},"importAs":"@taiga-ui/core/utils/dom"}
1
+ {"__symbolic":"module","version":4,"metadata":{"areCssVarsSupported":{"__symbolic":"function","parameters":["cssRef","userAgent"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"cssRef"},"member":"supports"},"arguments":["(--a: 0)"]},"right":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@taiga-ui/cdk","name":"isEdgeOlderThan","line":6,"character":43},"arguments":[17,{"__symbolic":"reference","name":"userAgent"}]}}}},"checkFixedPosition":{"__symbolic":"function"},"getSafeAreaSize":{"__symbolic":"function"},"getScreenWidth":{"__symbolic":"function","parameters":["documentRef"],"value":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Math"},"member":"max"},"arguments":[{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"documentRef"},"member":"documentElement"},"member":"clientWidth"},{"__symbolic":"if","condition":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"documentRef"},"member":"defaultView"},"thenExpression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"documentRef"},"member":"defaultView"},"member":"innerWidth"},"elseExpression":0}]}},"tuiGetViewportHeight":{"__symbolic":"function","parameters":["document","innerHeight"],"value":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Math"},"member":"max"},"arguments":[{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"document"},"member":"documentElement"},"member":"clientHeight"},"right":0},{"__symbolic":"binop","operator":"||","left":{"__symbolic":"reference","name":"innerHeight"},"right":0}]}},"tuiGetViewportWidth":{"__symbolic":"function","parameters":["document","innerWidth"],"value":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Math"},"member":"max"},"arguments":[{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"document"},"member":"documentElement"},"member":"clientWidth"},"right":0},{"__symbolic":"binop","operator":"||","left":{"__symbolic":"reference","name":"innerWidth"},"right":0}]}},"processIcon":{"__symbolic":"function"}},"origins":{"areCssVarsSupported":"./are-css-vars-supported","checkFixedPosition":"./check-fixed-position","getSafeAreaSize":"./get-safe-area-size","getScreenWidth":"./get-screen-width","tuiGetViewportHeight":"./get-viewport-height","tuiGetViewportWidth":"./get-viewport-width","processIcon":"./process-icon"},"importAs":"@taiga-ui/core/utils/dom"}
@@ -1,2 +1,2 @@
1
1
  import { TuiMedia } from '@taiga-ui/core/interfaces';
2
- export declare function tuiIsMobile({ innerWidth }: Window, { mobile }: TuiMedia): boolean;
2
+ export declare function tuiIsMobile(windowRef: Window, { mobile }: TuiMedia): boolean;
@@ -1 +1 @@
1
- {"__symbolic":"module","version":4,"metadata":{"tuiIsMobile":{"__symbolic":"function","parameters":["innerWidth","mobile"],"value":{"__symbolic":"binop","operator":"<=","left":{"__symbolic":"reference","name":"innerWidth"},"right":{"__symbolic":"reference","name":"mobile"}}}},"origins":{"tuiIsMobile":"./is-mobile"},"importAs":"@taiga-ui/core/utils/mobile"}
1
+ {"__symbolic":"module","version":4,"metadata":{"tuiIsMobile":{"__symbolic":"function","parameters":["windowRef","mobile"],"value":{"__symbolic":"binop","operator":"<","left":{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@taiga-ui/core/utils/dom","name":"tuiGetViewportWidth","line":4,"character":11},"arguments":[{"__symbolic":"reference","name":"windowRef"}]},"right":{"__symbolic":"reference","name":"mobile"}}}},"origins":{"tuiIsMobile":"./is-mobile"},"importAs":"@taiga-ui/core/utils/mobile"}