@taiga-ui/cdk 2.50.2 → 2.51.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 (72) hide show
  1. package/bundles/taiga-ui-cdk-directives-copy-processor.umd.js +7 -7
  2. package/bundles/taiga-ui-cdk-directives-copy-processor.umd.js.map +1 -1
  3. package/bundles/taiga-ui-cdk-directives-copy-processor.umd.min.js +1 -1
  4. package/bundles/taiga-ui-cdk-directives-copy-processor.umd.min.js.map +1 -1
  5. package/bundles/taiga-ui-cdk-directives-overscroll.umd.js +4 -1
  6. package/bundles/taiga-ui-cdk-directives-overscroll.umd.js.map +1 -1
  7. package/bundles/taiga-ui-cdk-directives-overscroll.umd.min.js +1 -1
  8. package/bundles/taiga-ui-cdk-directives-overscroll.umd.min.js.map +1 -1
  9. package/bundles/taiga-ui-cdk-exceptions.umd.js +39 -0
  10. package/bundles/taiga-ui-cdk-exceptions.umd.js.map +1 -1
  11. package/bundles/taiga-ui-cdk-exceptions.umd.min.js +1 -1
  12. package/bundles/taiga-ui-cdk-exceptions.umd.min.js.map +1 -1
  13. package/bundles/taiga-ui-cdk-utils-dom.umd.js +26 -0
  14. package/bundles/taiga-ui-cdk-utils-dom.umd.js.map +1 -1
  15. package/bundles/taiga-ui-cdk-utils-dom.umd.min.js +1 -1
  16. package/bundles/taiga-ui-cdk-utils-dom.umd.min.js.map +1 -1
  17. package/directives/copy-processor/taiga-ui-cdk-directives-copy-processor.metadata.json +1 -1
  18. package/esm2015/directives/copy-processor/copy-processor.directive.js +5 -4
  19. package/esm2015/directives/overscroll/overscroll.directive.js +5 -2
  20. package/esm2015/exceptions/invalid-day.exception.js +8 -1
  21. package/esm2015/exceptions/invalid-month.exception.js +8 -1
  22. package/esm2015/exceptions/invalid-year.exception.js +8 -1
  23. package/esm2015/utils/dom/get-selected-text.js +16 -0
  24. package/esm2015/utils/dom/index.js +3 -1
  25. package/esm2015/utils/dom/is-form-field.js +8 -0
  26. package/esm5/directives/copy-processor/copy-processor.directive.js +5 -4
  27. package/esm5/directives/overscroll/overscroll.directive.js +5 -2
  28. package/esm5/exceptions/invalid-day.exception.js +14 -1
  29. package/esm5/exceptions/invalid-month.exception.js +14 -1
  30. package/esm5/exceptions/invalid-year.exception.js +14 -1
  31. package/esm5/utils/dom/get-selected-text.js +17 -0
  32. package/esm5/utils/dom/index.js +3 -1
  33. package/esm5/utils/dom/is-form-field.js +8 -0
  34. package/exceptions/invalid-day.exception.d.ts +6 -0
  35. package/exceptions/invalid-month.exception.d.ts +6 -0
  36. package/exceptions/invalid-year.exception.d.ts +6 -0
  37. package/exceptions/taiga-ui-cdk-exceptions.metadata.json +1 -1
  38. package/fesm2015/taiga-ui-cdk-directives-copy-processor.js +4 -3
  39. package/fesm2015/taiga-ui-cdk-directives-copy-processor.js.map +1 -1
  40. package/fesm2015/taiga-ui-cdk-directives-overscroll.js +4 -1
  41. package/fesm2015/taiga-ui-cdk-directives-overscroll.js.map +1 -1
  42. package/fesm2015/taiga-ui-cdk-exceptions.js +22 -1
  43. package/fesm2015/taiga-ui-cdk-exceptions.js.map +1 -1
  44. package/fesm2015/taiga-ui-cdk-utils-dom.js +24 -1
  45. package/fesm2015/taiga-ui-cdk-utils-dom.js.map +1 -1
  46. package/fesm5/taiga-ui-cdk-directives-copy-processor.js +4 -3
  47. package/fesm5/taiga-ui-cdk-directives-copy-processor.js.map +1 -1
  48. package/fesm5/taiga-ui-cdk-directives-overscroll.js +4 -1
  49. package/fesm5/taiga-ui-cdk-directives-overscroll.js.map +1 -1
  50. package/fesm5/taiga-ui-cdk-exceptions.js +37 -1
  51. package/fesm5/taiga-ui-cdk-exceptions.js.map +1 -1
  52. package/fesm5/taiga-ui-cdk-utils-dom.js +25 -1
  53. package/fesm5/taiga-ui-cdk-utils-dom.js.map +1 -1
  54. package/package.json +1 -1
  55. package/schematics/ng-update/constants/modules.js +1 -0
  56. package/schematics/ng-update/constants/services.js +9 -0
  57. package/schematics/ng-update/constants/templates.d.ts +17 -0
  58. package/schematics/ng-update/constants/templates.js +31 -0
  59. package/schematics/ng-update/constants/types.js +30 -0
  60. package/schematics/ng-update/index.js +2 -0
  61. package/schematics/ng-update/steps/migrate-progress.d.ts +3 -0
  62. package/schematics/ng-update/steps/migrate-progress.js +43 -0
  63. package/schematics/ng-update/steps/migrate-sliders/migrate-input-range.js +31 -24
  64. package/schematics/ng-update/steps/migrate-sliders/migrate-input-slider.js +29 -19
  65. package/schematics/ng-update/steps/migrate-templates.js +16 -0
  66. package/schematics/ng-update/steps/show-warnings.js +1 -1
  67. package/schematics/utils/templates/elements.js +2 -1
  68. package/schematics/utils/templates/ng-component-input-manipulations.js +2 -1
  69. package/utils/dom/get-selected-text.d.ts +9 -0
  70. package/utils/dom/index.d.ts +2 -0
  71. package/utils/dom/is-form-field.d.ts +1 -0
  72. package/utils/dom/taiga-ui-cdk-utils-dom.metadata.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"taiga-ui-cdk-utils-dom.js","sources":["ng://@taiga-ui/cdk/utils/dom/can-scroll.ts","ng://@taiga-ui/cdk/utils/dom/contains-or-after.ts","ng://@taiga-ui/cdk/utils/dom/custom-event.ts","ng://@taiga-ui/cdk/utils/dom/get-actual-target.ts","ng://@taiga-ui/cdk/utils/dom/get-clipboard-data-text.ts","ng://@taiga-ui/cdk/utils/dom/get-closest-element.ts","ng://@taiga-ui/cdk/utils/dom/get-document-or-shadow-root.ts","ng://@taiga-ui/cdk/utils/dom/get-element-obscurers.ts","ng://@taiga-ui/cdk/utils/dom/get-element-offset.ts","ng://@taiga-ui/cdk/utils/dom/get-scroll-parent.ts","ng://@taiga-ui/cdk/utils/dom/is-current-target.ts","ng://@taiga-ui/cdk/utils/dom/is-inside-iframe.ts","ng://@taiga-ui/cdk/utils/dom/is-node-in.ts","ng://@taiga-ui/cdk/utils/dom/taiga-ui-cdk-utils-dom.ts"],"sourcesContent":["export function canScroll(\n element: Element,\n rootElement: Element,\n vertical: boolean,\n scrollEnd: boolean,\n): boolean {\n return vertical\n ? canScrollVertical(element, rootElement, scrollEnd)\n : canScrollHorizontal(element, rootElement, scrollEnd);\n}\n\nfunction canScrollVertical(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollTop) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollTop + currentElement.clientHeight) <\n currentElement.scrollHeight &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n\nfunction canScrollHorizontal(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollLeft) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollLeft + currentElement.clientWidth) <\n currentElement.scrollWidth &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n","export function containsOrAfter(current: Node, node: Node): boolean {\n return (\n current.contains(node) ||\n !!(node.compareDocumentPosition(current) & Node.DOCUMENT_POSITION_PRECEDING)\n );\n}\n","/** @deprecated only needed for IE, remove in 3.0 */\nexport function tuiCustomEvent<T = null>(\n name: string,\n {bubbles = false, cancelable = false, detail = null}: CustomEventInit<T | null> = {},\n documentRef: Document,\n): CustomEvent {\n if (typeof CustomEvent === 'function') {\n return new CustomEvent(name, {bubbles, cancelable, detail});\n }\n\n const customEvent = documentRef.createEvent('CustomEvent');\n\n customEvent.initCustomEvent(name, bubbles, cancelable, detail);\n\n return customEvent;\n}\n","/**\n * Gets actual target from open Shadow DOM if event happened within it\n */\nexport function getActualTarget(event: Event): Node {\n if ('composedPath' in event) {\n return (event as any).composedPath()[0];\n }\n\n return (event as any).target;\n}\n","const DEFAULT_FORMAT = 'text/plain';\n\n/**\n * Gets text from data of clipboardEvent, it also works in IE and Edge browsers\n */\nexport function getClipboardDataText(\n event: ClipboardEvent,\n format: string = DEFAULT_FORMAT,\n): string {\n return 'clipboardData' in event && event.clipboardData !== null\n ? event.clipboardData.getData(format) ||\n event.clipboardData.getData(DEFAULT_FORMAT)\n : (event as any).target.ownerDocument.defaultView.clipboardData.getData('text');\n}\n","/**\n * Gets closest element by selector i.e. {@link Element.closest}\n * @deprecated only needed for IE, remove in 3.0\n */\nexport function getClosestElement(element: Element, selector: string): Element | null {\n const closest = Element.prototype.closest;\n\n if (closest) {\n return closest.call(element, selector);\n }\n\n const matchesSelector =\n Element.prototype.matches || (Element.prototype as any).msMatchesSelector;\n\n do {\n if (matchesSelector.call(element, selector)) {\n return element;\n }\n\n (element as Element | null) = element.parentElement;\n } while (element !== null);\n\n return null;\n}\n","export function getDocumentOrShadowRoot(node: Node): DocumentOrShadowRoot {\n return 'getRootNode' in node && node.isConnected\n ? (node.getRootNode() as Document)\n : node.ownerDocument!;\n}\n","import {clamp} from '@taiga-ui/cdk/utils/math';\nimport {isPresent} from '@taiga-ui/cdk/utils/miscellaneous';\n\nimport {getDocumentOrShadowRoot} from './get-document-or-shadow-root';\n\n/**\n * Returns array of Elements covering edges of given element or null if at least one edge middle point is visible\n *\n * CAUTION: Empty array means element if offscreen i.e. covered by no elements, rather than not covered\n */\nexport function getElementObscurers(element: Element): readonly Element[] | null {\n const {ownerDocument} = element;\n\n if (!ownerDocument || !ownerDocument.defaultView) {\n return null;\n }\n\n const {innerWidth, innerHeight} = ownerDocument.defaultView;\n const documentRef = getDocumentOrShadowRoot(element);\n const rect = element.getBoundingClientRect();\n const left = clamp(Math.round(rect.left) + 2, 0, innerWidth);\n const top = clamp(Math.round(rect.top) + 2, 0, innerHeight);\n const right = clamp(Math.round(rect.right) - 2, 0, innerWidth);\n const bottom = clamp(Math.round(rect.bottom) - 2, 0, innerHeight);\n const horizontalMiddle = clamp(Math.round(rect.left + rect.width / 2), 0, innerWidth);\n const verticalMiddle = clamp(Math.round(rect.top + rect.height / 2), 0, innerHeight);\n const elements = [\n documentRef.elementFromPoint(horizontalMiddle, top),\n documentRef.elementFromPoint(horizontalMiddle, bottom),\n documentRef.elementFromPoint(left, verticalMiddle),\n documentRef.elementFromPoint(right, verticalMiddle),\n ];\n const nonNull = elements.filter(isPresent);\n\n if (!nonNull.length) {\n return nonNull;\n }\n\n const filtered = nonNull.filter(el => !element.contains(el));\n\n return filtered.length === 4 ? filtered : null;\n}\n","import {tuiAssert} from '@taiga-ui/cdk/classes';\n\n/**\n * Calculates offset for an element relative to it's parent several levels above\n *\n * @param host parent element\n * @param element\n * @return object with offsetTop and offsetLeft number properties\n */\nexport function getElementOffset(\n host: Element,\n element: HTMLElement,\n): {offsetTop: number; offsetLeft: number} {\n tuiAssert.assert(host.contains(element), 'Host must contain element');\n\n let {offsetTop, offsetLeft, offsetParent} = element;\n\n // TODO: iframe warning\n while (offsetParent && offsetParent instanceof HTMLElement && offsetParent !== host) {\n offsetTop += offsetParent.offsetTop;\n offsetLeft += offsetParent.offsetLeft;\n offsetParent = offsetParent.offsetParent;\n }\n\n return {offsetTop, offsetLeft};\n}\n","/**\n * Finds nearest parent with scroll in it\n *\n * @param element initial element\n * @param vertical flag for orientation of scroll\n */\nexport function getScrollParent(\n element: Element | null,\n vertical: boolean = true,\n): Element | null {\n if (element === null) {\n return null;\n }\n\n if (vertical && element.scrollHeight > element.clientHeight) {\n return element;\n }\n\n if (!vertical && element.scrollWidth > element.clientWidth) {\n return element;\n }\n\n return getScrollParent(element.parentElement, vertical);\n}\n","export function isCurrentTarget({target, currentTarget}: Event): boolean {\n return target === currentTarget;\n}\n","/**\n * Checks if an app is running inside <iframe /> tag\n */\nexport function isInsideIframe(windowRef: Window): boolean {\n return windowRef.parent !== windowRef;\n}\n","import {getClosestElement} from './get-closest-element';\n\n/**\n * Checks if node is inside a specific selector\n *\n * @param node\n * @param selector\n * @return true if node is inside a particular selector\n */\nexport function isNodeIn(node: Node, selector: string): boolean {\n return node.nodeType === Node.TEXT_NODE\n ? !!node.parentElement && !!getClosestElement(node.parentElement, selector)\n : node.nodeType === Node.ELEMENT_NODE &&\n !!getClosestElement(node as Element, selector);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;SAAgB,SAAS,CACrB,OAAgB,EAChB,WAAoB,EACpB,QAAiB,EACjB,SAAkB;IAElB,OAAO,QAAQ;UACT,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC;UAClD,mBAAmB,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,iBAAiB,CACtB,OAAgB,EAChB,WAAoB,EACpB,SAAkB;IAElB,IAAI,cAAc,GAAG,OAAO,CAAC;IAE7B,OAAO,cAAc,KAAK,WAAW,CAAC,aAAa,EAAE;QACjD,IACI,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS;aACtD,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,GAAG,cAAc,CAAC,YAAY,CAAC;gBAC9D,cAAc,CAAC,YAAY;gBAC3B,SAAS,CAAC,EAChB;YACE,OAAO,IAAI,CAAC;SACf;QAED,IAAI,cAAc,CAAC,aAAa,EAAE;YAC9B,cAAc,GAAG,cAAc,CAAC,aAAa,CAAC;SACjD;aAAM;YACH,OAAO,KAAK,CAAC;SAChB;KACJ;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,SAAS,mBAAmB,CACxB,OAAgB,EAChB,WAAoB,EACpB,SAAkB;IAElB,IAAI,cAAc,GAAG,OAAO,CAAC;IAE7B,OAAO,cAAc,KAAK,WAAW,CAAC,aAAa,EAAE;QACjD,IACI,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS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AO,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;AAC5D;;SCvBgB,eAAe,CAAC,EAA8B;QAA7B,kBAAM,EAAE,gCAAa;IAClD,OAAO,MAAM,KAAK,aAAa,CAAC;AACpC;;ACFA;;;SAGgB,cAAc,CAAC,SAAiB;IAC5C,OAAO,SAAS,CAAC,MAAM,KAAK,SAAS,CAAC;AAC1C;;ACHA;;;;;;;SAOgB,QAAQ,CAAC,IAAU,EAAE,QAAgB;IACjD,OAAO,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,SAAS;UACjC,CAAC,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC;UACzE,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY;YAC/B,CAAC,CAAC,iBAAiB,CAAC,IAAe,EAAE,QAAQ,CAAC,CAAC;AAC7D;;ACdA;;;;;;"}
1
+ {"version":3,"file":"taiga-ui-cdk-utils-dom.js","sources":["ng://@taiga-ui/cdk/utils/dom/can-scroll.ts","ng://@taiga-ui/cdk/utils/dom/contains-or-after.ts","ng://@taiga-ui/cdk/utils/dom/custom-event.ts","ng://@taiga-ui/cdk/utils/dom/get-actual-target.ts","ng://@taiga-ui/cdk/utils/dom/get-clipboard-data-text.ts","ng://@taiga-ui/cdk/utils/dom/get-closest-element.ts","ng://@taiga-ui/cdk/utils/dom/get-document-or-shadow-root.ts","ng://@taiga-ui/cdk/utils/dom/get-element-obscurers.ts","ng://@taiga-ui/cdk/utils/dom/get-element-offset.ts","ng://@taiga-ui/cdk/utils/dom/get-scroll-parent.ts","ng://@taiga-ui/cdk/utils/dom/is-form-field.ts","ng://@taiga-ui/cdk/utils/dom/get-selected-text.ts","ng://@taiga-ui/cdk/utils/dom/is-current-target.ts","ng://@taiga-ui/cdk/utils/dom/is-inside-iframe.ts","ng://@taiga-ui/cdk/utils/dom/is-node-in.ts","ng://@taiga-ui/cdk/utils/dom/taiga-ui-cdk-utils-dom.ts"],"sourcesContent":["export function canScroll(\n element: Element,\n rootElement: Element,\n vertical: boolean,\n scrollEnd: boolean,\n): boolean {\n return vertical\n ? canScrollVertical(element, rootElement, scrollEnd)\n : canScrollHorizontal(element, rootElement, scrollEnd);\n}\n\nfunction canScrollVertical(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollTop) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollTop + currentElement.clientHeight) <\n currentElement.scrollHeight &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n\nfunction canScrollHorizontal(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollLeft) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollLeft + currentElement.clientWidth) <\n currentElement.scrollWidth &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n","export function containsOrAfter(current: Node, node: Node): boolean {\n return (\n current.contains(node) ||\n !!(node.compareDocumentPosition(current) & Node.DOCUMENT_POSITION_PRECEDING)\n );\n}\n","/** @deprecated only needed for IE, remove in 3.0 */\nexport function tuiCustomEvent<T = null>(\n name: string,\n {bubbles = false, cancelable = false, detail = null}: CustomEventInit<T | null> = {},\n documentRef: Document,\n): CustomEvent {\n if (typeof CustomEvent === 'function') {\n return new CustomEvent(name, {bubbles, cancelable, detail});\n }\n\n const customEvent = documentRef.createEvent('CustomEvent');\n\n customEvent.initCustomEvent(name, bubbles, cancelable, detail);\n\n return customEvent;\n}\n","/**\n * Gets actual target from open Shadow DOM if event happened within it\n */\nexport function getActualTarget(event: Event): Node {\n if ('composedPath' in event) {\n return (event as any).composedPath()[0];\n }\n\n return (event as any).target;\n}\n","const DEFAULT_FORMAT = 'text/plain';\n\n/**\n * Gets text from data of clipboardEvent, it also works in IE and Edge browsers\n */\nexport function getClipboardDataText(\n event: ClipboardEvent,\n format: string = DEFAULT_FORMAT,\n): string {\n return 'clipboardData' in event && event.clipboardData !== null\n ? event.clipboardData.getData(format) ||\n event.clipboardData.getData(DEFAULT_FORMAT)\n : (event as any).target.ownerDocument.defaultView.clipboardData.getData('text');\n}\n","/**\n * Gets closest element by selector i.e. {@link Element.closest}\n * @deprecated only needed for IE, remove in 3.0\n */\nexport function getClosestElement(element: Element, selector: string): Element | null {\n const closest = Element.prototype.closest;\n\n if (closest) {\n return closest.call(element, selector);\n }\n\n const matchesSelector =\n Element.prototype.matches || (Element.prototype as any).msMatchesSelector;\n\n do {\n if (matchesSelector.call(element, selector)) {\n return element;\n }\n\n (element as Element | null) = element.parentElement;\n } while (element !== null);\n\n return null;\n}\n","export function getDocumentOrShadowRoot(node: Node): DocumentOrShadowRoot {\n return 'getRootNode' in node && node.isConnected\n ? (node.getRootNode() as Document)\n : node.ownerDocument!;\n}\n","import {clamp} from '@taiga-ui/cdk/utils/math';\nimport {isPresent} from '@taiga-ui/cdk/utils/miscellaneous';\n\nimport {getDocumentOrShadowRoot} from './get-document-or-shadow-root';\n\n/**\n * Returns array of Elements covering edges of given element or null if at least one edge middle point is visible\n *\n * CAUTION: Empty array means element if offscreen i.e. covered by no elements, rather than not covered\n */\nexport function getElementObscurers(element: Element): readonly Element[] | null {\n const {ownerDocument} = element;\n\n if (!ownerDocument || !ownerDocument.defaultView) {\n return null;\n }\n\n const {innerWidth, innerHeight} = ownerDocument.defaultView;\n const documentRef = getDocumentOrShadowRoot(element);\n const rect = element.getBoundingClientRect();\n const left = clamp(Math.round(rect.left) + 2, 0, innerWidth);\n const top = clamp(Math.round(rect.top) + 2, 0, innerHeight);\n const right = clamp(Math.round(rect.right) - 2, 0, innerWidth);\n const bottom = clamp(Math.round(rect.bottom) - 2, 0, innerHeight);\n const horizontalMiddle = clamp(Math.round(rect.left + rect.width / 2), 0, innerWidth);\n const verticalMiddle = clamp(Math.round(rect.top + rect.height / 2), 0, innerHeight);\n const elements = [\n documentRef.elementFromPoint(horizontalMiddle, top),\n documentRef.elementFromPoint(horizontalMiddle, bottom),\n documentRef.elementFromPoint(left, verticalMiddle),\n documentRef.elementFromPoint(right, verticalMiddle),\n ];\n const nonNull = elements.filter(isPresent);\n\n if (!nonNull.length) {\n return nonNull;\n }\n\n const filtered = nonNull.filter(el => !element.contains(el));\n\n return filtered.length === 4 ? filtered : null;\n}\n","import {tuiAssert} from '@taiga-ui/cdk/classes';\n\n/**\n * Calculates offset for an element relative to it's parent several levels above\n *\n * @param host parent element\n * @param element\n * @return object with offsetTop and offsetLeft number properties\n */\nexport function getElementOffset(\n host: Element,\n element: HTMLElement,\n): {offsetTop: number; offsetLeft: number} {\n tuiAssert.assert(host.contains(element), 'Host must contain element');\n\n let {offsetTop, offsetLeft, offsetParent} = element;\n\n // TODO: iframe warning\n while (offsetParent && offsetParent instanceof HTMLElement && offsetParent !== host) {\n offsetTop += offsetParent.offsetTop;\n offsetLeft += offsetParent.offsetLeft;\n offsetParent = offsetParent.offsetParent;\n }\n\n return {offsetTop, offsetLeft};\n}\n","/**\n * Finds nearest parent with scroll in it\n *\n * @param element initial element\n * @param vertical flag for orientation of scroll\n */\nexport function getScrollParent(\n element: Element | null,\n vertical: boolean = true,\n): Element | null {\n if (element === null) {\n return null;\n }\n\n if (vertical && element.scrollHeight > element.clientHeight) {\n return element;\n }\n\n if (!vertical && element.scrollWidth > element.clientWidth) {\n return element;\n }\n\n return getScrollParent(element.parentElement, vertical);\n}\n","export function tuiIsFormFieldElement(\n element: unknown | null,\n): element is HTMLInputElement | HTMLTextAreaElement {\n const textfield = element as Record<string, unknown> | null;\n\n return (\n !!textfield &&\n 'value' in textfield &&\n 'selectionStart' in textfield &&\n 'selectionEnd' in textfield\n );\n}\n","import {tuiIsFormFieldElement} from './is-form-field';\n\n/**\n * @description:\n * cross browser way to get selected text\n *\n * History:\n * BUG - window.getSelection() fails when text selected in a form field\n * https://bugzilla.mozilla.org/show_bug.cgi?id=85686\n */\nexport function tuiGetSelectedText({getSelection, document}: Window): string | null {\n return tuiIsFormFieldElement(document.activeElement)\n ? document.activeElement.value.slice(\n document.activeElement.selectionStart || 0,\n document.activeElement.selectionEnd || 0,\n )\n : getSelection()?.toString() || null;\n}\n","export function isCurrentTarget({target, currentTarget}: Event): boolean {\n return target === currentTarget;\n}\n","/**\n * Checks if an app is running inside <iframe /> tag\n */\nexport function isInsideIframe(windowRef: Window): boolean {\n return windowRef.parent !== windowRef;\n}\n","import {getClosestElement} from './get-closest-element';\n\n/**\n * Checks if node is inside a specific selector\n *\n * @param node\n * @param selector\n * @return true if node is inside a particular selector\n */\nexport function isNodeIn(node: Node, selector: string): boolean {\n return node.nodeType === Node.TEXT_NODE\n ? !!node.parentElement && !!getClosestElement(node.parentElement, selector)\n : node.nodeType === Node.ELEMENT_NODE &&\n !!getClosestElement(node as Element, selector);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;SAAgB,SAAS,CACrB,OAAgB,EAChB,WAAoB,EACpB,QAAiB,EACjB,SAAkB;IAElB,OAAO,QAAQ;UACT,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC;UAClD,mBAAmB,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,iBAAiB,CACtB,OAAgB,EAChB,WAAoB,EACpB,SAAkB;IAElB,IAAI,cAAc,GAAG,OAAO,CAAC;IAE7B,OAAO,cAAc,KAAK,WAAW,CAAC,aAAa,EAAE;QACjD,IACI,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS;aACtD,IAA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FA;;;SAGgB,cAAc,CAAC,SAAiB;IAC5C,OAAO,SAAS,CAAC,MAAM,KAAK,SAAS,CAAC;AAC1C;;ACHA;;;;;;;SAOgB,QAAQ,CAAC,IAAU,EAAE,QAAgB;IACjD,OAAO,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,SAAS;UACjC,CAAC,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC;UACzE,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY;YAC/B,CAAC,CAAC,iBAAiB,CAAC,IAAe,EAAE,QAAQ,CAAC,CAAC;AAC7D;;ACdA;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taiga-ui/cdk",
3
- "version": "2.50.2",
3
+ "version": "2.51.0",
4
4
  "description": "Base library for creating Angular components and applications using Taiga UI principles regarding of actual visual appearance",
5
5
  "keywords": [
6
6
  "angular",
@@ -2,4 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.REMOVED_MODULES = [
4
4
  { name: 'TuiResizableColumnModule', moduleSpecifier: '@taiga-ui/addon-table' },
5
+ { name: 'ScrollIntoViewModule', moduleSpecifier: '@taiga-ui/addon-doc' },
5
6
  ];
@@ -40,4 +40,13 @@ exports.SERVICES_TO_REPLACE = [
40
40
  },
41
41
  ],
42
42
  },
43
+ {
44
+ from: {
45
+ name: 'PreviewDialogService',
46
+ },
47
+ to: {
48
+ name: 'TuiPreviewDialogService',
49
+ moduleSpecifier: '@taiga-ui/addon-preview',
50
+ },
51
+ },
43
52
  ];
@@ -25,3 +25,20 @@ export interface AttributeToDirective {
25
25
  export declare const ATTRS_TO_REPLACE: ReplacementAttributes[];
26
26
  export declare const TAGS_TO_REPLACE: ReplacementTags[];
27
27
  export declare const ATTR_TO_DIRECTIVE: AttributeToDirective[];
28
+ export declare const TEMPLATE_COMMENTS: readonly [{
29
+ readonly tag: "tui-input-slider";
30
+ readonly withAttr: "pluralize";
31
+ readonly comment: "[pluralize] => Use [postfix] instead. See https://taiga-ui.dev/components/input-slider/API?postfix=apples";
32
+ }, {
33
+ readonly tag: "tui-input-slider";
34
+ readonly withAttr: "segmentsPluralize";
35
+ readonly comment: "See examples how create labels for ticks without this property (outside the component): https://taiga-ui.dev/components/input-slider#slider-segments";
36
+ }, {
37
+ readonly tag: "tui-input-range";
38
+ readonly withAttr: "segmentsPluralize";
39
+ readonly comment: "See examples how create labels for ticks without this property (outside the component): https://taiga-ui.dev/components/input-range#segments";
40
+ }, {
41
+ readonly tag: "tui-range";
42
+ readonly withAttr: "pluralize";
43
+ readonly comment: "See examples how create labels for ticks without this property (outside the component): https://taiga-ui.dev/components/range#segments";
44
+ }];
@@ -129,4 +129,35 @@ exports.ATTR_TO_DIRECTIVE = [
129
129
  moduleSpecifier: '@taiga-ui/core',
130
130
  },
131
131
  },
132
+ {
133
+ componentSelector: '*',
134
+ inputProperty: 'scrollIntoView',
135
+ directive: 'tuiScrollIntoViewLink',
136
+ directiveModule: {
137
+ name: 'TuiScrollIntoViewLinkModule',
138
+ moduleSpecifier: '@taiga-ui/addon-doc',
139
+ },
140
+ },
141
+ ];
142
+ exports.TEMPLATE_COMMENTS = [
143
+ {
144
+ tag: 'tui-input-slider',
145
+ withAttr: 'pluralize',
146
+ comment: '[pluralize] => Use [postfix] instead. See https://taiga-ui.dev/components/input-slider/API?postfix=apples',
147
+ },
148
+ {
149
+ tag: 'tui-input-slider',
150
+ withAttr: 'segmentsPluralize',
151
+ comment: 'See examples how create labels for ticks without this property (outside the component): https://taiga-ui.dev/components/input-slider#slider-segments',
152
+ },
153
+ {
154
+ tag: 'tui-input-range',
155
+ withAttr: 'segmentsPluralize',
156
+ comment: 'See examples how create labels for ticks without this property (outside the component): https://taiga-ui.dev/components/input-range#segments',
157
+ },
158
+ {
159
+ tag: 'tui-range',
160
+ withAttr: 'pluralize',
161
+ comment: 'See examples how create labels for ticks without this property (outside the component): https://taiga-ui.dev/components/range#segments',
162
+ },
132
163
  ];
@@ -121,4 +121,34 @@ exports.TYPES_TO_RENAME = [
121
121
  to: 'TuiLanguage',
122
122
  moduleSpecifier: ['@taiga-ui/i18n'],
123
123
  },
124
+ {
125
+ from: 'ScrollIntoViewDirective',
126
+ to: 'TuiScrollIntoViewLinkDirective',
127
+ moduleSpecifier: ['@taiga-ui/addon-doc'],
128
+ },
129
+ {
130
+ from: 'CodeComponent',
131
+ to: 'TuiCodeComponent',
132
+ moduleSpecifier: ['@taiga-ui/addon-doc'],
133
+ },
134
+ {
135
+ from: 'TableBar',
136
+ to: 'TuiTableBar',
137
+ moduleSpecifier: ['@taiga-ui/addon-tablebars'],
138
+ },
139
+ {
140
+ from: 'InvalidDayException',
141
+ to: 'TuiInvalidDayException',
142
+ moduleSpecifier: ['@taiga-ui/cdk'],
143
+ },
144
+ {
145
+ from: 'InvalidMonthException',
146
+ to: 'TuiInvalidMonthException',
147
+ moduleSpecifier: ['@taiga-ui/cdk'],
148
+ },
149
+ {
150
+ from: 'InvalidYearException',
151
+ to: 'TuiInvalidYearException',
152
+ moduleSpecifier: ['@taiga-ui/cdk'],
153
+ },
124
154
  ];
@@ -14,6 +14,7 @@ const migrate_sliders_1 = require("./steps/migrate-sliders");
14
14
  const remove_module_1 = require("./steps/remove-module");
15
15
  const miscellaneous_1 = require("./steps/miscellaneous");
16
16
  const replace_functions_1 = require("./steps/replace-functions");
17
+ const migrate_progress_1 = require("./steps/migrate-progress");
17
18
  function updateToV3(_) {
18
19
  return (tree, context) => tslib_1.__awaiter(this, void 0, void 0, function* () {
19
20
  context.logger.info(`taiga packages will be updated to ${versions_1.TAIGA_VERSION}`);
@@ -26,6 +27,7 @@ function updateToV3(_) {
26
27
  show_warnings_1.showWarnings(context);
27
28
  migrate_templates_1.migrateTemplates(tree);
28
29
  migrate_sliders_1.migrateSliders(tree);
30
+ migrate_progress_1.migrateProgress(tree);
29
31
  remove_module_1.removeModules();
30
32
  replace_functions_1.replaceFunctions();
31
33
  miscellaneous_1.miscellaneousMigrations();
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@angular-devkit/schematics';
2
+ export declare const DEPRECATED_PROGRESS_PIPES_REG: RegExp;
3
+ export declare function migrateProgress(tree: Tree): void;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ng_morph_1 = require("ng-morph");
4
+ const devkit_file_system_1 = require("ng-morph/project/classes/devkit-file-system");
5
+ const get_component_templates_1 = require("../../utils/templates/get-component-templates");
6
+ const elements_1 = require("../../utils/templates/elements");
7
+ const template_resource_1 = require("../../utils/templates/template-resource");
8
+ exports.DEPRECATED_PROGRESS_PIPES_REG = /\s*\|\s*tuiProgressColorSegments(Async\s*\|\s*async)?/gi;
9
+ const PROPERTY_FOR_DEPRECATED_PIPES = '[color]';
10
+ function migrateProgress(tree) {
11
+ const fileSystem = new devkit_file_system_1.DevkitFileSystem(tree);
12
+ const templateResources = get_component_templates_1.getComponentTemplates('**/**');
13
+ for (const templateResource of templateResources) {
14
+ replaceProgressColorSegmentsPipe(templateResource, fileSystem);
15
+ }
16
+ fileSystem.commitEdits();
17
+ ng_morph_1.saveActiveProject();
18
+ ng_morph_1.setActiveProject(ng_morph_1.createProject(fileSystem.tree, '/', '**/**'));
19
+ }
20
+ exports.migrateProgress = migrateProgress;
21
+ function replaceProgressColorSegmentsPipe(templateResource, fileSystem) {
22
+ var _a, _b;
23
+ const template = template_resource_1.getTemplateFromTemplateResource(templateResource, fileSystem);
24
+ const templateOffset = template_resource_1.getTemplateOffset(templateResource);
25
+ const path = fileSystem.resolve(template_resource_1.getPathFromTemplateResource(templateResource));
26
+ const recorder = fileSystem.edit(path);
27
+ const progressElements = elements_1.findElementsWithAttribute(template, PROPERTY_FOR_DEPRECATED_PIPES).filter(isProgressWithDeprecatedPipe);
28
+ for (const progressEl of progressElements) {
29
+ const oldValue = ((_a = progressEl.attrs.find(attr => attr.name === PROPERTY_FOR_DEPRECATED_PIPES)) === null || _a === void 0 ? void 0 : _a.value) || '';
30
+ const newValue = oldValue.replace(exports.DEPRECATED_PROGRESS_PIPES_REG, '');
31
+ const attrLocations = (_b = progressEl.sourceCodeLocation) === null || _b === void 0 ? void 0 : _b.attrs;
32
+ if (attrLocations) {
33
+ const { startOffset, endOffset } = attrLocations[PROPERTY_FOR_DEPRECATED_PIPES];
34
+ recorder.remove(templateOffset + startOffset, endOffset - startOffset);
35
+ recorder.insertRight(templateOffset + startOffset, `[tuiProgressColorSegments]="${newValue}"`);
36
+ }
37
+ }
38
+ }
39
+ function isProgressWithDeprecatedPipe(element) {
40
+ return (element.tagName === 'progress' &&
41
+ element.attrs.some(attr => attr.name === PROPERTY_FOR_DEPRECATED_PIPES &&
42
+ attr.value.match(exports.DEPRECATED_PROGRESS_PIPES_REG)));
43
+ }
@@ -6,55 +6,62 @@ const ng_component_input_manipulations_1 = require("../../../utils/templates/ng-
6
6
  const ng_morph_1 = require("ng-morph");
7
7
  const ng_component_1 = require("../../../utils/angular/ng-component");
8
8
  const add_unique_import_1 = require("../../../utils/add-unique-import");
9
+ const MIN_LABELS_MIGRATION_METHOD_NAME = 'tuiMigrationInputRangeMinLabel';
10
+ const MAX_LABELS_MIGRATION_METHOD_NAME = 'tuiMigrationInputRangeMaxLabel';
9
11
  function migrateInputRange(tree) {
10
12
  const fileSystem = new devkit_file_system_1.DevkitFileSystem(tree);
11
13
  const templateResources = get_component_templates_1.getComponentTemplates('**/**');
14
+ const COMPONENTS_WITH_MIN_LABELS = new Set();
15
+ const COMPONENTS_WITH_MAX_LABELS = new Set();
12
16
  for (const templateResource of templateResources) {
13
- replaceMinLabel(templateResource, fileSystem);
14
- replaceMaxLabel(templateResource, fileSystem);
17
+ replaceMinLabel(templateResource, fileSystem, COMPONENTS_WITH_MIN_LABELS);
18
+ replaceMaxLabel(templateResource, fileSystem, COMPONENTS_WITH_MAX_LABELS);
19
+ }
20
+ save(fileSystem);
21
+ for (const componentPath of COMPONENTS_WITH_MIN_LABELS) {
22
+ addMinMaxLabelMethod(componentPath, MIN_LABELS_MIGRATION_METHOD_NAME, [
23
+ 'const currentValue = context.$implicit;',
24
+ 'const minValue = 0; // TODO: (Taiga UI migration) replace with the MIN value of the input-range',
25
+ 'const minLabelText = "Min"; // TODO: (Taiga UI migration) replace with the required label',
26
+ 'if (currentValue === minValue) return minLabelText;',
27
+ 'return String(currentValue);',
28
+ ]);
29
+ }
30
+ for (const componentPath of COMPONENTS_WITH_MAX_LABELS) {
31
+ addMinMaxLabelMethod(componentPath, MAX_LABELS_MIGRATION_METHOD_NAME, [
32
+ 'const currentValue = context.$implicit;',
33
+ 'const maxValue = 100; // TODO: (Taiga UI migration) replace with the MAX value of the input',
34
+ 'const maxLabelText = "Max"; // TODO: (Taiga UI migration) replace with the required label',
35
+ 'if (currentValue === maxValue) return maxLabelText;',
36
+ 'return String(currentValue);',
37
+ ]);
15
38
  }
16
39
  }
17
40
  exports.migrateInputRange = migrateInputRange;
18
- function replaceMinLabel(templateResource, fileSystem) {
19
- const MIGRATION_VARIABLE_NAME = 'tuiMigrationInputRangeMinLabel';
41
+ function replaceMinLabel(templateResource, fileSystem, modifiedComponentStorage) {
20
42
  const wasModified = ng_component_input_manipulations_1.replaceInputProperty({
21
43
  templateResource,
22
44
  fileSystem,
23
45
  componentSelector: 'tui-input-range',
24
46
  from: 'minLabel',
25
47
  to: '[leftValueContent]',
26
- newValue: MIGRATION_VARIABLE_NAME,
48
+ newValue: MIN_LABELS_MIGRATION_METHOD_NAME,
27
49
  });
28
- save(fileSystem);
29
50
  if (wasModified) {
30
- addMinMaxLabelMethod(templateResource.componentPath, MIGRATION_VARIABLE_NAME, [
31
- 'const currentValue = context.$implicit;',
32
- 'const minValue = 0; // TODO replace with the MIN value of the input-range',
33
- 'const minLabelText = "Min"; // TODO replace with the required label',
34
- 'if (currentValue === minValue) return minLabelText;',
35
- 'return String(currentValue);',
36
- ]);
51
+ modifiedComponentStorage.add(templateResource.componentPath);
37
52
  }
38
53
  }
39
- function replaceMaxLabel(templateResource, fileSystem) {
40
- const MIGRATION_VARIABLE_NAME = 'tuiMigrationInputRangeMaxLabel';
54
+ function replaceMaxLabel(templateResource, fileSystem, modifiedComponentStorage) {
41
55
  const wasModified = ng_component_input_manipulations_1.replaceInputProperty({
42
56
  templateResource,
43
57
  fileSystem,
44
58
  componentSelector: 'tui-input-range',
45
59
  from: 'maxLabel',
46
60
  to: '[rightValueContent]',
47
- newValue: MIGRATION_VARIABLE_NAME,
61
+ newValue: MAX_LABELS_MIGRATION_METHOD_NAME,
48
62
  });
49
- save(fileSystem);
50
63
  if (wasModified) {
51
- addMinMaxLabelMethod(templateResource.componentPath, MIGRATION_VARIABLE_NAME, [
52
- 'const currentValue = context.$implicit;',
53
- 'const maxValue = 100; // TODO replace with the MAX value of the input',
54
- 'const maxLabelText = "Max"; // TODO replace with the required label',
55
- 'if (currentValue === maxValue) return maxLabelText;',
56
- 'return String(currentValue);',
57
- ]);
64
+ modifiedComponentStorage.add(templateResource.componentPath);
58
65
  }
59
66
  }
60
67
  function addMinMaxLabelMethod(componentPath, methodName, methodCode) {
@@ -10,19 +10,31 @@ const elements_1 = require("../../../utils/templates/elements");
10
10
  function migrateInputSlider(tree) {
11
11
  const fileSystem = new devkit_file_system_1.DevkitFileSystem(tree);
12
12
  const templateResources = get_component_templates_1.getComponentTemplates('**/**');
13
+ const COMPONENTS_WITH_MIN_MAX_LABELS = new Set();
13
14
  for (const templateResource of templateResources) {
14
- replaceMinMaxLabels(templateResource, fileSystem);
15
+ replaceMinMaxLabels(templateResource, fileSystem, COMPONENTS_WITH_MIN_MAX_LABELS);
16
+ }
17
+ /**
18
+ * We should update virtual file tree
19
+ * otherwise all following ng-morph commands will overwrite all previous template manipulations
20
+ * */
21
+ fileSystem.commitEdits();
22
+ ng_morph_1.saveActiveProject();
23
+ ng_morph_1.setActiveProject(ng_morph_1.createProject(fileSystem.tree, '/', '**/**'));
24
+ for (const componentPath of COMPONENTS_WITH_MIN_MAX_LABELS) {
25
+ addMinMaxLabelMethod(componentPath);
15
26
  }
16
27
  }
17
28
  exports.migrateInputSlider = migrateInputSlider;
18
- function replaceMinMaxLabels(templateResource, fileSystem) {
29
+ const MIN_MAX_LABELS_MIGRATION_METHOD_NAME = 'tuiMigrationMinMaxLabel';
30
+ function replaceMinMaxLabels(templateResource, fileSystem, modifiedComponentStorage) {
19
31
  const wasMaxLabelModified = ng_component_input_manipulations_1.replaceInputProperty({
20
32
  templateResource,
21
33
  fileSystem,
22
34
  componentSelector: 'tui-input-slider',
23
35
  from: 'maxLabel',
24
36
  to: '[valueContent]',
25
- newValue: 'tuiMigrationMinMaxLabel',
37
+ newValue: MIN_MAX_LABELS_MIGRATION_METHOD_NAME,
26
38
  });
27
39
  const wasMinLabelModified = ng_component_input_manipulations_1.replaceInputProperty({
28
40
  templateResource,
@@ -30,7 +42,7 @@ function replaceMinMaxLabels(templateResource, fileSystem) {
30
42
  componentSelector: 'tui-input-slider',
31
43
  from: 'minLabel',
32
44
  to: '[valueContent]',
33
- newValue: 'tuiMigrationMinMaxLabel',
45
+ newValue: MIN_MAX_LABELS_MIGRATION_METHOD_NAME,
34
46
  filterFn: element => !elements_1.hasElementAttribute(element, 'maxLabel'),
35
47
  });
36
48
  ng_component_input_manipulations_1.removeInputProperty({
@@ -40,26 +52,24 @@ function replaceMinMaxLabels(templateResource, fileSystem) {
40
52
  inputProperty: 'minLabel',
41
53
  filterFn: element => elements_1.hasElementAttribute(element, 'maxLabel'),
42
54
  });
43
- /**
44
- * We should update virtual file tree
45
- * otherwise all following ng-morph commands will overwrite all previous template manipulations
46
- * */
47
- fileSystem.commitEdits();
48
- ng_morph_1.saveActiveProject();
49
- ng_morph_1.setActiveProject(ng_morph_1.createProject(fileSystem.tree, '/', '**/**'));
50
- const [ngComponent] = ng_component_1.getNgComponents(templateResource.componentPath);
51
- if ((wasMaxLabelModified || wasMinLabelModified) && ngComponent) {
52
- add_unique_import_1.addUniqueImport(templateResource.componentPath, 'TuiContextWithImplicit', '@taiga-ui/cdk');
55
+ if (wasMaxLabelModified || wasMinLabelModified) {
56
+ modifiedComponentStorage.add(templateResource.componentPath);
57
+ }
58
+ }
59
+ function addMinMaxLabelMethod(componentPath) {
60
+ const [ngComponent] = ng_component_1.getNgComponents(componentPath);
61
+ if (ngComponent) {
62
+ add_unique_import_1.addUniqueImport(componentPath, 'TuiContextWithImplicit', '@taiga-ui/cdk');
53
63
  ng_morph_1.addMethods(ngComponent, {
54
- name: 'tuiMigrationMinMaxLabel',
64
+ name: MIN_MAX_LABELS_MIGRATION_METHOD_NAME,
55
65
  returnType: 'string',
56
66
  parameters: [{ name: 'context', type: 'TuiContextWithImplicit<number>' }],
57
67
  statements: [
58
68
  'const currentValue = context.$implicit;',
59
- 'const maxValue = 100; // TODO replace with the MAX value of the input',
60
- 'const maxLabelText = "Max"; // TODO replace with the required label',
61
- 'const minValue = 0; // TODO replace with the MIN value of the input',
62
- 'const minLabelText = "Min"; // TODO replace with the required label',
69
+ 'const maxValue = 100; // TODO: (Taiga UI migration) replace with the MAX value of the input',
70
+ 'const maxLabelText = "Max"; // TODO: (Taiga UI migration) replace with the required label',
71
+ 'const minValue = 0; // TODO: (Taiga UI migration) replace with the MIN value of the input',
72
+ 'const minLabelText = "Min"; // TODO: (Taiga UI migration) replace with the required label',
63
73
  'if (currentValue === maxValue) return maxLabelText;',
64
74
  'if (currentValue === minValue) return minLabelText;',
65
75
  'return String(currentValue);',
@@ -18,6 +18,7 @@ function migrateTemplates(tree) {
18
18
  replaceAttrsByDirective,
19
19
  replaceBreadcrumbs,
20
20
  replaceFieldError,
21
+ addHTMLCommentTags,
21
22
  ];
22
23
  actions.forEach(action => {
23
24
  componentWithTemplatesPaths.forEach(componentPath => {
@@ -78,6 +79,21 @@ function replaceTags({ resource, recorder, fileSystem, }) {
78
79
  });
79
80
  });
80
81
  }
82
+ function addHTMLCommentTags({ resource, recorder, fileSystem, }) {
83
+ const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
84
+ const templateOffset = template_resource_1.getTemplateOffset(resource);
85
+ templates_1.TEMPLATE_COMMENTS.forEach(({ comment, tag, withAttr }) => {
86
+ const elementStartOffsets = [
87
+ ...elements_1.findElementsWithAttribute(template, withAttr),
88
+ ...elements_1.findElementsWithAttribute(template, `[${withAttr}]`),
89
+ ]
90
+ .filter(el => el.tagName === tag)
91
+ .map(el => { var _a; return (((_a = el.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.startOffset) || 0) + templateOffset; });
92
+ elementStartOffsets.forEach(offset => {
93
+ recorder.insertRight(offset, `<!-- TODO: (Taiga UI migration) ${comment} -->\n`);
94
+ });
95
+ });
96
+ }
81
97
  function replaceBreadcrumbs({ resource, recorder, fileSystem, }) {
82
98
  const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
83
99
  const templateOffset = template_resource_1.getTemplateOffset(resource);
@@ -30,6 +30,6 @@ function showWarning({ name, message, moduleSpecifier = '**/**' }, { logger }) {
30
30
  */
31
31
  referencesMeta.forEach(({ sourceFile, filePath, startLinePos }) => {
32
32
  logger.warn(`[WARNING] in ${filePath}: ${message}`);
33
- sourceFile.insertText(startLinePos, `// TODO: ${message}\n`);
33
+ sourceFile.insertText(startLinePos, `// TODO: (Taiga UI migration) ${message}\n`);
34
34
  });
35
35
  }
@@ -49,7 +49,8 @@ exports.findElementsWithAttribute = findElementsWithAttribute;
49
49
  */
50
50
  function findAttributeOnElementWithTag(html, name, tagNames, filterFn = ALWAYS_TRUE_HANDLER) {
51
51
  return findElementsWithAttribute(html, name)
52
- .filter(element => tagNames.includes(element.tagName) && filterFn(element))
52
+ .filter(element => (tagNames.includes(element.tagName) || tagNames.includes('*')) &&
53
+ filterFn(element))
53
54
  .map(element => getStartOffsetOfAttribute(element, name));
54
55
  }
55
56
  exports.findAttributeOnElementWithTag = findAttributeOnElementWithTag;
@@ -80,7 +80,8 @@ exports.replaceInputProperty = replaceInputProperty;
80
80
  */
81
81
  function getInputPropertyOffsets(html, attrName, tags, filterFn = () => true) {
82
82
  return elements_1.findElementsWithAttribute(html, attrName)
83
- .filter(element => tags.includes(element.tagName) && filterFn(element))
83
+ .filter(element => (tags.includes(element.tagName) || tags.includes('*')) &&
84
+ filterFn(element))
84
85
  .map((element) => {
85
86
  var _a, _b;
86
87
  const { startOffset = 0, endOffset = 0 } = ((_b = (_a = element.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.attrs) === null || _b === void 0 ? void 0 : _b[attrName.toLowerCase()]) || {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @description:
3
+ * cross browser way to get selected text
4
+ *
5
+ * History:
6
+ * BUG - window.getSelection() fails when text selected in a form field
7
+ * https://bugzilla.mozilla.org/show_bug.cgi?id=85686
8
+ */
9
+ export declare function tuiGetSelectedText({ getSelection, document }: Window): string | null;
@@ -8,6 +8,8 @@ export * from './get-document-or-shadow-root';
8
8
  export * from './get-element-obscurers';
9
9
  export * from './get-element-offset';
10
10
  export * from './get-scroll-parent';
11
+ export * from './get-selected-text';
11
12
  export * from './is-current-target';
13
+ export * from './is-form-field';
12
14
  export * from './is-inside-iframe';
13
15
  export * from './is-node-in';
@@ -0,0 +1 @@
1
+ export declare function tuiIsFormFieldElement(element: unknown | null): element is HTMLInputElement | HTMLTextAreaElement;
@@ -1 +1 @@
1
- {"__symbolic":"module","version":4,"metadata":{"canScroll":{"__symbolic":"function","parameters":["element","rootElement","vertical","scrollEnd"],"value":{"__symbolic":"if","condition":{"__symbolic":"reference","name":"vertical"},"thenExpression":{"__symbolic":"error","message":"Reference to a non-exported function","line":11,"character":9,"context":{"name":"canScrollVertical"},"module":"./can-scroll"},"elseExpression":{"__symbolic":"error","message":"Reference to a non-exported function","line":38,"character":9,"context":{"name":"canScrollHorizontal"},"module":"./can-scroll"}}},"containsOrAfter":{"__symbolic":"function","parameters":["current","node"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"current"},"member":"contains"},"arguments":[{"__symbolic":"reference","name":"node"}]},"right":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"binop","operator":"&","left":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"node"},"member":"compareDocumentPosition"},"arguments":[{"__symbolic":"reference","name":"current"}]},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Node"},"member":"DOCUMENT_POSITION_PRECEDING"}}}}}},"tuiCustomEvent":{"__symbolic":"function"},"getActualTarget":{"__symbolic":"function"},"getClipboardDataText":{"__symbolic":"function","parameters":["event","format"],"defaults":[null,"text/plain"],"value":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"in","left":"clipboardData","right":{"__symbolic":"reference","name":"event"}},"right":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"event"},"member":"clipboardData"},"right":null}},"thenExpression":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"event"},"member":"clipboardData"},"member":"getData"},"arguments":[{"__symbolic":"reference","name":"format"}]},"right":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"event"},"member":"clipboardData"},"member":"getData"},"arguments":["text/plain"]}},"elseExpression":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"event"},"member":"target"},"member":"ownerDocument"},"member":"defaultView"},"member":"clipboardData"},"member":"getData"},"arguments":["text"]}}},"getClosestElement":{"__symbolic":"function"},"getDocumentOrShadowRoot":{"__symbolic":"function","parameters":["node"],"value":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"in","left":"getRootNode","right":{"__symbolic":"reference","name":"node"}},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"node"},"member":"isConnected"}},"thenExpression":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"node"},"member":"getRootNode"}},"elseExpression":{"__symbolic":"error","message":"Expression form not supported","line":3,"character":10,"module":"./get-document-or-shadow-root"}}},"getElementObscurers":{"__symbolic":"function"},"getElementOffset":{"__symbolic":"function"},"getScrollParent":{"__symbolic":"function"},"isCurrentTarget":{"__symbolic":"function","parameters":["target","currentTarget"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"target"},"right":{"__symbolic":"reference","name":"currentTarget"}}},"isInsideIframe":{"__symbolic":"function","parameters":["windowRef"],"value":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"windowRef"},"member":"parent"},"right":{"__symbolic":"reference","name":"windowRef"}}},"isNodeIn":{"__symbolic":"function","parameters":["node","selector"],"value":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"node"},"member":"nodeType"},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Node"},"member":"TEXT_NODE"}},"thenExpression":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"node"},"member":"parentElement"}}},"right":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"getClosestElement"},"arguments":[{"__symbolic":"select","expression":{"__symbolic":"reference","name":"node"},"member":"parentElement"},{"__symbolic":"reference","name":"selector"}]}}}},"elseExpression":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"node"},"member":"nodeType"},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Node"},"member":"ELEMENT_NODE"}},"right":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"getClosestElement"},"arguments":[{"__symbolic":"reference","name":"node"},{"__symbolic":"reference","name":"selector"}]}}}}}}},"origins":{"canScroll":"./can-scroll","containsOrAfter":"./contains-or-after","tuiCustomEvent":"./custom-event","getActualTarget":"./get-actual-target","getClipboardDataText":"./get-clipboard-data-text","getClosestElement":"./get-closest-element","getDocumentOrShadowRoot":"./get-document-or-shadow-root","getElementObscurers":"./get-element-obscurers","getElementOffset":"./get-element-offset","getScrollParent":"./get-scroll-parent","isCurrentTarget":"./is-current-target","isInsideIframe":"./is-inside-iframe","isNodeIn":"./is-node-in"},"importAs":"@taiga-ui/cdk/utils/dom"}
1
+ {"__symbolic":"module","version":4,"metadata":{"canScroll":{"__symbolic":"function","parameters":["element","rootElement","vertical","scrollEnd"],"value":{"__symbolic":"if","condition":{"__symbolic":"reference","name":"vertical"},"thenExpression":{"__symbolic":"error","message":"Reference to a non-exported function","line":11,"character":9,"context":{"name":"canScrollVertical"},"module":"./can-scroll"},"elseExpression":{"__symbolic":"error","message":"Reference to a non-exported function","line":38,"character":9,"context":{"name":"canScrollHorizontal"},"module":"./can-scroll"}}},"containsOrAfter":{"__symbolic":"function","parameters":["current","node"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"current"},"member":"contains"},"arguments":[{"__symbolic":"reference","name":"node"}]},"right":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"binop","operator":"&","left":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"node"},"member":"compareDocumentPosition"},"arguments":[{"__symbolic":"reference","name":"current"}]},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Node"},"member":"DOCUMENT_POSITION_PRECEDING"}}}}}},"tuiCustomEvent":{"__symbolic":"function"},"getActualTarget":{"__symbolic":"function"},"getClipboardDataText":{"__symbolic":"function","parameters":["event","format"],"defaults":[null,"text/plain"],"value":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"in","left":"clipboardData","right":{"__symbolic":"reference","name":"event"}},"right":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"event"},"member":"clipboardData"},"right":null}},"thenExpression":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"event"},"member":"clipboardData"},"member":"getData"},"arguments":[{"__symbolic":"reference","name":"format"}]},"right":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"event"},"member":"clipboardData"},"member":"getData"},"arguments":["text/plain"]}},"elseExpression":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"event"},"member":"target"},"member":"ownerDocument"},"member":"defaultView"},"member":"clipboardData"},"member":"getData"},"arguments":["text"]}}},"getClosestElement":{"__symbolic":"function"},"getDocumentOrShadowRoot":{"__symbolic":"function","parameters":["node"],"value":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"in","left":"getRootNode","right":{"__symbolic":"reference","name":"node"}},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"node"},"member":"isConnected"}},"thenExpression":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"node"},"member":"getRootNode"}},"elseExpression":{"__symbolic":"error","message":"Expression form not supported","line":3,"character":10,"module":"./get-document-or-shadow-root"}}},"getElementObscurers":{"__symbolic":"function"},"getElementOffset":{"__symbolic":"function"},"getScrollParent":{"__symbolic":"function"},"tuiGetSelectedText":{"__symbolic":"function","parameters":["getSelection","document"],"value":{"__symbolic":"if","condition":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"tuiIsFormFieldElement"},"arguments":[{"__symbolic":"select","expression":{"__symbolic":"reference","name":"document"},"member":"activeElement"}]},"thenExpression":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"document"},"member":"activeElement"},"member":"value"},"member":"slice"},"arguments":[{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"document"},"member":"activeElement"},"member":"selectionStart"},"right":0},{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"document"},"member":"activeElement"},"member":"selectionEnd"},"right":0}]},"elseExpression":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"getSelection"}},"member":"toString"}},"right":null}}},"isCurrentTarget":{"__symbolic":"function","parameters":["target","currentTarget"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"target"},"right":{"__symbolic":"reference","name":"currentTarget"}}},"tuiIsFormFieldElement":{"__symbolic":"function"},"isInsideIframe":{"__symbolic":"function","parameters":["windowRef"],"value":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"windowRef"},"member":"parent"},"right":{"__symbolic":"reference","name":"windowRef"}}},"isNodeIn":{"__symbolic":"function","parameters":["node","selector"],"value":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"node"},"member":"nodeType"},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Node"},"member":"TEXT_NODE"}},"thenExpression":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"node"},"member":"parentElement"}}},"right":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"getClosestElement"},"arguments":[{"__symbolic":"select","expression":{"__symbolic":"reference","name":"node"},"member":"parentElement"},{"__symbolic":"reference","name":"selector"}]}}}},"elseExpression":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"node"},"member":"nodeType"},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Node"},"member":"ELEMENT_NODE"}},"right":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"getClosestElement"},"arguments":[{"__symbolic":"reference","name":"node"},{"__symbolic":"reference","name":"selector"}]}}}}}}},"origins":{"canScroll":"./can-scroll","containsOrAfter":"./contains-or-after","tuiCustomEvent":"./custom-event","getActualTarget":"./get-actual-target","getClipboardDataText":"./get-clipboard-data-text","getClosestElement":"./get-closest-element","getDocumentOrShadowRoot":"./get-document-or-shadow-root","getElementObscurers":"./get-element-obscurers","getElementOffset":"./get-element-offset","getScrollParent":"./get-scroll-parent","tuiGetSelectedText":"./get-selected-text","isCurrentTarget":"./is-current-target","tuiIsFormFieldElement":"./is-form-field","isInsideIframe":"./is-inside-iframe","isNodeIn":"./is-node-in"},"importAs":"@taiga-ui/cdk/utils/dom"}