igniteui-angular 18.2.0-beta.0 → 18.2.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/esm2022/lib/badge/badge.component.mjs +19 -3
  2. package/esm2022/lib/core/i18n/query-builder-resources.mjs +4 -3
  3. package/esm2022/lib/data-operations/filtering-expression.interface.mjs +1 -1
  4. package/esm2022/lib/grids/filtering/base/grid-filtering-cell.component.mjs +2 -2
  5. package/esm2022/lib/grids/grid/groupby-row.component.mjs +2 -2
  6. package/esm2022/lib/grids/grouping/grid-group-by-area.component.mjs +3 -3
  7. package/esm2022/lib/grids/grouping/tree-grid-group-by-area.component.mjs +3 -3
  8. package/esm2022/lib/grids/pivot-grid/pivot-header-row.component.mjs +2 -2
  9. package/esm2022/lib/grids/selection/selection.service.mjs +9 -9
  10. package/esm2022/lib/icon/icon.references.mjs +6 -10
  11. package/esm2022/lib/query-builder/query-builder-header.component.mjs +3 -3
  12. package/esm2022/lib/query-builder/query-builder-tree.component.mjs +3 -3
  13. package/esm2022/lib/tabs/tabs/tabs.component.mjs +4 -3
  14. package/fesm2022/igniteui-angular.mjs +46 -33
  15. package/fesm2022/igniteui-angular.mjs.map +1 -1
  16. package/lib/badge/badge.component.d.ts +12 -1
  17. package/lib/core/i18n/query-builder-resources.d.ts +1 -0
  18. package/lib/core/styles/components/badge/_badge-component.scss +4 -0
  19. package/lib/core/styles/components/badge/_badge-theme.scss +6 -12
  20. package/lib/core/styles/components/banner/_banner-theme.scss +5 -1
  21. package/lib/core/styles/components/card/_card-theme.scss +18 -1
  22. package/lib/core/styles/components/chip/_chip-theme.scss +180 -154
  23. package/lib/core/styles/components/drop-down/_drop-down-theme.scss +5 -1
  24. package/lib/core/styles/components/navdrawer/_navdrawer-theme.scss +9 -7
  25. package/lib/core/styles/components/query-builder/_query-builder-component.scss +4 -0
  26. package/lib/core/styles/components/query-builder/_query-builder-theme.scss +34 -27
  27. package/lib/core/styles/components/tabs/_tabs-theme.scss +72 -18
  28. package/lib/core/styles/components/tree/_tree-theme.scss +1 -3
  29. package/lib/core/styles/typography/_indigo.scss +3 -1
  30. package/lib/data-operations/filtering-expression.interface.d.ts +2 -4
  31. package/migrations/common/ServerHost.d.ts +3 -1
  32. package/migrations/common/ServerHost.js +4 -1
  33. package/migrations/common/UpdateChanges.d.ts +7 -2
  34. package/migrations/common/UpdateChanges.js +39 -29
  35. package/migrations/common/project-service-container.d.ts +11 -0
  36. package/migrations/common/project-service-container.js +25 -0
  37. package/migrations/update-13_0_0/changes/members.json +1 -1
  38. package/migrations/update-18_2_0/changes/inputs.json +14 -0
  39. package/migrations/update-18_2_0/changes/theme-changes.json +6 -0
  40. package/migrations/update-18_2_0/index.js +4 -0
  41. package/package.json +2 -2
  42. package/styles/igniteui-angular-dark.css +1 -1
  43. package/styles/igniteui-angular.css +1 -1
  44. package/styles/igniteui-bootstrap-dark.css +1 -1
  45. package/styles/igniteui-bootstrap-light.css +1 -1
  46. package/styles/igniteui-dark-green.css +1 -1
  47. package/styles/igniteui-fluent-dark-excel.css +1 -1
  48. package/styles/igniteui-fluent-dark-word.css +1 -1
  49. package/styles/igniteui-fluent-dark.css +1 -1
  50. package/styles/igniteui-fluent-light-excel.css +1 -1
  51. package/styles/igniteui-fluent-light-word.css +1 -1
  52. package/styles/igniteui-fluent-light.css +1 -1
  53. package/styles/igniteui-indigo-dark.css +1 -1
  54. package/styles/igniteui-indigo-light.css +1 -1
  55. package/styles/maps/igniteui-angular-dark.css.map +1 -1
  56. package/styles/maps/igniteui-angular.css.map +1 -1
  57. package/styles/maps/igniteui-bootstrap-dark.css.map +1 -1
  58. package/styles/maps/igniteui-bootstrap-light.css.map +1 -1
  59. package/styles/maps/igniteui-dark-green.css.map +1 -1
  60. package/styles/maps/igniteui-fluent-dark-excel.css.map +1 -1
  61. package/styles/maps/igniteui-fluent-dark-word.css.map +1 -1
  62. package/styles/maps/igniteui-fluent-dark.css.map +1 -1
  63. package/styles/maps/igniteui-fluent-light-excel.css.map +1 -1
  64. package/styles/maps/igniteui-fluent-light-word.css.map +1 -1
  65. package/styles/maps/igniteui-fluent-light.css.map +1 -1
  66. package/styles/maps/igniteui-indigo-dark.css.map +1 -1
  67. package/styles/maps/igniteui-indigo-light.css.map +1 -1
@@ -202,7 +202,7 @@
202
202
  }
203
203
 
204
204
  %navdrawer-display-mini-pinned {
205
- flex-basis: var(--igx-mini-nav-drawer-size, #{$item-mini-size});
205
+ flex-basis: calc(var(--igx-mini-nav-drawer-size, #{$item-mini-size}) + rem(1px));
206
206
  }
207
207
 
208
208
  %aside {
@@ -213,11 +213,11 @@
213
213
  background: var-get($theme, 'background');
214
214
  top: 0;
215
215
  bottom: 0;
216
- min-width: var(--igx-nav-drawer-size);
216
+ width: var(--igx-nav-drawer-size);
217
217
  inset-inline-start: 0;
218
218
  z-index: 999;
219
219
  transition: width, padding, transform;
220
- transition-timing-function: $in-out-quad, $in-out-quad;
220
+ transition-timing-function: $in-out-quad;
221
221
  box-shadow: var-get($theme, 'shadow');
222
222
  padding: $aside-padding;
223
223
 
@@ -279,11 +279,13 @@
279
279
  }
280
280
 
281
281
  %aside--mini {
282
- transition-duration: .2s, .2s;
283
- min-width: var(--igx-nav-drawer-size--mini);
282
+ transition-duration: .3s;
283
+ width: var(--igx-nav-drawer-size--mini);
284
+ min-width: fit-content;
284
285
 
285
286
  %item {
286
287
  justify-content: center;
288
+ min-width: fit-content;
287
289
 
288
290
  @if $variant == 'bootstrap' {
289
291
  width: rem(56px);
@@ -303,7 +305,7 @@
303
305
  }
304
306
 
305
307
  %aside--normal {
306
- transition-duration: .3s, .3s;
308
+ transition-duration: .3s;
307
309
  width: var(--igx-nav-drawer-size);
308
310
  }
309
311
 
@@ -311,7 +313,7 @@
311
313
  opacity: 1;
312
314
  background: color(null, 'gray', 500, .54);
313
315
  transition: opacity, visibility;
314
- transition-duration: .25s, .25s;
316
+ transition-duration: .3s, .3s;
315
317
  transition-timing-function: ease-in, step-start;
316
318
  transition-delay: 0s, 0s;
317
319
  position: absolute;
@@ -24,6 +24,10 @@
24
24
  @extend %advanced-filter__header !optional;
25
25
  }
26
26
 
27
+ @include e(title) {
28
+ @extend %advanced-filter__title !optional;
29
+ }
30
+
27
31
  @include e(main) {
28
32
  @extend %advanced-filter__main !optional;
29
33
  }
@@ -143,11 +143,8 @@
143
143
  }
144
144
 
145
145
  %advanced-filter__main {
146
- padding: pad-inline(
147
- map.get($vertical-space, 'compact'),
148
- map.get($vertical-space, 'cosy'),
149
- map.get($vertical-space, 'comfortable')
150
- );
146
+ padding-inline: pad-inline(rem(8px), rem(12px), rem(16px));
147
+ padding-block: pad-block(rem(16px));
151
148
  }
152
149
  }
153
150
  }
@@ -174,13 +171,10 @@
174
171
  }
175
172
 
176
173
  %advanced-filter__header {
177
- @if $variant != 'indigo' {
178
- @include type-style('h6');
179
- } @else {
180
- @include type-style('h5');
181
-
182
- border-top-left-radius: border-radius(rem(10px));
183
- border-top-right-radius: border-radius(rem(10px));
174
+ @if $variant == 'bootstrap' {
175
+ > * {
176
+ margin-bottom: rem(0) !important;
177
+ }
184
178
  }
185
179
 
186
180
  display: flex;
@@ -193,6 +187,10 @@
193
187
  border-block-end: rem(1px) solid var-get($theme, 'header-border');
194
188
  }
195
189
 
190
+ %advanced-filter__title {
191
+ @include type-style(if($variant != 'indigo', 'h6', 'h5'));
192
+ }
193
+
196
194
  %advanced-filter__main {
197
195
  display: flex;
198
196
  overflow: auto;
@@ -284,13 +282,10 @@
284
282
  display: flex;
285
283
  align-items: center;
286
284
  width: 100%;
287
- gap: $gap;
285
+ gap: if($variant != 'indigo', $gap, rem(8px));
288
286
  position: relative;
289
287
 
290
288
  > igx-chip {
291
- @container style(--ig-size: 1) {
292
- --ig-size: 2;
293
- }
294
289
 
295
290
  @if $variant != 'indigo' {
296
291
  .igx-chip__item {
@@ -298,10 +293,14 @@
298
293
  }
299
294
  }
300
295
 
301
- .igx-filter-tree__expression-column {
296
+ %filter-tree__expression-column {
302
297
  padding-inline: pad-inline(rem(3px), rem(6px), rem(8px));
303
298
  }
304
299
 
300
+ %filter-tree__expression-condition {
301
+ padding-inline-start: pad-inline(rem(3px), rem(6px), rem(8px));
302
+ }
303
+
305
304
  igx-prefix {
306
305
  display: flex;
307
306
  }
@@ -318,7 +317,11 @@
318
317
 
319
318
  %filter-tree__expression-actions {
320
319
  display: inline-flex;
321
- gap: $gap;
320
+ gap: if($variant != 'indigo', $gap, rem(8px));
321
+
322
+ span {
323
+ display: inline-flex;
324
+ }
322
325
 
323
326
  igx-icon {
324
327
  cursor: pointer;
@@ -333,7 +336,7 @@
333
336
  }
334
337
 
335
338
  %filter-tree__expression-condition {
336
- opacity: .7;
339
+ opacity: if($variant != 'indigo', .6, .8);
337
340
  }
338
341
 
339
342
  %filter-tree__buttons {
@@ -345,14 +348,19 @@
345
348
 
346
349
  %filter-tree__inputs {
347
350
  display: flex;
348
- justify-content: space-between;
349
- align-items: center;
351
+ align-items: flex-end;
350
352
  gap: rem(8px);
353
+ width: 100%;
351
354
 
352
355
  igx-input-group {
353
356
  --ig-size: 1;
354
357
  }
355
358
 
359
+ > * {
360
+ max-width: rem(300px);
361
+ width: 100%;
362
+ }
363
+
356
364
  &:empty {
357
365
  display: none !important;
358
366
  }
@@ -362,6 +370,7 @@
362
370
  display: flex;
363
371
  gap: $gap;
364
372
  align-items: center;
373
+ width: auto;
365
374
 
366
375
  [igxIconButton] {
367
376
  transition: none;
@@ -379,18 +388,16 @@
379
388
  display: inline-flex;
380
389
  align-items: center;
381
390
  font-size: rem(12px);
382
-
383
- @if $variant == 'indigo' {
384
- font-weight: 400;
385
- }
391
+ line-height: rem(16px);
392
+ font-weight: 400;
386
393
 
387
394
  &::before {
388
395
  content: '';
389
396
  width: rem(24px);
390
397
  height: rem(24px);
391
398
  background: white;
392
- border-radius: $border-radius;
393
399
  margin-inline-end: rem(8px);
400
+ border-radius: if($variant != 'indigo', $border-radius, #{rem(4px)});
394
401
  }
395
402
 
396
403
  + %filter-legend__item {
@@ -493,7 +500,7 @@
493
500
  color: contrast-color(null, 'gray', 50, .6);
494
501
  }
495
502
  } @else {
496
- color: color(null, 'gray', 600);
503
+ color: color(null, 'gray', 500);
497
504
  }
498
505
  }
499
506
 
@@ -188,7 +188,8 @@
188
188
  border-color: $border-color,
189
189
  border-radius: $border-radius,
190
190
  _meta: map.merge(if($meta, $meta, ()), (
191
- variant: map.get($schema, '_meta', 'theme')
191
+ variant: map.get($schema, '_meta', 'theme'),
192
+ theme-variant: map.get($schema, '_meta', 'variant')
192
193
  )),
193
194
  ));
194
195
  }
@@ -205,6 +206,7 @@
205
206
  $not-bootstrap-theme: $variant != 'bootstrap';
206
207
  $bootstrap-theme: $variant == 'bootstrap';
207
208
  $indigo-theme: $variant == 'indigo';
209
+ $theme-variant: map.get($theme, '_meta', 'theme-variant');
208
210
 
209
211
  $item-min-width: rem(90px);
210
212
  $item-max-width: rem(360px);
@@ -228,9 +230,12 @@
228
230
  %tabs-header-item-inner,
229
231
  %tabs-header-content {
230
232
  display: flex;
233
+ align-items: center;
231
234
  }
232
235
 
233
236
  %tabs-display {
237
+ --nav-btn-border-color: #{var-get($theme, 'border-color')};
238
+
234
239
  display: flex;
235
240
  flex-direction: column;
236
241
  overflow: hidden;
@@ -240,8 +245,21 @@
240
245
  overflow: hidden;
241
246
  flex: 0 0 auto;
242
247
  background: var-get($theme, 'item-background');
243
- min-height: rem(42px);
244
248
  z-index: 1;
249
+
250
+ @if $indigo-theme {
251
+ [igxIconButton='flat'].igx-button--focused {
252
+ box-shadow: none;
253
+
254
+ &::after {
255
+ border: rem(3px) solid var(--nav-btn-border-color);
256
+
257
+ @if $theme-variant == 'dark' {
258
+ border-color: contrast-color($color: 'gray', $variant: 50, $opacity: .2);
259
+ }
260
+ }
261
+ }
262
+ }
245
263
  }
246
264
 
247
265
  %tabs-header-content {
@@ -286,6 +304,10 @@
286
304
  background: var-get($theme, 'button-background');
287
305
  color: var-get($theme, 'button-color');
288
306
  outline: 0;
307
+ align-self: stretch;
308
+ height: auto;
309
+ transition: none;
310
+ border-radius: border-radius(0);
289
311
 
290
312
  &:hover {
291
313
  background: var-get($theme, 'button-hover-background');
@@ -294,7 +316,10 @@
294
316
 
295
317
  &:focus {
296
318
  outline: 0;
297
- background: var-get($theme, 'button-hover-background');
319
+
320
+ @if $variant != 'indigo' {
321
+ background: var-get($theme, 'button-hover-background');
322
+ }
298
323
  }
299
324
 
300
325
  &::-moz-focus-inner {
@@ -304,12 +329,27 @@
304
329
 
305
330
  &:disabled {
306
331
  color: var-get($theme, 'button-disabled-color');
332
+ cursor: default;
333
+ pointer-events: none;
307
334
  }
308
335
 
309
336
  &--none {
310
337
  display: none;
311
338
  }
312
339
 
340
+ @if $indigo-theme {
341
+ min-width: rem(40px);
342
+ width: rem(40px);
343
+
344
+ &::after {
345
+ content: '';
346
+ position: absolute;
347
+ pointer-events: none;
348
+ width: 100%;
349
+ height: 100%;
350
+ border-bottom: rem(1px) solid var(--nav-btn-border-color);
351
+ }
352
+ }
313
353
 
314
354
  @include ripple($button-ripple-theme);
315
355
  @include css-vars($button-ripple-theme);
@@ -327,7 +367,7 @@
327
367
 
328
368
  %tabs-header-item {
329
369
  > * {
330
- margin-inline-start: rem(12px);
370
+ margin-inline-start: rem(if($variant != 'indigo', 12px, 8px));
331
371
 
332
372
  &:first-child {
333
373
  margin-inline-start: 0;
@@ -338,6 +378,7 @@
338
378
  align-items: center;
339
379
  min-width: $item-min-width;
340
380
  max-width: $item-max-width;
381
+ min-height: #{if($variant == 'indigo', rem(40px), rem(42px))};
341
382
  word-wrap: break-word;
342
383
  // Flex basis & shrink are Needed for IE11
343
384
  flex-basis: auto;
@@ -355,16 +396,6 @@
355
396
  color: var-get($theme, 'item-icon-color');
356
397
  }
357
398
 
358
- @if $bootstrap-theme {
359
- padding-block: rem(12px);
360
- border-start-start-radius: var-get($theme, 'border-radius');
361
- border-start-end-radius: var-get($theme, 'border-radius');
362
- }
363
-
364
- @if $indigo-theme {
365
- border-bottom: rem(1px) solid var-get($theme, 'border-color');
366
- }
367
-
368
399
  &::-moz-focus-inner {
369
400
  border: 0;
370
401
  }
@@ -392,6 +423,7 @@
392
423
  }
393
424
 
394
425
  @if $bootstrap-theme {
426
+ padding-block: rem(12px);
395
427
  border-start-start-radius: var-get($theme, 'border-radius');
396
428
  border-start-end-radius: var-get($theme, 'border-radius');
397
429
  }
@@ -407,13 +439,18 @@
407
439
  }
408
440
 
409
441
  @if $indigo-theme {
410
- border-top: transparent;
411
- border-inline: transparent;
442
+ border-top: rem(1px) solid transparent;
443
+ border-inline: none;
412
444
 
413
445
  &:hover,
414
446
  &:focus {
415
- border-top: transparent;
416
- border-inline: transparent;
447
+ border-top: rem(1px) solid transparent;
448
+ border-inline: none;
449
+ border-bottom: rem(1px) solid var-get($theme, 'border-color');
450
+ }
451
+
452
+ igx-icon {
453
+ --ig-size: 2;
417
454
  }
418
455
  }
419
456
 
@@ -459,6 +496,18 @@
459
496
  box-shadow: inset 0 0 0 rem(1px) var-get($theme, 'border-color');
460
497
  }
461
498
  }
499
+
500
+ @if $indigo-theme {
501
+ &:hover,
502
+ &:focus-visible {
503
+ background: var-get($theme, 'item-hover-background');
504
+ color: var-get($theme, 'item-hover-color');
505
+
506
+ igx-icon {
507
+ color: var-get($theme, 'item-hover-icon-color');
508
+ }
509
+ }
510
+ }
462
511
  }
463
512
 
464
513
  %tabs-header-item:focus,
@@ -516,9 +565,14 @@
516
565
  min-width: $item-min-width;
517
566
  background: var-get($theme, 'indicator-color');
518
567
  transition: transform .3s $tabs-animation-function, width .2s $tabs-animation-function;
568
+
519
569
  @if $bootstrap-theme {
520
570
  display: none;
521
571
  }
572
+
573
+ @if $indigo-theme {
574
+ height: rem(3px);
575
+ }
522
576
  }
523
577
 
524
578
  %tabs-panels {
@@ -240,9 +240,7 @@
240
240
  }
241
241
 
242
242
  igx-icon {
243
- @if $variant == 'indigo' {
244
- --component-size: 2;
245
- }
243
+ --component-size: #{if($variant == 'indigo', 2, 3)};
246
244
  }
247
245
 
248
246
  [dir='rtl'] & {
@@ -102,7 +102,9 @@
102
102
  @include switch-typography($categories: (
103
103
  label: 'body-2'
104
104
  ));
105
- @include tabs-typography();
105
+ @include tabs-typography($categories: (
106
+ label: 'subtitle-2',
107
+ ));
106
108
  @include time-picker-typography($categories: (
107
109
  header-time-period: 'subtitle-1',
108
110
  header-hour: 'h5',
@@ -1,6 +1,4 @@
1
- /// <reference types="node" />
2
1
  import { IFilteringOperation } from './filtering-condition';
3
- import { Serializable } from 'node:child_process';
4
2
  import { IExpressionTree } from './filtering-expressions-tree';
5
3
  export declare enum FilteringLogic {
6
4
  And = 0,
@@ -12,8 +10,8 @@ export declare enum FilteringLogic {
12
10
  export declare interface IFilteringExpression {
13
11
  fieldName: string;
14
12
  condition?: IFilteringOperation;
15
- conditionName: string;
16
- searchVal?: Serializable;
13
+ conditionName?: string;
14
+ searchVal?: any;
17
15
  searchTree?: IExpressionTree;
18
16
  ignoreCase?: boolean;
19
17
  }
@@ -6,10 +6,12 @@ import * as ts from 'typescript/lib/tsserverlibrary';
6
6
  * Angular's Ivy LS sometimes bypasses these, calling path methods instead of tsLsHost operations
7
7
  */
8
8
  export declare class ServerHost implements ts.server.ServerHost {
9
- private host;
9
+ host: Tree;
10
10
  readonly args: string[];
11
11
  readonly newLine: string;
12
12
  readonly useCaseSensitiveFileNames: boolean;
13
+ /** Cached because Angular schematics encapsulation's customRequire doesn't provide `resolve` */
14
+ private nativeRequire;
13
15
  constructor(host: Tree);
14
16
  /**
15
17
  * Read a file's content from the Virtual Tree
@@ -4,6 +4,7 @@ exports.ServerHost = void 0;
4
4
  const pathFs = require("path");
5
5
  const ts = require("typescript/lib/tsserverlibrary");
6
6
  const tsUtils_1 = require("./tsUtils");
7
+ const module_1 = require("module");
7
8
  /**
8
9
  * Language server host is responsible for **most** of the FS operations / checks
9
10
  * Angular's Ivy LS sometimes bypasses these, calling path methods instead of tsLsHost operations
@@ -11,6 +12,8 @@ const tsUtils_1 = require("./tsUtils");
11
12
  class ServerHost {
12
13
  constructor(host) {
13
14
  this.host = host;
15
+ /** Cached because Angular schematics encapsulation's customRequire doesn't provide `resolve` */
16
+ this.nativeRequire = (0, module_1.createRequire)(__filename);
14
17
  this.args = ts.sys.args;
15
18
  this.newLine = ts.sys.newLine;
16
19
  this.useCaseSensitiveFileNames = ts.sys.useCaseSensitiveFileNames;
@@ -112,7 +115,7 @@ class ServerHost {
112
115
  moduleName = tsUtils_1.CUSTOM_TS_PLUGIN_PATH;
113
116
  paths.push(__dirname);
114
117
  }
115
- const modulePath = require.resolve(moduleName, { paths });
118
+ const modulePath = this.nativeRequire.resolve(moduleName, { paths });
116
119
  return {
117
120
  module: require(modulePath),
118
121
  error: undefined,
@@ -18,12 +18,11 @@ export declare class UpdateChanges {
18
18
  private host;
19
19
  private context?;
20
20
  protected tsconfigPath: string;
21
- protected _projectService: tss.server.ProjectService;
22
21
  _shouldInvokeLS: boolean;
23
22
  get shouldInvokeLS(): boolean;
24
23
  set shouldInvokeLS(val: boolean);
25
24
  get projectService(): tss.server.ProjectService;
26
- protected serverHost: ServerHost;
25
+ protected get serverHost(): ServerHost;
27
26
  protected workspace: WorkspaceSchema;
28
27
  protected sourcePaths: string[];
29
28
  protected classChanges: ClassChanges;
@@ -91,6 +90,12 @@ export declare class UpdateChanges {
91
90
  private updateTsFiles;
92
91
  private updateMembers;
93
92
  private getDefaultProjectForFile;
93
+ /**
94
+ * Force Angular service to compile project on initial load w/ configured project
95
+ * otherwise if the first compilation occurs on an HTML file the project won't have proper refs
96
+ * and no actual angular metadata will be resolved for the rest of the migration
97
+ */
98
+ private configureForAngularLS;
94
99
  private getWorkspaceProjectEntryPath;
95
100
  }
96
101
  export declare enum BindingType {
@@ -12,7 +12,7 @@ const tss = require("typescript/lib/tsserverlibrary");
12
12
  const schema_1 = require("./schema");
13
13
  const tsUtils_1 = require("./tsUtils");
14
14
  const util_1 = require("./util");
15
- const ServerHost_1 = require("./ServerHost");
15
+ const project_service_container_1 = require("./project-service-container");
16
16
  const TSCONFIG_PATH = 'tsconfig.json';
17
17
  var InputPropertyType;
18
18
  (function (InputPropertyType) {
@@ -33,31 +33,15 @@ class UpdateChanges {
33
33
  this._shouldInvokeLS = val;
34
34
  }
35
35
  get projectService() {
36
- if (!this._projectService) {
37
- this._projectService = (0, tsUtils_1.createProjectService)(this.serverHost);
38
- // Force Angular service to compile project on initial load w/ configure project
39
- // otherwise if the first compilation occurs on an HTML file the project won't have proper refs
40
- // and no actual angular metadata will be resolved for the rest of the migration
41
- // TODO: this patter/issue might be obsolete; if so, should be safe to return _projectService directly
42
- const mainRelPath = this.getWorkspaceProjectEntryPath();
43
- if (!mainRelPath) {
44
- return null;
45
- }
46
- // patch TSConfig so it includes angularOptions.strictTemplates
47
- // ivy ls requires this in order to function properly on templates
48
- this.patchTsConfig();
49
- const mainAbsPath = path.resolve(this._projectService.currentDirectory, mainRelPath);
50
- const scriptInfo = this._projectService.getOrCreateScriptInfoForNormalizedPath(tss.server.toNormalizedPath(mainAbsPath), false);
51
- this._projectService.openClientFile(scriptInfo.fileName);
52
- try {
53
- const project = this._projectService.findProject(scriptInfo.containingProjects[0].getProjectName());
54
- project.getLanguageService().getSemanticDiagnostics(mainAbsPath);
55
- }
56
- catch (err) {
57
- this.context.logger.warn("An error occurred during TypeScript project service setup. Some migrations relying on language services might not be applied.");
58
- }
36
+ const projectService = project_service_container_1.serviceContainer.projectService;
37
+ if (!project_service_container_1.serviceContainer.configured) {
38
+ this.configureForAngularLS(projectService);
39
+ project_service_container_1.serviceContainer.configured = true;
59
40
  }
60
- return this._projectService;
41
+ return projectService;
42
+ }
43
+ get serverHost() {
44
+ return project_service_container_1.serviceContainer.serverHost;
61
45
  }
62
46
  get templateFiles() {
63
47
  if (!this._templateFiles.length) {
@@ -132,7 +116,8 @@ class UpdateChanges {
132
116
  this.themeChanges = this.loadConfig('theme-changes.json');
133
117
  this.importsChanges = this.loadConfig('imports.json');
134
118
  this.membersChanges = this.loadConfig('members.json');
135
- this.serverHost = new ServerHost_1.ServerHost(this.host);
119
+ // update LS server host with the schematics tree:
120
+ this.serverHost.host = this.host;
136
121
  }
137
122
  /** Apply configured changes to the Host Tree */
138
123
  applyChanges() {
@@ -588,7 +573,7 @@ class UpdateChanges {
588
573
  return;
589
574
  }
590
575
  // attempt to find a main tsconfig from workspace:
591
- const wsProject = this.workspace.projects[0];
576
+ const wsProject = Object.values(this.workspace.projects)[0];
592
577
  // technically could be per-project, but assuming there's at least one main tsconfig for IDE support
593
578
  const projectConfig = (_b = (_a = wsProject.architect) === null || _a === void 0 ? void 0 : _a.build) === null || _b === void 0 ? void 0 : _b.options['tsConfig'];
594
579
  if (!projectConfig || !this.host.exists(projectConfig)) {
@@ -731,6 +716,31 @@ class UpdateChanges {
731
716
  project.addMissingFileRoot(scriptInfo.fileName);
732
717
  return project;
733
718
  }
719
+ /**
720
+ * Force Angular service to compile project on initial load w/ configured project
721
+ * otherwise if the first compilation occurs on an HTML file the project won't have proper refs
722
+ * and no actual angular metadata will be resolved for the rest of the migration
723
+ */
724
+ configureForAngularLS(projectService) {
725
+ // TODO: this pattern/issue might be obsolete
726
+ const mainRelPath = this.getWorkspaceProjectEntryPath();
727
+ if (!mainRelPath) {
728
+ return;
729
+ }
730
+ // patch TSConfig so it includes angularOptions.strictTemplates
731
+ // ivy ls requires this in order to function properly on templates
732
+ this.patchTsConfig();
733
+ const mainAbsPath = path.resolve(projectService.currentDirectory, mainRelPath);
734
+ const scriptInfo = projectService.getOrCreateScriptInfoForNormalizedPath(tss.server.toNormalizedPath(mainAbsPath), false);
735
+ projectService.openClientFile(scriptInfo.fileName);
736
+ try {
737
+ const project = projectService.findProject(scriptInfo.containingProjects[0].getProjectName());
738
+ project.getLanguageService().getSemanticDiagnostics(mainAbsPath);
739
+ }
740
+ catch (err) {
741
+ this.context.logger.warn("An error occurred during TypeScript project service setup. Some migrations relying on language services might not be applied.");
742
+ }
743
+ }
734
744
  getWorkspaceProjectEntryPath() {
735
745
  var _a, _b;
736
746
  const projectKeys = Object.keys(this.workspace.projects);
@@ -742,8 +752,8 @@ class UpdateChanges {
742
752
  for (const key of projectKeys) {
743
753
  const wsProject = this.workspace.projects[key];
744
754
  // intentionally compare against string values of the enum to avoid hard import
745
- if (wsProject.projectType == "application" && ((_b = (_a = wsProject.architect) === null || _a === void 0 ? void 0 : _a.build) === null || _b === void 0 ? void 0 : _b.options['main'])) {
746
- return wsProject.architect.build.options['main'];
755
+ if (wsProject.projectType == "application" && ((_b = (_a = wsProject.architect) === null || _a === void 0 ? void 0 : _a.build) === null || _b === void 0 ? void 0 : _b.options)) {
756
+ return wsProject.architect.build.options['browser'] || wsProject.architect.build.options['main'];
747
757
  }
748
758
  else if (wsProject.projectType == "library") {
749
759
  // TODO: attempt to resolve from project ng-package.json or tsConfig
@@ -0,0 +1,11 @@
1
+ import * as tss from 'typescript/lib/tsserverlibrary';
2
+ import { ServerHost } from './ServerHost';
3
+ export declare class ProjectServiceContainer {
4
+ private _serverHost;
5
+ private _projectService;
6
+ /** Indicates additional config adjustments after init have been made */
7
+ configured: boolean;
8
+ get serverHost(): ServerHost;
9
+ get projectService(): tss.server.ProjectService;
10
+ }
11
+ export declare const serviceContainer: ProjectServiceContainer;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.serviceContainer = exports.ProjectServiceContainer = void 0;
4
+ const tsUtils_1 = require("./tsUtils");
5
+ const ServerHost_1 = require("./ServerHost");
6
+ class ProjectServiceContainer {
7
+ constructor() {
8
+ /** Indicates additional config adjustments after init have been made */
9
+ this.configured = false;
10
+ }
11
+ get serverHost() {
12
+ if (!this._serverHost) {
13
+ this._serverHost = new ServerHost_1.ServerHost(null);
14
+ }
15
+ return this._serverHost;
16
+ }
17
+ get projectService() {
18
+ if (!this._projectService) {
19
+ this._projectService = (0, tsUtils_1.createProjectService)(this.serverHost);
20
+ }
21
+ return this._projectService;
22
+ }
23
+ }
24
+ exports.ProjectServiceContainer = ProjectServiceContainer;
25
+ exports.serviceContainer = new ProjectServiceContainer();