@taiga-ui/cdk 2.33.0 → 2.34.0

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 (118) hide show
  1. package/bundles/taiga-ui-cdk-components-portal-host.umd.js +5 -6
  2. package/bundles/taiga-ui-cdk-components-portal-host.umd.js.map +1 -1
  3. package/bundles/taiga-ui-cdk-components-portal-host.umd.min.js +2 -2
  4. package/bundles/taiga-ui-cdk-components-portal-host.umd.min.js.map +1 -1
  5. package/bundles/taiga-ui-cdk-date-time.umd.js +7 -7
  6. package/bundles/taiga-ui-cdk-date-time.umd.js.map +1 -1
  7. package/bundles/taiga-ui-cdk-date-time.umd.min.js +2 -2
  8. package/bundles/taiga-ui-cdk-date-time.umd.min.js.map +1 -1
  9. package/bundles/taiga-ui-cdk-decorators.umd.js +16 -14
  10. package/bundles/taiga-ui-cdk-decorators.umd.js.map +1 -1
  11. package/bundles/taiga-ui-cdk-decorators.umd.min.js +2 -2
  12. package/bundles/taiga-ui-cdk-decorators.umd.min.js.map +1 -1
  13. package/bundles/taiga-ui-cdk-exceptions.umd.js +347 -0
  14. package/bundles/taiga-ui-cdk-exceptions.umd.js.map +1 -0
  15. package/bundles/taiga-ui-cdk-exceptions.umd.min.js +16 -0
  16. package/bundles/taiga-ui-cdk-exceptions.umd.min.js.map +1 -0
  17. package/bundles/taiga-ui-cdk-observables.umd.js +9 -9
  18. package/bundles/taiga-ui-cdk-observables.umd.js.map +1 -1
  19. package/bundles/taiga-ui-cdk-observables.umd.min.js +1 -1
  20. package/bundles/taiga-ui-cdk-observables.umd.min.js.map +1 -1
  21. package/bundles/taiga-ui-cdk.umd.js +12 -4
  22. package/bundles/taiga-ui-cdk.umd.js.map +1 -1
  23. package/bundles/taiga-ui-cdk.umd.min.js +1 -1
  24. package/components/portal-host/taiga-ui-cdk-components-portal-host.metadata.json +1 -1
  25. package/date-time/taiga-ui-cdk-date-time.metadata.json +1 -1
  26. package/esm2015/components/portal-host/portal.service.js +3 -3
  27. package/esm2015/date-time/day.js +5 -4
  28. package/esm2015/decorators/pure.js +14 -11
  29. package/esm2015/exceptions/computed-document.exception.js +6 -0
  30. package/esm2015/exceptions/document-selection.exception.js +6 -0
  31. package/esm2015/exceptions/index.js +14 -0
  32. package/esm2015/exceptions/invalid-day.exception.js +6 -0
  33. package/esm2015/exceptions/invalid-month.exception.js +6 -0
  34. package/esm2015/exceptions/invalid-year.exception.js +6 -0
  35. package/esm2015/exceptions/no-host.exception.js +6 -0
  36. package/esm2015/exceptions/owner-document.exception.js +6 -0
  37. package/esm2015/exceptions/pure.exception.js +6 -0
  38. package/esm2015/exceptions/table-sort-key.exception.js +6 -0
  39. package/esm2015/exceptions/taiga-ui-cdk-exceptions.js +5 -0
  40. package/esm2015/exceptions/ts-parser.exception.js +6 -0
  41. package/esm2015/exceptions/value-changes.exception.js +6 -0
  42. package/esm2015/exceptions/value-present.exception.js +6 -0
  43. package/esm2015/exceptions/xml-parsing.exception.js +6 -0
  44. package/esm2015/index.js +2 -1
  45. package/esm2015/observables/drag-and-drop-from.js +3 -2
  46. package/esm2015/observables/focus-visible-observable.js +3 -2
  47. package/esm2015/observables/must-be-present.js +3 -2
  48. package/esm2015/observables/pressed-observable.js +3 -2
  49. package/esm2015/observables/replay-control-value-changes.js +3 -2
  50. package/esm5/components/portal-host/portal.service.js +3 -3
  51. package/esm5/date-time/day.js +5 -4
  52. package/esm5/decorators/pure.js +14 -11
  53. package/esm5/exceptions/computed-document.exception.js +10 -0
  54. package/esm5/exceptions/document-selection.exception.js +10 -0
  55. package/esm5/exceptions/index.js +14 -0
  56. package/esm5/exceptions/invalid-day.exception.js +10 -0
  57. package/esm5/exceptions/invalid-month.exception.js +10 -0
  58. package/esm5/exceptions/invalid-year.exception.js +10 -0
  59. package/esm5/exceptions/no-host.exception.js +10 -0
  60. package/esm5/exceptions/owner-document.exception.js +10 -0
  61. package/esm5/exceptions/pure.exception.js +10 -0
  62. package/esm5/exceptions/table-sort-key.exception.js +10 -0
  63. package/esm5/exceptions/taiga-ui-cdk-exceptions.js +5 -0
  64. package/esm5/exceptions/ts-parser.exception.js +10 -0
  65. package/esm5/exceptions/value-changes.exception.js +10 -0
  66. package/esm5/exceptions/value-present.exception.js +10 -0
  67. package/esm5/exceptions/xml-parsing.exception.js +10 -0
  68. package/esm5/index.js +2 -1
  69. package/esm5/observables/drag-and-drop-from.js +3 -2
  70. package/esm5/observables/focus-visible-observable.js +3 -2
  71. package/esm5/observables/must-be-present.js +3 -2
  72. package/esm5/observables/pressed-observable.js +3 -2
  73. package/esm5/observables/replay-control-value-changes.js +3 -2
  74. package/exceptions/computed-document.exception.d.ts +3 -0
  75. package/exceptions/document-selection.exception.d.ts +3 -0
  76. package/exceptions/index.d.ts +13 -0
  77. package/exceptions/invalid-day.exception.d.ts +3 -0
  78. package/exceptions/invalid-month.exception.d.ts +3 -0
  79. package/exceptions/invalid-year.exception.d.ts +3 -0
  80. package/exceptions/no-host.exception.d.ts +3 -0
  81. package/exceptions/owner-document.exception.d.ts +3 -0
  82. package/exceptions/package.json +13 -0
  83. package/exceptions/pure.exception.d.ts +3 -0
  84. package/exceptions/table-sort-key.exception.d.ts +3 -0
  85. package/exceptions/taiga-ui-cdk-exceptions.d.ts +4 -0
  86. package/exceptions/taiga-ui-cdk-exceptions.metadata.json +1 -0
  87. package/exceptions/ts-parser.exception.d.ts +3 -0
  88. package/exceptions/value-changes.exception.d.ts +3 -0
  89. package/exceptions/value-present.exception.d.ts +3 -0
  90. package/exceptions/xml-parsing.exception.d.ts +3 -0
  91. package/fesm2015/taiga-ui-cdk-components-portal-host.js +2 -2
  92. package/fesm2015/taiga-ui-cdk-components-portal-host.js.map +1 -1
  93. package/fesm2015/taiga-ui-cdk-date-time.js +4 -3
  94. package/fesm2015/taiga-ui-cdk-date-time.js.map +1 -1
  95. package/fesm2015/taiga-ui-cdk-decorators.js +13 -10
  96. package/fesm2015/taiga-ui-cdk-decorators.js.map +1 -1
  97. package/fesm2015/taiga-ui-cdk-exceptions.js +84 -0
  98. package/fesm2015/taiga-ui-cdk-exceptions.js.map +1 -0
  99. package/fesm2015/taiga-ui-cdk-observables.js +6 -5
  100. package/fesm2015/taiga-ui-cdk-observables.js.map +1 -1
  101. package/fesm2015/taiga-ui-cdk.js +1 -0
  102. package/fesm2015/taiga-ui-cdk.js.map +1 -1
  103. package/fesm5/taiga-ui-cdk-components-portal-host.js +2 -2
  104. package/fesm5/taiga-ui-cdk-components-portal-host.js.map +1 -1
  105. package/fesm5/taiga-ui-cdk-date-time.js +4 -3
  106. package/fesm5/taiga-ui-cdk-date-time.js.map +1 -1
  107. package/fesm5/taiga-ui-cdk-decorators.js +13 -10
  108. package/fesm5/taiga-ui-cdk-decorators.js.map +1 -1
  109. package/fesm5/taiga-ui-cdk-exceptions.js +112 -0
  110. package/fesm5/taiga-ui-cdk-exceptions.js.map +1 -0
  111. package/fesm5/taiga-ui-cdk-observables.js +6 -5
  112. package/fesm5/taiga-ui-cdk-observables.js.map +1 -1
  113. package/fesm5/taiga-ui-cdk.js +1 -0
  114. package/fesm5/taiga-ui-cdk.js.map +1 -1
  115. package/index.d.ts +1 -0
  116. package/observables/taiga-ui-cdk-observables.metadata.json +1 -1
  117. package/package.json +1 -1
  118. package/taiga-ui-cdk.metadata.json +1 -1
@@ -0,0 +1,84 @@
1
+ class TuiComputedDocumentException extends Error {
2
+ constructor() {
3
+ super('Only use computedDocument after load event');
4
+ }
5
+ }
6
+
7
+ class TuiDocumentSelectionException extends Error {
8
+ constructor() {
9
+ super('Failed to get document selection');
10
+ }
11
+ }
12
+
13
+ class InvalidDayException extends Error {
14
+ constructor(day) {
15
+ super(`Invalid day: ${day}`);
16
+ }
17
+ }
18
+
19
+ class InvalidMonthException extends Error {
20
+ constructor(month) {
21
+ super(`Invalid month: ${month}`);
22
+ }
23
+ }
24
+
25
+ class InvalidYearException extends Error {
26
+ constructor(year) {
27
+ super(`Invalid year: ${year}`);
28
+ }
29
+ }
30
+
31
+ class TuiNoHostException extends Error {
32
+ constructor() {
33
+ super('Portals cannot be used without TuiPortalHostComponent');
34
+ }
35
+ }
36
+
37
+ class TuiOwnerDocumentException extends Error {
38
+ constructor() {
39
+ super('Element does not have ownerDocument');
40
+ }
41
+ }
42
+
43
+ class TuiPureException extends Error {
44
+ constructor() {
45
+ super('tuiPure can only be used with functions or getters');
46
+ }
47
+ }
48
+
49
+ class TuiTableSortKeyException extends Error {
50
+ constructor() {
51
+ super('Trying to sort with no key');
52
+ }
53
+ }
54
+
55
+ class TuiTsParserException extends Error {
56
+ constructor() {
57
+ super('TsFileParser: 1 component/module per ts-file');
58
+ }
59
+ }
60
+
61
+ class TuiValueChangesException extends Error {
62
+ constructor() {
63
+ super('Control does not have valueChanges');
64
+ }
65
+ }
66
+
67
+ class TuiValuePresentException extends Error {
68
+ constructor() {
69
+ super('Value must present');
70
+ }
71
+ }
72
+
73
+ class TuiXmlParsingException extends Error {
74
+ constructor() {
75
+ super('Error parsing XML string');
76
+ }
77
+ }
78
+
79
+ /**
80
+ * Generated bundle index. Do not edit.
81
+ */
82
+
83
+ export { InvalidDayException, InvalidMonthException, InvalidYearException, TuiComputedDocumentException, TuiDocumentSelectionException, TuiNoHostException, TuiOwnerDocumentException, TuiPureException, TuiTableSortKeyException, TuiTsParserException, TuiValueChangesException, TuiValuePresentException, TuiXmlParsingException };
84
+ //# sourceMappingURL=taiga-ui-cdk-exceptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"taiga-ui-cdk-exceptions.js","sources":["ng://@taiga-ui/cdk/exceptions/computed-document.exception.ts","ng://@taiga-ui/cdk/exceptions/document-selection.exception.ts","ng://@taiga-ui/cdk/exceptions/invalid-day.exception.ts","ng://@taiga-ui/cdk/exceptions/invalid-month.exception.ts","ng://@taiga-ui/cdk/exceptions/invalid-year.exception.ts","ng://@taiga-ui/cdk/exceptions/no-host.exception.ts","ng://@taiga-ui/cdk/exceptions/owner-document.exception.ts","ng://@taiga-ui/cdk/exceptions/pure.exception.ts","ng://@taiga-ui/cdk/exceptions/table-sort-key.exception.ts","ng://@taiga-ui/cdk/exceptions/ts-parser.exception.ts","ng://@taiga-ui/cdk/exceptions/value-changes.exception.ts","ng://@taiga-ui/cdk/exceptions/value-present.exception.ts","ng://@taiga-ui/cdk/exceptions/xml-parsing.exception.ts","ng://@taiga-ui/cdk/exceptions/taiga-ui-cdk-exceptions.ts"],"sourcesContent":["export class TuiComputedDocumentException extends Error {\n constructor() {\n super('Only use computedDocument after load event');\n }\n}\n","export class TuiDocumentSelectionException extends Error {\n constructor() {\n super('Failed to get document selection');\n }\n}\n","export class InvalidDayException extends Error {\n constructor(day: number) {\n super(`Invalid day: ${day}`);\n }\n}\n","export class InvalidMonthException extends Error {\n constructor(month: number) {\n super(`Invalid month: ${month}`);\n }\n}\n","export class InvalidYearException extends Error {\n constructor(year: number) {\n super(`Invalid year: ${year}`);\n }\n}\n","export class TuiNoHostException extends Error {\n constructor() {\n super('Portals cannot be used without TuiPortalHostComponent');\n }\n}\n","export class TuiOwnerDocumentException extends Error {\n constructor() {\n super('Element does not have ownerDocument');\n }\n}\n","export class TuiPureException extends Error {\n constructor() {\n super('tuiPure can only be used with functions or getters');\n }\n}\n","export class TuiTableSortKeyException extends Error {\n constructor() {\n super('Trying to sort with no key');\n }\n}\n","export class TuiTsParserException extends Error {\n constructor() {\n super('TsFileParser: 1 component/module per ts-file');\n }\n}\n","export class TuiValueChangesException extends Error {\n constructor() {\n super('Control does not have valueChanges');\n }\n}\n","export class TuiValuePresentException extends Error {\n constructor() {\n super('Value must present');\n }\n}\n","export class TuiXmlParsingException extends Error {\n constructor() {\n super('Error parsing XML string');\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"MAAa,4BAA6B,SAAQ,KAAK;IACnD;QACI,KAAK,CAAC,4CAA4C,CAAC,CAAC;KACvD;;;MCHQ,6BAA8B,SAAQ,KAAK;IACpD;QACI,KAAK,CAAC,kCAAkC,CAAC,CAAC;KAC7C;;;MCHQ,mBAAoB,SAAQ,KAAK;IAC1C,YAAY,GAAW;QACnB,KAAK,CAAC,gBAAgB,GAAG,EAAE,CAAC,CAAC;KAChC;;;MCHQ,qBAAsB,SAAQ,KAAK;IAC5C,YAAY,KAAa;QACrB,KAAK,CAAC,kBAAkB,KAAK,EAAE,CAAC,CAAC;KACpC;;;MCHQ,oBAAqB,SAAQ,KAAK;IAC3C,YAAY,IAAY;QACpB,KAAK,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;KAClC;;;MCHQ,kBAAmB,SAAQ,KAAK;IACzC;QACI,KAAK,CAAC,uDAAuD,CAAC,CAAC;KAClE;;;MCHQ,yBAA0B,SAAQ,KAAK;IAChD;QACI,KAAK,CAAC,qCAAqC,CAAC,CAAC;KAChD;;;MCHQ,gBAAiB,SAAQ,KAAK;IACvC;QACI,KAAK,CAAC,oDAAoD,CAAC,CAAC;KAC/D;;;MCHQ,wBAAyB,SAAQ,KAAK;IAC/C;QACI,KAAK,CAAC,4BAA4B,CAAC,CAAC;KACvC;;;MCHQ,oBAAqB,SAAQ,KAAK;IAC3C;QACI,KAAK,CAAC,8CAA8C,CAAC,CAAC;KACzD;;;MCHQ,wBAAyB,SAAQ,KAAK;IAC/C;QACI,KAAK,CAAC,oCAAoC,CAAC,CAAC;KAC/C;;;MCHQ,wBAAyB,SAAQ,KAAK;IAC/C;QACI,KAAK,CAAC,oBAAoB,CAAC,CAAC;KAC/B;;;MCHQ,sBAAuB,SAAQ,KAAK;IAC7C;QACI,KAAK,CAAC,0BAA0B,CAAC,CAAC;KACrC;;;ACHL;;;;;;"}
@@ -1,3 +1,4 @@
1
+ import { TuiOwnerDocumentException, TuiValuePresentException, TuiValueChangesException } from '@taiga-ui/cdk/exceptions';
1
2
  import { isPresent, getOriginalArrayFromQueryList } from '@taiga-ui/cdk/utils/miscellaneous';
2
3
  import { fromEvent, merge, concat, pipe, timer, Observable } from 'rxjs';
3
4
  import { take, map, endWith, takeWhile, repeat, switchMapTo, mapTo, startWith, distinctUntilChanged, shareReplay, filter, ignoreElements, withLatestFrom, tap } from 'rxjs/operators';
@@ -30,7 +31,7 @@ class TuiDragState {
30
31
  function dragAndDropFrom(element) {
31
32
  const { ownerDocument } = element;
32
33
  if (!ownerDocument) {
33
- throw new Error('element does not have ownerDocument');
34
+ throw new TuiOwnerDocumentException();
34
35
  }
35
36
  return concat(typedFromEvent(element, 'mousedown').pipe(take(1), map(event => new TuiDragState(0 /* Start */, event))), merge(typedFromEvent(ownerDocument, 'mousemove').pipe(map(event => new TuiDragState(1 /* Continues */, event))), mouseDragFinishFrom(ownerDocument).pipe(take(1), map(event => new TuiDragState(2 /* End */, event)), endWith(null))).pipe(takeWhile(isPresent))).pipe(repeat());
36
37
  }
@@ -48,7 +49,7 @@ function focusVisibleObservable(element) {
48
49
  const elementBlur$ = typedFromEvent(element, 'blur');
49
50
  const { ownerDocument } = element;
50
51
  if (!ownerDocument) {
51
- throw new Error('element does not have ownerDocument');
52
+ throw new TuiOwnerDocumentException();
52
53
  }
53
54
  if (!documentMouseDownIsAlive$ || !documentMouseUpIsAlive$) {
54
55
  documentMouseUpIsAlive$ = typedFromEvent(ownerDocument, 'mouseup', {
@@ -75,7 +76,7 @@ function itemsQueryListObservable(queryList) {
75
76
  function mustBePresent() {
76
77
  return map(value => {
77
78
  if (!isPresent(value)) {
78
- throw new Error('Value must present');
79
+ throw new TuiValuePresentException();
79
80
  }
80
81
  return value;
81
82
  });
@@ -84,7 +85,7 @@ function mustBePresent() {
84
85
  function pressedObservable(element, { onlyTrusted } = { onlyTrusted: true }) {
85
86
  const { ownerDocument } = element;
86
87
  if (!ownerDocument) {
87
- throw new Error('element does not have ownerDocument');
88
+ throw new TuiOwnerDocumentException();
88
89
  }
89
90
  return typedFromEvent(element, 'mousedown').pipe(filter(({ isTrusted }) => isTrusted || !onlyTrusted), switchMapTo(mouseDragFinishFrom(ownerDocument).pipe(mapTo(false), take(1), startWith(true))));
90
91
  }
@@ -102,7 +103,7 @@ function preventDefault() {
102
103
  function tuiReplayedValueChangesFrom(control) {
103
104
  return new Observable(subscriber => {
104
105
  if (!control.valueChanges) {
105
- throw new Error('Control does not have valueChanges');
106
+ throw new TuiValueChangesException();
106
107
  }
107
108
  control.valueChanges.pipe(startWith(control.value)).subscribe(subscriber);
108
109
  });
@@ -1 +1 @@
1
- {"version":3,"file":"taiga-ui-cdk-observables.js","sources":["ng://@taiga-ui/cdk/observables/typed-from-event.ts","ng://@taiga-ui/cdk/observables/mouse-drag-finish-from.ts","ng://@taiga-ui/cdk/observables/drag-and-drop-from.ts","ng://@taiga-ui/cdk/observables/is-alive.ts","ng://@taiga-ui/cdk/observables/focus-visible-observable.ts","ng://@taiga-ui/cdk/observables/items-query-list-observable.ts","ng://@taiga-ui/cdk/observables/must-be-present.ts","ng://@taiga-ui/cdk/observables/pressed-observable.ts","ng://@taiga-ui/cdk/observables/prevent-default.ts","ng://@taiga-ui/cdk/observables/replay-control-value-changes.ts","ng://@taiga-ui/cdk/observables/stop-propagation.ts","ng://@taiga-ui/cdk/observables/watch.ts","ng://@taiga-ui/cdk/observables/zone-free.ts","ng://@taiga-ui/cdk/observables/taiga-ui-cdk-observables.ts"],"sourcesContent":["import {TuiEventWith, TuiTypedEventTarget} from '@taiga-ui/cdk/types';\nimport {fromEvent, Observable} from 'rxjs';\n\nexport function typedFromEvent<E extends keyof WindowEventMap>(\n target: Window,\n event: E,\n options?: AddEventListenerOptions,\n): Observable<TuiEventWith<WindowEventMap[E], typeof target>>;\nexport function typedFromEvent<E extends keyof DocumentEventMap>(\n target: Document,\n event: E,\n options?: AddEventListenerOptions,\n): Observable<TuiEventWith<DocumentEventMap[E], typeof target>>;\nexport function typedFromEvent<T extends Element, E extends keyof HTMLElementEventMap>(\n target: T,\n event: E,\n options?: AddEventListenerOptions,\n): Observable<TuiEventWith<HTMLElementEventMap[E], typeof target>>;\nexport function typedFromEvent<\n E extends Event,\n T extends TuiTypedEventTarget<TuiEventWith<E, T>>,\n>(\n target: T,\n event: string,\n options?: AddEventListenerOptions,\n): Observable<TuiEventWith<E, T>>;\nexport function typedFromEvent<E extends Event>(\n target: TuiTypedEventTarget<E>,\n event: string,\n options?: AddEventListenerOptions,\n): Observable<E>;\nexport function typedFromEvent<E extends Event>(\n target: TuiTypedEventTarget<E>,\n event: string,\n options: AddEventListenerOptions = {},\n): Observable<E> {\n return fromEvent(target, event, options);\n}\n","import {TuiEventWith, TuiTypedEventTarget} from '@taiga-ui/cdk/types';\nimport {merge, Observable} from 'rxjs';\n\nimport {typedFromEvent} from './typed-from-event';\n\n/**\n * Letting go of the mouse after it was pressed\n * @param target\n */\nexport function mouseDragFinishFrom<\n T extends TuiTypedEventTarget<TuiEventWith<DragEvent, T>>,\n>(target: Exclude<T, null>): Observable<TuiEventWith<MouseEvent, T>> {\n return merge(typedFromEvent(target, 'mouseup'), typedFromEvent(target, 'dragend'));\n}\n","import {isPresent} from '@taiga-ui/cdk/utils/miscellaneous';\nimport {concat, merge, Observable} from 'rxjs';\nimport {endWith, map, repeat, take, takeWhile} from 'rxjs/operators';\n\nimport {mouseDragFinishFrom} from './mouse-drag-finish-from';\nimport {typedFromEvent} from './typed-from-event';\n\nexport const enum TuiDragStage {\n Start,\n Continues,\n End,\n}\n\nexport class TuiDragState {\n constructor(readonly stage: TuiDragStage, readonly event: MouseEvent) {}\n}\n\nexport function dragAndDropFrom(element: Element): Observable<TuiDragState> {\n const {ownerDocument} = element;\n\n if (!ownerDocument) {\n throw new Error('element does not have ownerDocument');\n }\n\n return concat(\n typedFromEvent(element, 'mousedown').pipe(\n take(1),\n map(event => new TuiDragState(TuiDragStage.Start, event)),\n ),\n merge(\n typedFromEvent(ownerDocument, 'mousemove').pipe(\n map(event => new TuiDragState(TuiDragStage.Continues, event)),\n ),\n mouseDragFinishFrom(ownerDocument).pipe(\n take(1),\n map(event => new TuiDragState(TuiDragStage.End, event)),\n endWith(null),\n ),\n ).pipe(takeWhile(isPresent)),\n ).pipe(repeat());\n}\n","import {OperatorFunction, pipe, timer} from 'rxjs';\nimport {distinctUntilChanged, mapTo, startWith, switchMapTo} from 'rxjs/operators';\n\n/**\n * Operator to set lifespan after which current value is considered obsolete\n */\nexport function tuiIsAlive(lifespan: number = 0): OperatorFunction<any, boolean> {\n return pipe(\n switchMapTo(timer(lifespan).pipe(mapTo(false), startWith(true))),\n distinctUntilChanged(),\n );\n}\n","import {isNativeFocused} from '@taiga-ui/cdk/utils/focus';\nimport {concat, merge, Observable} from 'rxjs';\nimport {\n distinctUntilChanged,\n filter,\n ignoreElements,\n mapTo,\n repeat,\n shareReplay,\n startWith,\n switchMapTo,\n take,\n withLatestFrom,\n} from 'rxjs/operators';\n\nimport {tuiIsAlive} from './is-alive';\nimport {typedFromEvent} from './typed-from-event';\n\nlet documentMouseUpIsAlive$: Observable<boolean>;\nlet documentMouseDownIsAlive$: Observable<boolean>;\n\nexport function focusVisibleObservable(element: Element): Observable<boolean> {\n const elementBlur$ = typedFromEvent(element, 'blur');\n const {ownerDocument} = element;\n\n if (!ownerDocument) {\n throw new Error('element does not have ownerDocument');\n }\n\n if (!documentMouseDownIsAlive$ || !documentMouseUpIsAlive$) {\n documentMouseUpIsAlive$ = typedFromEvent(ownerDocument, 'mouseup', {\n capture: true,\n }).pipe(tuiIsAlive(), startWith(false), shareReplay(1));\n documentMouseDownIsAlive$ = typedFromEvent(ownerDocument, 'mousedown', {\n capture: true,\n }).pipe(tuiIsAlive(), startWith(false), shareReplay(1));\n }\n\n return merge(\n // focus events excluding ones that came right after mouse action\n concat(\n typedFromEvent(element, 'focus').pipe(take(1)),\n // filtering out blur events when element remains focused so that we ignore browser tab focus loss\n elementBlur$.pipe(\n filter(() => !isNativeFocused(element)),\n take(1),\n ignoreElements(),\n ),\n ).pipe(\n repeat(),\n withLatestFrom(\n documentMouseDownIsAlive$,\n documentMouseUpIsAlive$,\n (_event, elementActual, documentActual) =>\n elementActual || documentActual,\n ),\n filter(isUserFocus => !isUserFocus),\n ),\n ).pipe(\n switchMapTo(elementBlur$.pipe(mapTo(false), take(1), startWith(true))),\n distinctUntilChanged(),\n );\n}\n","import {QueryList} from '@angular/core';\nimport {getOriginalArrayFromQueryList} from '@taiga-ui/cdk/utils/miscellaneous';\nimport {Observable} from 'rxjs';\nimport {map, startWith} from 'rxjs/operators';\n\n/**\n * Converts changes observable of a QueryList to an Observable of arrays\n */\nexport function itemsQueryListObservable<T>(\n queryList: QueryList<T>,\n): Observable<ReadonlyArray<T>> {\n return queryList.changes.pipe(\n map(() => getOriginalArrayFromQueryList(queryList)),\n startWith(getOriginalArrayFromQueryList(queryList)),\n );\n}\n","import {isPresent} from '@taiga-ui/cdk/utils/miscellaneous';\nimport {OperatorFunction} from 'rxjs';\nimport {map} from 'rxjs/operators';\n\nexport function mustBePresent<T>(): OperatorFunction<T | undefined | null, T> {\n return map(value => {\n if (!isPresent(value)) {\n throw new Error('Value must present');\n }\n\n return value;\n });\n}\n","import {Observable} from 'rxjs';\nimport {filter, mapTo, startWith, switchMapTo, take} from 'rxjs/operators';\n\nimport {mouseDragFinishFrom} from './mouse-drag-finish-from';\nimport {typedFromEvent} from './typed-from-event';\n\nexport interface TuiPressedObservableOptions {\n onlyTrusted: boolean;\n}\n\nexport function pressedObservable(\n element: Element,\n {onlyTrusted}: TuiPressedObservableOptions = {onlyTrusted: true},\n): Observable<boolean> {\n const {ownerDocument} = element;\n\n if (!ownerDocument) {\n throw new Error('element does not have ownerDocument');\n }\n\n return typedFromEvent(element, 'mousedown').pipe(\n filter(({isTrusted}) => isTrusted || !onlyTrusted),\n switchMapTo(\n mouseDragFinishFrom(ownerDocument).pipe(\n mapTo(false),\n take(1),\n startWith(true),\n ),\n ),\n );\n}\n","import {MonoTypeOperatorFunction} from 'rxjs';\nimport {tap} from 'rxjs/operators';\n\nexport function preventDefault<T extends Event>(): MonoTypeOperatorFunction<T> {\n return tap(e => {\n e.preventDefault();\n });\n}\n","import {AbstractControl, AbstractControlDirective} from '@angular/forms';\nimport {Observable} from 'rxjs';\nimport {startWith} from 'rxjs/operators';\n\n/**\n * Turns AbstractControl/Abstract-control-directive valueChanges into ReplaySubject(1)\n * TODO: rename function in 3.0. The name should be shorter.\n */\nexport function tuiReplayedValueChangesFrom<T>(\n control: AbstractControl | AbstractControlDirective,\n): Observable<T> {\n return new Observable(subscriber => {\n if (!control.valueChanges) {\n throw new Error('Control does not have valueChanges');\n }\n\n control.valueChanges.pipe(startWith(control.value)).subscribe(subscriber);\n });\n}\n","import {MonoTypeOperatorFunction} from 'rxjs';\nimport {tap} from 'rxjs/operators';\n\nexport function stopPropagation<T extends Event>(): MonoTypeOperatorFunction<T> {\n return tap(e => {\n e.stopPropagation();\n });\n}\n","import {ChangeDetectorRef} from '@angular/core';\nimport {MonoTypeOperatorFunction} from 'rxjs';\nimport {tap} from 'rxjs/operators';\n\nexport function watch<T>(\n changeDetectorRef: ChangeDetectorRef,\n): MonoTypeOperatorFunction<T> {\n return tap(() => {\n changeDetectorRef.markForCheck();\n });\n}\n","import {NgZone} from '@angular/core';\nimport {MonoTypeOperatorFunction, Observable, pipe} from 'rxjs';\n\nexport function tuiZonefull<T>(ngZone: NgZone): MonoTypeOperatorFunction<T> {\n return source =>\n new Observable(subscriber =>\n source.subscribe({\n next: value => ngZone.run(() => subscriber.next(value)),\n error: error => ngZone.run(() => subscriber.error(error)),\n complete: () => ngZone.run(() => subscriber.complete()),\n }),\n );\n}\n\nexport function tuiZonefree<T>(ngZone: NgZone): MonoTypeOperatorFunction<T> {\n return source =>\n new Observable(subscriber =>\n ngZone.runOutsideAngular(() => source.subscribe(subscriber)),\n );\n}\n\nexport function tuiZoneOptimized<T>(ngZone: NgZone): MonoTypeOperatorFunction<T> {\n return pipe(tuiZonefree(ngZone), tuiZonefull(ngZone));\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;SA+BgB,cAAc,CAC1B,MAA8B,EAC9B,KAAa,EACb,UAAmC,EAAE;IAErC,OAA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IACrB,MAAM,CAAC,iBAAiB,CAAC,MAAM,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAC/D,CAAC;AACV,CAAC;SAEe,gBAAgB,CAAI,MAAc;IAC9C,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;AAC1D;;ACvBA;;;;;;"}
1
+ {"version":3,"file":"taiga-ui-cdk-observables.js","sources":["ng://@taiga-ui/cdk/observables/typed-from-event.ts","ng://@taiga-ui/cdk/observables/mouse-drag-finish-from.ts","ng://@taiga-ui/cdk/observables/drag-and-drop-from.ts","ng://@taiga-ui/cdk/observables/is-alive.ts","ng://@taiga-ui/cdk/observables/focus-visible-observable.ts","ng://@taiga-ui/cdk/observables/items-query-list-observable.ts","ng://@taiga-ui/cdk/observables/must-be-present.ts","ng://@taiga-ui/cdk/observables/pressed-observable.ts","ng://@taiga-ui/cdk/observables/prevent-default.ts","ng://@taiga-ui/cdk/observables/replay-control-value-changes.ts","ng://@taiga-ui/cdk/observables/stop-propagation.ts","ng://@taiga-ui/cdk/observables/watch.ts","ng://@taiga-ui/cdk/observables/zone-free.ts","ng://@taiga-ui/cdk/observables/taiga-ui-cdk-observables.ts"],"sourcesContent":["import {TuiEventWith, TuiTypedEventTarget} from '@taiga-ui/cdk/types';\nimport {fromEvent, Observable} from 'rxjs';\n\nexport function typedFromEvent<E extends keyof WindowEventMap>(\n target: Window,\n event: E,\n options?: AddEventListenerOptions,\n): Observable<TuiEventWith<WindowEventMap[E], typeof target>>;\nexport function typedFromEvent<E extends keyof DocumentEventMap>(\n target: Document,\n event: E,\n options?: AddEventListenerOptions,\n): Observable<TuiEventWith<DocumentEventMap[E], typeof target>>;\nexport function typedFromEvent<T extends Element, E extends keyof HTMLElementEventMap>(\n target: T,\n event: E,\n options?: AddEventListenerOptions,\n): Observable<TuiEventWith<HTMLElementEventMap[E], typeof target>>;\nexport function typedFromEvent<\n E extends Event,\n T extends TuiTypedEventTarget<TuiEventWith<E, T>>,\n>(\n target: T,\n event: string,\n options?: AddEventListenerOptions,\n): Observable<TuiEventWith<E, T>>;\nexport function typedFromEvent<E extends Event>(\n target: TuiTypedEventTarget<E>,\n event: string,\n options?: AddEventListenerOptions,\n): Observable<E>;\nexport function typedFromEvent<E extends Event>(\n target: TuiTypedEventTarget<E>,\n event: string,\n options: AddEventListenerOptions = {},\n): Observable<E> {\n return fromEvent(target, event, options);\n}\n","import {TuiEventWith, TuiTypedEventTarget} from '@taiga-ui/cdk/types';\nimport {merge, Observable} from 'rxjs';\n\nimport {typedFromEvent} from './typed-from-event';\n\n/**\n * Letting go of the mouse after it was pressed\n * @param target\n */\nexport function mouseDragFinishFrom<\n T extends TuiTypedEventTarget<TuiEventWith<DragEvent, T>>,\n>(target: Exclude<T, null>): Observable<TuiEventWith<MouseEvent, T>> {\n return merge(typedFromEvent(target, 'mouseup'), typedFromEvent(target, 'dragend'));\n}\n","import {TuiOwnerDocumentException} from '@taiga-ui/cdk/exceptions';\nimport {isPresent} from '@taiga-ui/cdk/utils/miscellaneous';\nimport {concat, merge, Observable} from 'rxjs';\nimport {endWith, map, repeat, take, takeWhile} from 'rxjs/operators';\n\nimport {mouseDragFinishFrom} from './mouse-drag-finish-from';\nimport {typedFromEvent} from './typed-from-event';\n\nexport const enum TuiDragStage {\n Start,\n Continues,\n End,\n}\n\nexport class TuiDragState {\n constructor(readonly stage: TuiDragStage, readonly event: MouseEvent) {}\n}\n\nexport function dragAndDropFrom(element: Element): Observable<TuiDragState> {\n const {ownerDocument} = element;\n\n if (!ownerDocument) {\n throw new TuiOwnerDocumentException();\n }\n\n return concat(\n typedFromEvent(element, 'mousedown').pipe(\n take(1),\n map(event => new TuiDragState(TuiDragStage.Start, event)),\n ),\n merge(\n typedFromEvent(ownerDocument, 'mousemove').pipe(\n map(event => new TuiDragState(TuiDragStage.Continues, event)),\n ),\n mouseDragFinishFrom(ownerDocument).pipe(\n take(1),\n map(event => new TuiDragState(TuiDragStage.End, event)),\n endWith(null),\n ),\n ).pipe(takeWhile(isPresent)),\n ).pipe(repeat());\n}\n","import {OperatorFunction, pipe, timer} from 'rxjs';\nimport {distinctUntilChanged, mapTo, startWith, switchMapTo} from 'rxjs/operators';\n\n/**\n * Operator to set lifespan after which current value is considered obsolete\n */\nexport function tuiIsAlive(lifespan: number = 0): OperatorFunction<any, boolean> {\n return pipe(\n switchMapTo(timer(lifespan).pipe(mapTo(false), startWith(true))),\n distinctUntilChanged(),\n );\n}\n","import {TuiOwnerDocumentException} from '@taiga-ui/cdk/exceptions';\nimport {isNativeFocused} from '@taiga-ui/cdk/utils/focus';\nimport {concat, merge, Observable} from 'rxjs';\nimport {\n distinctUntilChanged,\n filter,\n ignoreElements,\n mapTo,\n repeat,\n shareReplay,\n startWith,\n switchMapTo,\n take,\n withLatestFrom,\n} from 'rxjs/operators';\n\nimport {tuiIsAlive} from './is-alive';\nimport {typedFromEvent} from './typed-from-event';\n\nlet documentMouseUpIsAlive$: Observable<boolean>;\nlet documentMouseDownIsAlive$: Observable<boolean>;\n\nexport function focusVisibleObservable(element: Element): Observable<boolean> {\n const elementBlur$ = typedFromEvent(element, 'blur');\n const {ownerDocument} = element;\n\n if (!ownerDocument) {\n throw new TuiOwnerDocumentException();\n }\n\n if (!documentMouseDownIsAlive$ || !documentMouseUpIsAlive$) {\n documentMouseUpIsAlive$ = typedFromEvent(ownerDocument, 'mouseup', {\n capture: true,\n }).pipe(tuiIsAlive(), startWith(false), shareReplay(1));\n documentMouseDownIsAlive$ = typedFromEvent(ownerDocument, 'mousedown', {\n capture: true,\n }).pipe(tuiIsAlive(), startWith(false), shareReplay(1));\n }\n\n return merge(\n // focus events excluding ones that came right after mouse action\n concat(\n typedFromEvent(element, 'focus').pipe(take(1)),\n // filtering out blur events when element remains focused so that we ignore browser tab focus loss\n elementBlur$.pipe(\n filter(() => !isNativeFocused(element)),\n take(1),\n ignoreElements(),\n ),\n ).pipe(\n repeat(),\n withLatestFrom(\n documentMouseDownIsAlive$,\n documentMouseUpIsAlive$,\n (_event, elementActual, documentActual) =>\n elementActual || documentActual,\n ),\n filter(isUserFocus => !isUserFocus),\n ),\n ).pipe(\n switchMapTo(elementBlur$.pipe(mapTo(false), take(1), startWith(true))),\n distinctUntilChanged(),\n );\n}\n","import {QueryList} from '@angular/core';\nimport {getOriginalArrayFromQueryList} from '@taiga-ui/cdk/utils/miscellaneous';\nimport {Observable} from 'rxjs';\nimport {map, startWith} from 'rxjs/operators';\n\n/**\n * Converts changes observable of a QueryList to an Observable of arrays\n */\nexport function itemsQueryListObservable<T>(\n queryList: QueryList<T>,\n): Observable<ReadonlyArray<T>> {\n return queryList.changes.pipe(\n map(() => getOriginalArrayFromQueryList(queryList)),\n startWith(getOriginalArrayFromQueryList(queryList)),\n );\n}\n","import {TuiValuePresentException} from '@taiga-ui/cdk/exceptions';\nimport {isPresent} from '@taiga-ui/cdk/utils/miscellaneous';\nimport {OperatorFunction} from 'rxjs';\nimport {map} from 'rxjs/operators';\n\nexport function mustBePresent<T>(): OperatorFunction<T | undefined | null, T> {\n return map(value => {\n if (!isPresent(value)) {\n throw new TuiValuePresentException();\n }\n\n return value;\n });\n}\n","import {TuiOwnerDocumentException} from '@taiga-ui/cdk/exceptions';\nimport {Observable} from 'rxjs';\nimport {filter, mapTo, startWith, switchMapTo, take} from 'rxjs/operators';\n\nimport {mouseDragFinishFrom} from './mouse-drag-finish-from';\nimport {typedFromEvent} from './typed-from-event';\n\nexport interface TuiPressedObservableOptions {\n onlyTrusted: boolean;\n}\n\nexport function pressedObservable(\n element: Element,\n {onlyTrusted}: TuiPressedObservableOptions = {onlyTrusted: true},\n): Observable<boolean> {\n const {ownerDocument} = element;\n\n if (!ownerDocument) {\n throw new TuiOwnerDocumentException();\n }\n\n return typedFromEvent(element, 'mousedown').pipe(\n filter(({isTrusted}) => isTrusted || !onlyTrusted),\n switchMapTo(\n mouseDragFinishFrom(ownerDocument).pipe(\n mapTo(false),\n take(1),\n startWith(true),\n ),\n ),\n );\n}\n","import {MonoTypeOperatorFunction} from 'rxjs';\nimport {tap} from 'rxjs/operators';\n\nexport function preventDefault<T extends Event>(): MonoTypeOperatorFunction<T> {\n return tap(e => {\n e.preventDefault();\n });\n}\n","import {AbstractControl, AbstractControlDirective} from '@angular/forms';\nimport {TuiValueChangesException} from '@taiga-ui/cdk/exceptions';\nimport {Observable} from 'rxjs';\nimport {startWith} from 'rxjs/operators';\n\n/**\n * Turns AbstractControl/Abstract-control-directive valueChanges into ReplaySubject(1)\n * TODO: rename function in 3.0. The name should be shorter.\n */\nexport function tuiReplayedValueChangesFrom<T>(\n control: AbstractControl | AbstractControlDirective,\n): Observable<T> {\n return new Observable(subscriber => {\n if (!control.valueChanges) {\n throw new TuiValueChangesException();\n }\n\n control.valueChanges.pipe(startWith(control.value)).subscribe(subscriber);\n });\n}\n","import {MonoTypeOperatorFunction} from 'rxjs';\nimport {tap} from 'rxjs/operators';\n\nexport function stopPropagation<T extends Event>(): MonoTypeOperatorFunction<T> {\n return tap(e => {\n e.stopPropagation();\n });\n}\n","import {ChangeDetectorRef} from '@angular/core';\nimport {MonoTypeOperatorFunction} from 'rxjs';\nimport {tap} from 'rxjs/operators';\n\nexport function watch<T>(\n changeDetectorRef: ChangeDetectorRef,\n): MonoTypeOperatorFunction<T> {\n return tap(() => {\n changeDetectorRef.markForCheck();\n });\n}\n","import {NgZone} from '@angular/core';\nimport {MonoTypeOperatorFunction, Observable, pipe} from 'rxjs';\n\nexport function tuiZonefull<T>(ngZone: NgZone): MonoTypeOperatorFunction<T> {\n return source =>\n new Observable(subscriber =>\n source.subscribe({\n next: value => ngZone.run(() => subscriber.next(value)),\n error: error => ngZone.run(() => subscriber.error(error)),\n complete: () => ngZone.run(() => subscriber.complete()),\n }),\n );\n}\n\nexport function tuiZonefree<T>(ngZone: NgZone): MonoTypeOperatorFunction<T> {\n return source =>\n new Observable(subscriber =>\n ngZone.runOutsideAngular(() => source.subscribe(subscriber)),\n );\n}\n\nexport function tuiZoneOptimized<T>(ngZone: NgZone): MonoTypeOperatorFunction<T> {\n return pipe(tuiZonefree(ngZone), tuiZonefull(ngZone));\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;SA+BgB,cAAc,CAC1B,MAA8B,EAC9B,KAAa,EACb,UAAmC,EAAE;IAErC,OAAO,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AAC7C;;AChCA;;;;SAIgB,mBAAmB,CAEjC,MAAwB;IACtB,OAAO,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,cAAc,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;AACvF;;ICLkB;AAAlB,WAAkB,YAAY;IAC1B,iDAAK,CAAA;IACL,yDAAS,CAAA;IACT,6CAAG,CAAA;AACP,CAAC,EAJiB,YAAY,KAAZ,YAAY,QAI7B;MAEY,YAAY;IACrB,YAAqB,KAAmB,EAAW,KAAiB;QAA/C,UAAK,GAAL,KAAK,CAAc;QAAW,UAAK,GAAL,KAAK,CAAY;KAAI;CAC3E;SAEe,eAAe,CAAC,OAAgB;IAC5C,MAAM,EAAC,aAAa,EAAC,GAAG,OAAO,CAAC;IAEhC,IAAI,CAAC,aAAa,EAAE;QAChB,MAAM,IAAI,yBAAyB,EAAE,CAAC;KACzC;IAED,OAAO,MAAM,CACT,cAAc,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,IAAI,CACrC,IAAI,CAAC,CAAC,CAAC,EACP,GAAG,CAAC,KAAK,IAAI,IAAI,YAAY,gBAAqB,KAAK,CAAC,CAAC,CAC5D,EACD,KAAK,CACD,cAAc,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC,IAAI,CAC3C,GAAG,CAAC,KAAK,IAAI,IAAI,YAAY,oBAAyB,KAAK,CAAC,CAAC,CAChE,EACD,mBAAmB,CAAC,aAAa,CAAC,CAAC,IAAI,CACnC,IAAI,CAA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M,MAAM,CAAC,GAAG,CAAC,MAAM,UAAU,CAAC,QAAQ,EAAE,CAAC;KAC1D,CAAC,CACL,CAAC;AACV,CAAC;SAEe,WAAW,CAAI,MAAc;IACzC,OAAO,MAAM,IACT,IAAI,UAAU,CAAC,UAAU,IACrB,MAAM,CAAC,iBAAiB,CAAC,MAAM,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAC/D,CAAC;AACV,CAAC;SAEe,gBAAgB,CAAI,MAAc;IAC9C,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;AAC1D;;ACvBA;;;;;;"}
@@ -6,6 +6,7 @@ export * from '@taiga-ui/cdk/date-time';
6
6
  export * from '@taiga-ui/cdk/decorators';
7
7
  export * from '@taiga-ui/cdk/directives';
8
8
  export * from '@taiga-ui/cdk/enums';
9
+ export * from '@taiga-ui/cdk/exceptions';
9
10
  export * from '@taiga-ui/cdk/observables';
10
11
  export * from '@taiga-ui/cdk/pipes';
11
12
  export * from '@taiga-ui/cdk/services';
@@ -1 +1 @@
1
- {"version":3,"file":"taiga-ui-cdk.js","sources":["ng://@taiga-ui/cdk/taiga-ui-cdk.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;;"}
1
+ {"version":3,"file":"taiga-ui-cdk.js","sources":["ng://@taiga-ui/cdk/taiga-ui-cdk.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;"}
@@ -1,7 +1,7 @@
1
1
  import { __decorate, __param } from 'tslib';
2
2
  import { ɵɵdefineInjectable, Injectable, Injector, ViewContainerRef, Inject, ElementRef, ViewChild, Component, ChangeDetectionStrategy, NgModule } from '@angular/core';
3
+ import { TuiNoHostException } from '@taiga-ui/cdk/exceptions';
3
4
 
4
- var NO_HOST = 'Portals cannot be used without TuiPortalHostComponent';
5
5
  /**
6
6
  * Service for displaying portals
7
7
  */
@@ -11,7 +11,7 @@ var TuiPortalService = /** @class */ (function () {
11
11
  Object.defineProperty(TuiPortalService.prototype, "safeHost", {
12
12
  get: function () {
13
13
  if (!this.host) {
14
- throw new Error(NO_HOST);
14
+ throw new TuiNoHostException();
15
15
  }
16
16
  return this.host;
17
17
  },
@@ -1 +1 @@
1
- {"version":3,"file":"taiga-ui-cdk-components-portal-host.js","sources":["ng://@taiga-ui/cdk/components/portal-host/portal.service.ts","ng://@taiga-ui/cdk/components/portal-host/portal-host.component.ts","ng://@taiga-ui/cdk/components/portal-host/portal-host.module.ts","ng://@taiga-ui/cdk/components/portal-host/taiga-ui-cdk-components-portal-host.ts"],"sourcesContent":["import {\n ComponentFactory,\n ComponentRef,\n EmbeddedViewRef,\n Injectable,\n Injector,\n TemplateRef,\n} from '@angular/core';\n\nimport {TuiPortalHostComponent} from './portal-host.component';\n\nconst NO_HOST = 'Portals cannot be used without TuiPortalHostComponent';\n\n/**\n * Service for displaying portals\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class TuiPortalService {\n private host?: TuiPortalHostComponent;\n\n private get safeHost(): TuiPortalHostComponent {\n if (!this.host) {\n throw new Error(NO_HOST);\n }\n\n return this.host;\n }\n\n attach(host: TuiPortalHostComponent) {\n this.host = host;\n }\n\n add<C>(componentFactory: ComponentFactory<C>, injector: Injector): ComponentRef<C> {\n return this.safeHost.addComponentChild(componentFactory, injector);\n }\n\n remove<C>({hostView}: ComponentRef<C>) {\n hostView.destroy();\n }\n\n addTemplate<C>(templateRef: TemplateRef<C>, context?: C): EmbeddedViewRef<C> {\n return this.safeHost.addTemplateChild(templateRef, context);\n }\n\n removeTemplate<C>(viewRef: EmbeddedViewRef<C>) {\n viewRef.destroy();\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ComponentFactory,\n ComponentRef,\n ElementRef,\n EmbeddedViewRef,\n Inject,\n Injector,\n TemplateRef,\n ViewChild,\n ViewContainerRef,\n} from '@angular/core';\n\nimport {TuiPortalService} from './portal.service';\n\nconst BLANK_CLIENT_RECT: ClientRect = {\n bottom: 0,\n height: 0,\n left: 0,\n right: 0,\n top: 0,\n width: 0,\n};\n\n/**\n * Host element for dynamically created portals, for example using {@link TuiDropdownDirective}.\n */\n@Component({\n selector: 'tui-portal-host',\n templateUrl: './portal-host.template.html',\n styleUrls: ['./portal-host.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiPortalHostComponent {\n @ViewChild('positionFixedOffset')\n private readonly positionFixedOffsetRef?: ElementRef<HTMLDivElement>;\n\n constructor(\n @Inject(ViewContainerRef)\n private readonly viewContainerRef: ViewContainerRef,\n @Inject(ElementRef)\n private readonly elementRef: ElementRef<HTMLElement>,\n @Inject(TuiPortalService) portalService: TuiPortalService,\n ) {\n portalService.attach(this);\n }\n\n get clientRect(): ClientRect {\n return this.elementRef.nativeElement.getBoundingClientRect();\n }\n\n addComponentChild<C>(\n componentFactory: ComponentFactory<C>,\n injector: Injector,\n ): ComponentRef<C> {\n return this.viewContainerRef.createComponent<C>(\n componentFactory,\n undefined,\n Injector.create({\n parent: injector,\n providers: [\n {\n provide: TuiPortalHostComponent,\n useValue: this,\n },\n ],\n }),\n );\n }\n\n addTemplateChild<C>(templateRef: TemplateRef<C>, context?: C): EmbeddedViewRef<C> {\n return this.viewContainerRef.createEmbeddedView(templateRef, context);\n }\n\n fixedPositionOffset(): ClientRect {\n return this.positionFixedOffsetRef\n ? this.positionFixedOffsetRef.nativeElement.getBoundingClientRect()\n : BLANK_CLIENT_RECT;\n }\n}\n","import {NgModule} from '@angular/core';\n\nimport {TuiPortalHostComponent} from './portal-host.component';\n\n@NgModule({\n declarations: [TuiPortalHostComponent],\n exports: [TuiPortalHostComponent],\n})\nexport class TuiPortalHostModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAWA,IAAM,O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,sBAAsB,CAAC;YACtC,OAAO,EAAE,CAAC,sBAAsB,CAAC;SACpC,CAAC;OACW,mBAAmB,CAAG;IAAD,0BAAC;CAAnC;;ACRA;;;;;;"}
1
+ {"version":3,"file":"taiga-ui-cdk-components-portal-host.js","sources":["ng://@taiga-ui/cdk/components/portal-host/portal.service.ts","ng://@taiga-ui/cdk/components/portal-host/portal-host.component.ts","ng://@taiga-ui/cdk/components/portal-host/portal-host.module.ts","ng://@taiga-ui/cdk/components/portal-host/taiga-ui-cdk-components-portal-host.ts"],"sourcesContent":["import {\n ComponentFactory,\n ComponentRef,\n EmbeddedViewRef,\n Injectable,\n Injector,\n TemplateRef,\n} from '@angular/core';\nimport {TuiNoHostException} from '@taiga-ui/cdk/exceptions';\n\nimport {TuiPortalHostComponent} from './portal-host.component';\n\n/**\n * Service for displaying portals\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class TuiPortalService {\n private host?: TuiPortalHostComponent;\n\n private get safeHost(): TuiPortalHostComponent {\n if (!this.host) {\n throw new TuiNoHostException();\n }\n\n return this.host;\n }\n\n attach(host: TuiPortalHostComponent) {\n this.host = host;\n }\n\n add<C>(componentFactory: ComponentFactory<C>, injector: Injector): ComponentRef<C> {\n return this.safeHost.addComponentChild(componentFactory, injector);\n }\n\n remove<C>({hostView}: ComponentRef<C>) {\n hostView.destroy();\n }\n\n addTemplate<C>(templateRef: TemplateRef<C>, context?: C): EmbeddedViewRef<C> {\n return this.safeHost.addTemplateChild(templateRef, context);\n }\n\n removeTemplate<C>(viewRef: EmbeddedViewRef<C>) {\n viewRef.destroy();\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ComponentFactory,\n ComponentRef,\n ElementRef,\n EmbeddedViewRef,\n Inject,\n Injector,\n TemplateRef,\n ViewChild,\n ViewContainerRef,\n} from '@angular/core';\n\nimport {TuiPortalService} from './portal.service';\n\nconst BLANK_CLIENT_RECT: ClientRect = {\n bottom: 0,\n height: 0,\n left: 0,\n right: 0,\n top: 0,\n width: 0,\n};\n\n/**\n * Host element for dynamically created portals, for example using {@link TuiDropdownDirective}.\n */\n@Component({\n selector: 'tui-portal-host',\n templateUrl: './portal-host.template.html',\n styleUrls: ['./portal-host.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiPortalHostComponent {\n @ViewChild('positionFixedOffset')\n private readonly positionFixedOffsetRef?: ElementRef<HTMLDivElement>;\n\n constructor(\n @Inject(ViewContainerRef)\n private readonly viewContainerRef: ViewContainerRef,\n @Inject(ElementRef)\n private readonly elementRef: ElementRef<HTMLElement>,\n @Inject(TuiPortalService) portalService: TuiPortalService,\n ) {\n portalService.attach(this);\n }\n\n get clientRect(): ClientRect {\n return this.elementRef.nativeElement.getBoundingClientRect();\n }\n\n addComponentChild<C>(\n componentFactory: ComponentFactory<C>,\n injector: Injector,\n ): ComponentRef<C> {\n return this.viewContainerRef.createComponent<C>(\n componentFactory,\n undefined,\n Injector.create({\n parent: injector,\n providers: [\n {\n provide: TuiPortalHostComponent,\n useValue: this,\n },\n ],\n }),\n );\n }\n\n addTemplateChild<C>(templateRef: TemplateRef<C>, context?: C): EmbeddedViewRef<C> {\n return this.viewContainerRef.createEmbeddedView(templateRef, context);\n }\n\n fixedPositionOffset(): ClientRect {\n return this.positionFixedOffsetRef\n ? this.positionFixedOffsetRef.nativeElement.getBoundingClientRect()\n : BLANK_CLIENT_RECT;\n }\n}\n","import {NgModule} from '@angular/core';\n\nimport {TuiPortalHostComponent} from './portal-host.component';\n\n@NgModule({\n declarations: [TuiPortalHostComponent],\n exports: [TuiPortalHostComponent],\n})\nexport class TuiPortalHostModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAYA;;;;IAMA;KA8BC;IA3BG,sBAAY,sCAAQ;aAApB;YACI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;gBACZ,MAAM,IAAI,kBAAkB,EAAE,CAAC;aAClC;YAED,OAAO,IAAI,CAAC,I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HAR_EN_DASH } from '@taiga-ui/cdk/constants';
3
3
  import { __extends } from 'tslib';
4
4
  import { tuiAssert } from '@taiga-ui/cdk/classes';
5
+ import { InvalidYearException, InvalidMonthException, InvalidDayException } from '@taiga-ui/cdk/exceptions';
5
6
  import { padStart } from '@taiga-ui/cdk/utils/format';
6
7
  import { inRange, normalizeToIntNumber } from '@taiga-ui/cdk/utils/math';
7
8
 
@@ -553,14 +554,14 @@ var TuiDay = /** @class */ (function (_super) {
553
554
  TuiDay.jsonParse = function (yearMonthDayString) {
554
555
  var _a = this.parseRawDateString(yearMonthDayString, 'YMD'), day = _a.day, month = _a.month, year = _a.year;
555
556
  if (!TuiYear.isValidYear(year)) {
556
- throw new Error('Invalid year: ' + year);
557
+ throw new InvalidYearException(year);
557
558
  }
558
559
  if (!TuiMonth.isValidMonth(year, month)) {
559
- throw new Error('Invalid month: ' + month);
560
+ throw new InvalidMonthException(month);
560
561
  }
561
562
  if (!Number.isInteger(day) ||
562
563
  !inRange(day, MIN_DAY, TuiMonth.getMonthDaysCount(month, TuiYear.isLeapYear(year)) + 1)) {
563
- throw new Error('Invalid day: ' + day);
564
+ throw new InvalidDayException(day);
564
565
  }
565
566
  return new TuiDay(year, month, day);
566
567
  };