@taiga-ui/cdk 4.0.0-rc.1 → 4.0.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/classes/control.d.ts +1 -1
- package/constants/used-icons.d.ts +1 -1
- package/constants/version.d.ts +1 -1
- package/constants/version.js +1 -1
- package/directives/auto-focus/autofocus.options.d.ts +1 -1
- package/directives/for/for.directive.d.ts +3 -3
- package/directives/platform/platform.directive.d.ts +1 -1
- package/directives/value-changes/value-changes.directive.d.ts +3 -3
- package/esm2022/classes/control.mjs +2 -2
- package/esm2022/constants/used-icons.mjs +6 -6
- package/esm2022/constants/version.mjs +2 -2
- package/esm2022/directives/active-zone/active-zone.directive.mjs +2 -2
- package/esm2022/directives/auto-focus/handlers/ios.handler.mjs +3 -3
- package/esm2022/directives/click-outside/click-outside.directive.mjs +2 -2
- package/esm2022/directives/droppable/droppable.directive.mjs +3 -3
- package/esm2022/directives/for/for.directive.mjs +6 -6
- package/esm2022/directives/hovered/hovered.service.mjs +2 -2
- package/esm2022/directives/obscured/obscured.directive.mjs +2 -2
- package/esm2022/directives/obscured/obscured.service.mjs +2 -2
- package/esm2022/directives/pan/pan.service.mjs +2 -2
- package/esm2022/directives/platform/platform.directive.mjs +6 -6
- package/esm2022/directives/swipe/swipe.service.mjs +2 -2
- package/esm2022/directives/value-changes/value-changes.directive.mjs +6 -6
- package/esm2022/directives/zoom/zoom.service.mjs +4 -4
- package/esm2022/observables/control-value.mjs +2 -2
- package/esm2022/observables/drag-and-drop-from.mjs +2 -2
- package/esm2022/observables/events.mjs +3 -3
- package/esm2022/observables/if-map.mjs +2 -2
- package/esm2022/observables/must-be-present.mjs +2 -2
- package/esm2022/observables/zone.mjs +4 -4
- package/esm2022/pipes/filter/filter.pipe.mjs +2 -2
- package/esm2022/services/popover.service.mjs +3 -3
- package/esm2022/services/scroll.service.mjs +2 -2
- package/esm2022/services/static-request.service.mjs +1 -1
- package/esm2022/tokens/active-element.mjs +3 -3
- package/esm2022/tokens/removed-element.mjs +2 -2
- package/esm2022/utils/color/get-gradient-data.mjs +6 -0
- package/esm2022/utils/color/hex-to-rgb.mjs +2 -2
- package/esm2022/utils/color/index.mjs +3 -1
- package/esm2022/utils/color/parse-color.mjs +3 -3
- package/esm2022/utils/color/parse-gradient.mjs +70 -0
- package/esm2022/utils/color/rgb-to-hex.mjs +2 -2
- package/esm2022/utils/dom/get-element-obscurers.mjs +2 -2
- package/esm2022/utils/dom/get-element-point.mjs +6 -0
- package/esm2022/utils/dom/index.mjs +2 -1
- package/esm2022/utils/miscellaneous/mark-control-as-touched-and-validate.mjs +3 -3
- package/esm2022/utils/miscellaneous/with-styles.mjs +2 -2
- package/fesm2022/taiga-ui-cdk-classes.mjs +1 -1
- package/fesm2022/taiga-ui-cdk-classes.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-constants.mjs +6 -6
- package/fesm2022/taiga-ui-cdk-constants.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-active-zone.mjs +1 -1
- package/fesm2022/taiga-ui-cdk-directives-active-zone.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-auto-focus.mjs +2 -2
- package/fesm2022/taiga-ui-cdk-directives-auto-focus.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-click-outside.mjs +1 -1
- package/fesm2022/taiga-ui-cdk-directives-click-outside.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-droppable.mjs +2 -2
- package/fesm2022/taiga-ui-cdk-directives-droppable.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-for.mjs +5 -5
- package/fesm2022/taiga-ui-cdk-directives-for.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-hovered.mjs +1 -1
- package/fesm2022/taiga-ui-cdk-directives-hovered.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-obscured.mjs +2 -2
- package/fesm2022/taiga-ui-cdk-directives-obscured.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-pan.mjs +1 -1
- package/fesm2022/taiga-ui-cdk-directives-pan.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-platform.mjs +5 -5
- package/fesm2022/taiga-ui-cdk-directives-platform.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-swipe.mjs +1 -1
- package/fesm2022/taiga-ui-cdk-directives-swipe.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-value-changes.mjs +5 -5
- package/fesm2022/taiga-ui-cdk-directives-value-changes.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-zoom.mjs +3 -3
- package/fesm2022/taiga-ui-cdk-directives-zoom.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-observables.mjs +9 -9
- package/fesm2022/taiga-ui-cdk-observables.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-pipes-filter.mjs +1 -1
- package/fesm2022/taiga-ui-cdk-pipes-filter.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-services.mjs +3 -3
- package/fesm2022/taiga-ui-cdk-services.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-tokens.mjs +3 -3
- package/fesm2022/taiga-ui-cdk-tokens.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-utils-color.mjs +80 -5
- package/fesm2022/taiga-ui-cdk-utils-color.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-utils-dom.mjs +7 -2
- package/fesm2022/taiga-ui-cdk-utils-dom.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-utils-miscellaneous.mjs +3 -3
- package/fesm2022/taiga-ui-cdk-utils-miscellaneous.mjs.map +1 -1
- package/package.json +67 -357
- package/schematics/migration.json +3 -3
- package/schematics/ng-add/constants/modules.d.ts +0 -1
- package/schematics/ng-add/constants/modules.js +1 -11
- package/schematics/ng-add/constants/versions.d.ts +0 -1
- package/schematics/ng-add/constants/versions.js +1 -2
- package/schematics/ng-add/index.js +1 -7
- package/schematics/ng-add/schema.d.ts +0 -1
- package/schematics/ng-add/schema.json +0 -27
- package/schematics/ng-add/steps/add-taiga-icons.js +1 -1
- package/schematics/ng-add/steps/add-taiga-modules.js +7 -22
- package/schematics/ng-update/interfaces/replacement-type.d.ts +1 -0
- package/schematics/ng-update/steps/icons/replace-imports.js +5 -5
- package/schematics/ng-update/steps/index.d.ts +1 -0
- package/schematics/ng-update/steps/index.js +1 -0
- package/schematics/ng-update/steps/remove-module.js +2 -2
- package/schematics/ng-update/steps/rename-types.js +7 -7
- package/schematics/ng-update/steps/replace-deep-import.js +2 -2
- package/schematics/ng-update/steps/replace-enums.js +2 -2
- package/schematics/ng-update/steps/replace-identifier.js +1 -1
- package/schematics/ng-update/steps/replace-package-name.d.ts +5 -0
- package/schematics/ng-update/steps/replace-package-name.js +19 -0
- package/schematics/ng-update/steps/replace-services.js +5 -5
- package/schematics/ng-update/steps/show-warnings.js +4 -4
- package/schematics/ng-update/utils/replace-text.js +1 -1
- package/schematics/ng-update/utils/templates/replace-attr-values.js +3 -3
- package/schematics/ng-update/utils/templates/replace-attrs.js +1 -1
- package/schematics/ng-update/utils/templates/template-comments.js +4 -2
- package/schematics/ng-update/v3/constants/templates.js +9 -9
- package/schematics/ng-update/v3/index.js +1 -1
- package/schematics/ng-update/v3/steps/migrate-date-time.js +10 -10
- package/schematics/ng-update/v3/steps/migrate-polymorpheus.js +8 -8
- package/schematics/ng-update/v3/steps/migrate-progress.js +4 -4
- package/schematics/ng-update/v3/steps/migrate-sliders/migrate-input-range.js +3 -3
- package/schematics/ng-update/v3/steps/migrate-sliders/migrate-input-slider.js +4 -4
- package/schematics/ng-update/v3/steps/migrate-taiga-proprietary-icons.js +2 -2
- package/schematics/ng-update/v3/steps/migrate-templates.js +16 -16
- package/schematics/ng-update/v3/steps/migrate-textfield-controller.js +8 -8
- package/schematics/ng-update/v3/steps/miscellaneous.js +5 -5
- package/schematics/ng-update/v3/steps/replace-functions.js +12 -12
- package/schematics/ng-update/v3/steps/replace-styles.js +2 -2
- package/schematics/ng-update/v3-36/index.js +7 -17
- package/schematics/ng-update/v3-40/index.js +1 -1
- package/schematics/ng-update/v3-5/steps/migrate-expand-templates.js +4 -4
- package/schematics/ng-update/v4/index.js +11 -6
- package/schematics/ng-update/v4/migrate-css-vars/palette.d.ts +11 -2
- package/schematics/ng-update/v4/migrate-css-vars/palette.js +18 -8
- package/schematics/ng-update/v4/migrate-css-vars/rename-css-vars.js +10 -2
- package/schematics/ng-update/v4/migrate-icons/index.js +8 -6
- package/schematics/ng-update/v4/migrate-icons/rename-icons.js +2 -2
- package/schematics/ng-update/v4/migrate-icons/rename-proprietary-icons.d.ts +2 -0
- package/schematics/ng-update/v4/migrate-icons/rename-proprietary-icons.js +66 -0
- package/schematics/ng-update/v4/steps/constants/attr-to-directive-replace.js +3 -3
- package/schematics/ng-update/v4/steps/constants/attr-with-values-to-replace.js +9 -1
- package/schematics/ng-update/v4/steps/constants/attrs-to-replace.js +10 -9
- package/schematics/ng-update/v4/steps/constants/enums.js +31 -0
- package/schematics/ng-update/v4/steps/constants/html-comments.js +10 -0
- package/schematics/ng-update/v4/steps/constants/identifiers-to-replace.js +884 -123
- package/schematics/ng-update/v4/steps/constants/inputs-to-remove.js +1 -1
- package/schematics/ng-update/v4/steps/constants/migration-warnings.js +5 -0
- package/schematics/ng-update/v4/steps/constants/modules-to-remove.js +12 -0
- package/schematics/ng-update/v4/steps/constants/modules-to-replace.d.ts +12 -0
- package/schematics/ng-update/v4/steps/constants/modules-to-replace.js +15 -0
- package/schematics/ng-update/v4/steps/constants/tags-to-replace.js +5 -4
- package/schematics/ng-update/v4/steps/constants/types.d.ts +2 -0
- package/schematics/ng-update/v4/steps/constants/types.js +17 -0
- package/schematics/ng-update/v4/steps/index.d.ts +4 -0
- package/schematics/ng-update/v4/steps/index.js +4 -0
- package/schematics/ng-update/v4/steps/migrate-all-country-iso-codes.js +1 -1
- package/schematics/ng-update/v4/steps/migrate-destroy-service.js +7 -4
- package/schematics/ng-update/v4/steps/migrate-legacy-mask.js +2 -2
- package/schematics/ng-update/v4/steps/migrate-option-providers.js +6 -3
- package/schematics/ng-update/v4/steps/migrate-proprietary.js +3 -3
- package/schematics/ng-update/v4/steps/migrate-styles.js +1 -1
- package/schematics/ng-update/v4/steps/migrate-templates.js +3 -1
- package/schematics/ng-update/v4/steps/templates/migrate-avatar.js +24 -6
- package/schematics/ng-update/v4/steps/templates/migrate-badge.js +4 -4
- package/schematics/ng-update/v4/steps/templates/migrate-expandable.js +2 -2
- package/schematics/ng-update/v4/steps/templates/migrate-focusable.js +1 -1
- package/schematics/ng-update/v4/steps/templates/migrate-labeled.js +1 -3
- package/schematics/ng-update/v4/steps/templates/migrate-money.js +1 -1
- package/schematics/ng-update/v4/steps/templates/migrate-overscroll.d.ts +8 -0
- package/schematics/ng-update/v4/steps/templates/migrate-overscroll.js +29 -0
- package/schematics/ng-update/v4/steps/templates/migrate-thumbnail-card.js +1 -1
- package/schematics/ng-update/v4/steps/templates/toggles/common.d.ts +1 -1
- package/schematics/ng-update/v4/steps/templates/toggles/common.js +3 -3
- package/schematics/ng-update/v4/steps/update-packages.d.ts +4 -0
- package/schematics/ng-update/v4/steps/update-packages.js +31 -0
- package/schematics/ng-update/v4/steps/utils/remove-attrs.js +1 -1
- package/schematics/ng-update/v4/steps/utils/replace-modules-with-providers.d.ts +13 -0
- package/schematics/ng-update/v4/steps/utils/replace-modules-with-providers.js +47 -0
- package/schematics/ng-update/v4/steps/utils/replace-substrings.js +1 -1
- package/schematics/ng-update/v4/tests/migrate-destroy-service/utils.js +1 -0
- package/schematics/utils/add-unique-import.js +1 -1
- package/schematics/utils/angular-json-manipulations.js +4 -4
- package/schematics/utils/get-named-import-references.js +4 -4
- package/schematics/utils/get-standalone-bootstrap-function.js +2 -2
- package/schematics/utils/import-manipulations.js +1 -1
- package/schematics/utils/push-to-array-property.js +1 -1
- package/schematics/utils/templates/elements.d.ts +5 -0
- package/schematics/utils/templates/elements.js +26 -13
- package/schematics/utils/templates/get-component-templates.js +1 -1
- package/schematics/utils/templates/inputs.js +1 -1
- package/schematics/utils/templates/ng-component-input-manipulations.js +5 -5
- package/utils/color/get-gradient-data.d.ts +1 -0
- package/utils/color/index.d.ts +2 -0
- package/utils/color/parse-gradient.d.ts +10 -0
- package/utils/dom/get-element-point.d.ts +2 -0
- package/utils/dom/index.d.ts +1 -0
@@ -0,0 +1,47 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.replaceModulesWithProviders = void 0;
|
4
|
+
const ng_morph_1 = require("ng-morph");
|
5
|
+
const add_unique_import_1 = require("../../../../utils/add-unique-import");
|
6
|
+
const colored_log_1 = require("../../../../utils/colored-log");
|
7
|
+
const get_named_import_references_1 = require("../../../../utils/get-named-import-references");
|
8
|
+
const import_manipulations_1 = require("../../../../utils/import-manipulations");
|
9
|
+
const replaceModulesWithProviders = (options, list) => {
|
10
|
+
!options['skip-logs'] &&
|
11
|
+
(0, colored_log_1.infoLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} replacing modules with providers...`);
|
12
|
+
list.forEach(replaceModule);
|
13
|
+
!options['skip-logs'] &&
|
14
|
+
(0, colored_log_1.successLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} modules replaced \n`);
|
15
|
+
};
|
16
|
+
exports.replaceModulesWithProviders = replaceModulesWithProviders;
|
17
|
+
function replaceModule({ from, to }) {
|
18
|
+
const references = (0, get_named_import_references_1.getNamedImportReferences)(from.name, from.moduleSpecifier);
|
19
|
+
references.forEach((ref) => {
|
20
|
+
if (ref.wasForgotten()) {
|
21
|
+
return;
|
22
|
+
}
|
23
|
+
const parent = ref.getParent();
|
24
|
+
if (ng_morph_1.Node.isImportSpecifier(parent)) {
|
25
|
+
(0, import_manipulations_1.removeImport)(parent);
|
26
|
+
addImport(to, parent.getSourceFile().getFilePath());
|
27
|
+
}
|
28
|
+
else if (ng_morph_1.Node.isArrayLiteralExpression(parent)) {
|
29
|
+
parent.removeElement(ref.getChildIndex());
|
30
|
+
addProvider(to, parent.getSourceFile().getFilePath());
|
31
|
+
}
|
32
|
+
});
|
33
|
+
}
|
34
|
+
function addImport(identifier, filePath) {
|
35
|
+
(0, add_unique_import_1.addUniqueImport)(filePath, identifier.name, identifier.providerSpecifier);
|
36
|
+
}
|
37
|
+
function addProvider(identifier, filePath) {
|
38
|
+
const provider = `${identifier.name}()`;
|
39
|
+
const componentClass = (0, ng_morph_1.getNgComponents)(filePath)[0];
|
40
|
+
if (componentClass) {
|
41
|
+
(0, ng_morph_1.addProviderToComponent)(componentClass, provider);
|
42
|
+
}
|
43
|
+
const moduleClass = (0, ng_morph_1.getNgModules)(filePath)[0];
|
44
|
+
if (moduleClass) {
|
45
|
+
(0, ng_morph_1.addProviderToNgModule)(moduleClass, provider);
|
46
|
+
}
|
47
|
+
}
|
@@ -9,7 +9,7 @@ function replaceSubstring(text, replacement) {
|
|
9
9
|
function replaceSubstrings(text, replacements) {
|
10
10
|
let transformed = text;
|
11
11
|
let acc = 0;
|
12
|
-
replacements.forEach(replacement => {
|
12
|
+
replacements.forEach((replacement) => {
|
13
13
|
replacement.start += acc;
|
14
14
|
transformed = replaceSubstring(transformed, replacement);
|
15
15
|
acc += replacement.to.length - replacement.from.length;
|
@@ -13,6 +13,7 @@ function runMigration(before) {
|
|
13
13
|
const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
|
14
14
|
(0, ng_morph_1.setActiveProject)((0, ng_morph_1.createProject)(host));
|
15
15
|
(0, ng_morph_1.createSourceFile)('test/app/test.component.ts', before);
|
16
|
+
(0, ng_morph_1.createSourceFile)('package.json', '{}');
|
16
17
|
(0, ng_morph_1.saveActiveProject)();
|
17
18
|
const tree = yield runner.runSchematic('updateToV4', { 'skip-logs': process.env['TUI_CI'] === 'true' }, host);
|
18
19
|
return tree.readContent('test/app/test.component.ts');
|
@@ -16,7 +16,7 @@ function addUniqueImport(filePath, namedImport, moduleSpecifier) {
|
|
16
16
|
if (existingDeclaration.length) {
|
17
17
|
const modules = existingDeclaration[0]
|
18
18
|
.getNamedImports()
|
19
|
-
.map(namedImport => namedImport.getText());
|
19
|
+
.map((namedImport) => namedImport.getText());
|
20
20
|
(0, ng_morph_1.editImports)(existingDeclaration[0], () => ({
|
21
21
|
namedImports: [...modules, namedImport],
|
22
22
|
}));
|
@@ -10,7 +10,7 @@ const versions_1 = require("../ng-add/constants/versions");
|
|
10
10
|
const get_project_target_options_1 = require("./get-project-target-options");
|
11
11
|
const get_projects_1 = require("./get-projects");
|
12
12
|
function hasTaigaIcons(assets) {
|
13
|
-
return !!(assets === null || assets === void 0 ? void 0 : assets.find(asset => {
|
13
|
+
return !!(assets === null || assets === void 0 ? void 0 : assets.find((asset) => {
|
14
14
|
var _a;
|
15
15
|
return (0, is_string_1.tuiIsString)(asset)
|
16
16
|
? asset.includes('taiga-ui')
|
@@ -33,7 +33,7 @@ function isInvalidAngularJson(tree) {
|
|
33
33
|
exports.isInvalidAngularJson = isInvalidAngularJson;
|
34
34
|
function addStylesToAngularJson(options, context, taigaStyles, filter, stylesToReplace, tree) {
|
35
35
|
const MANUAL_MIGRATION_TIPS = `Add styles ${taigaStyles.join(',')} to angular.json manually.`;
|
36
|
-
return (0, workspace_1.updateWorkspace)(workspace => {
|
36
|
+
return (0, workspace_1.updateWorkspace)((workspace) => {
|
37
37
|
const projects = (0, get_projects_1.getProjects)(options, workspace);
|
38
38
|
if (!projects.length) {
|
39
39
|
context.logger.warn(`[WARNING]: Target project not found. ${MANUAL_MIGRATION_TIPS}`);
|
@@ -59,11 +59,11 @@ function addStylesToAngularJson(options, context, taigaStyles, filter, stylesToR
|
|
59
59
|
targetOptions.styles = taigaStyles;
|
60
60
|
}
|
61
61
|
if (stylesToReplace &&
|
62
|
-
(styles === null || styles === void 0 ? void 0 : styles.filter(style => style !== stylesToReplace.from))) {
|
62
|
+
(styles === null || styles === void 0 ? void 0 : styles.filter((style) => style !== stylesToReplace.from))) {
|
63
63
|
targetOptions.styles = Array.from(new Set([
|
64
64
|
...taigaStyles,
|
65
65
|
...stylesToReplace.to,
|
66
|
-
...styles.filter(style => style !== stylesToReplace.from),
|
66
|
+
...styles.filter((style) => style !== stylesToReplace.from),
|
67
67
|
]));
|
68
68
|
}
|
69
69
|
else {
|
@@ -8,18 +8,18 @@ function getNamedImportReferences(namedImport, moduleSpecifier = '**/**', files
|
|
8
8
|
namedImports: [namedImport],
|
9
9
|
moduleSpecifier,
|
10
10
|
});
|
11
|
-
const namedImports = importDeclarations.map(declaration => {
|
11
|
+
const namedImports = importDeclarations.map((declaration) => {
|
12
12
|
var _a;
|
13
13
|
return (_a = declaration
|
14
14
|
.getNamedImports()
|
15
|
-
.find(specifier => specifier.getName() === namedImport)) === null || _a === void 0 ? void 0 : _a.getNameNode();
|
15
|
+
.find((specifier) => specifier.getName() === namedImport)) === null || _a === void 0 ? void 0 : _a.getNameNode();
|
16
16
|
});
|
17
|
-
return (0, ng_morph_1.arrayFlat)(namedImports.map(specifier => (specifier === null || specifier === void 0 ? void 0 : specifier.findReferencesAsNodes().filter(
|
17
|
+
return (0, ng_morph_1.arrayFlat)(namedImports.map((specifier) => (specifier === null || specifier === void 0 ? void 0 : specifier.findReferencesAsNodes().filter(
|
18
18
|
/**
|
19
19
|
* Otherwise, each `findReferencesAsNodes` will return references across THE WHOLE project.
|
20
20
|
* It will cause a lot of duplicates in the result and significantly slow down the process.
|
21
21
|
*/
|
22
|
-
ref => ref.getSourceFile().getFilePath() ===
|
22
|
+
(ref) => ref.getSourceFile().getFilePath() ===
|
23
23
|
(specifier === null || specifier === void 0 ? void 0 : specifier.getSourceFile().getFilePath()))) || []));
|
24
24
|
}
|
25
25
|
exports.getNamedImportReferences = getNamedImportReferences;
|
@@ -5,8 +5,8 @@ const ng_morph_1 = require("ng-morph");
|
|
5
5
|
const get_named_import_references_1 = require("./get-named-import-references");
|
6
6
|
function getStandaloneBootstrapFunction(path) {
|
7
7
|
const standaloneBootstrapIdentifier = (0, get_named_import_references_1.getNamedImportReferences)('bootstrapApplication', '@angular/platform-browser', path)
|
8
|
-
.map(ref => ref.getParent())
|
9
|
-
.find(node => ng_morph_1.Node.isCallExpression(node));
|
8
|
+
.map((ref) => ref.getParent())
|
9
|
+
.find((node) => ng_morph_1.Node.isCallExpression(node));
|
10
10
|
const standaloneBootstrapFunction = standaloneBootstrapIdentifier;
|
11
11
|
return standaloneBootstrapFunction || null;
|
12
12
|
}
|
@@ -14,7 +14,7 @@ function renameImport(specifier, to, from) {
|
|
14
14
|
const namedImport = specifier
|
15
15
|
.getImportDeclaration()
|
16
16
|
.getNamedImports()
|
17
|
-
.find(specifier => specifier.getName() === from);
|
17
|
+
.find((specifier) => specifier.getName() === from);
|
18
18
|
namedImport === null || namedImport === void 0 ? void 0 : namedImport.replaceWithText(to);
|
19
19
|
}
|
20
20
|
exports.renameImport = renameImport;
|
@@ -18,7 +18,7 @@ function pushToObjectArrayProperty(objectExpression, propertyName, initializer,
|
|
18
18
|
if (unique &&
|
19
19
|
importsInitializer
|
20
20
|
.getElements()
|
21
|
-
.some(element => element.getText() === initializer)) {
|
21
|
+
.some((element) => element.getText() === initializer)) {
|
22
22
|
return;
|
23
23
|
}
|
24
24
|
if (typeof index === 'number') {
|
@@ -3,6 +3,11 @@ export declare function findElementsByFn(nodes: ChildNode[], predicateFn: (el: E
|
|
3
3
|
export declare function findElementsInTemplateByFn(html: string, predicateFn: (el: Element) => boolean): Element[];
|
4
4
|
export declare function findElementsByTagName(html: string, tagName: string, filterFn?: (element: Element) => boolean): Element[];
|
5
5
|
export declare function findElementsByTagNames(html: string, tagNames: string[]): Element[];
|
6
|
+
/**
|
7
|
+
* Parses a HTML fragment and traverses all AST nodes in order find elements that
|
8
|
+
* include the specified directive as attribute or input.
|
9
|
+
*/
|
10
|
+
export declare function findElementsWithDirective(html: string, attributeName: string): Element[];
|
6
11
|
/**
|
7
12
|
* Parses a HTML fragment and traverses all AST nodes in order find elements that
|
8
13
|
* include the specified attribute.
|
@@ -1,11 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getStartOffsetOfAttribute = exports.hasElementAttribute = exports.findAttributeOnElementWithAttrs = exports.findAttributeOnElementWithTag = exports.findElementsWithAttributeOnTag = exports.findElementsWithAttribute = exports.findElementsByTagNames = exports.findElementsByTagName = exports.findElementsInTemplateByFn = exports.findElementsByFn = void 0;
|
3
|
+
exports.getStartOffsetOfAttribute = exports.hasElementAttribute = exports.findAttributeOnElementWithAttrs = exports.findAttributeOnElementWithTag = exports.findElementsWithAttributeOnTag = exports.findElementsWithAttribute = exports.findElementsWithDirective = exports.findElementsByTagNames = exports.findElementsByTagName = exports.findElementsInTemplateByFn = exports.findElementsByFn = void 0;
|
4
4
|
const parse5_1 = require("parse5");
|
5
5
|
function findElementsByFn(nodes, predicateFn) {
|
6
6
|
const elements = [];
|
7
7
|
const visitNodes = (nodes) => {
|
8
|
-
nodes.forEach(n => {
|
8
|
+
nodes.forEach((n) => {
|
9
9
|
const node = n;
|
10
10
|
if (node.childNodes) {
|
11
11
|
visitNodes(node.childNodes);
|
@@ -31,19 +31,29 @@ exports.findElementsInTemplateByFn = findElementsInTemplateByFn;
|
|
31
31
|
function findElementsByTagName(html, tagName,
|
32
32
|
// eslint-disable-next-line no-restricted-syntax
|
33
33
|
filterFn = () => true) {
|
34
|
-
return findElementsInTemplateByFn(html, el => el.tagName === tagName && filterFn(el));
|
34
|
+
return findElementsInTemplateByFn(html, (el) => el.tagName === tagName && filterFn(el));
|
35
35
|
}
|
36
36
|
exports.findElementsByTagName = findElementsByTagName;
|
37
37
|
function findElementsByTagNames(html, tagNames) {
|
38
|
-
return findElementsInTemplateByFn(html, el => tagNames.includes(el.tagName));
|
38
|
+
return findElementsInTemplateByFn(html, (el) => tagNames.includes(el.tagName));
|
39
39
|
}
|
40
40
|
exports.findElementsByTagNames = findElementsByTagNames;
|
41
|
+
/**
|
42
|
+
* Parses a HTML fragment and traverses all AST nodes in order find elements that
|
43
|
+
* include the specified directive as attribute or input.
|
44
|
+
*/
|
45
|
+
function findElementsWithDirective(html, attributeName) {
|
46
|
+
const lowercasedAttrName = attributeName.toLowerCase();
|
47
|
+
const inputName = `[${lowercasedAttrName}]`;
|
48
|
+
return findElementsInTemplateByFn(html, (el) => { var _a; return (_a = el.attrs) === null || _a === void 0 ? void 0 : _a.some(({ name }) => name === lowercasedAttrName || name === inputName); });
|
49
|
+
}
|
50
|
+
exports.findElementsWithDirective = findElementsWithDirective;
|
41
51
|
/**
|
42
52
|
* Parses a HTML fragment and traverses all AST nodes in order find elements that
|
43
53
|
* include the specified attribute.
|
44
54
|
*/
|
45
55
|
function findElementsWithAttribute(html, attributeName) {
|
46
|
-
return findElementsInTemplateByFn(html, el => { var _a; return (_a = el.attrs) === null || _a === void 0 ? void 0 : _a.some(attr => attr.name === attributeName.toLowerCase()); });
|
56
|
+
return findElementsInTemplateByFn(html, (el) => { var _a; return (_a = el.attrs) === null || _a === void 0 ? void 0 : _a.some((attr) => attr.name === attributeName.toLowerCase()); });
|
47
57
|
}
|
48
58
|
exports.findElementsWithAttribute = findElementsWithAttribute;
|
49
59
|
/**
|
@@ -54,10 +64,13 @@ exports.findElementsWithAttribute = findElementsWithAttribute;
|
|
54
64
|
function findElementsWithAttributeOnTag(html, attributeNames, tagNames = [],
|
55
65
|
// eslint-disable-next-line no-restricted-syntax
|
56
66
|
filterFn = () => true) {
|
57
|
-
return findElementsInTemplateByFn(html, el => {
|
67
|
+
return findElementsInTemplateByFn(html, (el) => {
|
58
68
|
var _a;
|
59
|
-
return (
|
60
|
-
(
|
69
|
+
return (!attributeNames.length ||
|
70
|
+
((_a = el.attrs) === null || _a === void 0 ? void 0 : _a.some((attr) => attributeNames.map((name) => name.toLowerCase()).includes(attr.name)))) &&
|
71
|
+
(tagNames.includes(el.tagName) ||
|
72
|
+
tagNames.includes('*') ||
|
73
|
+
!tagNames.length) &&
|
61
74
|
filterFn(el);
|
62
75
|
});
|
63
76
|
}
|
@@ -70,9 +83,9 @@ function findAttributeOnElementWithTag(html, name, tagNames,
|
|
70
83
|
// eslint-disable-next-line no-restricted-syntax
|
71
84
|
filterFn = () => true) {
|
72
85
|
return findElementsWithAttribute(html, name)
|
73
|
-
.filter(element => (tagNames.includes(element.tagName) || tagNames.includes('*')) &&
|
86
|
+
.filter((element) => (tagNames.includes(element.tagName) || tagNames.includes('*')) &&
|
74
87
|
filterFn(element))
|
75
|
-
.map(element => getStartOffsetOfAttribute(element, name));
|
88
|
+
.map((element) => getStartOffsetOfAttribute(element, name));
|
76
89
|
}
|
77
90
|
exports.findAttributeOnElementWithTag = findAttributeOnElementWithTag;
|
78
91
|
/**
|
@@ -83,15 +96,15 @@ function findAttributeOnElementWithAttrs(html, name, attrs,
|
|
83
96
|
// eslint-disable-next-line no-restricted-syntax
|
84
97
|
filterFn = () => true) {
|
85
98
|
return findElementsWithAttribute(html, name)
|
86
|
-
.filter(element => attrs.some(attr => hasElementAttribute(element, attr)) &&
|
99
|
+
.filter((element) => attrs.some((attr) => hasElementAttribute(element, attr)) &&
|
87
100
|
filterFn(element))
|
88
|
-
.map(element => getStartOffsetOfAttribute(element, name));
|
101
|
+
.map((element) => getStartOffsetOfAttribute(element, name));
|
89
102
|
}
|
90
103
|
exports.findAttributeOnElementWithAttrs = findAttributeOnElementWithAttrs;
|
91
104
|
/** Shorthand function that checks if the specified element contains the given attribute. */
|
92
105
|
function hasElementAttribute(element, attributeName) {
|
93
106
|
var _a;
|
94
|
-
return (_a = element.attrs) === null || _a === void 0 ? void 0 : _a.some(attr => attr.name === attributeName.toLowerCase());
|
107
|
+
return (_a = element.attrs) === null || _a === void 0 ? void 0 : _a.some((attr) => attr.name === attributeName.toLowerCase());
|
95
108
|
}
|
96
109
|
exports.hasElementAttribute = hasElementAttribute;
|
97
110
|
/** Gets the start offset of the given attribute from a Parse5 element. */
|
@@ -31,7 +31,7 @@ function getFullTemplatePath(templatePath, componentPath) {
|
|
31
31
|
}
|
32
32
|
function getComponentTemplates(pattern, query) {
|
33
33
|
return (0, ng_morph_1.getClasses)(pattern, query)
|
34
|
-
.map(declaration => declaration.getDecorator('Component'))
|
34
|
+
.map((declaration) => declaration.getDecorator('Component'))
|
35
35
|
.filter((decorator) => !!decorator)
|
36
36
|
.map(decoratorToTemplateResource)
|
37
37
|
.filter((x) => Boolean(x));
|
@@ -2,7 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.isBinding = exports.findAttr = void 0;
|
4
4
|
function findAttr(attrs, name) {
|
5
|
-
return attrs.find(attr => attr.name === name || attr.name === `[${name}]`);
|
5
|
+
return attrs.find((attr) => attr.name === name || attr.name === `[${name}]`);
|
6
6
|
}
|
7
7
|
exports.findAttr = findAttr;
|
8
8
|
function isBinding(attr) {
|
@@ -39,11 +39,11 @@ function replaceInputProperty({ templateResource, fileSystem, componentSelector,
|
|
39
39
|
const stringProperties = [
|
40
40
|
...(0, elements_1.findAttributeOnElementWithTag)(template, from, selector, filterFn),
|
41
41
|
...(0, elements_1.findAttributeOnElementWithAttrs)(template, from, selector, filterFn),
|
42
|
-
].map(offset => templateOffset + offset);
|
42
|
+
].map((offset) => templateOffset + offset);
|
43
43
|
const propertyBindings = [
|
44
44
|
...(0, elements_1.findAttributeOnElementWithTag)(template, `[${from}]`, selector, filterFn),
|
45
45
|
...(0, elements_1.findAttributeOnElementWithAttrs)(template, `[${from}]`, selector, filterFn),
|
46
|
-
].map(offset => templateOffset + offset);
|
46
|
+
].map((offset) => templateOffset + offset);
|
47
47
|
const propertyValues = newValue
|
48
48
|
? getInputPropertyValueOffsets(template, from, selector).map(([start, end]) => [
|
49
49
|
templateOffset + start,
|
@@ -53,11 +53,11 @@ function replaceInputProperty({ templateResource, fileSystem, componentSelector,
|
|
53
53
|
if (!stringProperties.length && !propertyBindings.length) {
|
54
54
|
return false;
|
55
55
|
}
|
56
|
-
stringProperties.forEach(offset => {
|
56
|
+
stringProperties.forEach((offset) => {
|
57
57
|
recorder.remove(offset, from.length);
|
58
58
|
recorder.insertRight(offset, to);
|
59
59
|
});
|
60
|
-
propertyBindings.forEach(offset => {
|
60
|
+
propertyBindings.forEach((offset) => {
|
61
61
|
recorder.remove(offset, `[${from}]`.length);
|
62
62
|
recorder.insertRight(offset, to.startsWith('[') ? to : `[${to}]`);
|
63
63
|
});
|
@@ -79,7 +79,7 @@ function getInputPropertyOffsets(html, attrName, tags,
|
|
79
79
|
// eslint-disable-next-line no-restricted-syntax
|
80
80
|
filterFn = () => true) {
|
81
81
|
return (0, elements_1.findElementsWithAttribute)(html, attrName)
|
82
|
-
.filter(element => (tags.includes(element.tagName) || tags.includes('*')) &&
|
82
|
+
.filter((element) => (tags.includes(element.tagName) || tags.includes('*')) &&
|
83
83
|
filterFn(element))
|
84
84
|
.map((element) => {
|
85
85
|
var _a, _b;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function tuiGetGradientData(gradient: string): string;
|
package/utils/color/index.d.ts
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
export * from './get-gradient-data';
|
1
2
|
export * from './hex-to-rgb';
|
2
3
|
export * from './hex-to-rgba';
|
3
4
|
export * from './hsv-to-rgb';
|
4
5
|
export * from './parse-color';
|
6
|
+
export * from './parse-gradient';
|
5
7
|
export * from './rgb-to-hex';
|
6
8
|
export * from './rgb-to-hsv';
|
7
9
|
export * from './rgba-to-hex';
|
@@ -0,0 +1,10 @@
|
|
1
|
+
export interface TuiParsedGradient {
|
2
|
+
readonly side: TuiGradientDirection;
|
3
|
+
readonly stops: ReadonlyArray<{
|
4
|
+
readonly color: string;
|
5
|
+
readonly position: string;
|
6
|
+
}>;
|
7
|
+
}
|
8
|
+
export type TuiGradientDirection = 'to bottom left' | 'to bottom right' | 'to bottom' | 'to left' | 'to right' | 'to top left' | 'to top right' | 'to top';
|
9
|
+
export declare function tuiParseGradient(input: string): TuiParsedGradient;
|
10
|
+
export declare function tuiToGradient({ stops, side }: TuiParsedGradient): string;
|
package/utils/dom/index.d.ts
CHANGED
@@ -6,6 +6,7 @@ export * from './get-clipboard-data-text';
|
|
6
6
|
export * from './get-document-or-shadow-root';
|
7
7
|
export * from './get-element-obscurers';
|
8
8
|
export * from './get-element-offset';
|
9
|
+
export * from './get-element-point';
|
9
10
|
export * from './get-selected-text';
|
10
11
|
export * from './inject-element';
|
11
12
|
export * from './is-current-target';
|