@lucca-front/ng 21.0.0-rc.4 → 21.0.0-rc.6

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 (141) hide show
  1. package/app-layout/index.d.ts +1 -1
  2. package/box/index.d.ts +3 -3
  3. package/breadcrumbs/index.d.ts +3 -3
  4. package/button/index.d.ts +26 -21
  5. package/callout/index.d.ts +65 -57
  6. package/chip/index.d.ts +1 -1
  7. package/code/index.d.ts +1 -1
  8. package/comment/index.d.ts +11 -14
  9. package/core/index.d.ts +10 -7
  10. package/core-select/index.d.ts +6 -4
  11. package/core-select/user/index.d.ts +3 -2
  12. package/data-table/index.d.ts +1 -1
  13. package/dialog/index.d.ts +65 -48
  14. package/empty-state/index.d.ts +23 -26
  15. package/fancy-box/index.d.ts +11 -10
  16. package/fesm2022/lucca-front-ng-app-layout.mjs.map +1 -1
  17. package/fesm2022/lucca-front-ng-box.mjs.map +1 -1
  18. package/fesm2022/lucca-front-ng-breadcrumbs.mjs.map +1 -1
  19. package/fesm2022/lucca-front-ng-button.mjs +59 -90
  20. package/fesm2022/lucca-front-ng-button.mjs.map +1 -1
  21. package/fesm2022/lucca-front-ng-callout.mjs +96 -130
  22. package/fesm2022/lucca-front-ng-callout.mjs.map +1 -1
  23. package/fesm2022/lucca-front-ng-chip.mjs +1 -1
  24. package/fesm2022/lucca-front-ng-chip.mjs.map +1 -1
  25. package/fesm2022/lucca-front-ng-code.mjs.map +1 -1
  26. package/fesm2022/lucca-front-ng-comment.mjs +14 -34
  27. package/fesm2022/lucca-front-ng-comment.mjs.map +1 -1
  28. package/fesm2022/lucca-front-ng-core-select-api.mjs +3 -3
  29. package/fesm2022/lucca-front-ng-core-select-api.mjs.map +1 -1
  30. package/fesm2022/lucca-front-ng-core-select-user.mjs +14 -11
  31. package/fesm2022/lucca-front-ng-core-select-user.mjs.map +1 -1
  32. package/fesm2022/lucca-front-ng-core-select.mjs +15 -21
  33. package/fesm2022/lucca-front-ng-core-select.mjs.map +1 -1
  34. package/fesm2022/lucca-front-ng-core.mjs +6 -4
  35. package/fesm2022/lucca-front-ng-core.mjs.map +1 -1
  36. package/fesm2022/lucca-front-ng-data-table.mjs +15 -15
  37. package/fesm2022/lucca-front-ng-data-table.mjs.map +1 -1
  38. package/fesm2022/lucca-front-ng-date2.mjs +1 -1
  39. package/fesm2022/lucca-front-ng-date2.mjs.map +1 -1
  40. package/fesm2022/lucca-front-ng-dialog.mjs +96 -95
  41. package/fesm2022/lucca-front-ng-dialog.mjs.map +1 -1
  42. package/fesm2022/lucca-front-ng-empty-state.mjs +27 -68
  43. package/fesm2022/lucca-front-ng-empty-state.mjs.map +1 -1
  44. package/fesm2022/lucca-front-ng-establishment.mjs +2 -2
  45. package/fesm2022/lucca-front-ng-establishment.mjs.map +1 -1
  46. package/fesm2022/lucca-front-ng-fancy-box.mjs +14 -28
  47. package/fesm2022/lucca-front-ng-fancy-box.mjs.map +1 -1
  48. package/fesm2022/lucca-front-ng-file-upload.mjs +1 -1
  49. package/fesm2022/lucca-front-ng-file-upload.mjs.map +1 -1
  50. package/fesm2022/lucca-front-ng-filter-pills.mjs +4 -4
  51. package/fesm2022/lucca-front-ng-filter-pills.mjs.map +1 -1
  52. package/fesm2022/lucca-front-ng-form-field.mjs +2 -2
  53. package/fesm2022/lucca-front-ng-form-field.mjs.map +1 -1
  54. package/fesm2022/lucca-front-ng-forms-phone-number-input.mjs +15 -17
  55. package/fesm2022/lucca-front-ng-forms-phone-number-input.mjs.map +1 -1
  56. package/fesm2022/lucca-front-ng-forms-rich-text-input.mjs +6 -6
  57. package/fesm2022/lucca-front-ng-forms-rich-text-input.mjs.map +1 -1
  58. package/fesm2022/lucca-front-ng-forms.mjs +99 -187
  59. package/fesm2022/lucca-front-ng-forms.mjs.map +1 -1
  60. package/fesm2022/lucca-front-ng-icon.mjs +14 -19
  61. package/fesm2022/lucca-front-ng-icon.mjs.map +1 -1
  62. package/fesm2022/lucca-front-ng-index-table.mjs +1 -1
  63. package/fesm2022/lucca-front-ng-index-table.mjs.map +1 -1
  64. package/fesm2022/lucca-front-ng-inline-message.mjs +15 -22
  65. package/fesm2022/lucca-front-ng-inline-message.mjs.map +1 -1
  66. package/fesm2022/lucca-front-ng-link.mjs +27 -61
  67. package/fesm2022/lucca-front-ng-link.mjs.map +1 -1
  68. package/fesm2022/lucca-front-ng-mobile-push.mjs +4 -8
  69. package/fesm2022/lucca-front-ng-mobile-push.mjs.map +1 -1
  70. package/fesm2022/lucca-front-ng-modal.mjs +3 -3
  71. package/fesm2022/lucca-front-ng-modal.mjs.map +1 -1
  72. package/fesm2022/lucca-front-ng-multi-select.mjs +1 -1
  73. package/fesm2022/lucca-front-ng-multi-select.mjs.map +1 -1
  74. package/fesm2022/lucca-front-ng-new-badge.mjs +7 -11
  75. package/fesm2022/lucca-front-ng-new-badge.mjs.map +1 -1
  76. package/fesm2022/lucca-front-ng-numeric-badge.mjs +40 -39
  77. package/fesm2022/lucca-front-ng-numeric-badge.mjs.map +1 -1
  78. package/fesm2022/lucca-front-ng-option.mjs +1 -1
  79. package/fesm2022/lucca-front-ng-option.mjs.map +1 -1
  80. package/fesm2022/lucca-front-ng-plg-push.mjs +8 -17
  81. package/fesm2022/lucca-front-ng-plg-push.mjs.map +1 -1
  82. package/fesm2022/lucca-front-ng-popover2.mjs +2 -2
  83. package/fesm2022/lucca-front-ng-popover2.mjs.map +1 -1
  84. package/fesm2022/lucca-front-ng-scroll-box.mjs +26 -24
  85. package/fesm2022/lucca-front-ng-scroll-box.mjs.map +1 -1
  86. package/fesm2022/lucca-front-ng-scroll.mjs +19 -29
  87. package/fesm2022/lucca-front-ng-scroll.mjs.map +1 -1
  88. package/fesm2022/lucca-front-ng-simple-select.mjs +1 -1
  89. package/fesm2022/lucca-front-ng-simple-select.mjs.map +1 -1
  90. package/fesm2022/lucca-front-ng-skeleton.mjs +24 -40
  91. package/fesm2022/lucca-front-ng-skeleton.mjs.map +1 -1
  92. package/fesm2022/lucca-front-ng-status-badge.mjs +1 -1
  93. package/fesm2022/lucca-front-ng-status-badge.mjs.map +1 -1
  94. package/fesm2022/lucca-front-ng-tag.mjs +31 -42
  95. package/fesm2022/lucca-front-ng-tag.mjs.map +1 -1
  96. package/fesm2022/lucca-front-ng-time.mjs +8 -18
  97. package/fesm2022/lucca-front-ng-time.mjs.map +1 -1
  98. package/fesm2022/lucca-front-ng-toast.mjs +55 -60
  99. package/fesm2022/lucca-front-ng-toast.mjs.map +1 -1
  100. package/fesm2022/lucca-front-ng-tooltip.mjs +85 -108
  101. package/fesm2022/lucca-front-ng-tooltip.mjs.map +1 -1
  102. package/fesm2022/lucca-front-ng-user-popover.mjs +2 -2
  103. package/fesm2022/lucca-front-ng-user-popover.mjs.map +1 -1
  104. package/fesm2022/lucca-front-ng-user.mjs +58 -96
  105. package/fesm2022/lucca-front-ng-user.mjs.map +1 -1
  106. package/fesm2022/lucca-front-ng-vertical-navigation.mjs +6 -6
  107. package/fesm2022/lucca-front-ng-vertical-navigation.mjs.map +1 -1
  108. package/forms/index.d.ts +54 -62
  109. package/forms/phone-number-input/index.d.ts +13 -13
  110. package/icon/index.d.ts +10 -10
  111. package/index-table/index.d.ts +1 -1
  112. package/inline-message/index.d.ts +9 -11
  113. package/link/index.d.ts +12 -17
  114. package/mobile-push/index.d.ts +5 -6
  115. package/new-badge/index.d.ts +2 -3
  116. package/numeric-badge/index.d.ts +14 -11
  117. package/package.json +33 -37
  118. package/plg-push/index.d.ts +6 -8
  119. package/read-more/index.d.ts +1 -1
  120. package/schematics/collection.json +10 -0
  121. package/schematics/color-text/index.js +55 -0
  122. package/schematics/color-text/migration.spec.js +50 -0
  123. package/schematics/color-text/schema.json +23 -0
  124. package/schematics/lib/angular-component-ast.js +29 -0
  125. package/schematics/lu-text-input/index.js +24 -0
  126. package/schematics/lu-text-input/migration.js +116 -0
  127. package/schematics/lu-text-input/migration.spec.js +23 -0
  128. package/schematics/lu-text-input/schema.json +23 -0
  129. package/scroll/index.d.ts +20 -22
  130. package/scroll-box/index.d.ts +6 -5
  131. package/skeleton/index.d.ts +27 -32
  132. package/src/components/cdk/_global.scss +22 -1
  133. package/tag/index.d.ts +17 -15
  134. package/time/index.d.ts +5 -5
  135. package/toast/index.d.ts +23 -25
  136. package/tooltip/index.d.ts +35 -41
  137. package/user/index.d.ts +24 -32
  138. package/vertical-navigation/index.d.ts +16 -16
  139. package/fesm2022/lucca-front-ng-scrollBox.mjs +0 -6
  140. package/fesm2022/lucca-front-ng-scrollBox.mjs.map +0 -1
  141. package/scrollBox/index.d.ts +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucca-front/ng",
3
- "version": "21.0.0-rc.4",
3
+ "version": "21.0.0-rc.6",
4
4
  "description": "A library of icons made by the team @Lucca",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,8 +27,8 @@
27
27
  "@angular/core": "^20.0.0",
28
28
  "@angular/cdk": "^20.0.0",
29
29
  "@angular/animations": "^20.0.0",
30
- "@lucca-front/icons": "21.0.0-rc.4",
31
- "@lucca-front/scss": "21.0.0-rc.4",
30
+ "@lucca-front/icons": "21.0.0-rc.6",
31
+ "@lucca-front/scss": "21.0.0-rc.6",
32
32
  "isomorphic-dompurify": "^2.17.0",
33
33
  "date-fns": "^3.6.0",
34
34
  "ngx-mask": "^20.0.3",
@@ -90,26 +90,26 @@
90
90
  "types": "./index.d.ts",
91
91
  "default": "./fesm2022/lucca-front-ng.mjs"
92
92
  },
93
+ "./animations": {
94
+ "types": "./animations/index.d.ts",
95
+ "default": "./fesm2022/lucca-front-ng-animations.mjs"
96
+ },
93
97
  "./api": {
94
98
  "types": "./api/index.d.ts",
95
99
  "default": "./fesm2022/lucca-front-ng-api.mjs"
96
100
  },
101
+ "./a11y": {
102
+ "types": "./a11y/index.d.ts",
103
+ "default": "./fesm2022/lucca-front-ng-a11y.mjs"
104
+ },
97
105
  "./box": {
98
106
  "types": "./box/index.d.ts",
99
107
  "default": "./fesm2022/lucca-front-ng-box.mjs"
100
108
  },
101
- "./animations": {
102
- "types": "./animations/index.d.ts",
103
- "default": "./fesm2022/lucca-front-ng-animations.mjs"
104
- },
105
109
  "./app-layout": {
106
110
  "types": "./app-layout/index.d.ts",
107
111
  "default": "./fesm2022/lucca-front-ng-app-layout.mjs"
108
112
  },
109
- "./a11y": {
110
- "types": "./a11y/index.d.ts",
111
- "default": "./fesm2022/lucca-front-ng-a11y.mjs"
112
- },
113
113
  "./breadcrumbs": {
114
114
  "types": "./breadcrumbs/index.d.ts",
115
115
  "default": "./fesm2022/lucca-front-ng-breadcrumbs.mjs"
@@ -134,25 +134,21 @@
134
134
  "types": "./code/index.d.ts",
135
135
  "default": "./fesm2022/lucca-front-ng-code.mjs"
136
136
  },
137
- "./comment": {
138
- "types": "./comment/index.d.ts",
139
- "default": "./fesm2022/lucca-front-ng-comment.mjs"
140
- },
141
137
  "./container": {
142
138
  "types": "./container/index.d.ts",
143
139
  "default": "./fesm2022/lucca-front-ng-container.mjs"
144
140
  },
145
- "./core-select": {
146
- "types": "./core-select/index.d.ts",
147
- "default": "./fesm2022/lucca-front-ng-core-select.mjs"
141
+ "./comment": {
142
+ "types": "./comment/index.d.ts",
143
+ "default": "./fesm2022/lucca-front-ng-comment.mjs"
148
144
  },
149
145
  "./core": {
150
146
  "types": "./core/index.d.ts",
151
147
  "default": "./fesm2022/lucca-front-ng-core.mjs"
152
148
  },
153
- "./data-table": {
154
- "types": "./data-table/index.d.ts",
155
- "default": "./fesm2022/lucca-front-ng-data-table.mjs"
149
+ "./core-select": {
150
+ "types": "./core-select/index.d.ts",
151
+ "default": "./fesm2022/lucca-front-ng-core-select.mjs"
156
152
  },
157
153
  "./date": {
158
154
  "types": "./date/index.d.ts",
@@ -162,6 +158,10 @@
162
158
  "types": "./date2/index.d.ts",
163
159
  "default": "./fesm2022/lucca-front-ng-date2.mjs"
164
160
  },
161
+ "./data-table": {
162
+ "types": "./data-table/index.d.ts",
163
+ "default": "./fesm2022/lucca-front-ng-data-table.mjs"
164
+ },
165
165
  "./department": {
166
166
  "types": "./department/index.d.ts",
167
167
  "default": "./fesm2022/lucca-front-ng-department.mjs"
@@ -178,14 +178,14 @@
178
178
  "types": "./dropdown/index.d.ts",
179
179
  "default": "./fesm2022/lucca-front-ng-dropdown.mjs"
180
180
  },
181
- "./empty-state": {
182
- "types": "./empty-state/index.d.ts",
183
- "default": "./fesm2022/lucca-front-ng-empty-state.mjs"
184
- },
185
181
  "./establishment": {
186
182
  "types": "./establishment/index.d.ts",
187
183
  "default": "./fesm2022/lucca-front-ng-establishment.mjs"
188
184
  },
185
+ "./empty-state": {
186
+ "types": "./empty-state/index.d.ts",
187
+ "default": "./fesm2022/lucca-front-ng-empty-state.mjs"
188
+ },
189
189
  "./fancy-box": {
190
190
  "types": "./fancy-box/index.d.ts",
191
191
  "default": "./fesm2022/lucca-front-ng-fancy-box.mjs"
@@ -266,14 +266,14 @@
266
266
  "types": "./listing/index.d.ts",
267
267
  "default": "./fesm2022/lucca-front-ng-listing.mjs"
268
268
  },
269
- "./main-layout": {
270
- "types": "./main-layout/index.d.ts",
271
- "default": "./fesm2022/lucca-front-ng-main-layout.mjs"
272
- },
273
269
  "./loading": {
274
270
  "types": "./loading/index.d.ts",
275
271
  "default": "./fesm2022/lucca-front-ng-loading.mjs"
276
272
  },
273
+ "./main-layout": {
274
+ "types": "./main-layout/index.d.ts",
275
+ "default": "./fesm2022/lucca-front-ng-main-layout.mjs"
276
+ },
277
277
  "./mobile-push": {
278
278
  "types": "./mobile-push/index.d.ts",
279
279
  "default": "./fesm2022/lucca-front-ng-mobile-push.mjs"
@@ -354,10 +354,6 @@
354
354
  "types": "./scroll-box/index.d.ts",
355
355
  "default": "./fesm2022/lucca-front-ng-scroll-box.mjs"
356
356
  },
357
- "./scrollBox": {
358
- "types": "./scrollBox/index.d.ts",
359
- "default": "./fesm2022/lucca-front-ng-scrollBox.mjs"
360
- },
361
357
  "./segmented-control": {
362
358
  "types": "./segmented-control/index.d.ts",
363
359
  "default": "./fesm2022/lucca-front-ng-segmented-control.mjs"
@@ -486,13 +482,13 @@
486
482
  "types": "./forms/rich-text-input/formatters/html/index.d.ts",
487
483
  "default": "./fesm2022/lucca-front-ng-forms-rich-text-input-formatters-html.mjs"
488
484
  },
489
- "./forms/rich-text-input/formatters/markdown": {
490
- "types": "./forms/rich-text-input/formatters/markdown/index.d.ts",
491
- "default": "./fesm2022/lucca-front-ng-forms-rich-text-input-formatters-markdown.mjs"
492
- },
493
485
  "./forms/rich-text-input/formatters/plain-text": {
494
486
  "types": "./forms/rich-text-input/formatters/plain-text/index.d.ts",
495
487
  "default": "./fesm2022/lucca-front-ng-forms-rich-text-input-formatters-plain-text.mjs"
488
+ },
489
+ "./forms/rich-text-input/formatters/markdown": {
490
+ "types": "./forms/rich-text-input/formatters/markdown/index.d.ts",
491
+ "default": "./fesm2022/lucca-front-ng-forms-rich-text-input-formatters-markdown.mjs"
496
492
  }
497
493
  },
498
494
  "sideEffects": false,
@@ -1,4 +1,4 @@
1
- import * as i0 from '@angular/core';
1
+ import * as _angular_core from '@angular/core';
2
2
 
3
3
  interface LuPlgPushLabel {
4
4
  close: string;
@@ -6,16 +6,14 @@ interface LuPlgPushLabel {
6
6
 
7
7
  declare class PLGPushComponent {
8
8
  protected intl: LuPlgPushLabel;
9
- heading: string;
10
- removable: boolean;
9
+ readonly heading: _angular_core.InputSignal<string>;
10
+ readonly removable: _angular_core.InputSignalWithTransform<boolean, unknown>;
11
11
  /**
12
12
  * Is the callout removed? Works with two way binding too.
13
13
  */
14
- removed: i0.ModelSignal<boolean>;
15
- get hiddenAttr(): 'hidden' | null;
16
- static ɵfac: i0.ɵɵFactoryDeclaration<PLGPushComponent, never>;
17
- static ɵcmp: i0.ɵɵComponentDeclaration<PLGPushComponent, "lu-plg-push", never, { "heading": { "alias": "heading"; "required": false; }; "removable": { "alias": "removable"; "required": false; }; "removed": { "alias": "removed"; "required": false; "isSignal": true; }; }, { "removed": "removedChange"; }, never, ["*"], true, never>;
18
- static ngAcceptInputType_removable: unknown;
14
+ readonly removed: _angular_core.ModelSignal<boolean>;
15
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<PLGPushComponent, never>;
16
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<PLGPushComponent, "lu-plg-push", never, { "heading": { "alias": "heading"; "required": false; "isSignal": true; }; "removable": { "alias": "removable"; "required": false; "isSignal": true; }; "removed": { "alias": "removed"; "required": false; "isSignal": true; }; }, { "removed": "removedChange"; }, never, ["*"], true, never>;
19
17
  }
20
18
 
21
19
  export { PLGPushComponent };
@@ -20,7 +20,7 @@ declare class ReadMoreComponent implements OnInit {
20
20
  expanded: _angular_core.WritableSignal<boolean>;
21
21
  isClamped: _angular_core.WritableSignal<boolean>;
22
22
  readonly backgroundColor: _angular_core.Signal<string>;
23
- isNil: <T>(value: T | null | undefined) => value is null | undefined;
23
+ isNil: <T>(value: T | null) => value is null;
24
24
  ngOnInit(): void;
25
25
  toggleExpanded(): void;
26
26
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ReadMoreComponent, never>;
@@ -16,6 +16,11 @@
16
16
  "factory": "./lu-select/index",
17
17
  "schema": "./lu-select/schema.json"
18
18
  },
19
+ "lu-text-input": {
20
+ "description": "Migrate deprecated textfield into lu-text-input where possible.",
21
+ "factory": "./lu-text-input/index",
22
+ "schema": "./lu-text-input/schema.json"
23
+ },
19
24
  "tokens-spacings": {
20
25
  "description": "Replace spacing tokens with new names.",
21
26
  "factory": "./tokens-spacing/index",
@@ -36,6 +41,11 @@
36
41
  "factory": "./tokens-typo/index",
37
42
  "schema": "./tokens-typo/schema.json"
38
43
  },
44
+ "color-text": {
45
+ "description": "Replace color text tokens.",
46
+ "factory": "./color-text/index",
47
+ "schema": "./color-text/schema.json"
48
+ },
39
49
  "palettes": {
40
50
  "description": "Replace palettes with new names.",
41
51
  "factory": "./palettes/index",
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const css_mapper_1 = require("../lib/css-mapper");
4
+ const lf_schematic_context_1 = require("../lib/lf-schematic-context");
5
+ // Nx need to see "@angular-devkit/schematics" in order to run this migration correctly (see https://github.com/nrwl/nx/blob/d9fed4b832bf01d1b9a44ae9e486a5e5cd2d2253/packages/nx/src/command-line/migrate/migrate.ts#L1729-L1738)
6
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
7
+ require('@angular-devkit/schematics');
8
+ exports.default = (options) => {
9
+ return async (tree, context) => {
10
+ await lf_schematic_context_1.currentSchematicContext.init(context, options);
11
+ await new css_mapper_1.CssMapper(tree, {
12
+ classes: {
13
+ 'pr-u-textProduct': 'pr-u-colorTextProduct',
14
+ 'pr-u-textPrimary': 'pr-u-colorTextProduct',
15
+ 'pr-u-textSecondary': 'pr-u-colorTextProduct',
16
+ 'pr-u-textBrand': 'pr-u-colorTextBrand',
17
+ 'pr-u-textLucca': 'pr-u-colorTextBrand',
18
+ 'pr-u-textPlaceholder': 'pr-u-colorInputTextPlaceholder',
19
+ 'pr-u-textNeutral': 'pr-u-colorText',
20
+ 'pr-u-textDefault': 'pr-u-colorText',
21
+ 'pr-u-textGrey': 'pr-u-colorText',
22
+ 'pr-u-textLight': 'pr-u-colorTextSubtle',
23
+ 'pr-u-textSuccess': 'pr-u-colorTextSuccess',
24
+ 'pr-u-textWarning': 'pr-u-colorTextWarning',
25
+ 'pr-u-textCritical': 'pr-u-colorTextCritical',
26
+ 'pr-u-textError': 'pr-u-colorTextCritical',
27
+ 'pr-u-textSuccessContrasted': 'pr-u-colorTextSuccessContrasted',
28
+ 'pr-u-textWarningContrasted': 'pr-u-colorTextWarningContrasted',
29
+ 'pr-u-textBrandContrasted': 'pr-u-colorTextBrandContrasted',
30
+ 'pr-u-textNavigation': 'pr-u-colorTextNavigation',
31
+ 'pr-u-textAI': 'pr-u-colorTextAI',
32
+ 'pr-u-textPagga': 'pr-u-colorTextPagga',
33
+ 'pr-u-textPoplee': 'pr-u-colorTextPoplee',
34
+ 'pr-u-textCoreHR': 'pr-u-colorTextCoreHR',
35
+ 'pr-u-textTimmi': 'pr-u-colorTextTimmi',
36
+ 'pr-u-textCleemy': 'pr-u-colorTextCleemy',
37
+ 'pr-u-textCc': 'pr-u-colorTextCc',
38
+ 'pr-u-textKiwi': 'pr-u-colorTextKiwi',
39
+ 'pr-u-textLime': 'pr-u-colorTextLime',
40
+ 'pr-u-textCucumber': 'pr-u-colorTextCucumber',
41
+ 'pr-u-textMint': 'pr-u-colorTextMint',
42
+ 'pr-u-textGlacier': 'pr-u-colorTextGlacier',
43
+ 'pr-u-textLagoon': 'pr-u-colorTextLagoon',
44
+ 'pr-u-textBlueberry': 'pr-u-colorTextBlueberry',
45
+ 'pr-u-textLavender': 'pr-u-colorTextLavender',
46
+ 'pr-u-textGrape': 'pr-u-colorTextGrape',
47
+ 'pr-u-textWatermelon': 'pr-u-colorTextWatermelon',
48
+ 'pr-u-textPumpkin': 'pr-u-colorTextPumpkin',
49
+ 'pr-u-textPineapple': 'pr-u-colorTextPineapple',
50
+ },
51
+ variables: {},
52
+ mixins: {}
53
+ }, {}).run();
54
+ };
55
+ };
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const fs = require("fs");
4
+ const glob = require("glob");
5
+ const path = require("path");
6
+ const migration_test_js_1 = require("../lib/migration-test.js");
7
+ const collectionPath = path.normalize(path.join(__dirname, '..', 'collection.json'));
8
+ const testsRoot = path.join(__dirname, 'tests');
9
+ const files = fs.readdirSync(testsRoot);
10
+ describe('Color Text Migration', () => {
11
+ it('should update files', async () => {
12
+ // Arrange
13
+ const tree = (0, migration_test_js_1.createTreeFromFiles)(testsRoot, files, '.input.');
14
+ const expectedTree = (0, migration_test_js_1.createTreeFromFiles)(testsRoot, files, '.output.');
15
+ // Act
16
+ try {
17
+ await (0, migration_test_js_1.runSchematic)('collection', collectionPath, 'color-text', { skipInstallation: true }, tree);
18
+ }
19
+ catch (error) {
20
+ // eslint-disable-next-line no-console
21
+ console.log(error);
22
+ }
23
+ // Assert
24
+ (0, migration_test_js_1.expectTree)(tree).toMatchTree(expectedTree);
25
+ });
26
+ // Use this to migrate @lucca-front/* packages
27
+ it.skip('should migrate @lucca-front/*', async () => {
28
+ // Arrange
29
+ const lfRoot = path.normalize(path.join(__dirname, '..', '..', '..', '..'));
30
+ const lfFiles = [
31
+ ...glob.sync('packages/icons/**/*.scss', { cwd: lfRoot, nodir: true }),
32
+ ...glob.sync('packages/scss/**/*.scss', { cwd: lfRoot, nodir: true }),
33
+ ...glob.sync('packages/ng/**/*', { cwd: lfRoot, nodir: true, ignore: ['**/schematics/**'] }),
34
+ ...glob.sync('stories/**', { cwd: lfRoot, nodir: true }),
35
+ ];
36
+ const treeOriginalTree = (0, migration_test_js_1.createTreeFromFiles)(lfRoot, lfFiles, '.');
37
+ const tree = (0, migration_test_js_1.createTreeFromFiles)(lfRoot, lfFiles, '.');
38
+ // Act
39
+ await (0, migration_test_js_1.runSchematic)('collection', collectionPath, 'color-text', { skipInstallation: true }, tree);
40
+ // Assert
41
+ tree.visit((p, entry) => {
42
+ const original = treeOriginalTree.get(p)?.content.toString() || '';
43
+ const updated = entry?.content.toString() || '';
44
+ if (original !== updated) {
45
+ const fromRootPath = path.join(lfRoot, p);
46
+ fs.writeFileSync(fromRootPath, updated);
47
+ }
48
+ });
49
+ });
50
+ });
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "LuccaFrontColorText",
4
+ "title": "Lucca Front Color Text Schema",
5
+ "type": "object",
6
+ "properties": {
7
+ "dryRun": {
8
+ "type": "boolean",
9
+ "description": "Run through the migration without making any changes.",
10
+ "default": false
11
+ },
12
+ "skipInstall": {
13
+ "type": "boolean",
14
+ "description": "Skip installing dependencies.",
15
+ "default": false
16
+ },
17
+ "verbose": {
18
+ "type": "boolean",
19
+ "description": "Enable verbose logging.",
20
+ "default": false
21
+ }
22
+ }
23
+ }
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.extractProviders = extractProviders;
4
4
  exports.extractComponentImports = extractComponentImports;
5
+ exports.inputValueToHTML = inputValueToHTML;
6
+ exports.getInputValue = getInputValue;
5
7
  exports.insertTSImportIfNeeded = insertTSImportIfNeeded;
6
8
  exports.insertAngularImportIfNeeded = insertAngularImportIfNeeded;
7
9
  exports.removeAngularImport = removeAngularImport;
@@ -10,6 +12,7 @@ const change_1 = require("@schematics/angular/utility/change");
10
12
  const eol_1 = require("@schematics/angular/utility/eol");
11
13
  const typescript_1 = require("typescript");
12
14
  const angular_template_1 = require("./angular-template");
15
+ const lf_schematic_context_1 = require("./lf-schematic-context");
13
16
  function extractProviders(sourceFile) {
14
17
  const providerEntries = [];
15
18
  (0, typescript_1.forEachChild)(sourceFile, (0, angular_template_1.createVisitor)(typescript_1.isDecorator, (decorator) => {
@@ -88,6 +91,32 @@ function extractComponentImports(sourceFile) {
88
91
  }));
89
92
  return imports;
90
93
  }
94
+ function inputValueToHTML(name, value) {
95
+ if (!value) {
96
+ return "";
97
+ }
98
+ return `${value.isBinding ? '[' : ''}${value.twoWayBinding ? '(' : ''}${name}${value.twoWayBinding ? ')' : ''}${value.isBinding ? ']' : ''}="${value.value}"`;
99
+ }
100
+ function getInputValue(node, inputName) {
101
+ const input = node.inputs.find((i) => i.name === inputName);
102
+ if (input) {
103
+ const output = node.outputs.find((o) => o.name === `${inputName}Change`);
104
+ const value = input?.value instanceof lf_schematic_context_1.currentSchematicContext.angularCompiler.ASTWithSource ? input.value.source : null;
105
+ return {
106
+ isBinding: true,
107
+ value,
108
+ twoWayBinding: output?.handler instanceof lf_schematic_context_1.currentSchematicContext.angularCompiler.ASTWithSource ? output.handler.source === value : false
109
+ };
110
+ }
111
+ const attr = node.attributes.find((a) => a.name === inputName);
112
+ if (attr) {
113
+ return {
114
+ isBinding: false,
115
+ value: attr.value
116
+ };
117
+ }
118
+ return undefined;
119
+ }
91
120
  // Simplified version of https://github.com/angular/angular-cli/blob/main/packages/schematics/angular/utility/ast-utils.ts#L24 for our use case
92
121
  function insertTSImportIfNeeded(sourceFile, fileToEdit, symbolName, fileName) {
93
122
  const allImports = sourceFile.statements.filter(typescript_1.isImportDeclaration);
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const typescript_1 = require("typescript");
4
+ const lf_schematic_context_1 = require("../lib/lf-schematic-context");
5
+ const schematics_1 = require("../lib/schematics");
6
+ const migration_1 = require("./migration");
7
+ // Nx need to see "@angular-devkit/schematics" in order to run this migration correctly (see https://github.com/nrwl/nx/blob/d9fed4b832bf01d1b9a44ae9e486a5e5cd2d2253/packages/nx/src/command-line/migrate/migrate.ts#L1729-L1738)
8
+ require('@angular-devkit/schematics');
9
+ exports.default = (options) => {
10
+ return async (tree, context) => {
11
+ await lf_schematic_context_1.currentSchematicContext.init(context, options);
12
+ tree.visit((path, entry) => {
13
+ if (path.includes('node_modules') || !entry) {
14
+ return;
15
+ }
16
+ if (path.endsWith('.ts')) {
17
+ (0, schematics_1.migrateFile)(path, entry, tree, (content) => {
18
+ const sourceFile = (0, typescript_1.createSourceFile)(path, content, typescript_1.ScriptTarget.ESNext);
19
+ return (0, migration_1.migrateComponent)(sourceFile, path, tree);
20
+ });
21
+ }
22
+ });
23
+ };
24
+ };
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.migrateComponent = migrateComponent;
4
+ const angular_template_1 = require("../lib/angular-template");
5
+ const html_ast_js_1 = require("../lib/html-ast.js");
6
+ const lf_schematic_context_1 = require("../lib/lf-schematic-context");
7
+ const angular_component_ast_1 = require("../lib/angular-component-ast");
8
+ const change_1 = require("@schematics/angular/utility/change");
9
+ function migrateComponent(sourceFile, path, tree) {
10
+ const textfields = findTextfields(sourceFile, path, tree);
11
+ if (textfields.length > 0) {
12
+ const tsUpdate = tree.beginUpdate(path);
13
+ const isInlineTemplate = textfields[0].filePath === path;
14
+ const templateUpdate = isInlineTemplate ? tsUpdate : tree.beginUpdate(textfields[0].filePath);
15
+ let updatedStuff = false;
16
+ textfields.forEach((field) => {
17
+ if (field.rejection) {
18
+ // TODO check if custom directive is in place for custom inputs
19
+ // eslint-disable-next-line no-console
20
+ console.log(`[REJECTED] ${field.filePath}#L${field.node.startSourceSpan.start.line} => ${field.rejection}`);
21
+ }
22
+ else {
23
+ updatedStuff = true;
24
+ // Let's remove everything first
25
+ templateUpdate.remove(field.nodeOffset + field.node.startSourceSpan.start.offset, field.node.sourceSpan.toString().length);
26
+ // Then forge the new input
27
+ const textInput = `<lu-text-input ${(0, angular_component_ast_1.inputValueToHTML)('placeholder', field.inputs.placeholder)} ${(0, angular_component_ast_1.inputValueToHTML)('formControlName', field.inputs.formControlName)} ${(0, angular_component_ast_1.inputValueToHTML)('ngModel', field.inputs.ngModel)} />`.replace(/\s{2,}/, " ");
28
+ const fieldOpeningTag = `lu-form-field [label]="labelTpl"`.replace(/\s{2,}/, " ").trim();
29
+ // TODO handle required migration from template-driven to form-driven???
30
+ const newInput = `<${fieldOpeningTag}>
31
+ <ng-template #labelTpl>${field.label}</ng-template>
32
+ ${textInput}
33
+ </lu-form-field>`;
34
+ templateUpdate.insertRight(field.nodeOffset + field.node.startSourceSpan.start.offset, newInput);
35
+ }
36
+ // For errors management, how can we detect it??? Then we could migrate text logic in its own ng-template like formation does.
37
+ });
38
+ if (updatedStuff) {
39
+ // Add import if needed
40
+ (0, change_1.applyToUpdateRecorder)(tsUpdate, [
41
+ (0, angular_component_ast_1.insertTSImportIfNeeded)(sourceFile, path, 'FormFieldComponent', '@lucca-front/ng/form-field'),
42
+ (0, angular_component_ast_1.insertAngularImportIfNeeded)(sourceFile, path, 'FormFieldComponent'),
43
+ (0, angular_component_ast_1.insertTSImportIfNeeded)(sourceFile, path, 'TextInputComponent', '@lucca-front/ng/forms'),
44
+ (0, angular_component_ast_1.insertAngularImportIfNeeded)(sourceFile, path, 'TextInputComponent')
45
+ ]);
46
+ tree.commitUpdate(tsUpdate);
47
+ if (!isInlineTemplate) {
48
+ tree.commitUpdate(templateUpdate);
49
+ }
50
+ }
51
+ }
52
+ return tree.readText(path);
53
+ }
54
+ function findTextfields(sourceFile, basePath, tree) {
55
+ const fields = [];
56
+ const ngTemplates = (0, angular_template_1.extractNgTemplatesIncludingHtml)(sourceFile, tree, basePath);
57
+ ngTemplates.forEach((template) => {
58
+ const htmlAst = new html_ast_js_1.HtmlAst(template.content);
59
+ htmlAst.visitNodes((node) => {
60
+ if (isInterestingNode(node) && node.name === "label") {
61
+ const classes = getNodeClasses(node);
62
+ const inputs = {
63
+ size: classes.find(c => /mod-(XS|S|M|L|XL|XXL)/.test(c))?.replace('mod-', '')
64
+ };
65
+ const field = {
66
+ node: node,
67
+ inputs,
68
+ nodeOffset: template.offsetStart,
69
+ filePath: template.filePath,
70
+ componentTS: sourceFile,
71
+ classes: classes
72
+ };
73
+ if (classes.includes("textfield")) {
74
+ if (node.children.filter(el => isInterestingNode(el) || isControlFlowNode(el)).length > 2) {
75
+ field.rejection = "Field contains more than an input + label";
76
+ }
77
+ // Find native input and grab params from it
78
+ const nativeInput = node.children.find(el => isInterestingNode(el) && el.name === "input");
79
+ if (!nativeInput) {
80
+ field.rejection = "Field doesn't contain a native input[type=text]";
81
+ }
82
+ else if (isInterestingNode(nativeInput)) {
83
+ inputs.placeholder = (0, angular_component_ast_1.getInputValue)(nativeInput, "placeholder");
84
+ inputs.formControlName = (0, angular_component_ast_1.getInputValue)(nativeInput, "formControlName");
85
+ inputs.ngModel = (0, angular_component_ast_1.getInputValue)(nativeInput, "ngModel");
86
+ inputs.forceRequired = (0, angular_component_ast_1.getInputValue)(nativeInput, "aria-required");
87
+ }
88
+ // This is a textfield, now let's find if it has everything required for migration
89
+ const visitor = new html_ast_js_1.HtmlAstVisitor(node);
90
+ visitor.visitElements(/span/, (el) => {
91
+ if (isInterestingNode(el) && getNodeClasses(el).includes("textfield-label")) {
92
+ field.label = template.content.slice(el.startSourceSpan.end.offset, el.endSourceSpan?.start?.offset);
93
+ }
94
+ });
95
+ if (!field.label) {
96
+ field.rejection = "Field has no label";
97
+ }
98
+ fields.push(field);
99
+ }
100
+ }
101
+ });
102
+ });
103
+ return fields;
104
+ }
105
+ function getNodeClasses(node) {
106
+ return (node.attributes.find(attr => attr.name === 'class')?.value || "").split(" ");
107
+ }
108
+ function isInterestingNode(node) {
109
+ return node instanceof lf_schematic_context_1.currentSchematicContext.angularCompiler.TmplAstElement;
110
+ }
111
+ function isControlFlowNode(node) {
112
+ return node instanceof lf_schematic_context_1.currentSchematicContext.angularCompiler.TmplAstIfBlock ||
113
+ node instanceof lf_schematic_context_1.currentSchematicContext.angularCompiler.TmplAstForLoopBlock ||
114
+ node instanceof lf_schematic_context_1.currentSchematicContext.angularCompiler.TmplAstSwitchBlock ||
115
+ node instanceof lf_schematic_context_1.currentSchematicContext.angularCompiler.TmplAstDeferredBlock;
116
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const path = require("path");
4
+ const migration_test_js_1 = require("../lib/migration-test.js");
5
+ const collectionPath = path.normalize(path.join(__dirname, '..', 'collection.json'));
6
+ const testsRoot = path.join(__dirname, 'tests');
7
+ describe('Textfield Migration', () => {
8
+ it('should handle basic case files', async () => {
9
+ // Arrange
10
+ const tree = (0, migration_test_js_1.createTreeFromFolder)(path.join(testsRoot, 'input'));
11
+ const expectedTree = (0, migration_test_js_1.createTreeFromFolder)(path.join(testsRoot, 'output'));
12
+ // Act
13
+ try {
14
+ await (0, migration_test_js_1.runSchematic)('collection', collectionPath, 'lu-text-input', { skipInstallation: true }, tree);
15
+ }
16
+ catch (error) {
17
+ // eslint-disable-next-line no-console
18
+ console.log(error);
19
+ }
20
+ // Assert
21
+ (0, migration_test_js_1.expectTree)(tree).toMatchTree(expectedTree);
22
+ });
23
+ });
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "LuccaFrontLuButton",
4
+ "title": "Migrate CSS-only buttons to the new luButton component",
5
+ "type": "object",
6
+ "properties": {
7
+ "dryRun": {
8
+ "type": "boolean",
9
+ "description": "Run through the migration without making any changes.",
10
+ "default": false
11
+ },
12
+ "skipInstall": {
13
+ "type": "boolean",
14
+ "description": "Skip installing dependencies.",
15
+ "default": false
16
+ },
17
+ "verbose": {
18
+ "type": "boolean",
19
+ "description": "Enable verbose logging.",
20
+ "default": false
21
+ }
22
+ }
23
+ }