@taiga-ui/cdk 3.53.0 → 3.54.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.
- package/bundles/taiga-ui-cdk-components-alert-host.umd.js +1 -1
- package/bundles/taiga-ui-cdk-components-alert-host.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-constants.umd.js +1 -1
- package/bundles/taiga-ui-cdk-constants.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-autofilled.umd.js +1 -1
- package/bundles/taiga-ui-cdk-directives-autofilled.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-pipes-filter.umd.js +1 -1
- package/bundles/taiga-ui-cdk-pipes-filter.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-pipes-keys.umd.js +1 -1
- package/bundles/taiga-ui-cdk-pipes-keys.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-pipes-mapper.umd.js +1 -1
- package/bundles/taiga-ui-cdk-pipes-mapper.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-pipes-replace.umd.js +1 -1
- package/bundles/taiga-ui-cdk-pipes-replace.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-focus.umd.js +6 -2
- package/bundles/taiga-ui-cdk-utils-focus.umd.js.map +1 -1
- package/constants/version.d.ts +1 -1
- package/constants/version.js +1 -1
- package/esm2015/components/alert-host/alert-host.component.js +2 -2
- package/esm2015/constants/version.js +2 -2
- package/esm2015/directives/autofilled/autofilled.module.js +2 -2
- package/esm2015/pipes/filter/filter.module.js +2 -2
- package/esm2015/pipes/keys/keys.module.js +2 -2
- package/esm2015/pipes/mapper/mapper.module.js +2 -2
- package/esm2015/pipes/replace/replace.module.js +2 -2
- package/esm2015/utils/focus/is-native-focused-in.js +4 -2
- package/esm2015/utils/focus/is-native-focused.js +4 -2
- package/fesm2015/taiga-ui-cdk-components-alert-host.js +2 -2
- package/fesm2015/taiga-ui-cdk-components-alert-host.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-constants.js +1 -1
- package/fesm2015/taiga-ui-cdk-constants.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-autofilled.js +1 -1
- package/fesm2015/taiga-ui-cdk-directives-autofilled.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-pipes-filter.js +1 -1
- package/fesm2015/taiga-ui-cdk-pipes-filter.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-pipes-keys.js +1 -1
- package/fesm2015/taiga-ui-cdk-pipes-keys.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-pipes-mapper.js +1 -1
- package/fesm2015/taiga-ui-cdk-pipes-mapper.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-pipes-replace.js +1 -1
- package/fesm2015/taiga-ui-cdk-pipes-replace.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-focus.js +6 -2
- package/fesm2015/taiga-ui-cdk-utils-focus.js.map +1 -1
- package/package.json +1 -1
- package/schematics/ng-add/steps/add-taiga-modules.js +1 -1
- package/schematics/ng-update/steps/replace-identifier.js +1 -1
- package/schematics/ng-update/v4/steps/constants/attrs-to-replace.js +7 -0
- package/schematics/ng-update/v4/steps/constants/html-comments.js +10 -0
- package/schematics/ng-update/v4/steps/constants/identifiers-to-replace.js +4 -0
- package/schematics/ng-update/v4/steps/constants/inputs-to-remove.js +1 -0
- package/schematics/ng-update/v4/steps/migrate-templates.js +1 -0
- package/schematics/ng-update/v4/steps/templates/index.d.ts +1 -0
- package/schematics/ng-update/v4/steps/templates/index.js +1 -0
- package/schematics/ng-update/v4/steps/templates/migrate-avatar.d.ts +8 -0
- package/schematics/ng-update/v4/steps/templates/migrate-avatar.js +75 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"taiga-ui-cdk-utils-focus.js","sources":["../../../projects/cdk/utils/focus/get-native-focused.ts","../../../projects/cdk/utils/focus/blur-native-focused.ts","../../../projects/cdk/utils/focus/is-native-keyboard-focusable.ts","../../../projects/cdk/utils/focus/is-native-mouse-focusable.ts","../../../projects/cdk/utils/focus/get-closest-focusable.ts","../../../projects/cdk/utils/focus/is-native-focused.ts","../../../projects/cdk/utils/focus/is-native-focused-in.ts","../../../projects/cdk/utils/focus/move-focus.ts","../../../projects/cdk/utils/focus/set-native-mouse-focused.ts","../../../projects/cdk/utils/focus/taiga-ui-cdk-utils-focus.ts"],"sourcesContent":["/**\n * Returns current active element, including shadow dom\n *\n * @return element or null\n */\nexport function tuiGetNativeFocused({activeElement}: Document): Element | null {\n if (!activeElement?.shadowRoot) {\n return activeElement;\n }\n\n let element = activeElement.shadowRoot.activeElement;\n\n while (element?.shadowRoot) {\n element = element.shadowRoot.activeElement;\n }\n\n return element;\n}\n","import {tuiIsHTMLElement} from '@taiga-ui/cdk/utils/dom';\n\nimport {tuiGetNativeFocused} from './get-native-focused';\n\n/**\n * Finds and blurs current active element, including shadow DOM\n */\nexport function tuiBlurNativeFocused(doc: Document): void {\n const activeElement = tuiGetNativeFocused(doc);\n\n if (tuiIsHTMLElement(activeElement)) {\n activeElement.blur();\n }\n}\n","import {tuiIsHTMLElement} from '@taiga-ui/cdk/utils/dom';\n\n/**\n * Checks for signs that element can be focused with keyboard. tabIndex above 0 is ignored to\n * only target natural focus order. Not checking the possibility of an element to\n * be focused, for example element can have display: none applied to it or any other\n * circumstances could prevent actual focus.\n */\nexport function tuiIsNativeKeyboardFocusable(element: Element): boolean {\n if (element.hasAttribute(`disabled`) || element.getAttribute(`tabIndex`) === `-1`) {\n return false;\n }\n\n if (\n (tuiIsHTMLElement(element) && element.isContentEditable) ||\n element.getAttribute(`tabIndex`) === `0`\n ) {\n return true;\n }\n\n switch (element.tagName) {\n case `BUTTON`:\n case `SELECT`:\n case `TEXTAREA`:\n return true;\n case `VIDEO`:\n case `AUDIO`:\n return element.hasAttribute(`controls`);\n case `INPUT`:\n return element.getAttribute(`type`) !== `hidden`;\n case `A`:\n case `LINK`:\n return element.hasAttribute(`href`);\n default:\n return false;\n }\n}\n","import {tuiIsNativeKeyboardFocusable} from './is-native-keyboard-focusable';\n\nexport function tuiIsNativeMouseFocusable(element: Element): boolean {\n return (\n !element.hasAttribute(`disabled`) &&\n (element.getAttribute(`tabIndex`) === `-1` ||\n tuiIsNativeKeyboardFocusable(element))\n );\n}\n","import {svgNodeFilter} from '@taiga-ui/cdk/constants';\nimport {tuiIsHTMLElement} from '@taiga-ui/cdk/utils/dom';\n\nimport {tuiIsNativeKeyboardFocusable} from './is-native-keyboard-focusable';\nimport {tuiIsNativeMouseFocusable} from './is-native-mouse-focusable';\n\nexport interface TuiGetClosestFocusableOptions {\n /**\n * @description:\n * current HTML element\n */\n initial: Element;\n\n /**\n * @description:\n * determine if only keyboard focus is of interest\n */\n keyboard?: boolean;\n\n /**\n * @description:\n * should it look backwards instead (find item that will be focused with Shift + Tab)\n */\n previous?: boolean;\n\n /**\n * @description:\n * top Node limiting the search area\n */\n root: Node;\n}\n\n/**\n * @description:\n * Finds the closest element that can be focused with a keyboard or mouse in theory\n */\nexport function tuiGetClosestFocusable({\n initial,\n root,\n previous = false,\n keyboard = true,\n}: TuiGetClosestFocusableOptions): HTMLElement | null {\n if (!root.ownerDocument) {\n return null;\n }\n\n const check = keyboard ? tuiIsNativeKeyboardFocusable : tuiIsNativeMouseFocusable;\n const treeWalker = root.ownerDocument.createTreeWalker(\n root,\n NodeFilter.SHOW_ELEMENT,\n svgNodeFilter,\n );\n\n treeWalker.currentNode = initial;\n\n while (previous ? treeWalker.previousNode() : treeWalker.nextNode()) {\n if (tuiIsHTMLElement(treeWalker.currentNode)) {\n initial = treeWalker.currentNode;\n }\n\n if (tuiIsHTMLElement(initial) && check(initial)) {\n return initial;\n }\n }\n\n return null;\n}\n","import {tuiGetNativeFocused} from './get-native-focused';\n\n/**\n * Checks if element is focused.\n *\n * Could return true even after blur since element remains focused if you switch away from a browser tab.\n *\n * @param node or null (as a common return value of DOM nodes walking)\n * @return true if focused\n */\nexport function tuiIsNativeFocused(node: Node | null): boolean {\n return !!node?.ownerDocument && tuiGetNativeFocused(node.ownerDocument) === node;\n}\n","import {tuiGetNativeFocused} from './get-native-focused';\n\n/**\n * Checks if focused element is within given element.\n *\n * @param node\n * @return true if focused node is contained within element\n */\nexport function tuiIsNativeFocusedIn(node: Node): boolean {\n // !node.contains - check for IE11\n if (!node.ownerDocument || !node.contains) {\n return false;\n }\n\n const nativeFocused = tuiGetNativeFocused(node.ownerDocument);\n\n return nativeFocused !== null && node.contains(nativeFocused);\n}\n","import {tuiIsNativeFocused} from './is-native-focused';\n\n/**\n * Utility method for moving focus in a list of elements\n *\n * @param currentIndex currently focused index\n * @param elements array of focusable elements\n * @param step a step to move focus by, typically -1 or 1\n */\nexport function tuiMoveFocus(\n currentIndex: number,\n elements: readonly HTMLElement[],\n step: number,\n): void {\n currentIndex += step;\n\n while (currentIndex >= 0 && currentIndex < elements.length) {\n elements[currentIndex].focus();\n\n if (tuiIsNativeFocused(elements[currentIndex])) {\n return;\n }\n\n currentIndex += step;\n }\n}\n","/**\n * Focuses or blurs element with mouse action imitation (to spoof {@link TuiFocusVisibleService})\n *\n * @param element\n * @param focused desired focused state\n * @param preventScroll optionally prevent native browser scroll after focus\n */\nexport function tuiSetNativeMouseFocused(\n element: Element & HTMLOrSVGElement,\n focused: boolean = true,\n preventScroll: boolean = false,\n): void {\n if (!element.ownerDocument) {\n return;\n }\n\n if (typeof Event === `function`) {\n element.dispatchEvent(new Event(`mousedown`, {bubbles: true, cancelable: true}));\n } else {\n const event = element.ownerDocument.createEvent(`Event`);\n\n event.initEvent(`mousedown`, true, true);\n element.dispatchEvent(event);\n }\n\n if (focused) {\n element.focus({preventScroll});\n } else {\n element.blur();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAAA;;;;AAIG;AACa,SAAA,mBAAmB,CAAC,EAAC,aAAa,EAAW,EAAA;IACzD,IAAI,EAAC,aAAa,KAAb,IAAA,IAAA,aAAa,uBAAb,aAAa,CAAE,UAAU,CAAA,E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,OAAO;AACV,KAAA;AAED,IAAA,IAAI,OAAO,KAAK,KAAK,CAAA,QAAA,CAAU,EAAE;AAC7B,QAAA,OAAO,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,WAAW,EAAE,EAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAC,CAAC,CAAC,CAAC;AACpF,KAAA;AAAM,SAAA;QACH,MAAM,KAAK,GAAG,OAAO,CAAC,aAAa,CAAC,WAAW,CAAC,CAAO,KAAA,CAAA,CAAC,CAAC;QAEzD,KAAK,CAAC,SAAS,CAAC,CAAA,SAAA,CAAW,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACzC,QAAA,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAChC,KAAA;AAED,IAAA,IAAI,OAAO,EAAE;AACT,QAAA,OAAO,CAAC,KAAK,CAAC,EAAC,aAAa,EAAC,CAAC,CAAC;AAClC,KAAA;AAAM,SAAA;QACH,OAAO,CAAC,IAAI,EAAE,CAAC;AAClB,KAAA;AACL;;AC9BA;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"taiga-ui-cdk-utils-focus.js","sources":["../../../projects/cdk/utils/focus/get-native-focused.ts","../../../projects/cdk/utils/focus/blur-native-focused.ts","../../../projects/cdk/utils/focus/is-native-keyboard-focusable.ts","../../../projects/cdk/utils/focus/is-native-mouse-focusable.ts","../../../projects/cdk/utils/focus/get-closest-focusable.ts","../../../projects/cdk/utils/focus/is-native-focused.ts","../../../projects/cdk/utils/focus/is-native-focused-in.ts","../../../projects/cdk/utils/focus/move-focus.ts","../../../projects/cdk/utils/focus/set-native-mouse-focused.ts","../../../projects/cdk/utils/focus/taiga-ui-cdk-utils-focus.ts"],"sourcesContent":["/**\n * Returns current active element, including shadow dom\n *\n * @return element or null\n */\nexport function tuiGetNativeFocused({activeElement}: Document): Element | null {\n if (!activeElement?.shadowRoot) {\n return activeElement;\n }\n\n let element = activeElement.shadowRoot.activeElement;\n\n while (element?.shadowRoot) {\n element = element.shadowRoot.activeElement;\n }\n\n return element;\n}\n","import {tuiIsHTMLElement} from '@taiga-ui/cdk/utils/dom';\n\nimport {tuiGetNativeFocused} from './get-native-focused';\n\n/**\n * Finds and blurs current active element, including shadow DOM\n */\nexport function tuiBlurNativeFocused(doc: Document): void {\n const activeElement = tuiGetNativeFocused(doc);\n\n if (tuiIsHTMLElement(activeElement)) {\n activeElement.blur();\n }\n}\n","import {tuiIsHTMLElement} from '@taiga-ui/cdk/utils/dom';\n\n/**\n * Checks for signs that element can be focused with keyboard. tabIndex above 0 is ignored to\n * only target natural focus order. Not checking the possibility of an element to\n * be focused, for example element can have display: none applied to it or any other\n * circumstances could prevent actual focus.\n */\nexport function tuiIsNativeKeyboardFocusable(element: Element): boolean {\n if (element.hasAttribute(`disabled`) || element.getAttribute(`tabIndex`) === `-1`) {\n return false;\n }\n\n if (\n (tuiIsHTMLElement(element) && element.isContentEditable) ||\n element.getAttribute(`tabIndex`) === `0`\n ) {\n return true;\n }\n\n switch (element.tagName) {\n case `BUTTON`:\n case `SELECT`:\n case `TEXTAREA`:\n return true;\n case `VIDEO`:\n case `AUDIO`:\n return element.hasAttribute(`controls`);\n case `INPUT`:\n return element.getAttribute(`type`) !== `hidden`;\n case `A`:\n case `LINK`:\n return element.hasAttribute(`href`);\n default:\n return false;\n }\n}\n","import {tuiIsNativeKeyboardFocusable} from './is-native-keyboard-focusable';\n\nexport function tuiIsNativeMouseFocusable(element: Element): boolean {\n return (\n !element.hasAttribute(`disabled`) &&\n (element.getAttribute(`tabIndex`) === `-1` ||\n tuiIsNativeKeyboardFocusable(element))\n );\n}\n","import {svgNodeFilter} from '@taiga-ui/cdk/constants';\nimport {tuiIsHTMLElement} from '@taiga-ui/cdk/utils/dom';\n\nimport {tuiIsNativeKeyboardFocusable} from './is-native-keyboard-focusable';\nimport {tuiIsNativeMouseFocusable} from './is-native-mouse-focusable';\n\nexport interface TuiGetClosestFocusableOptions {\n /**\n * @description:\n * current HTML element\n */\n initial: Element;\n\n /**\n * @description:\n * determine if only keyboard focus is of interest\n */\n keyboard?: boolean;\n\n /**\n * @description:\n * should it look backwards instead (find item that will be focused with Shift + Tab)\n */\n previous?: boolean;\n\n /**\n * @description:\n * top Node limiting the search area\n */\n root: Node;\n}\n\n/**\n * @description:\n * Finds the closest element that can be focused with a keyboard or mouse in theory\n */\nexport function tuiGetClosestFocusable({\n initial,\n root,\n previous = false,\n keyboard = true,\n}: TuiGetClosestFocusableOptions): HTMLElement | null {\n if (!root.ownerDocument) {\n return null;\n }\n\n const check = keyboard ? tuiIsNativeKeyboardFocusable : tuiIsNativeMouseFocusable;\n const treeWalker = root.ownerDocument.createTreeWalker(\n root,\n NodeFilter.SHOW_ELEMENT,\n svgNodeFilter,\n );\n\n treeWalker.currentNode = initial;\n\n while (previous ? treeWalker.previousNode() : treeWalker.nextNode()) {\n if (tuiIsHTMLElement(treeWalker.currentNode)) {\n initial = treeWalker.currentNode;\n }\n\n if (tuiIsHTMLElement(initial) && check(initial)) {\n return initial;\n }\n }\n\n return null;\n}\n","import {tuiGetNativeFocused} from './get-native-focused';\n\n/**\n * Checks if element is focused.\n *\n * Could return true even after blur since element remains focused if you switch away from a browser tab.\n *\n * @param node or null (as a common return value of DOM nodes walking)\n * @return true if focused\n */\nexport function tuiIsNativeFocused(node: Node | null): boolean {\n return (\n !!node?.ownerDocument &&\n tuiGetNativeFocused(node.ownerDocument) === node &&\n node.ownerDocument.hasFocus()\n );\n}\n","import {tuiGetNativeFocused} from './get-native-focused';\n\n/**\n * Checks if focused element is within given element.\n *\n * @param node\n * @return true if focused node is contained within element\n */\nexport function tuiIsNativeFocusedIn(node: Node): boolean {\n // !node.contains - check for IE11\n if (!node.ownerDocument || !node.contains) {\n return false;\n }\n\n const nativeFocused = tuiGetNativeFocused(node.ownerDocument);\n\n return (\n nativeFocused !== null &&\n node.contains(nativeFocused) &&\n node.ownerDocument.hasFocus()\n );\n}\n","import {tuiIsNativeFocused} from './is-native-focused';\n\n/**\n * Utility method for moving focus in a list of elements\n *\n * @param currentIndex currently focused index\n * @param elements array of focusable elements\n * @param step a step to move focus by, typically -1 or 1\n */\nexport function tuiMoveFocus(\n currentIndex: number,\n elements: readonly HTMLElement[],\n step: number,\n): void {\n currentIndex += step;\n\n while (currentIndex >= 0 && currentIndex < elements.length) {\n elements[currentIndex].focus();\n\n if (tuiIsNativeFocused(elements[currentIndex])) {\n return;\n }\n\n currentIndex += step;\n }\n}\n","/**\n * Focuses or blurs element with mouse action imitation (to spoof {@link TuiFocusVisibleService})\n *\n * @param element\n * @param focused desired focused state\n * @param preventScroll optionally prevent native browser scroll after focus\n */\nexport function tuiSetNativeMouseFocused(\n element: Element & HTMLOrSVGElement,\n focused: boolean = true,\n preventScroll: boolean = false,\n): void {\n if (!element.ownerDocument) {\n return;\n }\n\n if (typeof Event === `function`) {\n element.dispatchEvent(new Event(`mousedown`, {bubbles: true, cancelable: true}));\n } else {\n const event = element.ownerDocument.createEvent(`Event`);\n\n event.initEvent(`mousedown`, true, true);\n element.dispatchEvent(event);\n }\n\n if (focused) {\n element.focus({preventScroll});\n } else {\n element.blur();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAAA;;;;AAIG;AACa,SAAA,mBAAmB,CAAC,EAAC,aAAa,EAAW,EAAA;IACzD,IAAI,EAAC,aAAa,KAAb,IAAA,IAAA,aAAa,uBAAb,aAAa,CAAE,UAAU,CAAA,EAAE;AAC5B,QAAA,OAAO,aAAa,CAAC;AACxB,KAAA;AAED,IAAA,IAAI,OAAO,GAAG,aAAa,CAAC,UAAU,CAAC,aAAa,CAAC;AAErD,IAAA,OAAO,OAAO,KAAP,IAAA,IAAA,OAAO,uBAAP,OAAO,CAAE,UAAU,EAAE;AACxB,QAAA,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC;AAC9C,KAAA;AAED,IAAA,OAAO,OAAO,CAAC;AACnB;;ACbA;;AAEG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,EAAC,CAAC,CAAC,CAAC;AACpF,KAAA;AAAM,SAAA;QACH,MAAM,KAAK,GAAG,OAAO,CAAC,aAAa,CAAC,WAAW,CAAC,CAAO,KAAA,CAAA,CAAC,CAAC;QAEzD,KAAK,CAAC,SAAS,CAAC,CAAA,SAAA,CAAW,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACzC,QAAA,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAChC,KAAA;AAED,IAAA,IAAI,OAAO,EAAE;AACT,QAAA,OAAO,CAAC,KAAK,CAAC,EAAC,aAAa,EAAC,CAAC,CAAC;AAClC,KAAA;AAAM,SAAA;QACH,OAAO,CAAC,IAAI,EAAE,CAAC;AAClB,KAAA;AACL;;AC9BA;;AAEG;;;;"}
|
package/package.json
CHANGED
@@ -22,7 +22,7 @@ function addTaigaModules(options) {
|
|
22
22
|
return;
|
23
23
|
}
|
24
24
|
const buildOptions = get_project_target_options_1.getProjectTargetOptions(project, `build`);
|
25
|
-
const mainFilePath = buildOptions.main;
|
25
|
+
const mainFilePath = (buildOptions.main || buildOptions.browser);
|
26
26
|
if (!mainFilePath) {
|
27
27
|
context.logger.error(`[ERROR]: Could not find the project main file`);
|
28
28
|
return;
|
@@ -9,7 +9,7 @@ const import_manipulations_1 = require("../../utils/import-manipulations");
|
|
9
9
|
function replaceIdentifiers(options, constants) {
|
10
10
|
!options[`skip-logs`] &&
|
11
11
|
colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} replacing identifiers...`);
|
12
|
-
constants.forEach(
|
12
|
+
constants.forEach(replaceIdentifier);
|
13
13
|
!options[`skip-logs`] &&
|
14
14
|
colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} identifiers replaced \n`);
|
15
15
|
}
|
@@ -7,4 +7,14 @@ exports.HTML_COMMENTS = [
|
|
7
7
|
withAttrs: [`singleColor`, `showLoader`],
|
8
8
|
comment: `toggle [singleColor] and [showLoader] inputs have been removed due to design changes`,
|
9
9
|
},
|
10
|
+
{
|
11
|
+
tag: `tui-table-pagination`,
|
12
|
+
withAttrs: [`[(page)]`, `[(size)]`, `(pageChange)`, `(sizeChange)`],
|
13
|
+
comment: `(pageChange) and (sizeChange) outputs have been removed. Use (paginationChange) instead`,
|
14
|
+
},
|
15
|
+
{
|
16
|
+
tag: `tui-radio`,
|
17
|
+
withAttrs: [`identityMatcher`, `showLoader`],
|
18
|
+
comment: `radio [identityMatcher] and [pseudoDisabled] inputs have been removed. If you need a workaround, please start a discussion on GitHub to think together`,
|
19
|
+
},
|
10
20
|
];
|
@@ -25,6 +25,10 @@ exports.IDENTIFIERS_TO_REPLACE = [
|
|
25
25
|
from: { name: `TuiRadioModule`, moduleSpecifier: `@taiga-ui/experimental` },
|
26
26
|
to: { name: `TuiRadioModule`, moduleSpecifier: `@taiga-ui/kit` },
|
27
27
|
},
|
28
|
+
{
|
29
|
+
from: { name: `TuiAvatarModule`, moduleSpecifier: `@taiga-ui/experimental` },
|
30
|
+
to: { name: `TuiAvatarModule`, moduleSpecifier: `@taiga-ui/kit` },
|
31
|
+
},
|
28
32
|
{
|
29
33
|
from: { name: `TuiToggleModule`, moduleSpecifier: `@taiga-ui/experimental` },
|
30
34
|
to: { name: `TuiToggleModule`, moduleSpecifier: `@taiga-ui/kit` },
|
@@ -27,6 +27,7 @@ function migrateTemplates(fileSystem, options) {
|
|
27
27
|
templates_2.migrateCheckbox,
|
28
28
|
templates_2.migrateRadio,
|
29
29
|
templates_2.migrateToggle,
|
30
|
+
templates_2.migrateAvatar,
|
30
31
|
];
|
31
32
|
const progressLog = progress_1.setupProgressLogger({
|
32
33
|
total: componentWithTemplatesPaths.length,
|
@@ -1,5 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const tslib_1 = require("tslib");
|
4
|
+
tslib_1.__exportStar(require("./migrate-avatar"), exports);
|
4
5
|
tslib_1.__exportStar(require("./migrate-badge"), exports);
|
5
6
|
tslib_1.__exportStar(require("./toggles"), exports);
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { UpdateRecorder } from '@angular-devkit/schematics';
|
2
|
+
import { DevkitFileSystem } from 'ng-morph';
|
3
|
+
import { TemplateResource } from '../../../interfaces';
|
4
|
+
export declare function migrateAvatar({ resource, recorder, fileSystem, }: {
|
5
|
+
fileSystem: DevkitFileSystem;
|
6
|
+
recorder: UpdateRecorder;
|
7
|
+
resource: TemplateResource;
|
8
|
+
}): void;
|
@@ -0,0 +1,75 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.migrateAvatar = void 0;
|
4
|
+
const add_import_to_closest_module_1 = require("../../../../utils/add-import-to-closest-module");
|
5
|
+
const elements_1 = require("../../../../utils/templates/elements");
|
6
|
+
const template_resource_1 = require("../../../../utils/templates/template-resource");
|
7
|
+
function migrateAvatar({ resource, recorder, fileSystem, }) {
|
8
|
+
const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
|
9
|
+
const templateOffset = template_resource_1.getTemplateOffset(resource);
|
10
|
+
const elements = elements_1.findElementsByTagName(template, `tui-avatar`);
|
11
|
+
elements.forEach(({ attrs, sourceCodeLocation }) => {
|
12
|
+
const avatarUrlAttr = attrs.find(attr => attr.name === `[avatarurl]` || attr.name === `avatarurl`);
|
13
|
+
const fallbackAttr = attrs.find(attr => attr.name === `[fallback]` || attr.name === `fallback`);
|
14
|
+
const textAttr = attrs.find(attr => attr.name === `[text]` || attr.name === `text`);
|
15
|
+
const roundedAttr = attrs.find(attr => attr.name === `[rounded]` || attr.name === `rounded`);
|
16
|
+
if ((!avatarUrlAttr && !textAttr) || !sourceCodeLocation) {
|
17
|
+
return;
|
18
|
+
}
|
19
|
+
const urlAttrValue = (avatarUrlAttr === null || avatarUrlAttr === void 0 ? void 0 : avatarUrlAttr.value) &&
|
20
|
+
normalizeAttrValue(avatarUrlAttr.name, avatarUrlAttr.value);
|
21
|
+
const textAttrValue = (textAttr === null || textAttr === void 0 ? void 0 : textAttr.value) && normalizeAttrValue(textAttr.name, textAttr.value);
|
22
|
+
const fallbackAttrValue = (fallbackAttr === null || fallbackAttr === void 0 ? void 0 : fallbackAttr.value) &&
|
23
|
+
normalizeAttrValue(fallbackAttr.name, fallbackAttr.value);
|
24
|
+
const insertTo = sourceCodeLocation.startTag.startOffset + `<tui-avatar`.length;
|
25
|
+
if (!insertTo) {
|
26
|
+
return;
|
27
|
+
}
|
28
|
+
const mainSrc = urlAttrValue || (textAttrValue ? `${textAttrValue} | tuiInitials` : ``);
|
29
|
+
const fallbackValue = urlAttrValue
|
30
|
+
? getFallbackValue(textAttrValue, fallbackAttrValue)
|
31
|
+
: ``;
|
32
|
+
const fallbackSrc = urlAttrValue && fallbackValue
|
33
|
+
? `| tuiFallbackSrc : ${fallbackValue} | async`
|
34
|
+
: ``;
|
35
|
+
recorder.insertRight(insertTo + templateOffset, ` [src]="${mainSrc}${fallbackSrc ? ` ${fallbackSrc}` : ``}"${!roundedAttr ? ` [round]="false"` : ``}`);
|
36
|
+
const attrsToRemove = [avatarUrlAttr, textAttr, fallbackAttr].filter((attr) => attr !== undefined);
|
37
|
+
const fallbackModule = !!((avatarUrlAttr && textAttrValue) || fallbackAttr);
|
38
|
+
const initialsModule = !!textAttrValue;
|
39
|
+
const modules = [
|
40
|
+
...(fallbackModule
|
41
|
+
? [{ moduleName: `TuiFallbackModule`, moduleSpecifier: `@taiga-ui/cdk` }]
|
42
|
+
: []),
|
43
|
+
...(initialsModule
|
44
|
+
? [{ moduleName: `TuiInitialsModule`, moduleSpecifier: `@taiga-ui/cdk` }]
|
45
|
+
: []),
|
46
|
+
];
|
47
|
+
addModules(resource.componentPath, modules);
|
48
|
+
removeAttrs(attrsToRemove, sourceCodeLocation, recorder, templateOffset);
|
49
|
+
});
|
50
|
+
}
|
51
|
+
exports.migrateAvatar = migrateAvatar;
|
52
|
+
function addModules(componentPath, modules) {
|
53
|
+
modules.forEach(({ moduleName, moduleSpecifier }) => {
|
54
|
+
add_import_to_closest_module_1.addImportToClosestModule(componentPath, moduleName, moduleSpecifier);
|
55
|
+
});
|
56
|
+
}
|
57
|
+
function removeAttrs(attrs, sourceCodeLocation, recorder, templateOffset) {
|
58
|
+
attrs.forEach(attr => {
|
59
|
+
var _a;
|
60
|
+
const attrOffset = (_a = sourceCodeLocation.attrs) === null || _a === void 0 ? void 0 : _a[attr.name];
|
61
|
+
if (attrOffset) {
|
62
|
+
const { startOffset, endOffset } = attrOffset;
|
63
|
+
recorder.remove(templateOffset + startOffset - 1, endOffset - startOffset + 1);
|
64
|
+
}
|
65
|
+
});
|
66
|
+
}
|
67
|
+
function getFallbackValue(textValue, fallbackValue) {
|
68
|
+
if (textValue) {
|
69
|
+
return `(${textValue} | tuiInitials)`;
|
70
|
+
}
|
71
|
+
return textValue ? `(${textValue} | tuiInitials)` : fallbackValue || ``;
|
72
|
+
}
|
73
|
+
function normalizeAttrValue(attrName, attrValue) {
|
74
|
+
return attrName.startsWith(`[`) ? attrValue : `'${attrValue}'`;
|
75
|
+
}
|