@ethlete/cdk 5.0.0-next.44 → 5.0.0-next.45

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.
@@ -8,11 +8,26 @@ const TEMPLATE_REPLACEMENTS = [
8
8
  ['etColorThemed', 'etColored'],
9
9
  ['[etSurfaceThemed]', '[etSurfaced]'],
10
10
  ['etSurfaceThemed', 'etSurfaced'],
11
- ['[theme]=', '[color]='],
12
- ['[altTheme]=', '[altColor]='],
13
11
  ['et-theme-alt--', 'et-color-alt--'],
14
12
  ['et-theme--', 'et-color--'],
15
13
  ];
14
+ const SDK_COLOR_INPUT_HOST_ATTRIBUTES = new Set(['et-button', 'et-fab', 'et-icon-button', 'et-text-button']);
15
+ const SDK_COLOR_INPUT_RENAMES = new Map([
16
+ ['theme', 'color'],
17
+ ['[theme]', '[color]'],
18
+ ['altTheme', 'altColor'],
19
+ ['[altTheme]', '[altColor]'],
20
+ ]);
21
+ const START_TAG_PATTERN = /<([a-zA-Z][\w.:-]*)((?:\s+[^\s"'>/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?)*)(\s*\/?>)/g;
22
+ const ATTRIBUTE_PATTERN = /(\s+)([^\s"'>/=]+)((?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?)/g;
23
+ const renameSdkColorInputs = (text) => text.replace(START_TAG_PATTERN, (tag, name, attributes, end) => {
24
+ const names = [...attributes.matchAll(ATTRIBUTE_PATTERN)].map((match) => match[2] ?? '');
25
+ if (!names.some((attribute) => SDK_COLOR_INPUT_HOST_ATTRIBUTES.has(attribute))) {
26
+ return tag;
27
+ }
28
+ const renamed = attributes.replace(ATTRIBUTE_PATTERN, (_match, space, attribute, value) => `${space}${SDK_COLOR_INPUT_RENAMES.get(attribute) ?? attribute}${value}`);
29
+ return `<${name}${renamed}${end}`;
30
+ });
16
31
  const CSS_REPLACEMENTS = [
17
32
  ['.et-color-themed', '.et-colored'],
18
33
  ['.et-surface-themed', '.et-surfaced'],
@@ -55,6 +70,7 @@ export default async function migrateColorThemes(tree) {
55
70
  for (const [oldStr, newStr] of TEMPLATE_REPLACEMENTS) {
56
71
  modified = modified.replaceAll(oldStr, newStr);
57
72
  }
73
+ modified = renameSdkColorInputs(modified);
58
74
  if (modified !== content) {
59
75
  tree.write(filePath, modified);
60
76
  filesModified++;
@@ -94,7 +110,8 @@ export default async function migrateColorThemes(tree) {
94
110
  const needsImportMigration = content.includes('provideThemes') || content.includes('@ethlete/theming') || content.includes('@ethlete/cdk');
95
111
  const needsTemplateMigration = TEMPLATE_REPLACEMENTS.some(([oldStr]) => content.includes(oldStr));
96
112
  const needsCssMigration = CSS_REPLACEMENTS.some(([oldStr]) => content.includes(oldStr));
97
- if (!needsImportMigration && !needsTemplateMigration && !needsCssMigration) {
113
+ const needsSdkColorInputMigration = renameSdkColorInputs(content) !== content;
114
+ if (!needsImportMigration && !needsTemplateMigration && !needsCssMigration && !needsSdkColorInputMigration) {
98
115
  return;
99
116
  }
100
117
  let modified = content;
@@ -106,6 +123,11 @@ export default async function migrateColorThemes(tree) {
106
123
  }
107
124
  fileChanges++;
108
125
  }
126
+ const withSdkColorInputs = renameSdkColorInputs(modified);
127
+ if (withSdkColorInputs !== modified) {
128
+ modified = withSdkColorInputs;
129
+ fileChanges++;
130
+ }
109
131
  // Apply CSS replacements (covers inline styles)
110
132
  if (needsCssMigration) {
111
133
  for (const [oldStr, newStr] of CSS_REPLACEMENTS) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethlete/cdk",
3
- "version": "5.0.0-next.44",
3
+ "version": "5.0.0-next.45",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/ethlete-io/ethdk",
@@ -32,7 +32,7 @@
32
32
  "@ethlete/query": "^6.0.0-beta.8",
33
33
  "@ethlete/types": "^2.0.0-beta.4",
34
34
  "@floating-ui/dom": "^1.6.0",
35
- "@nx/devkit": "^24.0.0",
35
+ "@nx/devkit": ">=23.0.0",
36
36
  "date-fns": "^4.0.0",
37
37
  "rxjs": "^7.8.0",
38
38
  "typescript": "^6.0.0"
@@ -7453,6 +7453,7 @@ export declare class ComboboxDirective implements OnInit {
7453
7453
  removeSelectedOption(option: unknown): void;
7454
7454
  open(): void;
7455
7455
  close(): void;
7456
+ _closeFromOutsideClick(): void;
7456
7457
  focus(): void;
7457
7458
  selectInputAndOpen(): void;
7458
7459
  writeValueFromOption(option: unknown): void;
@@ -8110,6 +8111,7 @@ export declare class SelectDirective<T extends SelectDirectiveBodyComponentBase>
8110
8111
  trackByFn: TrackByFunction<SelectOptionDirective>;
8111
8112
  open(): void;
8112
8113
  close(): void;
8114
+ _closeFromOutsideClick(): void;
8113
8115
  clearValue(): void;
8114
8116
  writeValueFromOption(option: SelectOptionDirective): void;
8115
8117
  focus(): void;