@design-factory/design-factory 20.0.0-next.1 → 20.0.0-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -16
- package/design-factory-initial-branding.css +1 -1
- package/design-factory-initial-branding.scss +1 -1
- package/design-factory.css +2 -2
- package/design-factory.scss +0 -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 +520 -476
- package/fesm2022/design-factory.mjs.map +1 -1
- package/index.d.ts +22 -72
- package/package.json +15 -3
- 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 +18 -0
- package/schematics/migrations/20_0_0/colors-new-branding/index.js +151 -0
- package/schematics/migrations/20_0_0/modal-removal/index.d.ts +7 -0
- package/schematics/migrations/20_0_0/modal-removal/index.js +53 -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/20_0_0/style-import/index.d.ts +7 -0
- package/schematics/migrations/20_0_0/style-import/index.js +39 -0
- package/schematics/migrations/20_0_0/waves-of-progress/index.d.ts +7 -0
- package/schematics/migrations/20_0_0/waves-of-progress/index.js +69 -0
- package/schematics/migrations/helpers.js +1 -1
- package/schematics/migrations/migration.json +27 -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/bootstrap/_utilities-override.scss +14 -8
- package/styles/scss/bootstrap/_variables.scss +2 -2
- package/styles/scss/components/alert/_alert.scss +23 -11
- package/styles/scss/components/badge/_badge.mixins.scss +2 -4
- package/styles/scss/components/badge/_badge.scss +84 -23
- package/styles/scss/components/button/_button.scss +394 -86
- 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 +29 -11
- package/styles/scss/components/checkbox/_checkbox.scss +2 -1
- package/styles/scss/components/collapse/_collapse.scss +6 -1
- package/styles/scss/components/datepicker/_datepicker.scss +9 -11
- package/styles/scss/components/dropdown/_dropdown.scss +23 -0
- package/styles/scss/components/fonts/_font-faces.mixins.scss +108 -54
- package/styles/scss/components/fonts/_icon-font.scss +2 -1
- package/styles/scss/components/footer/_footer.scss +1 -1
- package/styles/scss/components/inputs/_inputs.root.scss +1 -1
- package/styles/scss/components/inputs/_inputs.scss +7 -1
- package/styles/scss/components/link/_link.mixins.scss +7 -3
- package/styles/scss/components/link/_link.scss +10 -0
- package/styles/scss/components/link/_link.variables.scss +5 -2
- 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 +51 -19
- package/styles/scss/components/navbar/_navbar.scss +12 -0
- package/styles/scss/components/pagination/_pagination.scss +1 -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/radio/_radio.scss +1 -1
- package/styles/scss/components/rating/_rating.scss +3 -3
- package/styles/scss/components/rating/_rating.variables.scss +1 -1
- package/styles/scss/components/scrollspy/_scrollspy.scss +5 -2
- 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 +1 -1
- 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/tabs/_tabs.scss +3 -0
- package/styles/scss/components/toast/_toast.scss +37 -32
- package/styles/scss/components/tooltip/_tooltip_container.scss +17 -13
- package/styles/scss/themes/brand2023/_variables.scss +68 -29
- package/styles/scss/themes/brand2023/tokens/_mapping.gen.scss +156 -186
- package/styles/scss/themes/brand2023/tokens/_root.gen.scss +1709 -0
- package/styles/scss/themes/brand2023/tokens/_sass-vars.gen.scss +1468 -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/assets/waves_of_progress/arrowRight.svg +0 -34
- package/assets/waves_of_progress/arrowUp.svg +0 -35
- package/assets/waves_of_progress/circleDiagonal.svg +0 -29
- package/assets/waves_of_progress/circleUp.svg +0 -24
- package/styles/scss/components/waves/_waves.scss +0 -15
- package/styles/scss/components/waves/_waves.variables.scss +0 -86
- 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,
|
|
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
|
-
|
|
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(
|
|
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(
|
|
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<"" | "
|
|
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
|
|
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<
|
|
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
|
}
|
|
@@ -1751,37 +1711,27 @@ declare class DfTitleTruncateDirective implements OnInit, DoCheck {
|
|
|
1751
1711
|
|
|
1752
1712
|
declare class DfWavesOfProgressDirective {
|
|
1753
1713
|
/**
|
|
1754
|
-
* The type of waves to display
|
|
1755
|
-
|
|
1714
|
+
* The type of waves to display
|
|
1715
|
+
*/
|
|
1716
|
+
readonly dfWavesOfProgress: i0.InputSignal<"circleDiagonal" | "circleUp" | "arrowRight" | "arrowUp">;
|
|
1717
|
+
/**
|
|
1718
|
+
* The color of the waves. It can be one of the predefined brand colors or a custom color.
|
|
1756
1719
|
* @example
|
|
1757
|
-
*
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
* "output": "assets/"
|
|
1762
|
-
* },
|
|
1763
|
-
* ...]
|
|
1764
|
-
*/
|
|
1765
|
-
readonly dfWavesOfProgress: i0.InputSignal<"arrowRight" | "circleDiagonal" | "circleUp" | "arrowUp">;
|
|
1766
|
-
private readonly http;
|
|
1767
|
-
elementRef: ElementRef<any>;
|
|
1768
|
-
private readonly platformId;
|
|
1769
|
-
private baseSvg;
|
|
1720
|
+
* 'dark-sky', 'vivid-crimson', 'light-forest', ['#000835', '#3A8BFF']
|
|
1721
|
+
*/
|
|
1722
|
+
readonly color: i0.InputSignal<"dark-sky" | "dark-crimson" | "dark-pumpkin" | "dark-forest" | "dark-canary" | "dark-fuchsia" | "dark-violet" | "vivid-sky" | "vivid-crimson" | "vivid-pumpkin" | "vivid-forest" | "vivid-canary" | "vivid-fuchsia" | "vivid-violet" | "light-sky" | "light-crimson" | "light-pumpkin" | "light-forest" | "light-canary" | "light-fuchsia" | "light-violet" | [string, string]>;
|
|
1723
|
+
readonly backgroundImage: i0.Signal<string>;
|
|
1770
1724
|
/**
|
|
1771
1725
|
* Prepares the SVG string by replacing color variables and encoding it.
|
|
1726
|
+
* @param svgAsString - The SVG string to prepare.
|
|
1772
1727
|
* @param bgColor - The background color.
|
|
1773
1728
|
* @param lineColor - The line color.
|
|
1774
1729
|
* @returns The prepared SVG string.
|
|
1775
1730
|
*/
|
|
1776
|
-
prepareSvg
|
|
1777
|
-
|
|
1778
|
-
* Updates the SVG background image based on the current element's styles.
|
|
1779
|
-
*/
|
|
1780
|
-
updateSvg(): void;
|
|
1781
|
-
constructor();
|
|
1782
|
-
private getSvg;
|
|
1731
|
+
private prepareSvg;
|
|
1732
|
+
private getWavesAsString;
|
|
1783
1733
|
static ɵfac: i0.ɵɵFactoryDeclaration<DfWavesOfProgressDirective, never>;
|
|
1784
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<DfWavesOfProgressDirective, "[dfWavesOfProgress]", ["dfWavesOfProgress"], { "dfWavesOfProgress": { "alias": "dfWavesOfProgress"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1734
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DfWavesOfProgressDirective, "[dfWavesOfProgress]", ["dfWavesOfProgress"], { "dfWavesOfProgress": { "alias": "dfWavesOfProgress"; "required": true; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1785
1735
|
}
|
|
1786
1736
|
|
|
1787
1737
|
declare class DfWavesOfProgressModule {
|
|
@@ -1799,5 +1749,5 @@ declare class DfAmadeusLogoComponent {
|
|
|
1799
1749
|
static ɵcmp: i0.ɵɵComponentDeclaration<DfAmadeusLogoComponent, "df-amadeus-logo", never, { "svgClass": { "alias": "svgClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1800
1750
|
}
|
|
1801
1751
|
|
|
1802
|
-
export { BREAKPOINTS_VARS, ChangeContext, DF_BREAKPOINTS_VAR_DEFAULT, DfAccessibilityModule, DfAdvancedCardModule, DfAdvancedInputModule, DfAlertModule, DfAmadeusIconComponent, DfAmadeusLogoComponent, DfBreakpoints, DfDatePickerModule, DfDatepickerRangeDirective, DfDatepickerRangeService, DfDefaultSpinnerComponent, DfDirectionDetectionService,
|
|
1752
|
+
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
1753
|
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.3",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"tslib": "^2.0.0"
|
|
8
8
|
},
|
|
@@ -14,10 +14,12 @@
|
|
|
14
14
|
"@angular/localize": "^20.0.0",
|
|
15
15
|
"@angular/router": "^20.0.0",
|
|
16
16
|
"@ng-bootstrap/ng-bootstrap": "~19.0.0",
|
|
17
|
-
"@ng-select/ng-select": "^15.0.0",
|
|
17
|
+
"@ng-select/ng-select": "^15.0.0 || ^20.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,18 @@
|
|
|
1
|
+
import { type Rule } from '@angular-devkit/schematics';
|
|
2
|
+
export declare function replaceContentFactory(isTemplate: boolean, loggingContext: {
|
|
3
|
+
warnings: boolean;
|
|
4
|
+
deprecatedColors: boolean;
|
|
5
|
+
}): (content: string) => string;
|
|
6
|
+
/**
|
|
7
|
+
* This migration updates the classes regarding the colors.
|
|
8
|
+
*
|
|
9
|
+
* - bg-dark, bg-outline-dark, bg-secondary, bg-outline-secondary are replaced by their "neutral" equivalent classes,
|
|
10
|
+
* - mystery is replaced by tip,
|
|
11
|
+
* - yellow is replaced by chromatic1,
|
|
12
|
+
* - love is replaced by chromatic2,
|
|
13
|
+
*
|
|
14
|
+
* - The -light color variations are replaced by the -soft ones (bg-[color]-light becomes bg-[color]-soft),
|
|
15
|
+
*
|
|
16
|
+
* @returns the Rule to migrate the color classes
|
|
17
|
+
*/
|
|
18
|
+
export default function colorNamesProcess(): Rule;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.replaceContentFactory = replaceContentFactory;
|
|
4
|
+
exports.default = colorNamesProcess;
|
|
5
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
|
+
const project_tsconfig_paths_1 = require("../../utils/project_tsconfig_paths");
|
|
7
|
+
const compiler_host_1 = require("../../utils/typescript/compiler_host");
|
|
8
|
+
const template_updater_1 = require("../../utils/template-updater");
|
|
9
|
+
const style_updater_1 = require("../../utils/style-updater");
|
|
10
|
+
const classBreak = '[^a-zA-Z-]'; // to avoid matching "bg-primary-light" for example
|
|
11
|
+
const indent = `[ \t]*`;
|
|
12
|
+
const colorsWithDeprecation = {
|
|
13
|
+
light: 'neutral-soft',
|
|
14
|
+
secondary: 'neutral'
|
|
15
|
+
};
|
|
16
|
+
const regExpColorsWithDeprecation = new RegExp(`(${indent}).*${classBreak}(bg|text|text-bg])-(${Object.keys(colorsWithDeprecation).join('|')})${classBreak}`, 'g');
|
|
17
|
+
const safeColorMap = {
|
|
18
|
+
dark: 'neutral',
|
|
19
|
+
mystery: 'tip',
|
|
20
|
+
yellow: 'chromatic1',
|
|
21
|
+
love: 'chromatic2'
|
|
22
|
+
};
|
|
23
|
+
const allColorNamesMap = {
|
|
24
|
+
...colorsWithDeprecation,
|
|
25
|
+
...safeColorMap
|
|
26
|
+
};
|
|
27
|
+
const removedColorsList = ['pacific', 'dark-primary', 'dark-green'];
|
|
28
|
+
const regExpRemovedColors = new RegExp(`(${indent}).*${classBreak}(bg|text|text-bg|btn|btn-outline|df-badge-outline|toast)-(${removedColorsList.join('|')})${classBreak}.*`, 'g');
|
|
29
|
+
const colorNames = Object.keys(allColorNamesMap).join('|');
|
|
30
|
+
/*
|
|
31
|
+
Matches "light" color variants, specifically for badges, as "light" colors are only defined for badges.
|
|
32
|
+
for exemple bg-*-light
|
|
33
|
+
*/
|
|
34
|
+
const regExpLight = new RegExp(`${classBreak}(bg|df-badge-outline)-[a-z]+-light${classBreak}`, 'g');
|
|
35
|
+
const regExpBadgeLight = new RegExp(`.*?(badge|toast)${classBreak}bg-light${classBreak}`, 'g');
|
|
36
|
+
const regExpSoftColor = new RegExp(`${classBreak}(bg|text|text-bg|df-badge-outline)-(${colorNames})-soft${classBreak}`, 'g');
|
|
37
|
+
const regExpColors = new RegExp(`([ \t]*).*${classBreak}(bg|text|text-bg|btn|btn-outline|df-badge-outline|toast)-(${colorNames})${classBreak}`, 'g');
|
|
38
|
+
const regExpBadgeOrToast = /(badge|toast)/;
|
|
39
|
+
const regExpBadgeOrButton = /(badge|btn)/;
|
|
40
|
+
function replaceContentFactory(isTemplate, loggingContext) {
|
|
41
|
+
return function replaceContent(content) {
|
|
42
|
+
// Replace the specific bg-light in the badge
|
|
43
|
+
content = content.replace(regExpBadgeLight, function (str) {
|
|
44
|
+
return str.replace('bg-light', 'bg-neutral-soft');
|
|
45
|
+
});
|
|
46
|
+
// Replace the "light" variants by the "soft" ones
|
|
47
|
+
content = content.replace(regExpLight, function (str) {
|
|
48
|
+
const result = str.replace('-light', '-soft');
|
|
49
|
+
return result;
|
|
50
|
+
});
|
|
51
|
+
// Replace the old name by the new ones for the soft first
|
|
52
|
+
content = content.replace(regExpSoftColor, function (str, _prefix, color) {
|
|
53
|
+
let result = str;
|
|
54
|
+
const mappedColor = allColorNamesMap[color];
|
|
55
|
+
if (mappedColor) {
|
|
56
|
+
result = result.replace(color, mappedColor);
|
|
57
|
+
}
|
|
58
|
+
return result;
|
|
59
|
+
});
|
|
60
|
+
// Replace the old name by the new ones
|
|
61
|
+
content = content.replace(regExpColors, function (str, indent, _prefix, color) {
|
|
62
|
+
let result = str;
|
|
63
|
+
if (regExpBadgeOrToast.test(str)) {
|
|
64
|
+
const mappedColor = allColorNamesMap[color];
|
|
65
|
+
if (mappedColor) {
|
|
66
|
+
result = result.replace(color, mappedColor);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
else if (str.includes('btn') && (color === 'secondary' || color === 'light')) {
|
|
70
|
+
loggingContext.warnings = true;
|
|
71
|
+
const msg = `DF 20 migration: ${color} is no longer supported in buttons.`;
|
|
72
|
+
result = isTemplate ? `${indent}<!-- ${msg} -->\n${str}` : `${indent}\\* ${msg} *\\\n${str}`;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
// Safe color replacement
|
|
76
|
+
const mappedColor = safeColorMap[color];
|
|
77
|
+
if (mappedColor) {
|
|
78
|
+
result = result.replace(color, mappedColor);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return result;
|
|
82
|
+
});
|
|
83
|
+
// Warning for secondary and light colors
|
|
84
|
+
content = content.replace(regExpColorsWithDeprecation, function (str, _indent, _prefix) {
|
|
85
|
+
if (!regExpBadgeOrButton.test(str)) {
|
|
86
|
+
loggingContext.deprecatedColors = true;
|
|
87
|
+
}
|
|
88
|
+
return str;
|
|
89
|
+
});
|
|
90
|
+
// Removed colors
|
|
91
|
+
content = content.replace(regExpRemovedColors, function (str, indent, _, color) {
|
|
92
|
+
let result = str;
|
|
93
|
+
if (!str.includes('navbar')) {
|
|
94
|
+
loggingContext.warnings = true;
|
|
95
|
+
const msg = `DF 20 migration: ${color} has been removed`;
|
|
96
|
+
result = isTemplate ? `${indent}<!-- ${msg} -->\n${str}` : `${indent}\\* ${msg} *\\\n${str}`;
|
|
97
|
+
}
|
|
98
|
+
return result;
|
|
99
|
+
});
|
|
100
|
+
return content;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* This migration updates the classes regarding the colors.
|
|
105
|
+
*
|
|
106
|
+
* - bg-dark, bg-outline-dark, bg-secondary, bg-outline-secondary are replaced by their "neutral" equivalent classes,
|
|
107
|
+
* - mystery is replaced by tip,
|
|
108
|
+
* - yellow is replaced by chromatic1,
|
|
109
|
+
* - love is replaced by chromatic2,
|
|
110
|
+
*
|
|
111
|
+
* - The -light color variations are replaced by the -soft ones (bg-[color]-light becomes bg-[color]-soft),
|
|
112
|
+
*
|
|
113
|
+
* @returns the Rule to migrate the color classes
|
|
114
|
+
*/
|
|
115
|
+
function colorNamesProcess() {
|
|
116
|
+
return async (tree, context) => {
|
|
117
|
+
const loggingContext = { warnings: false, deprecatedColors: false };
|
|
118
|
+
const { buildPaths, testPaths } = await (0, project_tsconfig_paths_1.getProjectTsConfigPaths)(tree);
|
|
119
|
+
const basePath = process.cwd();
|
|
120
|
+
const allPaths = [...buildPaths, ...testPaths];
|
|
121
|
+
if (!allPaths.length) {
|
|
122
|
+
throw new schematics_1.SchematicsException('Could not find any tsconfig file. Cannot run the `color names` migration.');
|
|
123
|
+
}
|
|
124
|
+
const templateUpdater = new template_updater_1.TemplateUpdater(tree, replaceContentFactory(true, loggingContext));
|
|
125
|
+
for (const tsconfigPath of allPaths) {
|
|
126
|
+
const program = (0, compiler_host_1.createMigrationProgram)(tree, tsconfigPath, basePath);
|
|
127
|
+
const sourceFiles = program
|
|
128
|
+
.getSourceFiles()
|
|
129
|
+
.filter((sourceFile) => (0, compiler_host_1.canMigrateFile)(basePath, sourceFile, program));
|
|
130
|
+
for (const sourceFile of sourceFiles) {
|
|
131
|
+
templateUpdater.update(sourceFile, program.getTypeChecker());
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const styleUpdater = new style_updater_1.StyleUpdater(tree, replaceContentFactory(false, loggingContext));
|
|
135
|
+
for (const tsconfigPath of allPaths) {
|
|
136
|
+
const program = (0, compiler_host_1.createMigrationProgram)(tree, tsconfigPath, basePath);
|
|
137
|
+
const sourceFiles = program
|
|
138
|
+
.getSourceFiles()
|
|
139
|
+
.filter((sourceFile) => (0, compiler_host_1.canMigrateFile)(basePath, sourceFile, program));
|
|
140
|
+
for (const sourceFile of sourceFiles) {
|
|
141
|
+
styleUpdater.update(sourceFile, program.getTypeChecker());
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (loggingContext.warnings) {
|
|
145
|
+
context.logger.warn('Some removed color classes were found. Check your files for comments in your code.');
|
|
146
|
+
}
|
|
147
|
+
if (loggingContext.deprecatedColors) {
|
|
148
|
+
context.logger.warn('Deprecated color classes (light, secondary) detected. Please review your usage of bg-light, text-light, text-bg-light, bg-secondary, text-secondary, and text-bg-secondary.');
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Rule } from '@angular-devkit/schematics';
|
|
2
|
+
/**
|
|
3
|
+
* This migration updates Angular code to remove the usage of the `DfModalService` from the Design Factory library.
|
|
4
|
+
*
|
|
5
|
+
* @returns the Rule to migrate the modal removal
|
|
6
|
+
*/
|
|
7
|
+
export default function modalRemoval(): Rule;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = modalRemoval;
|
|
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 path_1 = require("path");
|
|
8
|
+
const core_1 = require("@angular-devkit/core");
|
|
9
|
+
const regexImportDfModal = /import\s\{([^}]*)DfModalService(,\s*)?([^}]*)\}\sfrom\s['"]@design-factory\/design-factory['"];/gm;
|
|
10
|
+
const regexDfModalService = /DfModalService/g;
|
|
11
|
+
const replaceComponent = (text) => {
|
|
12
|
+
text = text.replace(regexImportDfModal, (_match, p1, _p2, p3) => {
|
|
13
|
+
return (`import { NgbModal } from '@ng-bootstrap/ng-bootstrap';` +
|
|
14
|
+
((p1 + p3).trim()
|
|
15
|
+
? `\nimport {${p3.trim() ? p1 : p1.replace(/(.*),\s*/, '$1')}${p3}} from '@design-factory/design-factory';`
|
|
16
|
+
: ''));
|
|
17
|
+
});
|
|
18
|
+
text = text.replace(regexDfModalService, 'NgbModal');
|
|
19
|
+
return text;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* This migration updates Angular code to remove the usage of the `DfModalService` from the Design Factory library.
|
|
23
|
+
*
|
|
24
|
+
* @returns the Rule to migrate the modal removal
|
|
25
|
+
*/
|
|
26
|
+
function modalRemoval() {
|
|
27
|
+
return async (tree, _context) => {
|
|
28
|
+
const { buildPaths, testPaths } = await (0, project_tsconfig_paths_1.getProjectTsConfigPaths)(tree);
|
|
29
|
+
const basePath = process.cwd();
|
|
30
|
+
const allPaths = [...buildPaths, ...testPaths];
|
|
31
|
+
if (!allPaths.length) {
|
|
32
|
+
throw new schematics_1.SchematicsException('Could not find any tsconfig file. Cannot run the `waves of progress` migration.');
|
|
33
|
+
}
|
|
34
|
+
for (const tsconfigPath of allPaths) {
|
|
35
|
+
const program = (0, compiler_host_1.createMigrationProgram)(tree, tsconfigPath, basePath);
|
|
36
|
+
const sourceFiles = program
|
|
37
|
+
.getSourceFiles()
|
|
38
|
+
.filter((sourceFile) => (0, compiler_host_1.canMigrateFile)(basePath, sourceFile, program));
|
|
39
|
+
for (const sourceFile of sourceFiles) {
|
|
40
|
+
const sourceText = sourceFile.getFullText();
|
|
41
|
+
const updatedText = replaceComponent(sourceText);
|
|
42
|
+
if (updatedText !== sourceText) {
|
|
43
|
+
const absFilePath = (0, core_1.normalize)(path_1.posix.resolve('/', (0, core_1.normalize)(sourceFile.fileName)));
|
|
44
|
+
const filePath = path_1.posix.relative((0, core_1.normalize)(process.cwd()), absFilePath);
|
|
45
|
+
const recorder = tree.beginUpdate(filePath);
|
|
46
|
+
recorder.remove(0, sourceText.length);
|
|
47
|
+
recorder.insertRight(0, updatedText);
|
|
48
|
+
tree.commitUpdate(recorder);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -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(
|
|
11
|
-
loggingContext.foundComplexCase =
|
|
12
|
-
|
|
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 `
|
|
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
|
+
}
|