@ethlete/cdk 5.0.0-next.37 → 5.0.0-next.39

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.
@@ -1,3 +1,4 @@
1
+ import { COMPONENTS_CLASSES } from './components-classes.js';
1
2
  import { LEGACY_SPINNER_COLOR_VARIABLE, LEGACY_SPINNER_TAG, lineOfIndex, PICTURE_TAG, SPINNER_TAG, } from './templates.js';
2
3
  export const DOCS_BASE_URL = 'https://ethlete-sdk-docs.web.app';
3
4
  export const createEmptyReport = () => ({
@@ -7,13 +8,40 @@ export const createEmptyReport = () => ({
7
8
  spinnerModeBindings: [],
8
9
  judgmentSymbols: new Map(),
9
10
  gatedSymbols: new Map(),
11
+ unknownStyleClasses: new Map(),
12
+ reactiveFormControls: new Map(),
10
13
  });
11
14
  export const isReportEmpty = (report) => report.picturesWithoutAlt.length === 0 &&
12
15
  report.pictureClassInputs.length === 0 &&
13
16
  report.themedSpinners.length === 0 &&
14
17
  report.spinnerModeBindings.length === 0 &&
15
18
  report.judgmentSymbols.size === 0 &&
16
- report.gatedSymbols.size === 0;
19
+ report.gatedSymbols.size === 0 &&
20
+ report.unknownStyleClasses.size === 0 &&
21
+ report.reactiveFormControls.size === 0;
22
+ const FORM_CONTROL_TAGS = [
23
+ 'et-checkbox',
24
+ 'et-checkbox-group',
25
+ 'et-color-input',
26
+ 'et-combobox',
27
+ 'et-date-input',
28
+ 'et-date-time-input',
29
+ 'et-email-input',
30
+ 'et-native-select',
31
+ 'et-number-input',
32
+ 'et-password-input',
33
+ 'et-radio-group',
34
+ 'et-search-input',
35
+ 'et-segmented-button-group',
36
+ 'et-select',
37
+ 'et-slide-toggle',
38
+ 'et-slider',
39
+ 'et-tel-input',
40
+ 'et-text-input',
41
+ 'et-textarea-input',
42
+ 'et-time-input',
43
+ ];
44
+ const REACTIVE_FORM_BINDING = /\s\[?(formControl|formControlName|formGroup)\]?(?=[\s=/>])/;
17
45
  const PICTURE_CLASS_INPUTS = ['imgClass', 'figureClass', 'pictureClass', 'figcaptionClass'];
18
46
  const VARIANT_PREFIX = /^([\w-]+:)+/;
19
47
  const INDEFINITE_SIZES = new Set(['auto', 'min', 'max', 'fit']);
@@ -101,6 +129,16 @@ export const scanTemplate = (report, template, { file, startLine }) => {
101
129
  match = attributePattern.exec(tag);
102
130
  }
103
131
  });
132
+ for (const tagName of FORM_CONTROL_TAGS) {
133
+ forEachOpeningTag(template, tagName, (tag, index) => {
134
+ const binding = REACTIVE_FORM_BINDING.exec(tag);
135
+ if (!binding)
136
+ return;
137
+ const sites = report.reactiveFormControls.get(tagName) ?? [];
138
+ sites.push({ file, line: lineAt(index), detail: `\`${binding[1]}\`` });
139
+ report.reactiveFormControls.set(tagName, sites);
140
+ });
141
+ }
104
142
  for (const tagName of [SPINNER_TAG, LEGACY_SPINNER_TAG]) {
105
143
  forEachOpeningTag(template, tagName, (tag, index) => {
106
144
  if (/\s\[mode\]\s*=/.test(tag) && !/\s\[mode\]\s*=\s*(["'])'(in)?determinate'\1/.test(tag)) {
@@ -109,8 +147,28 @@ export const scanTemplate = (report, template, { file, startLine }) => {
109
147
  });
110
148
  }
111
149
  };
150
+ const blankOut = (match) => match.replace(/[^\n]/g, ' ');
151
+ export const collectEtClasses = (styles) => {
152
+ const code = styles.replace(/\/\*[\s\S]*?\*\/|\/\/[^\n]*|"(?:[^"\\\n]|\\.)*"|'(?:[^'\\\n]|\\.)*'/g, blankOut);
153
+ const pattern = /(?<![\w-])\.(et-[\w-]+)/g;
154
+ const classes = [];
155
+ let match = pattern.exec(code);
156
+ while (match) {
157
+ classes.push({ name: match[1], index: match.index });
158
+ match = pattern.exec(code);
159
+ }
160
+ return classes;
161
+ };
162
+ const KNOWN_COMPONENTS_CLASSES = new Set(COMPONENTS_CLASSES);
112
163
  export const scanStyleSheet = (report, styles, { file, startLine }) => {
113
164
  const lineAt = (index) => startLine + lineOfIndex(styles, index) - 1;
165
+ for (const { name, index } of collectEtClasses(styles)) {
166
+ if (KNOWN_COMPONENTS_CLASSES.has(name))
167
+ continue;
168
+ const sites = report.unknownStyleClasses.get(name) ?? [];
169
+ sites.push({ file, line: lineAt(index) });
170
+ report.unknownStyleClasses.set(name, sites);
171
+ }
114
172
  const variablePattern = new RegExp(`${LEGACY_SPINNER_COLOR_VARIABLE}(-\\d+)?`, 'g');
115
173
  let variableMatch = variablePattern.exec(styles);
116
174
  while (variableMatch) {
@@ -168,6 +226,16 @@ const renderPictureClassGroup = (sites, heading, guidance) => {
168
226
  '',
169
227
  ];
170
228
  };
229
+ const styleClassGroup = (name) => name.replace(/^et-/, '').split(/-/)[0] ?? name;
230
+ const renderUnknownStyleClasses = (classes) => {
231
+ const groups = new Map();
232
+ for (const name of [...classes.keys()].sort()) {
233
+ const group = styleClassGroup(name);
234
+ const sites = classes.get(name).map((site) => `\`${site.file}:${site.line}\``);
235
+ groups.set(group, [...(groups.get(group) ?? []), `- \`.${name}\` - ${sites.join(', ')}`]);
236
+ }
237
+ return [...groups.entries()].flatMap(([group, lines]) => [`### \`et-${group}\``, '', ...lines, '']);
238
+ };
171
239
  export const renderReport = (report, context) => {
172
240
  const pictureClassSites = report.pictureClassInputs;
173
241
  const fitSites = pictureClassSites.filter((site) => site.input === 'imgClass' && site.mode === 'fit');
@@ -214,8 +282,8 @@ export const renderReport = (report, context) => {
214
282
  ? [
215
283
  '## Spinner `[mode]` bindings',
216
284
  '',
217
- 'A bound `mode` cannot be rewritten mechanically. `mode` split into the `determinate` boolean, so',
218
- '`[mode]="expr"` becomes `[determinate]="expr === \'determinate\'"` (or whatever the expression meant).',
285
+ 'A bound `mode` cannot be rewritten mechanically. The spinner is determinate while `value` is bound, so',
286
+ '`[mode]="expr" [value]="v"` becomes `[value]="expr === \'determinate\' ? v : undefined"`.',
219
287
  '',
220
288
  ...renderSites(report.spinnerModeBindings),
221
289
  '',
@@ -274,6 +342,33 @@ export const renderReport = (report, context) => {
274
342
  }),
275
343
  ]
276
344
  : []),
345
+ ...(report.reactiveFormControls.size > 0
346
+ ? [
347
+ '## Form controls that need signal forms first',
348
+ '',
349
+ 'The components form controls bind through signal forms (`[formField]`) and have no ControlValueAccessor,',
350
+ 'so these cdk controls, still bound through reactive forms, stay on `@ethlete/cdk` until their form moves',
351
+ `to signal forms. See ${DOCS_BASE_URL}/cdk/migration.`,
352
+ '',
353
+ ...[...report.reactiveFormControls.entries()].flatMap(([tagName, sites]) => [
354
+ `### \`<${tagName}>\``,
355
+ '',
356
+ ...renderSites(sites),
357
+ '',
358
+ ]),
359
+ ]
360
+ : []),
361
+ ...(report.unknownStyleClasses.size > 0
362
+ ? [
363
+ '## Stylesheet selectors no components class matches',
364
+ '',
365
+ 'These `.et-*` selectors restyle a cdk class that no `@ethlete/components` stylesheet defines, so after the',
366
+ "move they match nothing. Restyle through the successor's tokens and CSS variables instead (each component",
367
+ `guide has a Theming section). See ${DOCS_BASE_URL}/cdk/migration#your-cdk-styles.`,
368
+ '',
369
+ ...renderUnknownStyleClasses(report.unknownStyleClasses),
370
+ ]
371
+ : []),
277
372
  ].join('\n');
278
373
  };
279
374
  //# sourceMappingURL=report.js.map
@@ -65,11 +65,10 @@ const rewriteSkeletonItems = (template) => mapOpeningTags(template, SKELETON_ITE
65
65
  const rewriteSpinnerTags = (template) => template
66
66
  .replace(new RegExp(`<${LEGACY_SPINNER_TAG}(?=[\\s/>])`, 'g'), `<${SPINNER_TAG}`)
67
67
  .replace(new RegExp(`</${LEGACY_SPINNER_TAG}\\s*>`, 'g'), `</${SPINNER_TAG}>`);
68
- const rewriteSpinnerAttributes = (template) => mapOpeningTags(template, SPINNER_TAG, (tag) => tag
69
- .replace(/\smode\s*=\s*(["'])indeterminate\1/g, '')
70
- .replace(/\s\[mode\]\s*=\s*(["'])'indeterminate'\1/g, '')
71
- .replace(/\smode\s*=\s*(["'])determinate\1/g, ' [determinate]="true"')
72
- .replace(/\s\[mode\]\s*=\s*(["'])'determinate'\1/g, ' [determinate]="true"')
68
+ const INDETERMINATE_MODE = /\s(?:mode\s*=\s*(["'])indeterminate\1|\[mode\]\s*=\s*(["'])'indeterminate'\2)/;
69
+ const rewriteSpinnerAttributes = (template) => mapOpeningTags(template, SPINNER_TAG, (tag) => (INDETERMINATE_MODE.test(tag) ? tag.replace(/\s(?:\[value\]|bind-value|value)\s*=\s*("[^"]*"|'[^']*')/g, '') : tag)
70
+ .replace(/\smode\s*=\s*(["'])(in)?determinate\1/g, '')
71
+ .replace(/\s\[mode\]\s*=\s*(["'])'(in)?determinate'\1/g, '')
73
72
  .replace(/(\s)\[renderBackground\]/g, '$1[track]')
74
73
  .replace(/(\s)renderBackground(?=[\s=/>])/g, '$1track')
75
74
  .replace(/\s\[?multiColor\]?\s*=\s*("[^"]*"|'[^']*')/g, '')
@@ -692,9 +692,9 @@
692
692
  },
693
693
  "DATE_TIME_INPUT_FORMAT_TOKEN": {
694
694
  "docs": "/components/date-time-inputs",
695
- "kind": "replaced-by",
695
+ "kind": "rename",
696
696
  "package": "@ethlete/components",
697
- "to": "DATE_FORMAT"
697
+ "to": "DATE_TIME_FORMAT"
698
698
  },
699
699
  "DATE_TIME_INPUT_TOKEN": {
700
700
  "kind": "removed",
@@ -702,11 +702,11 @@
702
702
  },
703
703
  "DEFAULT_DATE_INPUT_FORMAT": {
704
704
  "kind": "removed",
705
- "note": "the DATE_FORMAT token defaults to the same ISO format"
705
+ "note": "the DATE_FORMAT token defaults to yyyy-MM-dd"
706
706
  },
707
707
  "DEFAULT_DATE_TIME_INPUT_FORMAT": {
708
708
  "kind": "removed",
709
- "note": "the DATE_FORMAT token defaults to the same ISO format"
709
+ "note": "the DATE_TIME_FORMAT token defaults to the same ISO format"
710
710
  },
711
711
  "DEFAULT_TIME_INPUT_FORMAT": {
712
712
  "kind": "removed",
@@ -1954,7 +1954,7 @@
1954
1954
  "ProgressSpinnerComponent": {
1955
1955
  "docs": "/components/loader",
1956
1956
  "kind": "rename+reshape",
1957
- "note": "the mode input splits into a determinate boolean, renderBackground becomes track, multiColor is gone, and the default color is currentColor - set color for a theme",
1957
+ "note": "the mode input is gone - a bound value makes it determinate, an unbound one indeterminate; renderBackground becomes track, multiColor is gone, and the default color is currentColor - set color for a theme",
1958
1958
  "package": "@ethlete/components",
1959
1959
  "since": "1.0.0-next.34",
1960
1960
  "to": "SpinnerComponent"
@@ -1965,7 +1965,7 @@
1965
1965
  },
1966
1966
  "ProgressSpinnerMode": {
1967
1967
  "kind": "removed",
1968
- "note": "determinate is a boolean input"
1968
+ "note": "a bound value makes the spinner determinate"
1969
1969
  },
1970
1970
  "QUERY_ERROR_TOKEN": {
1971
1971
  "docs": "/components/query-error",
@@ -1974,18 +1974,18 @@
1974
1974
  "to": "QUERY_ERROR_TOKEN"
1975
1975
  },
1976
1976
  "QueryButtonComponent": {
1977
- "docs": "/components/button",
1977
+ "docs": "/components/button#query-button",
1978
1978
  "kind": "replaced-by",
1979
- "note": "bind the query state to the button\u2019s loading input; no one-second success/failure flash",
1979
+ "note": "[etQueryButton] on an et-button; loading and progress only, no one-second success/failure flash; wrap a legacy query or collection with queryButtonSourceFromV2Query(query), which needs an injection context (a field initializer or the constructor)",
1980
1980
  "package": "@ethlete/components",
1981
- "to": "ButtonComponent"
1981
+ "to": "QueryButtonDirective"
1982
1982
  },
1983
1983
  "QueryButtonDirective": {
1984
- "docs": "/components/button",
1984
+ "docs": "/components/button#query-button",
1985
1985
  "kind": "replaced-by",
1986
- "note": "bind the query state to the button\u2019s loading input; no one-second success/failure flash",
1986
+ "note": "[etQueryButton] on a button; loading and progress only, no one-second success/failure flash; queryButtonSourceFromV2Query for a legacy query",
1987
1987
  "package": "@ethlete/components",
1988
- "to": "ButtonDirective"
1988
+ "to": "QueryButtonDirective"
1989
1989
  },
1990
1990
  "QueryErrorComponent": {
1991
1991
  "docs": "/components/query-error",
@@ -3408,10 +3408,10 @@
3408
3408
  },
3409
3409
  "provideDateTimeFormat": {
3410
3410
  "docs": "/components/date-time-inputs",
3411
- "kind": "replaced-by",
3412
- "note": "date-time controls read the DATE_FORMAT wire format",
3411
+ "kind": "move",
3413
3412
  "package": "@ethlete/components",
3414
- "to": "provideDateFormat"
3413
+ "signatureUnchanged": true,
3414
+ "to": "provideDateTimeFormat"
3415
3415
  },
3416
3416
  "provideDialogStrategy": {
3417
3417
  "docs": "/components/overlays",
package/migrations.json CHANGED
@@ -4,6 +4,7 @@
4
4
  "name": "to-v5",
5
5
  "version": "5.0.0-beta.12",
6
6
  "kind": "auto",
7
+ "level": "required",
7
8
  "description": "Rewrite the v4 cdk API into its v5 shape.",
8
9
  "generator": "@ethlete/cdk:migrate-to-v5",
9
10
  "docs": "/cdk/migration"
@@ -12,6 +13,7 @@
12
13
  "name": "from-cdk",
13
14
  "version": "5.0.0-next.25",
14
15
  "kind": "auto",
16
+ "level": "optional",
15
17
  "description": "Rewrite the mechanical part of the move off @ethlete/cdk, and write migrate-from-cdk-tasks.md for the rest.",
16
18
  "generator": "@ethlete/cdk:migrate-from-cdk",
17
19
  "docs": "/cdk/migration"
@@ -20,6 +22,7 @@
20
22
  "name": "from-cdk-decisions",
21
23
  "version": "5.0.0-next.25",
22
24
  "kind": "assisted",
25
+ "level": "optional",
23
26
  "description": "Work through migrate-from-cdk-tasks.md: the call sites whose successor API behaves differently.",
24
27
  "instructions": "./migrations/from-cdk-decisions.md",
25
28
  "docs": "/cdk/migration"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethlete/cdk",
3
- "version": "5.0.0-next.37",
3
+ "version": "5.0.0-next.39",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "exports": {
@@ -17,35 +17,27 @@
17
17
  }
18
18
  },
19
19
  "peerDependencies": {
20
- "@analogjs/vite-plugin-angular": "2.6.3",
21
- "@angular/cdk": "22.1.6",
22
- "@angular/common": "22.1.6",
23
- "@angular/core": "22.1.6",
24
- "@angular/forms": "22.1.6",
25
- "@angular/platform-browser": "22.1.6",
26
- "@angular/router": "22.1.6",
20
+ "@angular/cdk": "^22.1.0",
21
+ "@angular/common": "^22.1.0",
22
+ "@angular/core": "^22.1.0",
23
+ "@angular/forms": "^22.1.0",
24
+ "@angular/platform-browser": "^22.1.0",
25
+ "@angular/router": "^22.1.0",
27
26
  "@ethlete/core": "^5.0.0-beta.11",
28
27
  "@ethlete/query": "^6.0.0-beta.8",
29
28
  "@ethlete/types": "^2.0.0-beta.4",
30
- "@floating-ui/dom": "1.8.0",
31
- "@nx/devkit": "23.1.0",
32
- "date-fns": "4.4.0",
33
- "rxjs": "7.8.2",
34
- "typescript": "6.0.3",
35
- "vite": "8.1.5"
29
+ "@floating-ui/dom": "^1.6.0",
30
+ "@nx/devkit": "^23.0.0",
31
+ "date-fns": "^4.0.0",
32
+ "rxjs": "^7.8.0",
33
+ "typescript": "^6.0.0"
36
34
  },
37
35
  "peerDependenciesMeta": {
38
- "@analogjs/vite-plugin-angular": {
39
- "optional": true
40
- },
41
36
  "@nx/devkit": {
42
37
  "optional": true
43
38
  },
44
39
  "typescript": {
45
40
  "optional": true
46
- },
47
- "vite": {
48
- "optional": true
49
41
  }
50
42
  },
51
43
  "ethlete": {
@@ -6658,6 +6658,8 @@ type SelectionModelBinding<T extends SelectionModelTypes = any> = SelectionModel
6658
6658
  declare class SelectionModel<T extends SelectionModelTypes = unknown> {
6659
6659
  private readonly _destroy$;
6660
6660
  private _lastSelectionSetSubscription;
6661
+ get isSyncingSelectionFromValue(): boolean;
6662
+ private _isSyncingSelectionFromValue;
6661
6663
  get selection$(): Observable<T[]>;
6662
6664
  get selection(): T[];
6663
6665
  private readonly _selection$;
@@ -6689,6 +6691,10 @@ declare class SelectionModel<T extends SelectionModelTypes = unknown> {
6689
6691
  constructor();
6690
6692
  setSelection(selection: T | T[]): this;
6691
6693
  setSelectionFromValue(value: unknown): void;
6694
+ /**
6695
+ * Applies `value` once options are available. Until then, and while applying it, `isSyncingSelectionFromValue` is `true`.
6696
+ * Any user selection change cancels a pending sync.
6697
+ */
6692
6698
  setSelectionFromValue$(value: unknown): void;
6693
6699
  setValueBinding(fnOrPropertyPath: SelectionModelBinding<T> | null): this;
6694
6700
  setKeyBinding(fnOrPropertyPath: SelectionModelBinding<T> | null): this;
@@ -6744,6 +6750,7 @@ declare class SelectionModel<T extends SelectionModelTypes = unknown> {
6744
6750
  clearSelectedOptions(): void;
6745
6751
  toggleSelectedOption(option: T): void;
6746
6752
  toggleAllSelectedOptions(): void;
6753
+ private _cancelPendingSelectionFromValue;
6747
6754
  }
6748
6755
 
6749
6756
  declare class ActiveSelectionModel<T = unknown> {
@@ -6798,6 +6805,7 @@ declare class ComboboxDirective implements OnInit {
6798
6805
  set options(value: unknown[]);
6799
6806
  set initialValue(value: unknown);
6800
6807
  private _initialValue$;
6808
+ private _hasReceivedSelectionValue;
6801
6809
  get filterInternal(): boolean;
6802
6810
  set filterInternal(value: unknown);
6803
6811
  private _filterInternal$;
@@ -8728,7 +8736,7 @@ type OverlayConfig<D = unknown> = {
8728
8736
  restoreFocus?: boolean;
8729
8737
  /**
8730
8738
  * Whether to wait for the opening animation to finish before trapping focus.
8731
- * @default true
8739
+ * @default false
8732
8740
  */
8733
8741
  delayFocusTrap?: boolean;
8734
8742
  /**
@@ -9461,7 +9469,7 @@ type ToggletipConfig = {
9461
9469
  /**
9462
9470
  * The offset of the toggletip.
9463
9471
  * @see https://popper.js.org/docs/v2/modifiers/offset/#offset-1
9464
- * @default { mainAxis: 8, crossAxis: 8 }
9472
+ * @default 8
9465
9473
  */
9466
9474
  offset: OffsetOptions | null;
9467
9475
  /**
@@ -10448,7 +10456,7 @@ type SortHeaderArrowPosition = 'before' | 'after';
10448
10456
  type Sortable = {
10449
10457
  id: string;
10450
10458
  start: SortDirection;
10451
- disableClear: boolean;
10459
+ disableClear?: boolean;
10452
10460
  };
10453
10461
  /**
10454
10462
  * @deprecated `@ethlete/cdk` is in maintenance mode. Use the `@ethlete/components` equivalent instead - see https://ethlete-sdk-docs.web.app/cdk/migration, and run `nx g @ethlete/cdk:migrate-from-cdk` to rewrite the mechanical parts. Intent to remove in v6.
@@ -10479,7 +10487,7 @@ declare class SortDirective implements OnChanges, OnDestroy, OnInit {
10479
10487
  get direction(): SortDirection;
10480
10488
  set direction(direction: SortDirection);
10481
10489
  private _direction;
10482
- disableClear: boolean;
10490
+ disableClear?: boolean;
10483
10491
  sortControl?: FormControl<Sort | null>;
10484
10492
  sortByControl?: FormControl<string | null>;
10485
10493
  sortDirectionControl?: FormControl<SortDirection | null>;
@@ -10541,7 +10549,7 @@ declare class SortHeaderComponent implements Sortable, OnDestroy, OnInit, AfterV
10541
10549
  get sortActionDescription(): string;
10542
10550
  set sortActionDescription(value: string);
10543
10551
  private _sortActionDescription;
10544
- disableClear: boolean;
10552
+ disableClear?: boolean;
10545
10553
  get _isSorted(): boolean;
10546
10554
  get _getArrowDirectionState(): string;
10547
10555
  get _getArrowViewState(): string;