@design-factory/design-factory 20.0.0-next.0 → 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.
- package/design-factory-initial-branding.css +1 -1
- package/design-factory-initial-branding.scss +1 -1
- package/design-factory.css +2 -2
- package/fesm2022/design-factory-design-factory-tokens-style-dictionary.mjs +358 -0
- package/fesm2022/design-factory-design-factory-tokens-style-dictionary.mjs.map +1 -0
- package/fesm2022/design-factory.mjs +433 -530
- package/fesm2022/design-factory.mjs.map +1 -1
- package/index.d.ts +46 -168
- package/package.json +14 -2
- package/schematics/migrations/15_0_0/remove-ngx-slider/index.js +11 -5
- package/schematics/migrations/16_0_0/revert-to-old-brand/index.js +2 -2
- package/schematics/migrations/20_0_0/colors-new-branding/index.d.ts +14 -0
- package/schematics/migrations/20_0_0/colors-new-branding/index.js +108 -0
- package/schematics/migrations/20_0_0/navbar-toggler-logo-svg/index.js +6 -5
- package/schematics/migrations/20_0_0/spinner-new-branding/index.d.ts +7 -0
- package/schematics/migrations/20_0_0/spinner-new-branding/index.js +41 -0
- package/schematics/migrations/helpers.js +1 -1
- package/schematics/migrations/migration.json +12 -0
- package/schematics/migrations/utils/component-resource-collector.js +2 -2
- package/schematics/migrations/utils/project_tsconfig_paths.js +4 -0
- package/schematics/migrations/utils/style-updater.js +3 -1
- package/schematics/migrations/utils/template-updater.js +3 -1
- package/schematics/migrations/utils/typescript/compiler_host.js +6 -4
- package/schematics/ng-add/index.js +3 -6
- package/styles/scss/_common.root.scss +20 -3
- package/styles/scss/_common.scss +1 -1
- package/styles/scss/_common.variables.scss +2 -1
- package/styles/scss/_variables.scss +1 -0
- package/styles/scss/agnosui/_variables.scss +1 -1
- package/styles/scss/bootstrap/_utilities-override.scss +14 -8
- package/styles/scss/bootstrap/_variables.scss +2 -2
- package/styles/scss/components/accordion/_accordion.scss +7 -0
- package/styles/scss/components/alert/_alert.scss +32 -17
- package/styles/scss/components/badge/_badge.mixins.scss +12 -4
- package/styles/scss/components/badge/_badge.scss +191 -71
- package/styles/scss/components/badge/_badge.variables.scss +8 -0
- package/styles/scss/components/brand-color/_brand-color.mixins.scss +2 -2
- package/styles/scss/components/breadcrumbs/_breadcrumbs.scss +4 -1
- package/styles/scss/components/breadcrumbs/_breadcrumbs.variables.scss +3 -1
- package/styles/scss/components/button/_button.scss +389 -74
- package/styles/scss/components/button/_button.utils.scss +20 -1
- package/styles/scss/components/button/_button_container.scss +22 -5
- package/styles/scss/components/card/_card.scss +42 -10
- package/styles/scss/components/card/_card.variables.scss +2 -0
- package/styles/scss/components/carousel/_carousel.scss +2 -2
- package/styles/scss/components/checkbox/_checkbox.scss +2 -1
- package/styles/scss/components/datepicker/_datepicker.scss +2 -1
- package/styles/scss/components/dropdown/_dropdown.scss +18 -1
- package/styles/scss/components/fonts/_font-faces.mixins.scss +108 -54
- package/styles/scss/components/icon/_amadeus-icon.scss +2 -2
- package/styles/scss/components/inputs/_inputs.mixin.scss +2 -2
- package/styles/scss/components/inputs/_inputs.root.scss +1 -1
- package/styles/scss/components/inputs/_inputs.scss +10 -4
- package/styles/scss/components/link/_link.mixins.scss +7 -3
- package/styles/scss/components/link/_link.scss +6 -0
- package/styles/scss/components/media/_media.scss +4 -0
- package/styles/scss/components/media/_media.variables.scss +1 -0
- package/styles/scss/components/modal/_modal.scss +54 -14
- package/styles/scss/components/modal/_modal.variables.scss +1 -0
- package/styles/scss/components/navbar/_navbar.scss +12 -0
- package/styles/scss/components/pagination/_pagination.scss +5 -0
- package/styles/scss/components/pagination/_pagination_container.scss +1 -1
- package/styles/scss/components/progressbar/_progressbar.variables.scss +13 -4
- package/styles/scss/components/rating/_rating.scss +18 -2
- package/styles/scss/components/rating/_rating.variables.scss +1 -1
- package/styles/scss/components/scrollspy/_scrollspy.scss +1 -1
- package/styles/scss/components/select/_select.scss +14 -19
- package/styles/scss/components/separator/_separator.variables.scss +1 -1
- package/styles/scss/components/sidenav/_sidenav.scss +3 -3
- package/styles/scss/components/sidenav/_sidenav.variables.scss +6 -4
- package/styles/scss/components/spinner/_spinner.scss +14 -0
- package/styles/scss/components/spinner/_spinner.variables.scss +7 -4
- package/styles/scss/components/stepper/_stepper.variables.scss +3 -3
- package/styles/scss/components/tabs/_tabs.scss +8 -1
- package/styles/scss/components/timepicker/_timepicker.scss +5 -0
- package/styles/scss/components/timepicker/_timepicker.variables.scss +1 -0
- package/styles/scss/components/toast/_toast.scss +21 -30
- package/styles/scss/components/toggle/_toggle.scss +2 -1
- package/styles/scss/components/toggle/_toggle.variables.scss +1 -0
- package/styles/scss/components/tooltip/_tooltip.scss +5 -0
- package/styles/scss/components/tooltip/_tooltip.variables.scss +4 -0
- package/styles/scss/components/tooltip/_tooltip_container.scss +17 -13
- package/styles/scss/df-styles.scss +1 -0
- package/styles/scss/themes/brand2023/_variables.scss +161 -38
- package/styles/scss/themes/brand2023/tokens/_mapping.gen.scss +156 -186
- package/styles/scss/themes/brand2023/tokens/_root.gen.scss +1708 -0
- package/styles/scss/themes/brand2023/tokens/_sass-vars.gen.scss +1467 -0
- package/styles/scss/utilities/_common.utilities.scss +3 -10
- package/styles/scss/utilities/_rgb.scss +10 -0
- package/tokens/style-dictionary/index.d.ts +60 -0
- package/styles/scss/themes/brand2023/tokens/_figma.gen.scss +0 -3028
package/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { AfterViewInit, ElementRef, Renderer2, OnInit, OnDestroy,
|
|
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,
|
|
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';
|
|
8
|
-
import { NgSelectComponent } from '@ng-select/ng-select';
|
|
9
8
|
|
|
10
9
|
declare class SkipLinkDirective {
|
|
11
10
|
readonly inFocus: i0.WritableSignal<boolean>;
|
|
@@ -61,7 +60,7 @@ declare class DfAlertModule {
|
|
|
61
60
|
/**
|
|
62
61
|
* My dfDatepickerRange directive
|
|
63
62
|
*/
|
|
64
|
-
declare class DfDatepickerRangeDirective implements OnInit, OnDestroy,
|
|
63
|
+
declare class DfDatepickerRangeDirective implements OnInit, OnDestroy, AfterViewChecked, AfterViewInit {
|
|
65
64
|
private inputsElements;
|
|
66
65
|
private isDisabled;
|
|
67
66
|
private readonly siblingsNode;
|
|
@@ -81,7 +80,7 @@ declare class DfDatepickerRangeDirective implements OnInit, OnDestroy, DoCheck,
|
|
|
81
80
|
* if the direction (rtl / ltr) is changing dynamically
|
|
82
81
|
*/
|
|
83
82
|
updateDirection(): void;
|
|
84
|
-
|
|
83
|
+
ngAfterViewChecked(): void;
|
|
85
84
|
ngOnDestroy(): void;
|
|
86
85
|
static ɵfac: i0.ɵɵFactoryDeclaration<DfDatepickerRangeDirective, never>;
|
|
87
86
|
static ɵdir: i0.ɵɵDirectiveDeclaration<DfDatepickerRangeDirective, "[dfDatepickerRange]", ["dfDatepickerRange"], {}, {}, never, never, true, never>;
|
|
@@ -89,7 +88,6 @@ declare class DfDatepickerRangeDirective implements OnInit, OnDestroy, DoCheck,
|
|
|
89
88
|
|
|
90
89
|
declare class DfTriggerClickDirective {
|
|
91
90
|
private readonly elementRef;
|
|
92
|
-
constructor(elementRef: ElementRef);
|
|
93
91
|
triggerClick(event: KeyboardEvent | MouseEvent): void;
|
|
94
92
|
static ɵfac: i0.ɵɵFactoryDeclaration<DfTriggerClickDirective, never>;
|
|
95
93
|
static ɵdir: i0.ɵɵDirectiveDeclaration<DfTriggerClickDirective, "[dfTriggerClick]", never, {}, {}, never, never, true, never>;
|
|
@@ -136,8 +134,6 @@ declare class DfDatePickerModule {
|
|
|
136
134
|
}
|
|
137
135
|
|
|
138
136
|
declare class DfDatepickerRangeService {
|
|
139
|
-
private readonly calendar;
|
|
140
|
-
private readonly formatter;
|
|
141
137
|
fromDate: NgbDate | null;
|
|
142
138
|
toDate: NgbDate | null;
|
|
143
139
|
hoveredDate: NgbDate | null;
|
|
@@ -148,7 +144,8 @@ declare class DfDatepickerRangeService {
|
|
|
148
144
|
dropDown?: NgbDropdown;
|
|
149
145
|
isClosingOnToDate: boolean;
|
|
150
146
|
datepicker: NgbDatepicker | null;
|
|
151
|
-
|
|
147
|
+
private readonly calendar;
|
|
148
|
+
private readonly formatter;
|
|
152
149
|
onDateSelection(date: NgbDate): void;
|
|
153
150
|
setFocus(): void;
|
|
154
151
|
returnFocus(): void;
|
|
@@ -213,20 +210,6 @@ declare class DfIconModule {
|
|
|
213
210
|
static ɵinj: i0.ɵɵInjectorDeclaration<DfIconModule>;
|
|
214
211
|
}
|
|
215
212
|
|
|
216
|
-
/**
|
|
217
|
-
* @deprecated `DfModalService` is deprecated, use `NgbModal` from ng-bootstrap instead.
|
|
218
|
-
* 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.
|
|
219
|
-
*/
|
|
220
|
-
declare class DfModalService {
|
|
221
|
-
private modalService;
|
|
222
|
-
private rendererFactory;
|
|
223
|
-
private renderer;
|
|
224
|
-
constructor(modalService: NgbModal, rendererFactory: RendererFactory2);
|
|
225
|
-
open(content: any, options?: NgbModalOptions): NgbModalRef;
|
|
226
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DfModalService, never>;
|
|
227
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<DfModalService>;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
213
|
declare class DfPopoverModule {
|
|
231
214
|
static ɵfac: i0.ɵɵFactoryDeclaration<DfPopoverModule, never>;
|
|
232
215
|
static ɵmod: i0.ɵɵNgModuleDeclaration<DfPopoverModule, never, never, [typeof i2.NgbPopoverModule]>;
|
|
@@ -392,60 +375,8 @@ declare class DfProgressIndicatorRef {
|
|
|
392
375
|
constructor(containerRef: ComponentRef<DfProgressIndicatorContainerComponent>, contentRef: ComponentRef<unknown> | EmbeddedViewRef<unknown>, backdropRef?: ComponentRef<DfProgressIndicatorBackdropComponent> | undefined);
|
|
393
376
|
}
|
|
394
377
|
|
|
395
|
-
/** Type for the callback used to revert the scrollbar compensation. */
|
|
396
|
-
type CompensationReverter = () => void;
|
|
397
|
-
/**
|
|
398
|
-
* Utility to handle the scrollbar.
|
|
399
|
-
*
|
|
400
|
-
* It allows to compensate the lack of a vertical scrollbar by adding an
|
|
401
|
-
* equivalent padding on the right of the body, and to remove this compensation.
|
|
402
|
-
*
|
|
403
|
-
* It is a copy of https://github.com/ng-bootstrap/ng-bootstrap/blob/master/src/util/scrollbar.ts
|
|
404
|
-
*/
|
|
405
|
-
declare class ScrollBar {
|
|
406
|
-
private readonly _document;
|
|
407
|
-
constructor(_document: any);
|
|
408
|
-
/**
|
|
409
|
-
* To be called right before a potential vertical scrollbar would be removed:
|
|
410
|
-
*
|
|
411
|
-
* - if there was a scrollbar, adds some compensation padding to the body
|
|
412
|
-
* to keep the same layout as when the scrollbar is there
|
|
413
|
-
* - if there was none, there is nothing to do
|
|
414
|
-
*
|
|
415
|
-
* @return a callback used to revert the compensation (noop if there was none,
|
|
416
|
-
* otherwise a function removing the padding)
|
|
417
|
-
*/
|
|
418
|
-
compensate(): CompensationReverter;
|
|
419
|
-
/**
|
|
420
|
-
* Adds a padding of the given width on the right of the body.
|
|
421
|
-
*
|
|
422
|
-
* @return a callback used to revert the padding to its previous value
|
|
423
|
-
*/
|
|
424
|
-
private _adjustBody;
|
|
425
|
-
/**
|
|
426
|
-
* Tells whether a scrollbar is currently present on the body.
|
|
427
|
-
*
|
|
428
|
-
* @return true if scrollbar is present, false otherwise
|
|
429
|
-
*/
|
|
430
|
-
private _isPresent;
|
|
431
|
-
/**
|
|
432
|
-
* Calculates and returns the width of a scrollbar.
|
|
433
|
-
*
|
|
434
|
-
* @return the width of a scrollbar on this page
|
|
435
|
-
*/
|
|
436
|
-
private _getWidth;
|
|
437
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ScrollBar, never>;
|
|
438
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<ScrollBar>;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
378
|
type DfProgressIndicatorContent<T> = undefined | TemplateRef<T> | Type<T> | DfProgressIndicatorContentSpinner | DfProgressIndicatorContentProgressBar;
|
|
442
379
|
declare class DfProgressIndicatorService {
|
|
443
|
-
private readonly document;
|
|
444
|
-
private readonly rendererFactory;
|
|
445
|
-
private readonly componentFactoryResolver;
|
|
446
|
-
private readonly appRef;
|
|
447
|
-
private readonly injector;
|
|
448
|
-
private readonly scrollbar;
|
|
449
380
|
private readonly renderer;
|
|
450
381
|
private readonly BODY_CLASS;
|
|
451
382
|
private readonly containerAttributes;
|
|
@@ -453,7 +384,10 @@ declare class DfProgressIndicatorService {
|
|
|
453
384
|
private readonly defaultSpinnerAttributes;
|
|
454
385
|
private readonly defaultProgressBarAttributes;
|
|
455
386
|
private readonly activeInstances;
|
|
456
|
-
|
|
387
|
+
private readonly document;
|
|
388
|
+
private readonly appRef;
|
|
389
|
+
private readonly environmentInjector;
|
|
390
|
+
private readonly scrollbar;
|
|
457
391
|
open<T>(content: DfProgressIndicatorContent<T>, options?: DfProgressIndicatorOptions): DfProgressIndicatorRef;
|
|
458
392
|
close(progressIndicatorRef: DfProgressIndicatorRef): void;
|
|
459
393
|
/**
|
|
@@ -588,7 +522,7 @@ declare class Options {
|
|
|
588
522
|
in the stepsArray option. */
|
|
589
523
|
getLegend?: GetLegendFunction;
|
|
590
524
|
/** Use to display a custom legend of a stepItem from stepsArray.
|
|
591
|
-
|
|
525
|
+
It will be the same as getLegend but for stepsArray. */
|
|
592
526
|
getStepLegend?: GetStepLegendFunction;
|
|
593
527
|
/** If you want to display a slider with non linear/number steps.
|
|
594
528
|
Just pass an array with each slider value and that's it; the floor, ceil and step settings
|
|
@@ -844,7 +778,7 @@ declare class SliderComponent implements OnInit, AfterViewInit, OnChanges, OnDes
|
|
|
844
778
|
registerOnTouched(onTouchedCallback: any): void;
|
|
845
779
|
setDisabledState(isDisabled: boolean): void;
|
|
846
780
|
setAriaLabel(ariaLabel: string): void;
|
|
847
|
-
onResize(
|
|
781
|
+
onResize(): void;
|
|
848
782
|
private subscribeInputModelChangeSubject;
|
|
849
783
|
private subscribeOutputModelChangeSubject;
|
|
850
784
|
private subscribeResizeObserver;
|
|
@@ -1058,23 +992,6 @@ declare class DfSliderModule {
|
|
|
1058
992
|
static ɵinj: i0.ɵɵInjectorDeclaration<DfSliderModule>;
|
|
1059
993
|
}
|
|
1060
994
|
|
|
1061
|
-
/**
|
|
1062
|
-
* A configuration service for the [DfSideNavService](#/components/sidenav/api#DfSideNavComponent) component.
|
|
1063
|
-
*
|
|
1064
|
-
* You can inject this service, typically in your root component, and customize its properties
|
|
1065
|
-
* to provide default values for your sidenav used in the application.
|
|
1066
|
-
*/
|
|
1067
|
-
declare class DfSideNavConfig {
|
|
1068
|
-
isMinmized: boolean;
|
|
1069
|
-
isCollapsed: boolean;
|
|
1070
|
-
isPresent: boolean;
|
|
1071
|
-
isInMenuOverlay: boolean;
|
|
1072
|
-
isAppOverlay: boolean;
|
|
1073
|
-
isAppOverlayMode: boolean;
|
|
1074
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DfSideNavConfig, never>;
|
|
1075
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<DfSideNavConfig>;
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
995
|
interface DfSideNavItem {
|
|
1079
996
|
value: string;
|
|
1080
997
|
title?: string;
|
|
@@ -1104,8 +1021,8 @@ declare enum DfNavItemType {
|
|
|
1104
1021
|
* Creating a sidenav is straightforward: use [DfSideNavComponent](#/components/sidenav/api#DfSideNavComponent) component
|
|
1105
1022
|
*/
|
|
1106
1023
|
declare class DfSideNavService implements OnDestroy {
|
|
1107
|
-
private readonly config;
|
|
1108
1024
|
type: typeof DfNavItemType;
|
|
1025
|
+
private readonly config;
|
|
1109
1026
|
private readonly _sideNavItems$;
|
|
1110
1027
|
private readonly _isMinmized$;
|
|
1111
1028
|
private readonly _isCollapsed$;
|
|
@@ -1116,7 +1033,7 @@ declare class DfSideNavService implements OnDestroy {
|
|
|
1116
1033
|
private _isAppOverlayMode;
|
|
1117
1034
|
private _items;
|
|
1118
1035
|
private readonly subscription;
|
|
1119
|
-
constructor(
|
|
1036
|
+
constructor();
|
|
1120
1037
|
ngOnDestroy(): void;
|
|
1121
1038
|
/**
|
|
1122
1039
|
* Use this to init the list of Elements from your sidenav
|
|
@@ -1253,20 +1170,17 @@ declare class DfSideNavService implements OnDestroy {
|
|
|
1253
1170
|
}
|
|
1254
1171
|
|
|
1255
1172
|
declare class DfSideNavHeaderDirective {
|
|
1256
|
-
templateRef: TemplateRef<any>;
|
|
1257
|
-
constructor(templateRef: TemplateRef<any>);
|
|
1173
|
+
readonly templateRef: TemplateRef<any>;
|
|
1258
1174
|
static ɵfac: i0.ɵɵFactoryDeclaration<DfSideNavHeaderDirective, never>;
|
|
1259
1175
|
static ɵdir: i0.ɵɵDirectiveDeclaration<DfSideNavHeaderDirective, "ng-template[dfSideNavHeader]", never, {}, {}, never, never, true, never>;
|
|
1260
1176
|
}
|
|
1261
1177
|
declare class DfSideNavIconDirective {
|
|
1262
|
-
templateRef: TemplateRef<any>;
|
|
1263
|
-
constructor(templateRef: TemplateRef<any>);
|
|
1178
|
+
readonly templateRef: TemplateRef<any>;
|
|
1264
1179
|
static ɵfac: i0.ɵɵFactoryDeclaration<DfSideNavIconDirective, never>;
|
|
1265
1180
|
static ɵdir: i0.ɵɵDirectiveDeclaration<DfSideNavIconDirective, "ng-template[dfSideNavIcon]", never, {}, {}, never, never, true, never>;
|
|
1266
1181
|
}
|
|
1267
1182
|
declare class DfSideNavItemDirective {
|
|
1268
|
-
templateRef: TemplateRef<any>;
|
|
1269
|
-
constructor(templateRef: TemplateRef<any>);
|
|
1183
|
+
readonly templateRef: TemplateRef<any>;
|
|
1270
1184
|
static ɵfac: i0.ɵɵFactoryDeclaration<DfSideNavItemDirective, never>;
|
|
1271
1185
|
static ɵdir: i0.ɵɵDirectiveDeclaration<DfSideNavItemDirective, "ng-template[dfSideNavItem]", never, {}, {}, never, never, true, never>;
|
|
1272
1186
|
}
|
|
@@ -1296,54 +1210,24 @@ declare class DfSideNavComponent implements OnDestroy {
|
|
|
1296
1210
|
declare class DfManageSideNavDirective implements AfterViewChecked {
|
|
1297
1211
|
private readonly element;
|
|
1298
1212
|
private readonly renderer;
|
|
1299
|
-
constructor(element: ElementRef, renderer: Renderer2);
|
|
1300
1213
|
ngAfterViewChecked(): void;
|
|
1301
1214
|
static ɵfac: i0.ɵɵFactoryDeclaration<DfManageSideNavDirective, never>;
|
|
1302
1215
|
static ɵdir: i0.ɵɵDirectiveDeclaration<DfManageSideNavDirective, "[dfManageSideNav]", never, {}, {}, never, never, true, never>;
|
|
1303
1216
|
}
|
|
1304
1217
|
|
|
1305
|
-
/**
|
|
1306
|
-
* The directive to catch focusin event and put the focus at a defined position in the page
|
|
1307
|
-
*
|
|
1308
|
-
* @deprecated 19.1.0 use {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inert inert} instead
|
|
1309
|
-
* @since 9.1.0
|
|
1310
|
-
*/
|
|
1311
|
-
declare class DfExcludeTrapDirective implements OnDestroy, OnInit {
|
|
1312
|
-
private subscription;
|
|
1313
|
-
private subscriptionInput?;
|
|
1314
|
-
/**
|
|
1315
|
-
* The CSS selector used to get the element to put the focus when catched
|
|
1316
|
-
*
|
|
1317
|
-
*/
|
|
1318
|
-
readonly dfExcludeTrapSelector: i0.InputSignal<string>;
|
|
1319
|
-
/**
|
|
1320
|
-
* The Observable to enable or disable the ExcludeTrap
|
|
1321
|
-
* If `True` the excludeTrap will work
|
|
1322
|
-
*/
|
|
1323
|
-
readonly dfExcludeTrap: i0.InputSignal<Observable<boolean>>;
|
|
1324
|
-
private readonly zone;
|
|
1325
|
-
private readonly element;
|
|
1326
|
-
init(): void;
|
|
1327
|
-
ngOnInit(): void;
|
|
1328
|
-
ngOnDestroy(): void;
|
|
1329
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DfExcludeTrapDirective, never>;
|
|
1330
|
-
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>;
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
1218
|
declare class DfManageNavSelectDirective implements OnInit {
|
|
1219
|
+
private direction;
|
|
1334
1220
|
private readonly select;
|
|
1335
1221
|
private readonly element;
|
|
1336
1222
|
private readonly rtlDirectionService;
|
|
1337
1223
|
private readonly renderer;
|
|
1338
|
-
private direction;
|
|
1339
|
-
constructor(select: NgSelectComponent, element: ElementRef, rtlDirectionService: DfDirectionDetectionService, renderer: Renderer2);
|
|
1340
1224
|
ngOnInit(): void;
|
|
1341
1225
|
handleKeyDown(event: any): void;
|
|
1342
|
-
handleKeyDownBackspace(
|
|
1226
|
+
handleKeyDownBackspace(): void;
|
|
1343
1227
|
handleKeyDownRight(event: any): void;
|
|
1344
1228
|
arrowRightInnerHandler(event: any): void;
|
|
1345
1229
|
arrowLeftInnerHandler(event: any): void;
|
|
1346
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DfManageNavSelectDirective,
|
|
1230
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DfManageNavSelectDirective, never>;
|
|
1347
1231
|
static ɵdir: i0.ɵɵDirectiveDeclaration<DfManageNavSelectDirective, "[dfManageNavSelect]", never, {}, {}, never, never, true, never>;
|
|
1348
1232
|
}
|
|
1349
1233
|
|
|
@@ -1589,7 +1473,7 @@ declare class DfTooltipTruncateDirective implements OnInit, DoCheck {
|
|
|
1589
1473
|
* The direction considered when detecting overflow, can be 'x', 'y' or ''.
|
|
1590
1474
|
* @defaultValue ''
|
|
1591
1475
|
*/
|
|
1592
|
-
readonly dfTooltipTruncate: i0.InputSignal<"" | "
|
|
1476
|
+
readonly dfTooltipTruncate: i0.InputSignal<"" | "y" | "x">;
|
|
1593
1477
|
ngOnInit(): void;
|
|
1594
1478
|
ngDoCheck(): void;
|
|
1595
1479
|
static ɵfac: i0.ɵɵFactoryDeclaration<DfTooltipTruncateDirective, never>;
|
|
@@ -1647,22 +1531,6 @@ declare class DfSideNavCollapseDirective implements OnInit {
|
|
|
1647
1531
|
static ɵdir: i0.ɵɵDirectiveDeclaration<DfSideNavCollapseDirective, "[dfSideNavCollapse]", ["dfSideNavCollapse"], { "dfSideNavCollapse": { "alias": "dfSideNavCollapse"; "required": true; "isSignal": true; }; "minimized": { "alias": "minimized"; "required": false; "isSignal": true; }; }, { "dfSideNavCollapseChange": "dfSideNavCollapseChange"; "shown": "shown"; "hidden": "hidden"; }, never, never, true, never>;
|
|
1648
1532
|
}
|
|
1649
1533
|
|
|
1650
|
-
/**
|
|
1651
|
-
* A configuration service for the [DfSideNavCollapseDirective](#/components/sidenav/api#DfSideNavCollapseDirective) component.
|
|
1652
|
-
*
|
|
1653
|
-
* You can inject this service, typically in your root component, and customize its properties
|
|
1654
|
-
* to provide default values for the sideNav used in the application.
|
|
1655
|
-
*/
|
|
1656
|
-
declare class DfSideNavCollapseConfig {
|
|
1657
|
-
private readonly _ngbConfig;
|
|
1658
|
-
private _animation?;
|
|
1659
|
-
constructor(_ngbConfig: NgbConfig);
|
|
1660
|
-
get animation(): boolean;
|
|
1661
|
-
set animation(animation: boolean);
|
|
1662
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DfSideNavCollapseConfig, never>;
|
|
1663
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<DfSideNavCollapseConfig>;
|
|
1664
|
-
}
|
|
1665
|
-
|
|
1666
1534
|
declare class DfSideNavCollapseModule {
|
|
1667
1535
|
static ɵfac: i0.ɵɵFactoryDeclaration<DfSideNavCollapseModule, never>;
|
|
1668
1536
|
static ɵmod: i0.ɵɵNgModuleDeclaration<DfSideNavCollapseModule, never, [typeof DfSideNavCollapseDirective], [typeof DfSideNavCollapseDirective]>;
|
|
@@ -1671,10 +1539,27 @@ declare class DfSideNavCollapseModule {
|
|
|
1671
1539
|
|
|
1672
1540
|
declare class DfSideNavModule {
|
|
1673
1541
|
static ɵfac: i0.ɵɵFactoryDeclaration<DfSideNavModule, never>;
|
|
1674
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<DfSideNavModule, never, [typeof DfManageSideNavDirective, typeof DfSideNavComponent, typeof DfSideNavHeaderDirective, typeof
|
|
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]>;
|
|
1675
1543
|
static ɵinj: i0.ɵɵInjectorDeclaration<DfSideNavModule>;
|
|
1676
1544
|
}
|
|
1677
1545
|
|
|
1546
|
+
/**
|
|
1547
|
+
* A configuration service for the [DfSideNavService](#/components/sidenav/api#DfSideNavComponent) component.
|
|
1548
|
+
*
|
|
1549
|
+
* You can inject this service, typically in your root component, and customize its properties
|
|
1550
|
+
* to provide default values for your sidenav used in the application.
|
|
1551
|
+
*/
|
|
1552
|
+
declare class DfSideNavConfig {
|
|
1553
|
+
isMinmized: boolean;
|
|
1554
|
+
isCollapsed: boolean;
|
|
1555
|
+
isPresent: boolean;
|
|
1556
|
+
isInMenuOverlay: boolean;
|
|
1557
|
+
isAppOverlay: boolean;
|
|
1558
|
+
isAppOverlayMode: boolean;
|
|
1559
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DfSideNavConfig, never>;
|
|
1560
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DfSideNavConfig>;
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1678
1563
|
/**
|
|
1679
1564
|
* A service for managing the sidenav panel animation.
|
|
1680
1565
|
* This service is included at root level
|
|
@@ -1682,9 +1567,7 @@ declare class DfSideNavModule {
|
|
|
1682
1567
|
* Creating a sidenav is straightforward: use [DfSideNavComponent](#/components/sidenav/api#DfSideNavComponent) component
|
|
1683
1568
|
*/
|
|
1684
1569
|
declare class DfSideNavCollapseService {
|
|
1685
|
-
private readonly _config;
|
|
1686
1570
|
private readonly _sideNavAnimation$;
|
|
1687
|
-
constructor(_config: DfSideNavCollapseConfig);
|
|
1688
1571
|
get sideNavAnimation$(): Observable<boolean>;
|
|
1689
1572
|
/**
|
|
1690
1573
|
* Use this to activate or desactivate the animation for the sideNav
|
|
@@ -1716,15 +1599,13 @@ declare const BREAKPOINTS_VARS: InjectionToken<{
|
|
|
1716
1599
|
xxxl: string;
|
|
1717
1600
|
}>;
|
|
1718
1601
|
declare class DfBreakpoints {
|
|
1602
|
+
private readonly _breakPoints$;
|
|
1719
1603
|
private readonly _breakPointsVar;
|
|
1720
1604
|
private readonly platformID;
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
[breakpoint: string]: string;
|
|
1724
|
-
}, platformID: Object);
|
|
1725
|
-
get breakPoints$(): Observable<{} | null>;
|
|
1605
|
+
constructor();
|
|
1606
|
+
get breakPoints$(): Observable<Record<string, string> | null>;
|
|
1726
1607
|
private initBreakpoints;
|
|
1727
|
-
generate(sizes: any[][]):
|
|
1608
|
+
generate(sizes: any[][]): Record<string, string>;
|
|
1728
1609
|
static ɵfac: i0.ɵɵFactoryDeclaration<DfBreakpoints, never>;
|
|
1729
1610
|
static ɵprov: i0.ɵɵInjectableDeclaration<DfBreakpoints>;
|
|
1730
1611
|
}
|
|
@@ -1736,17 +1617,15 @@ interface MediaBreakpointsState {
|
|
|
1736
1617
|
}
|
|
1737
1618
|
declare class DfMediaQuery {
|
|
1738
1619
|
private readonly _isBrowser;
|
|
1739
|
-
constructor(platformId: Object);
|
|
1740
1620
|
notSupported(query: string): Partial<MediaQueryList>;
|
|
1741
1621
|
matchMedia(query: string): MediaQueryList;
|
|
1742
1622
|
static ɵfac: i0.ɵɵFactoryDeclaration<DfMediaQuery, never>;
|
|
1743
1623
|
static ɵprov: i0.ɵɵInjectableDeclaration<DfMediaQuery>;
|
|
1744
1624
|
}
|
|
1745
1625
|
declare class DfMediaObserver implements OnDestroy {
|
|
1746
|
-
private readonly _mediaQuery;
|
|
1747
1626
|
private readonly _subscription;
|
|
1748
1627
|
private readonly _queries;
|
|
1749
|
-
|
|
1628
|
+
private readonly _mediaQuery;
|
|
1750
1629
|
/**
|
|
1751
1630
|
* Verifies if at least one of the provided media-queries is matching
|
|
1752
1631
|
* the current viewport
|
|
@@ -1773,7 +1652,6 @@ declare class DfMediaObserver implements OnDestroy {
|
|
|
1773
1652
|
declare class DfMedia {
|
|
1774
1653
|
private readonly mediaObserver;
|
|
1775
1654
|
private readonly _breakPointsService;
|
|
1776
|
-
constructor(mediaObserver: DfMediaObserver, _breakPointsService: DfBreakpoints);
|
|
1777
1655
|
initQueries(mediaOrBreakpoints: string | string[], breakPoints?: {
|
|
1778
1656
|
[key: string]: string;
|
|
1779
1657
|
}): string[];
|
|
@@ -1844,7 +1722,7 @@ declare class DfWavesOfProgressDirective {
|
|
|
1844
1722
|
* },
|
|
1845
1723
|
* ...]
|
|
1846
1724
|
*/
|
|
1847
|
-
readonly dfWavesOfProgress: i0.InputSignal<"
|
|
1725
|
+
readonly dfWavesOfProgress: i0.InputSignal<"circleDiagonal" | "circleUp" | "arrowRight" | "arrowUp">;
|
|
1848
1726
|
private readonly http;
|
|
1849
1727
|
elementRef: ElementRef<any>;
|
|
1850
1728
|
private readonly platformId;
|
|
@@ -1881,5 +1759,5 @@ declare class DfAmadeusLogoComponent {
|
|
|
1881
1759
|
static ɵcmp: i0.ɵɵComponentDeclaration<DfAmadeusLogoComponent, "df-amadeus-logo", never, { "svgClass": { "alias": "svgClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1882
1760
|
}
|
|
1883
1761
|
|
|
1884
|
-
export { BREAKPOINTS_VARS, ChangeContext, DF_BREAKPOINTS_VAR_DEFAULT, DfAccessibilityModule, DfAdvancedCardModule, DfAdvancedInputModule, DfAlertModule, DfAmadeusIconComponent, DfAmadeusLogoComponent, DfBreakpoints, DfDatePickerModule, DfDatepickerRangeDirective, DfDatepickerRangeService, DfDefaultSpinnerComponent, DfDirectionDetectionService,
|
|
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 };
|
|
1885
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.
|
|
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.
|
|
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)([
|
|
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) &&
|
|
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 [
|
|
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 =
|
|
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
|
|
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
|
+
}
|