@design-factory/design-factory 15.2.2 → 16.0.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/README.md +17 -1
- package/assets/fonts/amadeus-neue/bold/AmadeusNeue-Bold.ttf +0 -0
- package/assets/fonts/amadeus-neue/bold/AmadeusNeue-Bold.woff +0 -0
- package/assets/fonts/amadeus-neue/bold/AmadeusNeue-Bold.woff2 +0 -0
- package/assets/fonts/amadeus-neue/bold/AmadeusNeue-BoldItalic.ttf +0 -0
- package/assets/fonts/amadeus-neue/bold/AmadeusNeue-BoldItalic.woff +0 -0
- package/assets/fonts/amadeus-neue/bold/AmadeusNeue-BoldItalic.woff2 +0 -0
- package/assets/fonts/amadeus-neue/light/AmadeusNeue-Light.ttf +0 -0
- package/assets/fonts/amadeus-neue/light/AmadeusNeue-Light.woff +0 -0
- package/assets/fonts/amadeus-neue/light/AmadeusNeue-Light.woff2 +0 -0
- package/assets/fonts/amadeus-neue/light/AmadeusNeue-LightItalic.ttf +0 -0
- package/assets/fonts/amadeus-neue/light/AmadeusNeue-LightItalic.woff +0 -0
- package/assets/fonts/amadeus-neue/light/AmadeusNeue-LightItalic.woff2 +0 -0
- package/assets/fonts/amadeus-neue/medium/AmadeusNeue-Medium.ttf +0 -0
- package/assets/fonts/amadeus-neue/medium/AmadeusNeue-Medium.woff +0 -0
- package/assets/fonts/amadeus-neue/medium/AmadeusNeue-Medium.woff2 +0 -0
- package/assets/fonts/amadeus-neue/medium/AmadeusNeue-MediumItalic.ttf +0 -0
- package/assets/fonts/amadeus-neue/medium/AmadeusNeue-MediumItalic.woff +0 -0
- package/assets/fonts/amadeus-neue/medium/AmadeusNeue-MediumItalic.woff2 +0 -0
- package/assets/fonts/amadeus-neue/regular/AmadeusNeue-Regular.ttf +0 -0
- package/assets/fonts/amadeus-neue/regular/AmadeusNeue-Regular.woff +0 -0
- package/assets/fonts/amadeus-neue/regular/AmadeusNeue-Regular.woff2 +0 -0
- package/assets/fonts/amadeus-neue/regular/AmadeusNeue-RegularItalic.ttf +0 -0
- package/assets/fonts/amadeus-neue/regular/AmadeusNeue-RegularItalic.woff +0 -0
- package/assets/fonts/amadeus-neue/regular/AmadeusNeue-RegularItalic.woff2 +0 -0
- package/design-factory-initial-branding.css +1 -0
- package/design-factory-initial-branding.scss +1 -0
- package/design-factory.css +1 -3
- package/design-factory.scss +1 -0
- package/esm2022/lib/angular/accessibility/components/skip-links-container/skip-links-container.component.mjs +3 -3
- package/esm2022/lib/angular/df.module.mjs +102 -0
- package/esm2022/lib/angular/icon/amadeus-icon.mjs +2 -2
- package/esm2022/lib/angular/stepper/stepper.component.mjs +65 -0
- package/esm2022/lib/angular/stepper/stepper.directive.mjs +174 -0
- package/esm2022/lib/angular/stepper/stepper.module.mjs +17 -0
- package/esm2022/lib/angular/stepper/stepper.service.mjs +213 -0
- package/esm2022/lib/index.mjs +9 -94
- package/fesm2022/design-factory.mjs +1854 -1394
- package/fesm2022/design-factory.mjs.map +1 -1
- package/lib/angular/df.module.d.ts +26 -0
- package/lib/angular/stepper/stepper.component.d.ts +31 -0
- package/lib/angular/stepper/stepper.directive.d.ts +37 -0
- package/lib/angular/stepper/stepper.module.d.ts +8 -0
- package/lib/angular/stepper/stepper.service.d.ts +126 -0
- package/lib/index.d.ts +7 -22
- package/package.json +23 -4
- package/schematics/migrations/15_0_0/remove-ngx-slider/index.js +0 -1
- package/schematics/migrations/16_0_0/navbar-logo-dark/index.d.ts +9 -0
- package/schematics/migrations/16_0_0/navbar-logo-dark/index.js +43 -0
- package/schematics/migrations/16_0_0/revert-to-old-brand/index.d.ts +7 -0
- package/schematics/migrations/16_0_0/revert-to-old-brand/index.js +115 -0
- package/schematics/migrations/16_0_0/scss-var/files/removed.json +55 -0
- package/schematics/migrations/16_0_0/scss-var/files/renames.json +76 -0
- package/schematics/migrations/16_0_0/scss-var/index.d.ts +7 -0
- package/schematics/migrations/16_0_0/scss-var/index.js +57 -0
- package/schematics/migrations/16_0_0/stepper-classes/index.d.ts +13 -0
- package/schematics/migrations/16_0_0/stepper-classes/index.js +63 -0
- package/schematics/migrations/helpers.js +0 -1
- package/schematics/migrations/migration.json +23 -1
- package/schematics/migrations/utils/component-resource-collector.d.ts +44 -0
- package/schematics/migrations/utils/component-resource-collector.js +166 -0
- package/schematics/migrations/utils/project_tsconfig_paths.js +0 -1
- package/schematics/migrations/utils/style-updater.d.ts +9 -0
- package/schematics/migrations/utils/style-updater.js +38 -0
- package/schematics/migrations/utils/template-updater.d.ts +9 -0
- package/schematics/migrations/utils/template-updater.js +38 -0
- package/schematics/migrations/utils/typescript/compiler_host.js +0 -1
- package/schematics/migrations/utils/typescript/decorators.d.ts +22 -0
- package/schematics/migrations/utils/typescript/decorators.js +41 -0
- package/schematics/migrations/utils/typescript/functions.d.ts +14 -0
- package/schematics/migrations/utils/typescript/functions.js +20 -0
- package/schematics/migrations/utils/typescript/imports.d.ts +17 -0
- package/schematics/migrations/utils/typescript/imports.js +110 -0
- package/schematics/migrations/utils/typescript/line-mappings.d.ts +21 -0
- package/schematics/migrations/utils/typescript/line-mappings.js +75 -0
- package/schematics/migrations/utils/typescript/parse_tsconfig.js +0 -1
- package/schematics/migrations/utils/typescript/property-name.d.ts +18 -0
- package/schematics/migrations/utils/typescript/property-name.js +27 -0
- package/schematics/ng-add/index.js +0 -1
- package/schematics/ng-add/schema.js +0 -1
- package/styles/scss/_common.root.scss +37 -0
- package/styles/scss/_common.scss +3 -9
- package/styles/scss/_common.variables.scss +16 -6
- package/styles/scss/_variables.scss +0 -1
- package/styles/scss/bootstrap/_maps.scss +10 -9
- package/styles/scss/bootstrap/_mixins-override.scss +26 -0
- package/styles/scss/bootstrap/_variables.scss +927 -267
- package/styles/scss/components/accordion/_accordion.scss +31 -14
- package/styles/scss/components/accordion/_accordion.variables.scss +5 -5
- package/styles/scss/components/alert/_alert.scss +130 -228
- package/styles/scss/components/alert/_alert.variables.scss +22 -33
- package/styles/scss/components/badge/_badge.scss +130 -118
- package/styles/scss/components/badge/_badge.variables.scss +14 -8
- package/styles/scss/components/brand-color/_brand-color.mixins.scss +19 -4
- package/styles/scss/components/brand-color/_brand-color.scss +4 -6
- package/styles/scss/components/brand-color/_brand-color.variables.scss +1 -7
- package/styles/scss/components/brand-color/_brand-color_container.scss +28 -0
- package/styles/scss/components/breadcrumbs/_breadcrumbs.scss +77 -65
- package/styles/scss/components/breadcrumbs/_breadcrumbs.variables.scss +6 -4
- package/styles/scss/components/button/_button.scss +120 -55
- package/styles/scss/components/button/_button.variables.scss +18 -4
- package/styles/scss/components/button/_button_container.scss +9 -45
- package/styles/scss/components/card/_card.scss +90 -58
- package/styles/scss/components/card/_card.variables.scss +13 -13
- package/styles/scss/components/carousel/_carousel.scss +22 -23
- package/styles/scss/components/carousel/_carousel.variables.scss +2 -1
- package/styles/scss/components/checkbox/_checkbox.scss +14 -8
- package/styles/scss/components/checkbox/_checkbox.variables.scss +2 -2
- package/styles/scss/components/collapse/_collapse.scss +15 -7
- package/styles/scss/components/collapse/_collapse.variables.scss +3 -3
- package/styles/scss/components/datepicker/_datepicker.scss +178 -122
- package/styles/scss/components/datepicker/_datepicker.variables.scss +22 -15
- package/styles/scss/components/dropdown/_dropdown.mixins.scss +4 -4
- package/styles/scss/components/dropdown/_dropdown.scss +39 -19
- package/styles/scss/components/dropdown/_dropdown.variables.scss +4 -4
- package/styles/scss/components/fieldset/_fieldset.scss +4 -2
- package/styles/scss/components/fonts/_fonts-family.scss +112 -29
- package/styles/scss/components/fonts/_fonts.root.scss +27 -0
- package/styles/scss/components/fonts/_fonts.scss +25 -26
- package/styles/scss/components/fonts/_fonts.variables.scss +2 -2
- package/styles/scss/components/footer/_footer.scss +48 -18
- package/styles/scss/components/footer/_footer.variables.scss +4 -2
- package/styles/scss/components/form/_form.scss +69 -16
- package/styles/scss/components/form/_form.variables.scss +23 -3
- package/styles/scss/components/icon/_amadeus-icon.scss +2 -2
- package/styles/scss/components/icon/_amadeus-icon.variables.scss +1 -0
- package/styles/scss/components/inputs/_inputs.mixin.scss +8 -4
- package/styles/scss/components/inputs/_inputs.root.scss +8 -0
- package/styles/scss/components/inputs/_inputs.scss +159 -118
- package/styles/scss/components/inputs/_inputs.variables.scss +2 -1
- package/styles/scss/components/link/_link.mixins.scss +49 -49
- package/styles/scss/components/link/_link.scss +84 -22
- package/styles/scss/components/link/_link.variables.scss +6 -6
- package/styles/scss/components/list/_list.scss +10 -5
- package/styles/scss/components/list-group/_list-group.scss +54 -48
- package/styles/scss/components/list-group/_list-group.variables.scss +6 -14
- package/styles/scss/components/media/_media.scss +17 -9
- package/styles/scss/components/media/_media.variables.scss +2 -1
- package/styles/scss/components/modal/_modal.scss +88 -39
- package/styles/scss/components/modal/_modal.variables.scss +4 -5
- package/styles/scss/components/navbar/_navbar.scss +298 -115
- package/styles/scss/components/navbar/_navbar.variables.scss +29 -18
- package/styles/scss/components/pagination/_pagination.scss +68 -82
- package/styles/scss/components/pagination/_pagination.variables.scss +5 -8
- package/styles/scss/components/pagination/_pagination_container.scss +3 -0
- package/styles/scss/components/popover/_popover.mixin.scss +20 -33
- package/styles/scss/components/popover/_popover.scss +25 -7
- package/styles/scss/components/popover/_popover_container.scss +123 -74
- package/styles/scss/components/progressbar/_progressbar.scss +15 -7
- package/styles/scss/components/progressbar/_progressbar.variables.scss +3 -2
- package/styles/scss/components/radio/_radio.scss +19 -14
- package/styles/scss/components/rating/_rating.scss +41 -22
- package/styles/scss/components/rating/_rating.variables.scss +5 -5
- package/styles/scss/components/scrollspy/_scrollspy.scss +30 -13
- package/styles/scss/components/scrollspy/_scrollspy.variables.scss +2 -1
- package/styles/scss/components/select/_select.scss +232 -166
- package/styles/scss/components/select/_select.variables.scss +15 -15
- package/styles/scss/components/separator/_separator.scss +2 -1
- package/styles/scss/components/sidenav/_sidenav.scss +208 -135
- package/styles/scss/components/sidenav/_sidenav.variables.scss +19 -20
- package/styles/scss/components/skip-links/_skip-links.scss +31 -16
- package/styles/scss/components/skip-links/_skip-links.variables.scss +6 -6
- package/styles/scss/components/slider/_slider.scss +11 -10
- package/styles/scss/components/slider/_slider.variables.scss +8 -8
- package/styles/scss/components/speechbubble/_speechbubble.scss +50 -30
- package/styles/scss/components/speechbubble/_speechbubble.variables.scss +4 -2
- package/styles/scss/components/spinner/_spinner.scss +34 -29
- package/styles/scss/components/stepper/_stepper.mixins.scss +111 -151
- package/styles/scss/components/stepper/_stepper.scss +163 -69
- package/styles/scss/components/stepper/_stepper.variables.scss +23 -17
- package/styles/scss/components/table/_advancedtables.scss +50 -31
- package/styles/scss/components/table/_table.variables.scss +3 -2
- package/styles/scss/components/tabs/_tabs.scss +98 -49
- package/styles/scss/components/tabs/_tabs.variables.scss +11 -10
- package/styles/scss/components/toast/_toast.scss +136 -68
- package/styles/scss/components/toast/_toast.variables.scss +4 -4
- package/styles/scss/components/toggle/_toggle.scss +90 -44
- package/styles/scss/components/toggle/_toggle.variables.scss +7 -5
- package/styles/scss/components/typeahead/_typeahead.scss +18 -8
- package/styles/scss/components/typeahead/_typeahead.variables.scss +1 -1
- package/styles/scss/df-styles-namespace.scss +8 -11
- package/styles/scss/df-styles.scss +6 -3
- package/styles/scss/themes/brand2023/_variables.scss +585 -0
- package/styles/scss/utilities/_common.utilities.scss +112 -32
- package/assets/fonts/amadeus-light/amadeus-light.svg +0 -8658
- package/assets/fonts/amadeus-light/amadeus-light.ttf +0 -0
- package/assets/fonts/amadeus-light/amadeus-light.woff +0 -0
- package/assets/fonts/amadeus-light/amadeus-light.woff2 +0 -0
- package/assets/icon-amadeus.svg +0 -1
- package/schematics/migrations/15_0_0/remove-ngx-slider/index.js.map +0 -1
- package/schematics/migrations/helpers.js.map +0 -1
- package/schematics/migrations/utils/project_tsconfig_paths.js.map +0 -1
- package/schematics/migrations/utils/typescript/compiler_host.js.map +0 -1
- package/schematics/migrations/utils/typescript/parse_tsconfig.js.map +0 -1
- package/schematics/ng-add/index.js.map +0 -1
- package/schematics/ng-add/schema.js.map +0 -1
- package/styles/scss/components/tooltip/_tooltip.scss +0 -3
- package/styles/scss/components/tooltip/_tooltip.variables.scss +0 -5
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
4
|
+
const project_tsconfig_paths_1 = require("../../utils/project_tsconfig_paths");
|
|
5
|
+
const compiler_host_1 = require("../../utils/typescript/compiler_host");
|
|
6
|
+
const style_updater_1 = require("../../utils/style-updater");
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const removed = JSON.parse((0, fs_1.readFileSync)(__dirname + '/files/removed.json', { encoding: 'UTF-8' }));
|
|
9
|
+
const removedSet = new Set();
|
|
10
|
+
for (const removedKey of removed) {
|
|
11
|
+
removedSet.add(removedKey);
|
|
12
|
+
}
|
|
13
|
+
const renames = JSON.parse((0, fs_1.readFileSync)(__dirname + '/files/renames.json', { encoding: 'UTF-8' }));
|
|
14
|
+
const renameMap = new Map();
|
|
15
|
+
for (const rename of renames) {
|
|
16
|
+
renameMap.set(rename.from, rename.to);
|
|
17
|
+
}
|
|
18
|
+
const regex = /\$([a-z-]+)([^a-z-])/g;
|
|
19
|
+
/**
|
|
20
|
+
* This migration
|
|
21
|
+
*
|
|
22
|
+
* @returns the Rule to migrate the classes
|
|
23
|
+
*/
|
|
24
|
+
function scssVars() {
|
|
25
|
+
return async (tree, context) => {
|
|
26
|
+
const { buildPaths, testPaths } = await (0, project_tsconfig_paths_1.getProjectTsConfigPaths)(tree);
|
|
27
|
+
const basePath = process.cwd();
|
|
28
|
+
const allPaths = [...buildPaths, ...testPaths];
|
|
29
|
+
if (!allPaths.length) {
|
|
30
|
+
throw new schematics_1.SchematicsException('Could not find any tsconfig file. Cannot run the `NavbarUpdate` migration.');
|
|
31
|
+
}
|
|
32
|
+
const replaceStyleContent = (content, filePath) => {
|
|
33
|
+
return content.replace(regex, (match, grp1, grp2) => {
|
|
34
|
+
if (renameMap.has(grp1)) {
|
|
35
|
+
return `$${renameMap.get(grp1)}${grp2}`;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
if (removedSet.has(grp1)) {
|
|
39
|
+
context.logger.warn(`Sass var ${grp1} used in ${filePath} was removed in the new version of Design Factory.`);
|
|
40
|
+
}
|
|
41
|
+
return match;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
const templateUpdater = new style_updater_1.StyleUpdater(tree, replaceStyleContent);
|
|
46
|
+
for (const tsconfigPath of allPaths) {
|
|
47
|
+
const program = (0, compiler_host_1.createMigrationProgram)(tree, tsconfigPath, basePath);
|
|
48
|
+
const sourceFiles = program
|
|
49
|
+
.getSourceFiles()
|
|
50
|
+
.filter((sourceFile) => (0, compiler_host_1.canMigrateFile)(basePath, sourceFile, program));
|
|
51
|
+
for (const sourceFile of sourceFiles) {
|
|
52
|
+
templateUpdater.update(sourceFile, program.getTypeChecker());
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
exports.default = scssVars;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Rule } from '@angular-devkit/schematics';
|
|
2
|
+
/**
|
|
3
|
+
* This migration migrates css classes of the stepper that were renamed as of DF 16.
|
|
4
|
+
* This migrates:
|
|
5
|
+
* - any element that contains the class df-stepper-step-600 into df-stepper-step-future
|
|
6
|
+
* - any element that contains the class df-stepper-outline-number-400 into df-stepper-outline-number-future
|
|
7
|
+
* - any element that contains the class df-stepper-step-brown into df-stepper-step-warning
|
|
8
|
+
* - any element that contains the class df-stepper-step-green into df-stepper-step-completed
|
|
9
|
+
* - any element that contains the class df-stepper-step-primary into df-stepper-step-current
|
|
10
|
+
*
|
|
11
|
+
* @returns the Rule to migrate the classes
|
|
12
|
+
*/
|
|
13
|
+
export default function stepperClassesUpdate(): Rule;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
4
|
+
const project_tsconfig_paths_1 = require("../../utils/project_tsconfig_paths");
|
|
5
|
+
const compiler_host_1 = require("../../utils/typescript/compiler_host");
|
|
6
|
+
const template_updater_1 = require("../../utils/template-updater");
|
|
7
|
+
const colorMapping = {
|
|
8
|
+
'400': 'future',
|
|
9
|
+
'600': 'future',
|
|
10
|
+
brown: 'warning',
|
|
11
|
+
green: 'completed',
|
|
12
|
+
primary: 'current'
|
|
13
|
+
};
|
|
14
|
+
const stepperStepMapping = {};
|
|
15
|
+
for (const key of Object.keys(colorMapping)) {
|
|
16
|
+
const replaced = colorMapping[key];
|
|
17
|
+
stepperStepMapping[`df-stepper-step-${key}`] = `df-stepper-step-${replaced}`;
|
|
18
|
+
stepperStepMapping[`df-stepper-outline-number-${key}`] = `df-stepper-outline-number-${replaced}`;
|
|
19
|
+
stepperStepMapping[`df-stepper-number-${key}`] = `df-stepper-number-${replaced}`;
|
|
20
|
+
}
|
|
21
|
+
const updates = Object.keys(stepperStepMapping).map((key) => ({
|
|
22
|
+
key,
|
|
23
|
+
regex: new RegExp(`(<[a-z]+\\s[^>]*\\sclass="|<[a-z]+\\sclass=")([^"]*)${key}([^"]*")`, 'g'),
|
|
24
|
+
replacement: stepperStepMapping[key]
|
|
25
|
+
}));
|
|
26
|
+
function replaceHtmlContent(content) {
|
|
27
|
+
for (const update of updates) {
|
|
28
|
+
content = content.replace(update.regex, (_match, g1, g2, g3) => `${g1}${g2}${stepperStepMapping[update.key]}${g3}`);
|
|
29
|
+
}
|
|
30
|
+
return content;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* This migration migrates css classes of the stepper that were renamed as of DF 16.
|
|
34
|
+
* This migrates:
|
|
35
|
+
* - any element that contains the class df-stepper-step-600 into df-stepper-step-future
|
|
36
|
+
* - any element that contains the class df-stepper-outline-number-400 into df-stepper-outline-number-future
|
|
37
|
+
* - any element that contains the class df-stepper-step-brown into df-stepper-step-warning
|
|
38
|
+
* - any element that contains the class df-stepper-step-green into df-stepper-step-completed
|
|
39
|
+
* - any element that contains the class df-stepper-step-primary into df-stepper-step-current
|
|
40
|
+
*
|
|
41
|
+
* @returns the Rule to migrate the classes
|
|
42
|
+
*/
|
|
43
|
+
function stepperClassesUpdate() {
|
|
44
|
+
return async (tree) => {
|
|
45
|
+
const { buildPaths, testPaths } = await (0, project_tsconfig_paths_1.getProjectTsConfigPaths)(tree);
|
|
46
|
+
const basePath = process.cwd();
|
|
47
|
+
const allPaths = [...buildPaths, ...testPaths];
|
|
48
|
+
if (!allPaths.length) {
|
|
49
|
+
throw new schematics_1.SchematicsException('Could not find any tsconfig file. Cannot run the `NavbarUpdate` migration.');
|
|
50
|
+
}
|
|
51
|
+
const templateUpdater = new template_updater_1.TemplateUpdater(tree, replaceHtmlContent);
|
|
52
|
+
for (const tsconfigPath of allPaths) {
|
|
53
|
+
const program = (0, compiler_host_1.createMigrationProgram)(tree, tsconfigPath, basePath);
|
|
54
|
+
const sourceFiles = program
|
|
55
|
+
.getSourceFiles()
|
|
56
|
+
.filter((sourceFile) => (0, compiler_host_1.canMigrateFile)(basePath, sourceFile, program));
|
|
57
|
+
for (const sourceFile of sourceFiles) {
|
|
58
|
+
templateUpdater.update(sourceFile, program.getTypeChecker());
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
exports.default = stepperClassesUpdate;
|
|
@@ -5,6 +5,28 @@
|
|
|
5
5
|
"description": "As of Design Factory version 15, ngx-slider is included as part of the library.",
|
|
6
6
|
"version": "15.0.0",
|
|
7
7
|
"factory": "./15_0_0/remove-ngx-slider"
|
|
8
|
+
},
|
|
9
|
+
"revert-to-old-brand": {
|
|
10
|
+
"description": "Continue with the old brand. As of Design Factory version 16, the new amadeus branding is applied by default. Launch this migration if you wish to keep using the old branding.",
|
|
11
|
+
"version": "16.0.0",
|
|
12
|
+
"factory": "./16_0_0/revert-to-old-brand",
|
|
13
|
+
"optional": true
|
|
14
|
+
},
|
|
15
|
+
"navbar-logo-dark": {
|
|
16
|
+
"description": "Migrate to the new brand for the navbar and amadeus logo. As of Design Factory version 16, the new amadeus branding is applied by default. This updates the navbar and amadeus logo to the new look.",
|
|
17
|
+
"version": "16.0.0",
|
|
18
|
+
"factory": "./16_0_0/navbar-logo-dark",
|
|
19
|
+
"optional": true
|
|
20
|
+
},
|
|
21
|
+
"scss-var": {
|
|
22
|
+
"description": "Migrates scss vars as best as possible.",
|
|
23
|
+
"version": "16.0.0",
|
|
24
|
+
"factory": "./16_0_0/scss-var"
|
|
25
|
+
},
|
|
26
|
+
"stepper-classes": {
|
|
27
|
+
"description": "As of Design Factory version 16, some css classes for the stepper have been renamed.",
|
|
28
|
+
"version": "16.0.0",
|
|
29
|
+
"factory": "./16_0_0/stepper-classes"
|
|
8
30
|
}
|
|
9
31
|
}
|
|
10
|
-
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
import * as ts from 'typescript';
|
|
9
|
+
import { LineAndCharacter } from './typescript/line-mappings';
|
|
10
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
11
|
+
export interface ResolvedResource {
|
|
12
|
+
/** Class declaration that contains this resource. */
|
|
13
|
+
container: ts.ClassDeclaration | null;
|
|
14
|
+
/** File content of the given template. */
|
|
15
|
+
content: string;
|
|
16
|
+
/** Start offset of the resource content (e.g. in the inline source file) */
|
|
17
|
+
start: number;
|
|
18
|
+
/** Whether the given resource is inline or not. */
|
|
19
|
+
inline: boolean;
|
|
20
|
+
/** Path to the file that contains this resource. */
|
|
21
|
+
filePath: string;
|
|
22
|
+
/**
|
|
23
|
+
* Gets the character and line of a given position index in the resource.
|
|
24
|
+
* If the resource is declared inline within a TypeScript source file, the line and
|
|
25
|
+
* character are based on the full source file content.
|
|
26
|
+
*/
|
|
27
|
+
getCharacterAndLineOfPosition: (pos: number) => LineAndCharacter;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Collector that can be used to find Angular templates and stylesheets referenced within
|
|
31
|
+
* given TypeScript source files (inline or external referenced files)
|
|
32
|
+
*/
|
|
33
|
+
export declare class ComponentResourceCollector {
|
|
34
|
+
typeChecker: ts.TypeChecker;
|
|
35
|
+
private tree;
|
|
36
|
+
resolvedTemplates: ResolvedResource[];
|
|
37
|
+
resolvedStylesheets: ResolvedResource[];
|
|
38
|
+
constructor(typeChecker: ts.TypeChecker, tree: Tree);
|
|
39
|
+
visitNode(node: ts.Node): void;
|
|
40
|
+
private _visitClassDeclaration;
|
|
41
|
+
/** Resolves an external stylesheet by reading its content and computing line mappings. */
|
|
42
|
+
resolveExternalStylesheet(filePath: string, container: ts.ClassDeclaration | null): ResolvedResource | null;
|
|
43
|
+
private _trackExternalStylesheet;
|
|
44
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ComponentResourceCollector = void 0;
|
|
11
|
+
const path_1 = require("path");
|
|
12
|
+
const core_1 = require("@angular-devkit/core");
|
|
13
|
+
const ts = require("typescript");
|
|
14
|
+
const decorators_1 = require("./typescript/decorators");
|
|
15
|
+
const functions_1 = require("./typescript/functions");
|
|
16
|
+
const line_mappings_1 = require("./typescript/line-mappings");
|
|
17
|
+
const property_name_1 = require("./typescript/property-name");
|
|
18
|
+
/**
|
|
19
|
+
* Collector that can be used to find Angular templates and stylesheets referenced within
|
|
20
|
+
* given TypeScript source files (inline or external referenced files)
|
|
21
|
+
*/
|
|
22
|
+
class ComponentResourceCollector {
|
|
23
|
+
constructor(typeChecker, tree) {
|
|
24
|
+
this.typeChecker = typeChecker;
|
|
25
|
+
this.tree = tree;
|
|
26
|
+
this.resolvedTemplates = [];
|
|
27
|
+
this.resolvedStylesheets = [];
|
|
28
|
+
}
|
|
29
|
+
visitNode(node) {
|
|
30
|
+
if (node.kind === ts.SyntaxKind.ClassDeclaration) {
|
|
31
|
+
this._visitClassDeclaration(node);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
_visitClassDeclaration(node) {
|
|
35
|
+
const decorators = ts.getDecorators(node);
|
|
36
|
+
if (!decorators || !decorators.length) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const ngDecorators = (0, decorators_1.getAngularDecorators)(this.typeChecker, decorators);
|
|
40
|
+
const componentDecorator = ngDecorators.find((dec) => dec.name === 'Component');
|
|
41
|
+
// In case no "@Component" decorator could be found on the current class, skip.
|
|
42
|
+
if (!componentDecorator) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const decoratorCall = componentDecorator.node.expression;
|
|
46
|
+
// In case the component decorator call is not valid, skip this class declaration.
|
|
47
|
+
if (decoratorCall.arguments.length !== 1) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const componentMetadata = (0, functions_1.unwrapExpression)(decoratorCall.arguments[0]);
|
|
51
|
+
// Ensure that the component metadata is an object literal expression.
|
|
52
|
+
if (!ts.isObjectLiteralExpression(componentMetadata)) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const sourceFile = node.getSourceFile();
|
|
56
|
+
const absFilePath = (0, core_1.normalize)(path_1.posix.resolve('/', (0, core_1.normalize)(sourceFile.fileName)));
|
|
57
|
+
const filePath = path_1.posix.relative(process.cwd(), absFilePath);
|
|
58
|
+
const sourceFileDirPath = (0, path_1.dirname)(sourceFile.fileName);
|
|
59
|
+
// Walk through all component metadata properties and determine the referenced
|
|
60
|
+
// HTML templates (either external or inline)
|
|
61
|
+
componentMetadata.properties.forEach((property) => {
|
|
62
|
+
if (!ts.isPropertyAssignment(property)) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const propertyName = (0, property_name_1.getPropertyNameText)(property.name);
|
|
66
|
+
if (propertyName === 'styles') {
|
|
67
|
+
const elements = ts.isArrayLiteralExpression(property.initializer)
|
|
68
|
+
? property.initializer.elements
|
|
69
|
+
: [property.initializer];
|
|
70
|
+
elements.forEach((el) => {
|
|
71
|
+
if (ts.isStringLiteralLike(el)) {
|
|
72
|
+
// Need to add an offset of one to the start because the template quotes are
|
|
73
|
+
// not part of the template content.
|
|
74
|
+
const templateStartIdx = el.getStart() + 1;
|
|
75
|
+
const content = stripBom(el.text);
|
|
76
|
+
this.resolvedStylesheets.push({
|
|
77
|
+
filePath,
|
|
78
|
+
container: node,
|
|
79
|
+
content,
|
|
80
|
+
inline: true,
|
|
81
|
+
start: templateStartIdx,
|
|
82
|
+
getCharacterAndLineOfPosition: (pos) => ts.getLineAndCharacterOfPosition(sourceFile, pos + templateStartIdx)
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
// In case there is an inline template specified, ensure that the value is statically
|
|
88
|
+
// analyzable by checking if the initializer is a string literal-like node.
|
|
89
|
+
if (propertyName === 'template' && ts.isStringLiteralLike(property.initializer)) {
|
|
90
|
+
// Need to add an offset of one to the start because the template quotes are
|
|
91
|
+
// not part of the template content.
|
|
92
|
+
const templateStartIdx = property.initializer.getStart() + 1;
|
|
93
|
+
this.resolvedTemplates.push({
|
|
94
|
+
filePath,
|
|
95
|
+
container: node,
|
|
96
|
+
content: property.initializer.text,
|
|
97
|
+
inline: true,
|
|
98
|
+
start: templateStartIdx,
|
|
99
|
+
getCharacterAndLineOfPosition: (pos) => ts.getLineAndCharacterOfPosition(sourceFile, pos + templateStartIdx)
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
if (propertyName === 'styleUrls' && ts.isArrayLiteralExpression(property.initializer)) {
|
|
103
|
+
property.initializer.elements.forEach((el) => {
|
|
104
|
+
if (ts.isStringLiteralLike(el)) {
|
|
105
|
+
this._trackExternalStylesheet(sourceFileDirPath, el, node);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
if (propertyName === 'styleUrl' && ts.isStringLiteralLike(property.initializer)) {
|
|
110
|
+
this._trackExternalStylesheet(sourceFileDirPath, property.initializer, node);
|
|
111
|
+
}
|
|
112
|
+
if (propertyName === 'templateUrl' && ts.isStringLiteralLike(property.initializer)) {
|
|
113
|
+
const templateUrl = property.initializer.text;
|
|
114
|
+
const absTemplatePath = (0, core_1.normalize)(path_1.posix.resolve('/', (0, core_1.normalize)(sourceFileDirPath), (0, core_1.normalize)(templateUrl)));
|
|
115
|
+
const templatePath = path_1.posix.relative(process.cwd(), absTemplatePath);
|
|
116
|
+
// In case the template does not exist in the file system, skip this
|
|
117
|
+
// external template.
|
|
118
|
+
if (!this.tree.exists(templatePath)) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const fileContent = stripBom(this.tree.readText(templatePath) || '');
|
|
122
|
+
if (fileContent) {
|
|
123
|
+
const lineStartsMap = (0, line_mappings_1.computeLineStartsMap)(fileContent);
|
|
124
|
+
this.resolvedTemplates.push({
|
|
125
|
+
filePath: templatePath,
|
|
126
|
+
container: node,
|
|
127
|
+
content: fileContent,
|
|
128
|
+
inline: false,
|
|
129
|
+
start: 0,
|
|
130
|
+
getCharacterAndLineOfPosition: (p) => (0, line_mappings_1.getLineAndCharacterFromPosition)(lineStartsMap, p)
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
/** Resolves an external stylesheet by reading its content and computing line mappings. */
|
|
137
|
+
resolveExternalStylesheet(filePath, container) {
|
|
138
|
+
// Strip the BOM to avoid issues with the Sass compiler. See:
|
|
139
|
+
// https://github.com/angular/components/issues/24227#issuecomment-1200934258
|
|
140
|
+
const fileContent = stripBom(this.tree.readText(filePath) || '');
|
|
141
|
+
if (!fileContent) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
const lineStartsMap = (0, line_mappings_1.computeLineStartsMap)(fileContent);
|
|
145
|
+
return {
|
|
146
|
+
filePath: filePath,
|
|
147
|
+
container: container,
|
|
148
|
+
content: fileContent,
|
|
149
|
+
inline: false,
|
|
150
|
+
start: 0,
|
|
151
|
+
getCharacterAndLineOfPosition: (pos) => (0, line_mappings_1.getLineAndCharacterFromPosition)(lineStartsMap, pos)
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
_trackExternalStylesheet(sourceFileDirPath, node, container) {
|
|
155
|
+
const stylesheetPath = path_1.posix.relative(process.cwd(), (0, core_1.normalize)(path_1.posix.resolve('/', (0, core_1.normalize)(sourceFileDirPath), (0, core_1.normalize)(node.text))));
|
|
156
|
+
const stylesheet = this.resolveExternalStylesheet(stylesheetPath, container);
|
|
157
|
+
if (stylesheet) {
|
|
158
|
+
this.resolvedStylesheets.push(stylesheet);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
exports.ComponentResourceCollector = ComponentResourceCollector;
|
|
163
|
+
/** Strips the BOM from a string. */
|
|
164
|
+
function stripBom(content) {
|
|
165
|
+
return content.replace(/\uFEFF/g, '');
|
|
166
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
2
|
+
import * as ts from 'typescript';
|
|
3
|
+
export declare class StyleUpdater {
|
|
4
|
+
private tree;
|
|
5
|
+
private replaceContent;
|
|
6
|
+
private _analyzedFiles;
|
|
7
|
+
constructor(tree: Tree, replaceContent: (arg: string, filePath: string) => string);
|
|
8
|
+
update(file: ts.SourceFile, typeChecker: ts.TypeChecker): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StyleUpdater = void 0;
|
|
4
|
+
const core_1 = require("@angular-devkit/core");
|
|
5
|
+
const component_resource_collector_1 = require("./component-resource-collector");
|
|
6
|
+
const ts = require("typescript");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
class StyleUpdater {
|
|
9
|
+
constructor(tree, replaceContent) {
|
|
10
|
+
this.tree = tree;
|
|
11
|
+
this.replaceContent = replaceContent;
|
|
12
|
+
this._analyzedFiles = new Set();
|
|
13
|
+
}
|
|
14
|
+
update(file, typeChecker) {
|
|
15
|
+
if (this._analyzedFiles.has((0, core_1.normalize)(path_1.posix.resolve(file.fileName)))) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const resourceCollector = new component_resource_collector_1.ComponentResourceCollector(typeChecker, this.tree);
|
|
19
|
+
const visitNodeAndCollectResources = (node) => {
|
|
20
|
+
ts.forEachChild(node, visitNodeAndCollectResources);
|
|
21
|
+
resourceCollector.visitNode(node);
|
|
22
|
+
};
|
|
23
|
+
visitNodeAndCollectResources(file);
|
|
24
|
+
for (const styleSheet of resourceCollector.resolvedStylesheets) {
|
|
25
|
+
if (styleSheet.inline || !this._analyzedFiles.has(styleSheet.filePath)) {
|
|
26
|
+
const content = this.replaceContent(styleSheet.content, styleSheet.filePath);
|
|
27
|
+
if (content !== styleSheet.content) {
|
|
28
|
+
const recorder = this.tree.beginUpdate(styleSheet.filePath);
|
|
29
|
+
recorder.remove(styleSheet.start, styleSheet.content.length);
|
|
30
|
+
recorder.insertRight(styleSheet.start, content);
|
|
31
|
+
this.tree.commitUpdate(recorder);
|
|
32
|
+
}
|
|
33
|
+
this._analyzedFiles.add(styleSheet.filePath);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.StyleUpdater = StyleUpdater;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
2
|
+
import * as ts from 'typescript';
|
|
3
|
+
export declare class TemplateUpdater {
|
|
4
|
+
private tree;
|
|
5
|
+
private replaceContent;
|
|
6
|
+
private _analyzedFiles;
|
|
7
|
+
constructor(tree: Tree, replaceContent: (arg: string) => string);
|
|
8
|
+
update(file: ts.SourceFile, typeChecker: ts.TypeChecker): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TemplateUpdater = void 0;
|
|
4
|
+
const core_1 = require("@angular-devkit/core");
|
|
5
|
+
const component_resource_collector_1 = require("./component-resource-collector");
|
|
6
|
+
const ts = require("typescript");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
class TemplateUpdater {
|
|
9
|
+
constructor(tree, replaceContent) {
|
|
10
|
+
this.tree = tree;
|
|
11
|
+
this.replaceContent = replaceContent;
|
|
12
|
+
this._analyzedFiles = new Set();
|
|
13
|
+
}
|
|
14
|
+
update(file, typeChecker) {
|
|
15
|
+
if (this._analyzedFiles.has((0, core_1.normalize)(path_1.posix.resolve(file.fileName)))) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const resourceCollector = new component_resource_collector_1.ComponentResourceCollector(typeChecker, this.tree);
|
|
19
|
+
const visitNodeAndCollectResources = (node) => {
|
|
20
|
+
ts.forEachChild(node, visitNodeAndCollectResources);
|
|
21
|
+
resourceCollector.visitNode(node);
|
|
22
|
+
};
|
|
23
|
+
visitNodeAndCollectResources(file);
|
|
24
|
+
for (const template of resourceCollector.resolvedTemplates) {
|
|
25
|
+
if (template.inline || !this._analyzedFiles.has(template.filePath)) {
|
|
26
|
+
const content = this.replaceContent(template.content);
|
|
27
|
+
if (content !== template.content) {
|
|
28
|
+
const recorder = this.tree.beginUpdate(template.filePath);
|
|
29
|
+
recorder.remove(template.start, template.content.length);
|
|
30
|
+
recorder.insertRight(template.start, content);
|
|
31
|
+
this.tree.commitUpdate(recorder);
|
|
32
|
+
}
|
|
33
|
+
this._analyzedFiles.add(template.filePath);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.TemplateUpdater = TemplateUpdater;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
import * as ts from 'typescript';
|
|
9
|
+
import { Import } from './imports';
|
|
10
|
+
export type CallExpressionDecorator = ts.Decorator & {
|
|
11
|
+
expression: ts.CallExpression;
|
|
12
|
+
};
|
|
13
|
+
export interface NgDecorator {
|
|
14
|
+
name: string;
|
|
15
|
+
node: CallExpressionDecorator;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Gets all decorators which are imported from an Angular package
|
|
19
|
+
* (e.g. "@angular/core") from a list of decorators.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getAngularDecorators(typeChecker: ts.TypeChecker, decorators: readonly ts.Decorator[]): readonly NgDecorator[];
|
|
22
|
+
export declare function getCallDecoratorImport(typeChecker: ts.TypeChecker, decorator: ts.Decorator): Import | null;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.getCallDecoratorImport = exports.getAngularDecorators = void 0;
|
|
11
|
+
const ts = require("typescript");
|
|
12
|
+
const imports_1 = require("./imports");
|
|
13
|
+
/**
|
|
14
|
+
* Gets all decorators which are imported from an Angular package
|
|
15
|
+
* (e.g. "@angular/core") from a list of decorators.
|
|
16
|
+
*/
|
|
17
|
+
function getAngularDecorators(typeChecker, decorators) {
|
|
18
|
+
return decorators
|
|
19
|
+
.map((node) => ({ node, importData: getCallDecoratorImport(typeChecker, node) }))
|
|
20
|
+
.filter(({ importData }) => importData && importData.moduleName.startsWith('@angular/'))
|
|
21
|
+
.map(({ node, importData }) => ({
|
|
22
|
+
node: node,
|
|
23
|
+
name: importData.symbolName
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
exports.getAngularDecorators = getAngularDecorators;
|
|
27
|
+
function getCallDecoratorImport(typeChecker, decorator) {
|
|
28
|
+
if (!ts.isCallExpression(decorator.expression)) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const valueExpr = decorator.expression.expression;
|
|
32
|
+
let identifier = null;
|
|
33
|
+
if (ts.isIdentifier(valueExpr)) {
|
|
34
|
+
identifier = valueExpr;
|
|
35
|
+
}
|
|
36
|
+
else if (ts.isPropertyAccessExpression(valueExpr) && ts.isIdentifier(valueExpr.name)) {
|
|
37
|
+
identifier = valueExpr.name;
|
|
38
|
+
}
|
|
39
|
+
return identifier ? (0, imports_1.getImportOfIdentifier)(identifier, typeChecker) : null;
|
|
40
|
+
}
|
|
41
|
+
exports.getCallDecoratorImport = getCallDecoratorImport;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
import * as ts from 'typescript';
|
|
9
|
+
/**
|
|
10
|
+
* Unwraps a given expression TypeScript node. Expressions can be wrapped within multiple
|
|
11
|
+
* parentheses. e.g. "(((({exp}))))()". The function should return the TypeScript node
|
|
12
|
+
* referring to the inner expression. e.g "exp".
|
|
13
|
+
*/
|
|
14
|
+
export declare function unwrapExpression(node: ts.Expression | ts.ParenthesizedExpression): ts.Expression;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.unwrapExpression = void 0;
|
|
11
|
+
const ts = require("typescript");
|
|
12
|
+
/**
|
|
13
|
+
* Unwraps a given expression TypeScript node. Expressions can be wrapped within multiple
|
|
14
|
+
* parentheses. e.g. "(((({exp}))))()". The function should return the TypeScript node
|
|
15
|
+
* referring to the inner expression. e.g "exp".
|
|
16
|
+
*/
|
|
17
|
+
function unwrapExpression(node) {
|
|
18
|
+
return ts.isParenthesizedExpression(node) ? unwrapExpression(node.expression) : node;
|
|
19
|
+
}
|
|
20
|
+
exports.unwrapExpression = unwrapExpression;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
import * as ts from 'typescript';
|
|
9
|
+
/** Interface describing a resolved import. */
|
|
10
|
+
export interface Import {
|
|
11
|
+
/** Name of the imported symbol. */
|
|
12
|
+
symbolName: string;
|
|
13
|
+
/** Module name from which the symbol has been imported. */
|
|
14
|
+
moduleName: string;
|
|
15
|
+
}
|
|
16
|
+
/** Resolves the import of the specified identifier. */
|
|
17
|
+
export declare function getImportOfIdentifier(node: ts.Identifier, typeChecker: ts.TypeChecker): Import | null;
|