@design-factory/design-factory 20.0.0-next.1 → 20.0.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/design-factory-initial-branding.css +1 -1
  2. package/design-factory-initial-branding.scss +1 -1
  3. package/design-factory.css +2 -2
  4. package/fesm2022/design-factory-design-factory-tokens-style-dictionary.mjs +358 -0
  5. package/fesm2022/design-factory-design-factory-tokens-style-dictionary.mjs.map +1 -0
  6. package/fesm2022/design-factory.mjs +327 -417
  7. package/fesm2022/design-factory.mjs.map +1 -1
  8. package/index.d.ts +10 -50
  9. package/package.json +14 -2
  10. package/schematics/migrations/15_0_0/remove-ngx-slider/index.js +11 -5
  11. package/schematics/migrations/16_0_0/revert-to-old-brand/index.js +2 -2
  12. package/schematics/migrations/20_0_0/colors-new-branding/index.d.ts +14 -0
  13. package/schematics/migrations/20_0_0/colors-new-branding/index.js +108 -0
  14. package/schematics/migrations/20_0_0/navbar-toggler-logo-svg/index.js +6 -5
  15. package/schematics/migrations/20_0_0/spinner-new-branding/index.d.ts +7 -0
  16. package/schematics/migrations/20_0_0/spinner-new-branding/index.js +41 -0
  17. package/schematics/migrations/helpers.js +1 -1
  18. package/schematics/migrations/migration.json +12 -0
  19. package/schematics/migrations/utils/component-resource-collector.js +2 -2
  20. package/schematics/migrations/utils/project_tsconfig_paths.js +4 -0
  21. package/schematics/migrations/utils/style-updater.js +3 -1
  22. package/schematics/migrations/utils/template-updater.js +3 -1
  23. package/schematics/migrations/utils/typescript/compiler_host.js +6 -4
  24. package/schematics/ng-add/index.js +3 -6
  25. package/styles/scss/_common.root.scss +20 -3
  26. package/styles/scss/_common.scss +1 -1
  27. package/styles/scss/bootstrap/_utilities-override.scss +14 -8
  28. package/styles/scss/bootstrap/_variables.scss +2 -2
  29. package/styles/scss/components/alert/_alert.scss +23 -11
  30. package/styles/scss/components/badge/_badge.mixins.scss +2 -4
  31. package/styles/scss/components/badge/_badge.scss +87 -23
  32. package/styles/scss/components/button/_button.scss +382 -75
  33. package/styles/scss/components/button/_button.utils.scss +20 -1
  34. package/styles/scss/components/button/_button_container.scss +22 -5
  35. package/styles/scss/components/card/_card.scss +28 -10
  36. package/styles/scss/components/checkbox/_checkbox.scss +2 -1
  37. package/styles/scss/components/dropdown/_dropdown.scss +17 -0
  38. package/styles/scss/components/fonts/_font-faces.mixins.scss +108 -54
  39. package/styles/scss/components/inputs/_inputs.root.scss +1 -1
  40. package/styles/scss/components/inputs/_inputs.scss +7 -1
  41. package/styles/scss/components/link/_link.mixins.scss +7 -3
  42. package/styles/scss/components/link/_link.scss +6 -0
  43. package/styles/scss/components/media/_media.scss +4 -0
  44. package/styles/scss/components/media/_media.variables.scss +1 -0
  45. package/styles/scss/components/modal/_modal.scss +38 -11
  46. package/styles/scss/components/navbar/_navbar.scss +12 -0
  47. package/styles/scss/components/pagination/_pagination_container.scss +1 -1
  48. package/styles/scss/components/progressbar/_progressbar.variables.scss +13 -4
  49. package/styles/scss/components/rating/_rating.scss +3 -3
  50. package/styles/scss/components/rating/_rating.variables.scss +1 -1
  51. package/styles/scss/components/select/_select.scss +14 -19
  52. package/styles/scss/components/separator/_separator.variables.scss +1 -1
  53. package/styles/scss/components/sidenav/_sidenav.scss +1 -1
  54. package/styles/scss/components/sidenav/_sidenav.variables.scss +6 -4
  55. package/styles/scss/components/spinner/_spinner.scss +14 -0
  56. package/styles/scss/components/spinner/_spinner.variables.scss +7 -4
  57. package/styles/scss/components/tabs/_tabs.scss +3 -0
  58. package/styles/scss/components/toast/_toast.scss +21 -30
  59. package/styles/scss/components/tooltip/_tooltip_container.scss +17 -13
  60. package/styles/scss/themes/brand2023/_variables.scss +50 -26
  61. package/styles/scss/themes/brand2023/tokens/_mapping.gen.scss +156 -186
  62. package/styles/scss/themes/brand2023/tokens/_root.gen.scss +1708 -0
  63. package/styles/scss/themes/brand2023/tokens/_sass-vars.gen.scss +1467 -0
  64. package/styles/scss/utilities/_common.utilities.scss +3 -10
  65. package/styles/scss/utilities/_rgb.scss +10 -0
  66. package/tokens/style-dictionary/index.d.ts +60 -0
  67. package/styles/scss/themes/brand2023/tokens/_figma.gen.scss +0 -3028
package/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { AfterViewInit, ElementRef, Renderer2, OnInit, OnDestroy, AfterViewChecked, DoCheck, ComponentRef, EmbeddedViewRef, TemplateRef, Type, OnChanges, EventEmitter, ChangeDetectorRef, NgZone, SimpleChanges, AfterContentInit, InjectionToken } from '@angular/core';
3
3
  import * as i2 from '@ng-bootstrap/ng-bootstrap';
4
- import { NgbDate, NgbDropdown, NgbDatepicker, NgbModalOptions, NgbModalRef, NgbPopoverConfig } from '@ng-bootstrap/ng-bootstrap';
4
+ import { NgbDate, NgbDropdown, NgbDatepicker, NgbPopoverConfig } from '@ng-bootstrap/ng-bootstrap';
5
5
  import { Observable } from 'rxjs';
6
6
  import { ControlValueAccessor } from '@angular/forms';
7
7
  import * as i4 from '@ng-select/ng-select';
@@ -210,18 +210,6 @@ declare class DfIconModule {
210
210
  static ɵinj: i0.ɵɵInjectorDeclaration<DfIconModule>;
211
211
  }
212
212
 
213
- /**
214
- * @deprecated `DfModalService` is deprecated, use `NgbModal` from ng-bootstrap instead.
215
- * Please note that `NgbModal` adds 'modal-open' class to the body while DfModalService adds 'df-modal-open' class. Both classes include the same styles, but you may need to update your stylesheets if you were overriding 'df-modal-open' in your application.
216
- */
217
- declare class DfModalService {
218
- private readonly renderer;
219
- private readonly modalService;
220
- open(content: any, options?: NgbModalOptions): NgbModalRef;
221
- static ɵfac: i0.ɵɵFactoryDeclaration<DfModalService, never>;
222
- static ɵprov: i0.ɵɵInjectableDeclaration<DfModalService>;
223
- }
224
-
225
213
  declare class DfPopoverModule {
226
214
  static ɵfac: i0.ɵɵFactoryDeclaration<DfPopoverModule, never>;
227
215
  static ɵmod: i0.ɵɵNgModuleDeclaration<DfPopoverModule, never, never, [typeof i2.NgbPopoverModule]>;
@@ -534,7 +522,7 @@ declare class Options {
534
522
  in the stepsArray option. */
535
523
  getLegend?: GetLegendFunction;
536
524
  /** Use to display a custom legend of a stepItem from stepsArray.
537
- It will be the same as getLegend but for stepsArray. */
525
+ It will be the same as getLegend but for stepsArray. */
538
526
  getStepLegend?: GetStepLegendFunction;
539
527
  /** If you want to display a slider with non linear/number steps.
540
528
  Just pass an array with each slider value and that's it; the floor, ceil and step settings
@@ -790,7 +778,7 @@ declare class SliderComponent implements OnInit, AfterViewInit, OnChanges, OnDes
790
778
  registerOnTouched(onTouchedCallback: any): void;
791
779
  setDisabledState(isDisabled: boolean): void;
792
780
  setAriaLabel(ariaLabel: string): void;
793
- onResize(event: any): void;
781
+ onResize(): void;
794
782
  private subscribeInputModelChangeSubject;
795
783
  private subscribeOutputModelChangeSubject;
796
784
  private subscribeResizeObserver;
@@ -1227,34 +1215,6 @@ declare class DfManageSideNavDirective implements AfterViewChecked {
1227
1215
  static ɵdir: i0.ɵɵDirectiveDeclaration<DfManageSideNavDirective, "[dfManageSideNav]", never, {}, {}, never, never, true, never>;
1228
1216
  }
1229
1217
 
1230
- /**
1231
- * The directive to catch focusin event and put the focus at a defined position in the page
1232
- *
1233
- * @deprecated 19.1.0 use {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inert inert} instead
1234
- * @since 9.1.0
1235
- */
1236
- declare class DfExcludeTrapDirective implements OnDestroy, OnInit {
1237
- private subscription;
1238
- private subscriptionInput?;
1239
- /**
1240
- * The CSS selector used to get the element to put the focus when catched
1241
- *
1242
- */
1243
- readonly dfExcludeTrapSelector: i0.InputSignal<string>;
1244
- /**
1245
- * The Observable to enable or disable the ExcludeTrap
1246
- * If `True` the excludeTrap will work
1247
- */
1248
- readonly dfExcludeTrap: i0.InputSignal<Observable<boolean>>;
1249
- private readonly zone;
1250
- private readonly element;
1251
- init(): void;
1252
- ngOnInit(): void;
1253
- ngOnDestroy(): void;
1254
- static ɵfac: i0.ɵɵFactoryDeclaration<DfExcludeTrapDirective, never>;
1255
- static ɵdir: i0.ɵɵDirectiveDeclaration<DfExcludeTrapDirective, "[dfExcludeTrap]", never, { "dfExcludeTrapSelector": { "alias": "dfExcludeTrapSelector"; "required": false; "isSignal": true; }; "dfExcludeTrap": { "alias": "dfExcludeTrap"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
1256
- }
1257
-
1258
1218
  declare class DfManageNavSelectDirective implements OnInit {
1259
1219
  private direction;
1260
1220
  private readonly select;
@@ -1263,7 +1223,7 @@ declare class DfManageNavSelectDirective implements OnInit {
1263
1223
  private readonly renderer;
1264
1224
  ngOnInit(): void;
1265
1225
  handleKeyDown(event: any): void;
1266
- handleKeyDownBackspace(event: any): void;
1226
+ handleKeyDownBackspace(): void;
1267
1227
  handleKeyDownRight(event: any): void;
1268
1228
  arrowRightInnerHandler(event: any): void;
1269
1229
  arrowLeftInnerHandler(event: any): void;
@@ -1513,7 +1473,7 @@ declare class DfTooltipTruncateDirective implements OnInit, DoCheck {
1513
1473
  * The direction considered when detecting overflow, can be 'x', 'y' or ''.
1514
1474
  * @defaultValue ''
1515
1475
  */
1516
- readonly dfTooltipTruncate: i0.InputSignal<"" | "x" | "y">;
1476
+ readonly dfTooltipTruncate: i0.InputSignal<"" | "y" | "x">;
1517
1477
  ngOnInit(): void;
1518
1478
  ngDoCheck(): void;
1519
1479
  static ɵfac: i0.ɵɵFactoryDeclaration<DfTooltipTruncateDirective, never>;
@@ -1579,7 +1539,7 @@ declare class DfSideNavCollapseModule {
1579
1539
 
1580
1540
  declare class DfSideNavModule {
1581
1541
  static ɵfac: i0.ɵɵFactoryDeclaration<DfSideNavModule, never>;
1582
- static ɵmod: i0.ɵɵNgModuleDeclaration<DfSideNavModule, never, [typeof DfManageSideNavDirective, typeof DfSideNavComponent, typeof DfSideNavHeaderDirective, typeof DfExcludeTrapDirective, typeof DfSideNavIconDirective, typeof DfSideNavItemDirective], [typeof DfManageSideNavDirective, typeof DfSideNavComponent, typeof DfSideNavHeaderDirective, typeof DfExcludeTrapDirective, typeof DfSideNavIconDirective, typeof DfSideNavItemDirective, typeof DfSideNavCollapseModule, typeof DfMediaModule]>;
1542
+ static ɵmod: i0.ɵɵNgModuleDeclaration<DfSideNavModule, never, [typeof DfManageSideNavDirective, typeof DfSideNavComponent, typeof DfSideNavHeaderDirective, typeof DfSideNavIconDirective, typeof DfSideNavItemDirective], [typeof DfManageSideNavDirective, typeof DfSideNavComponent, typeof DfSideNavHeaderDirective, typeof DfSideNavIconDirective, typeof DfSideNavItemDirective, typeof DfSideNavCollapseModule, typeof DfMediaModule]>;
1583
1543
  static ɵinj: i0.ɵɵInjectorDeclaration<DfSideNavModule>;
1584
1544
  }
1585
1545
 
@@ -1643,9 +1603,9 @@ declare class DfBreakpoints {
1643
1603
  private readonly _breakPointsVar;
1644
1604
  private readonly platformID;
1645
1605
  constructor();
1646
- get breakPoints$(): Observable<{} | null>;
1606
+ get breakPoints$(): Observable<Record<string, string> | null>;
1647
1607
  private initBreakpoints;
1648
- generate(sizes: any[][]): {};
1608
+ generate(sizes: any[][]): Record<string, string>;
1649
1609
  static ɵfac: i0.ɵɵFactoryDeclaration<DfBreakpoints, never>;
1650
1610
  static ɵprov: i0.ɵɵInjectableDeclaration<DfBreakpoints>;
1651
1611
  }
@@ -1762,7 +1722,7 @@ declare class DfWavesOfProgressDirective {
1762
1722
  * },
1763
1723
  * ...]
1764
1724
  */
1765
- readonly dfWavesOfProgress: i0.InputSignal<"arrowRight" | "circleDiagonal" | "circleUp" | "arrowUp">;
1725
+ readonly dfWavesOfProgress: i0.InputSignal<"circleDiagonal" | "circleUp" | "arrowRight" | "arrowUp">;
1766
1726
  private readonly http;
1767
1727
  elementRef: ElementRef<any>;
1768
1728
  private readonly platformId;
@@ -1799,5 +1759,5 @@ declare class DfAmadeusLogoComponent {
1799
1759
  static ɵcmp: i0.ɵɵComponentDeclaration<DfAmadeusLogoComponent, "df-amadeus-logo", never, { "svgClass": { "alias": "svgClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
1800
1760
  }
1801
1761
 
1802
- export { BREAKPOINTS_VARS, ChangeContext, DF_BREAKPOINTS_VAR_DEFAULT, DfAccessibilityModule, DfAdvancedCardModule, DfAdvancedInputModule, DfAlertModule, DfAmadeusIconComponent, DfAmadeusLogoComponent, DfBreakpoints, DfDatePickerModule, DfDatepickerRangeDirective, DfDatepickerRangeService, DfDefaultSpinnerComponent, DfDirectionDetectionService, DfExcludeTrapDirective, DfFooterModule, DfIconModule, DfIfMediaDirective, DfInputIconDirective, DfInsertIconDirective, DfInsertIconModule, DfManageBadgeEventsDirective, DfManageCardSelectionDirective, DfManageNavSelectDirective, DfManageSideNavDirective, DfMedia, DfMediaModule, DfMediaObserver, DfMediaQuery, DfModalService, DfModule, DfNavItemType, DfOptionHighlightDirective, DfPopoverConfig, DfPopoverModule, DfProgressIndicatorBackdropComponent, DfProgressIndicatorContainerComponent, DfProgressIndicatorContentPosition, DfProgressIndicatorContentProgressBar, DfProgressIndicatorContentSpinner, DfProgressIndicatorContentType, DfProgressIndicatorDirective, DfProgressIndicatorModule, DfProgressIndicatorRef, DfProgressIndicatorService, DfProgressbarComponent, DfProgressbarModule, DfSelectModule, DfSideNavCollapseDirective, DfSideNavCollapseModule, DfSideNavCollapseService, DfSideNavComponent, DfSideNavConfig, DfSideNavHeaderDirective, DfSideNavIconDirective, DfSideNavItemDirective, DfSideNavModule, DfSideNavService, DfSliderDirectionDirective, DfSliderModule, DfStepperComponent, DfStepperDirective, DfStepperModule, DfStepperService, DfStepperStepContentDirective, DfStepperStepDirective, DfTitleTruncateDirective, DfToastModule, DfTooltipModule, DfTooltipTruncateDirective, DfTriggerClickDirective, DfWavesOfProgressDirective, DfWavesOfProgressModule, LabelType, Options, PointerType, RightToLeftDirectionEnum, SkipLinkDirective, SkipLinksContainerComponent, SliderComponent };
1762
+ export { BREAKPOINTS_VARS, ChangeContext, DF_BREAKPOINTS_VAR_DEFAULT, DfAccessibilityModule, DfAdvancedCardModule, DfAdvancedInputModule, DfAlertModule, DfAmadeusIconComponent, DfAmadeusLogoComponent, DfBreakpoints, DfDatePickerModule, DfDatepickerRangeDirective, DfDatepickerRangeService, DfDefaultSpinnerComponent, DfDirectionDetectionService, DfFooterModule, DfIconModule, DfIfMediaDirective, DfInputIconDirective, DfInsertIconDirective, DfInsertIconModule, DfManageBadgeEventsDirective, DfManageCardSelectionDirective, DfManageNavSelectDirective, DfManageSideNavDirective, DfMedia, DfMediaModule, DfMediaObserver, DfMediaQuery, DfModule, DfNavItemType, DfOptionHighlightDirective, DfPopoverConfig, DfPopoverModule, DfProgressIndicatorBackdropComponent, DfProgressIndicatorContainerComponent, DfProgressIndicatorContentPosition, DfProgressIndicatorContentProgressBar, DfProgressIndicatorContentSpinner, DfProgressIndicatorContentType, DfProgressIndicatorDirective, DfProgressIndicatorModule, DfProgressIndicatorRef, DfProgressIndicatorService, DfProgressbarComponent, DfProgressbarModule, DfSelectModule, DfSideNavCollapseDirective, DfSideNavCollapseModule, DfSideNavCollapseService, DfSideNavComponent, DfSideNavConfig, DfSideNavHeaderDirective, DfSideNavIconDirective, DfSideNavItemDirective, DfSideNavModule, DfSideNavService, DfSliderDirectionDirective, DfSliderModule, DfStepperComponent, DfStepperDirective, DfStepperModule, DfStepperService, DfStepperStepContentDirective, DfStepperStepDirective, DfTitleTruncateDirective, DfToastModule, DfTooltipModule, DfTooltipTruncateDirective, DfTriggerClickDirective, DfWavesOfProgressDirective, DfWavesOfProgressModule, LabelType, Options, PointerType, RightToLeftDirectionEnum, SkipLinkDirective, SkipLinksContainerComponent, SliderComponent };
1803
1763
  export type { CombineLabelsFunction, CustomStepDefinition, DfDirection, DfProgressIndicatorContent, DfProgressIndicatorOptions, DfSideNavItem, DfStepType, DfStepperNormalizedState, DfStepperNormalizedStep, DfStepperState, DfStepperStep, GetLegendFunction, GetStepLegendFunction, PositionToValueFunction, TranslateFunction, ValueToPositionFunction };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@design-factory/design-factory",
3
3
  "description": "Amadeus design system",
4
4
  "license": "BSD-3-Clause",
5
- "version": "20.0.0-next.1",
5
+ "version": "20.0.0-next.2",
6
6
  "dependencies": {
7
7
  "tslib": "^2.0.0"
8
8
  },
@@ -17,7 +17,9 @@
17
17
  "@ng-select/ng-select": "^15.0.0",
18
18
  "ag-grid-angular": "^32.0.0",
19
19
  "ag-grid-community": "^32.0.0",
20
- "bootstrap": "5.3.6"
20
+ "bootstrap": "5.3.7",
21
+ "colorjs.io": "^0.5.2",
22
+ "style-dictionary": "^5.0.0"
21
23
  },
22
24
  "peerDependenciesMeta": {
23
25
  "@angular/router": {
@@ -31,6 +33,12 @@
31
33
  },
32
34
  "@agnos-ui/angular-bootstrap": {
33
35
  "optional": true
36
+ },
37
+ "colorjs.io": {
38
+ "optional": true
39
+ },
40
+ "style-dictionary": {
41
+ "optional": true
34
42
  }
35
43
  },
36
44
  "schematics": "./schematics/collection.json",
@@ -56,6 +64,10 @@
56
64
  ".": {
57
65
  "types": "./index.d.ts",
58
66
  "default": "./fesm2022/design-factory.mjs"
67
+ },
68
+ "./tokens/style-dictionary": {
69
+ "types": "./tokens/style-dictionary/index.d.ts",
70
+ "default": "./fesm2022/design-factory-design-factory-tokens-style-dictionary.mjs"
59
71
  }
60
72
  },
61
73
  "ng-update": {
@@ -17,7 +17,11 @@ function removeNgxSlider() {
17
17
  if (!allPaths.length) {
18
18
  throw new schematics_1.SchematicsException('Could not find any tsconfig file. Cannot run the `RemoveModuleId` migration.');
19
19
  }
20
- return (0, schematics_1.chain)([renameNgxSliderModules(basePath, allPaths), renameNgxSliderImports(basePath, allPaths), removeNgxSliderDependencies()]);
20
+ return (0, schematics_1.chain)([
21
+ renameNgxSliderModules(basePath, allPaths),
22
+ renameNgxSliderImports(basePath, allPaths),
23
+ removeNgxSliderDependencies()
24
+ ]);
21
25
  };
22
26
  }
23
27
  // rename all references of NgxSliderModule to DfSliderModule
@@ -31,7 +35,7 @@ function renameNgxSliderModules(basePath, tsconfigPaths) {
31
35
  }
32
36
  function renameNgxSliderModule(tree, tsconfigPath, basePath) {
33
37
  const program = (0, compiler_host_1.createMigrationProgram)(tree, tsconfigPath, basePath);
34
- const sourceFiles = program.getSourceFiles().filter(sourceFile => (0, compiler_host_1.canMigrateFile)(basePath, sourceFile, program));
38
+ const sourceFiles = program.getSourceFiles().filter((sourceFile) => (0, compiler_host_1.canMigrateFile)(basePath, sourceFile, program));
35
39
  for (const sourceFile of sourceFiles) {
36
40
  if (sourceFile.text.includes('NgxSliderModule')) {
37
41
  const update = tree.beginUpdate((0, path_1.relative)(basePath, sourceFile.fileName));
@@ -56,11 +60,13 @@ function renameNgxSliderImports(basePath, tsconfigPaths) {
56
60
  }
57
61
  function renameNgxSliderImport(tree, tsconfigPath, basePath) {
58
62
  const program = (0, compiler_host_1.createMigrationProgram)(tree, tsconfigPath, basePath);
59
- const sourceFiles = program.getSourceFiles().filter(sourceFile => (0, compiler_host_1.canMigrateFile)(basePath, sourceFile, program));
63
+ const sourceFiles = program.getSourceFiles().filter((sourceFile) => (0, compiler_host_1.canMigrateFile)(basePath, sourceFile, program));
60
64
  for (const sourceFile of sourceFiles) {
61
65
  const nodesToRewrite = [];
62
66
  for (const node of sourceFile.statements) {
63
- if (ts.isImportDeclaration(node) && ts.isStringLiteral(node.moduleSpecifier) && node.moduleSpecifier.text === '@angular-slider/ngx-slider') {
67
+ if (ts.isImportDeclaration(node) &&
68
+ ts.isStringLiteral(node.moduleSpecifier) &&
69
+ node.moduleSpecifier.text === '@angular-slider/ngx-slider') {
64
70
  nodesToRewrite.push(node);
65
71
  }
66
72
  }
@@ -80,7 +86,7 @@ function removeNgxSliderDependencies() {
80
86
  return async (tree, context) => {
81
87
  removeNgxSliderDependencyFromPackage('/package.json', tree);
82
88
  const workspace = await (0, workspace_1.getWorkspace)(tree);
83
- for (const [_projectKey, projectDefinition] of workspace.projects) {
89
+ for (const [, projectDefinition] of workspace.projects) {
84
90
  if (projectDefinition.root && tree.exists(`${projectDefinition.root}/package.json`)) {
85
91
  removeNgxSliderDependencyFromPackage(`${projectDefinition.root}/package.json`, tree);
86
92
  }
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = revertToOldBranding;
4
4
  const workspace_1 = require("@schematics/angular/utility/workspace");
5
- const regexMainStyleImport = /\@import\s('|")\@design-factory\/design-factory\/design-factory(\.|'|")/g;
5
+ const regexMainStyleImport = /@import\s('|")@design-factory\/design-factory\/design-factory(\.|'|")/g;
6
6
  /**
7
7
  * Goes through the styles imports declared in the styles options of a build target, trying to update to use the old branding styles.
8
8
  *
@@ -90,7 +90,7 @@ function updateImportInMainStyles(buildOptions, tree) {
90
90
  * @returns the Rule to revert to the old branding
91
91
  */
92
92
  function revertToOldBranding() {
93
- return async (tree, context) => {
93
+ return (tree, context) => {
94
94
  return (0, workspace_1.updateWorkspace)((workspace) => {
95
95
  workspace.projects.forEach((project, projectName) => {
96
96
  if (project.extensions['projectType'] === 'application') {
@@ -0,0 +1,14 @@
1
+ import { type Rule } from '@angular-devkit/schematics';
2
+ /**
3
+ * This migration updates the classes regarding the colors.
4
+ *
5
+ * - bg-dark, bg-outline-dark, bg-secondary, bg-outline-secondary are replaced by their "neutral" equivalent classes,
6
+ * - mystery is replaced by tip,
7
+ * - yellow is replaced by chromatic1,
8
+ * - love is replaced by chromatic2,
9
+ *
10
+ * - The -light color variations are replaced by the -soft ones (bg-[color]-light becomes bg-[color]-soft),
11
+ *
12
+ * @returns the Rule to migrate the color classes
13
+ */
14
+ export default function colorNamesProcess(): Rule;
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = colorNamesProcess;
4
+ const schematics_1 = require("@angular-devkit/schematics");
5
+ const project_tsconfig_paths_1 = require("../../utils/project_tsconfig_paths");
6
+ const compiler_host_1 = require("../../utils/typescript/compiler_host");
7
+ const template_updater_1 = require("../../utils/template-updater");
8
+ const style_updater_1 = require("../../utils/style-updater");
9
+ const colorNamesMap = {
10
+ // light: 'neutral-soft',
11
+ secondary: 'neutral',
12
+ dark: 'neutral',
13
+ mystery: 'tip',
14
+ yellow: 'chromatic1',
15
+ love: 'chromatic2'
16
+ };
17
+ const removedColorsMap = ['pacific', 'dark-primary', 'dark-green'];
18
+ const colorNames = Object.keys(colorNamesMap).join('|');
19
+ const classBreak = '[^a-zA-Z-]'; // to avoid matching "bg-primary-light" for example
20
+ const regExpSoft = new RegExp(`${classBreak}(bg|df-badge-outline)-[a-z]+-light${classBreak}`, 'g');
21
+ const regExpSoftClass = new RegExp(`${classBreak}(bg|text|text-bg|btn|btn-outline|df-badge-outline|toast)-(${colorNames})-soft${classBreak}`, 'g');
22
+ const regExp = new RegExp(`${classBreak}(bg|text|text-bg|btn|btn-outline|df-badge-outline|toast)-(${colorNames})${classBreak}`, 'g');
23
+ const regExpLight = new RegExp(`.*?badge.*?${classBreak}(bg-light)${classBreak}`, 'g');
24
+ const regExpRemoved = new RegExp(`([ \t]*).*${classBreak}(bg|text|text-bg|btn|btn-outline|df-badge-outline|toast)-(${removedColorsMap.join('|')})${classBreak}.*`, 'g');
25
+ function replaceContentFactory(isTemplate, loggingContext) {
26
+ return function replaceContent(content) {
27
+ // Replace the "light" variants by the "soft" ones
28
+ content = content.replace(regExpSoft, function (str) {
29
+ const result = str.replace('-light', '-soft');
30
+ return result;
31
+ });
32
+ // Replace the old name by the new ones for the soft first
33
+ content = content.replace(regExpSoftClass, function (str, _prefix, color) {
34
+ let result = str;
35
+ const mappedColor = colorNamesMap[color];
36
+ if (mappedColor) {
37
+ result = result.replace(color, mappedColor);
38
+ }
39
+ return result;
40
+ });
41
+ // Replace the old name by the new ones
42
+ content = content.replace(regExp, function (str, _prefix, color) {
43
+ let result = str;
44
+ const mappedColor = colorNamesMap[color];
45
+ if (mappedColor) {
46
+ result = result.replace(color, mappedColor);
47
+ }
48
+ return result;
49
+ });
50
+ // Special case for bg-light which is replaced only in the badge context (as bg-neutral-soft do not exist)
51
+ content = content.replace(regExpLight, function (str) {
52
+ return str.replace('bg-light', 'bg-neutral-soft');
53
+ });
54
+ // Removed colors
55
+ content = content.replace(regExpRemoved, function (str, indent, _, color) {
56
+ loggingContext.removedColor = true;
57
+ const msg = `DF 20 migration: ${color} has been removed`;
58
+ return isTemplate ? `${indent}<!-- ${msg} -->\n${str}` : `\\* ${msg} *\\\n${str}`;
59
+ });
60
+ return content;
61
+ };
62
+ }
63
+ /**
64
+ * This migration updates the classes regarding the colors.
65
+ *
66
+ * - bg-dark, bg-outline-dark, bg-secondary, bg-outline-secondary are replaced by their "neutral" equivalent classes,
67
+ * - mystery is replaced by tip,
68
+ * - yellow is replaced by chromatic1,
69
+ * - love is replaced by chromatic2,
70
+ *
71
+ * - The -light color variations are replaced by the -soft ones (bg-[color]-light becomes bg-[color]-soft),
72
+ *
73
+ * @returns the Rule to migrate the color classes
74
+ */
75
+ function colorNamesProcess() {
76
+ return async (tree, context) => {
77
+ const loggingContext = { removedColor: false };
78
+ const { buildPaths, testPaths } = await (0, project_tsconfig_paths_1.getProjectTsConfigPaths)(tree);
79
+ const basePath = process.cwd();
80
+ const allPaths = [...buildPaths, ...testPaths];
81
+ if (!allPaths.length) {
82
+ throw new schematics_1.SchematicsException('Could not find any tsconfig file. Cannot run the `color names` migration.');
83
+ }
84
+ const templateUpdater = new template_updater_1.TemplateUpdater(tree, replaceContentFactory(true, loggingContext));
85
+ for (const tsconfigPath of allPaths) {
86
+ const program = (0, compiler_host_1.createMigrationProgram)(tree, tsconfigPath, basePath);
87
+ const sourceFiles = program
88
+ .getSourceFiles()
89
+ .filter((sourceFile) => (0, compiler_host_1.canMigrateFile)(basePath, sourceFile, program));
90
+ for (const sourceFile of sourceFiles) {
91
+ templateUpdater.update(sourceFile, program.getTypeChecker());
92
+ }
93
+ }
94
+ const styleUpdater = new style_updater_1.StyleUpdater(tree, replaceContentFactory(false, loggingContext));
95
+ for (const tsconfigPath of allPaths) {
96
+ const program = (0, compiler_host_1.createMigrationProgram)(tree, tsconfigPath, basePath);
97
+ const sourceFiles = program
98
+ .getSourceFiles()
99
+ .filter((sourceFile) => (0, compiler_host_1.canMigrateFile)(basePath, sourceFile, program));
100
+ for (const sourceFile of sourceFiles) {
101
+ styleUpdater.update(sourceFile, program.getTypeChecker());
102
+ }
103
+ }
104
+ if (loggingContext.removedColor) {
105
+ context.logger.warn('Some removed color classes were found. Check your files for comments in your code.');
106
+ }
107
+ };
108
+ }
@@ -5,12 +5,13 @@ const schematics_1 = require("@angular-devkit/schematics");
5
5
  const project_tsconfig_paths_1 = require("../../utils/project_tsconfig_paths");
6
6
  const compiler_host_1 = require("../../utils/typescript/compiler_host");
7
7
  const template_updater_1 = require("../../utils/template-updater");
8
+ const navbarTogglerIconRegexp = /<span\s+class="navbar-toggler-icon"><\/span>/g;
9
+ const navbarTogglerIconComplexRegexp = /([ \t]*<span[^>]+navbar-toggler-icon)/g;
8
10
  function replaceHtmlContentFactory(loggingContext) {
9
11
  function replaceHtmlContent(content) {
10
- content = content.replace(/<span\s+class="navbar-toggler-icon"><\/span>/g, `<svg class="navbar-toggler-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"/></svg>`);
11
- loggingContext.foundComplexCase =
12
- loggingContext.foundComplexCase || /([ \t]*<span[^>]+navbar-toggler-icon)/g.test(content);
13
- content = content.replace(/([ \t]*<span[^>]+navbar-toggler-icon)/g, '<!-- TODO Avoid using spans with navbar-toggler-icon and replace with inline svgs. -->\n' +
12
+ content = content.replace(navbarTogglerIconRegexp, `<svg class="navbar-toggler-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"/></svg>`);
13
+ loggingContext.foundComplexCase = loggingContext.foundComplexCase || navbarTogglerIconComplexRegexp.test(content);
14
+ content = content.replace(navbarTogglerIconComplexRegexp, '<!-- TODO Avoid using spans with navbar-toggler-icon and replace with inline svgs. -->\n' +
14
15
  '<!-- You can check an example of the inline svg in the SideNav example: https://design-factory.amadeus.net/components/sidenav/examples#basic -->\n$1');
15
16
  return content;
16
17
  }
@@ -27,7 +28,7 @@ function navbarTogglerLogo() {
27
28
  const basePath = process.cwd();
28
29
  const allPaths = [...buildPaths, ...testPaths];
29
30
  if (!allPaths.length) {
30
- throw new schematics_1.SchematicsException('Could not find any tsconfig file. Cannot run the `Font Awesome 6` migration.');
31
+ throw new schematics_1.SchematicsException('Could not find any tsconfig file. Cannot run the `navbar toggler logo` migration.');
31
32
  }
32
33
  const loggingContext = { foundComplexCase: false };
33
34
  const templateUpdater = new template_updater_1.TemplateUpdater(tree, replaceHtmlContentFactory(loggingContext));
@@ -0,0 +1,7 @@
1
+ import { type Rule } from '@angular-devkit/schematics';
2
+ /**
3
+ * This migration updates templates to use inline svg instead of navbar span for the toggler icon.
4
+ *
5
+ * @returns the Rule to migrate the navbar logo
6
+ */
7
+ export default function spinnerNewBranding(): Rule;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = spinnerNewBranding;
4
+ const schematics_1 = require("@angular-devkit/schematics");
5
+ const project_tsconfig_paths_1 = require("../../utils/project_tsconfig_paths");
6
+ const compiler_host_1 = require("../../utils/typescript/compiler_host");
7
+ const template_updater_1 = require("../../utils/template-updater");
8
+ const spinner = /(\s+class=")([^"]*spinner-border[^"]*)"/g;
9
+ const spinnerText = /(^|\s)text-([a-z]+)/g;
10
+ function replaceSpinnerClass(_match, p1, p2) {
11
+ return `${p1}${p2.replace(spinnerText, '$1df-spinner-$2')}"`;
12
+ }
13
+ function replaceHtmlContent(content) {
14
+ content = content.replace(spinner, replaceSpinnerClass);
15
+ return content;
16
+ }
17
+ /**
18
+ * This migration updates templates to use inline svg instead of navbar span for the toggler icon.
19
+ *
20
+ * @returns the Rule to migrate the navbar logo
21
+ */
22
+ function spinnerNewBranding() {
23
+ return async (tree, _context) => {
24
+ const { buildPaths, testPaths } = await (0, project_tsconfig_paths_1.getProjectTsConfigPaths)(tree);
25
+ const basePath = process.cwd();
26
+ const allPaths = [...buildPaths, ...testPaths];
27
+ if (!allPaths.length) {
28
+ throw new schematics_1.SchematicsException('Could not find any tsconfig file. Cannot run the `spinner new branding` migration.');
29
+ }
30
+ const templateUpdater = new template_updater_1.TemplateUpdater(tree, replaceHtmlContent);
31
+ for (const tsconfigPath of allPaths) {
32
+ const program = (0, compiler_host_1.createMigrationProgram)(tree, tsconfigPath, basePath);
33
+ const sourceFiles = program
34
+ .getSourceFiles()
35
+ .filter((sourceFile) => (0, compiler_host_1.canMigrateFile)(basePath, sourceFile, program));
36
+ for (const sourceFile of sourceFiles) {
37
+ templateUpdater.update(sourceFile, program.getTypeChecker());
38
+ }
39
+ }
40
+ };
41
+ }
@@ -23,7 +23,7 @@ function dedent(strings, ...values) {
23
23
  if (matches === null) {
24
24
  return joinedString;
25
25
  }
26
- const minLineIndent = Math.min(...matches.map(el => el.length));
26
+ const minLineIndent = Math.min(...matches.map((el) => el.length));
27
27
  const omitMinIndentRegex = new RegExp(`^[ \\t]{${minLineIndent}}`, 'gm');
28
28
  const omitEmptyLineWhitespaceRegex = /^[ \t]+$/gm;
29
29
  const result = minLineIndent > 0 ? joinedString.replace(omitMinIndentRegex, '') : joinedString;
@@ -48,6 +48,18 @@
48
48
  "version": "20.0.0",
49
49
  "factory": "./20_0_0/navbar-toggler-logo-svg",
50
50
  "optional": true
51
+ },
52
+ "colors-new-branding": {
53
+ "description": "Changes the color names to match the new branding taxonomy. As of Design Factory version 20, the color names have been updated to better reflect the new brand.",
54
+ "version": "20.0.0",
55
+ "factory": "./20_0_0/colors-new-branding",
56
+ "optional": true
57
+ },
58
+ "spinner-new-branding": {
59
+ "description": "Use df-spinner-{color} instead of text-{color} for spinners. Recommended for apps using the new amadeus branding.",
60
+ "version": "20.0.0",
61
+ "factory": "./20_0_0/spinner-new-branding",
62
+ "optional": true
51
63
  }
52
64
  }
53
65
  }
@@ -73,7 +73,7 @@ class ComponentResourceCollector {
73
73
  // Need to add an offset of one to the start because the template quotes are
74
74
  // not part of the template content.
75
75
  const templateStartIdx = el.getStart() + 1;
76
- const content = stripBom(el.text);
76
+ const content = stripBom(el.getText().slice(1, -1));
77
77
  this.resolvedStylesheets.push({
78
78
  filePath,
79
79
  container: node,
@@ -94,7 +94,7 @@ class ComponentResourceCollector {
94
94
  this.resolvedTemplates.push({
95
95
  filePath,
96
96
  container: node,
97
- content: property.initializer.text,
97
+ content: property.initializer.getText().slice(1, -1),
98
98
  inline: true,
99
99
  start: templateStartIdx,
100
100
  getCharacterAndLineOfPosition: (pos) => ts.getLineAndCharacterOfPosition(sourceFile, pos + templateStartIdx)
@@ -60,6 +60,7 @@ function* allTargetOptions(target) {
60
60
  }
61
61
  function createHost(tree) {
62
62
  return {
63
+ // eslint-disable-next-line @typescript-eslint/require-await
63
64
  async readFile(path) {
64
65
  const data = tree.read(path);
65
66
  if (!data) {
@@ -67,9 +68,11 @@ function createHost(tree) {
67
68
  }
68
69
  return core_1.virtualFs.fileBufferToString(data);
69
70
  },
71
+ // eslint-disable-next-line @typescript-eslint/require-await
70
72
  async writeFile(path, data) {
71
73
  return tree.overwrite(path, data);
72
74
  },
75
+ // eslint-disable-next-line @typescript-eslint/require-await
73
76
  async isDirectory(path) {
74
77
  // Approximate a directory check.
75
78
  // We don't need to consider empty directories and hence this is a good enough approach.
@@ -77,6 +80,7 @@ function createHost(tree) {
77
80
  // https://angular.io/guide/schematics-for-libraries#get-the-project-configuration
78
81
  return !tree.exists(path) && tree.getDir(path).subfiles.length > 0;
79
82
  },
83
+ // eslint-disable-next-line @typescript-eslint/require-await
80
84
  async isFile(path) {
81
85
  return tree.exists(path);
82
86
  }
@@ -13,9 +13,11 @@ class StyleUpdater {
13
13
  this._analyzedFiles = new Set();
14
14
  }
15
15
  update(file, typeChecker) {
16
- if (this._analyzedFiles.has((0, core_1.normalize)(path_1.posix.resolve(file.fileName)))) {
16
+ const filePath = (0, core_1.normalize)(path_1.posix.resolve(file.fileName));
17
+ if (this._analyzedFiles.has(filePath)) {
17
18
  return;
18
19
  }
20
+ this._analyzedFiles.add(filePath);
19
21
  const resourceCollector = new component_resource_collector_1.ComponentResourceCollector(typeChecker, this.tree);
20
22
  const visitNodeAndCollectResources = (node) => {
21
23
  ts.forEachChild(node, visitNodeAndCollectResources);
@@ -13,9 +13,11 @@ class TemplateUpdater {
13
13
  this._analyzedFiles = new Set();
14
14
  }
15
15
  update(file, typeChecker) {
16
- if (this._analyzedFiles.has((0, core_1.normalize)(path_1.posix.resolve(file.fileName)))) {
16
+ const filePath = (0, core_1.normalize)(path_1.posix.resolve(file.fileName));
17
+ if (this._analyzedFiles.has(filePath)) {
17
18
  return;
18
19
  }
20
+ this._analyzedFiles.add(filePath);
19
21
  const resourceCollector = new component_resource_collector_1.ComponentResourceCollector(typeChecker, this.tree);
20
22
  const visitNodeAndCollectResources = (node) => {
21
23
  ts.forEachChild(node, visitNodeAndCollectResources);
@@ -48,14 +48,15 @@ function createMigrationCompilerHost(tree, options, basePath, fakeRead) {
48
48
  // program to be based on the file contents in the virtual file tree. Otherwise
49
49
  // if we run multiple migrations we might have intersecting changes and
50
50
  // source files.
51
- host.readFile = fileName => {
51
+ host.readFile = (fileName) => {
52
52
  const treeRelativePath = (0, path_1.relative)(basePath, fileName);
53
53
  let result = fakeRead?.(treeRelativePath);
54
54
  if (typeof result !== 'string') {
55
55
  // If the relative path resolved to somewhere outside of the tree, fall back to
56
56
  // TypeScript's default file reading function since the `tree` will throw an error.
57
- result = treeRelativePath.startsWith('..') ? defaultReadFile.call(host, fileName) :
58
- tree.read(treeRelativePath)?.toString();
57
+ result = treeRelativePath.startsWith('..')
58
+ ? defaultReadFile.call(host, fileName)
59
+ : tree.read(treeRelativePath)?.toString();
59
60
  }
60
61
  // Strip BOM as otherwise TSC methods (Ex: getWidth) will return an offset,
61
62
  // which breaks the CLI UpdateRecorder.
@@ -72,7 +73,8 @@ function createMigrationCompilerHost(tree, options, basePath, fakeRead) {
72
73
  */
73
74
  function canMigrateFile(basePath, sourceFile, program) {
74
75
  // We shouldn't migrate .d.ts files, files from an external library or type checking files.
75
- if (sourceFile.fileName.endsWith('.ngtypecheck.ts') || sourceFile.isDeclarationFile ||
76
+ if (sourceFile.fileName.endsWith('.ngtypecheck.ts') ||
77
+ sourceFile.isDeclarationFile ||
76
78
  program.isSourceFileFromExternalLibrary(sourceFile)) {
77
79
  return false;
78
80
  }
@@ -12,7 +12,7 @@ function addDependencies() {
12
12
  return (tree) => {
13
13
  const dfDependencies = JSON.parse((0, fs_1.readFileSync)((0, path_1.resolve)(__dirname, '..', '..', 'package.json'), { encoding: 'utf-8' })).peerDependencies;
14
14
  for (const dependency in dfDependencies) {
15
- if (dfDependencies.hasOwnProperty(dependency)) {
15
+ if (Object.prototype.hasOwnProperty.call(dfDependencies, dependency)) {
16
16
  (0, dependencies_1.addPackageJsonDependency)(tree, {
17
17
  type: dependencies_1.NodeDependencyType.Default,
18
18
  name: dependency,
@@ -31,7 +31,7 @@ function install() {
31
31
  }
32
32
  // Add DF styles to the main styles file. If no styles.scss found, add DF styles to the workspace.
33
33
  function addDFStyles(options) {
34
- return async (tree, _context) => {
34
+ return async (tree) => {
35
35
  const workspace = await (0, workspace_1.getWorkspace)(tree);
36
36
  const project = workspace.projects.get(options.project);
37
37
  if (!project) {
@@ -64,10 +64,7 @@ $font-path: '@design-factory/design-factory/assets/fonts';
64
64
  const buildOptions = (buildTarget.options || {});
65
65
  // if the main `styles.scss` was not found, add the DF styles to the workspace
66
66
  if (addStyleToWorkspace) {
67
- buildOptions.styles = [
68
- ...(buildOptions.styles ?? []),
69
- '@design-factory/design-factory/design-factory.scss'
70
- ];
67
+ buildOptions.styles = [...(buildOptions.styles ?? []), '@design-factory/design-factory/design-factory.scss'];
71
68
  }
72
69
  // update the style preprocessor options
73
70
  buildOptions.stylePreprocessorOptions = { includePaths: ['./src', 'node_modules'] };