@ethlete/cdk 5.0.0-next.43 → 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
|
-
|
|
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.
|
|
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": "
|
|
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"
|
package/types/ethlete-cdk.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { AfterContentChecked, AfterContentInit, AfterViewInit, ApplicationRef, ChangeDetectorRef, ComponentRef, ElementRef, EnvironmentInjector, EventEmitter, InjectionToken, Injector, InputSignal, OnChanges, OnDestroy, OnInit, Optional, Provider, Signal, SimpleChanges, StaticProvider, TemplateRef, TrackByFunction, ViewContainerRef } from "@angular/core";
|
|
2
|
+
import { AfterContentChecked, AfterContentInit, AfterViewInit, ApplicationRef, ChangeDetectorRef, ComponentRef, DoCheck, ElementRef, EnvironmentInjector, EventEmitter, InjectionToken, Injector, InputSignal, OnChanges, OnDestroy, OnInit, Optional, Provider, Signal, SimpleChanges, StaticProvider, TemplateRef, TrackByFunction, ViewContainerRef } from "@angular/core";
|
|
3
3
|
import { CdkPortal, CdkPortalOutlet, ComponentPortal, ComponentType, TemplatePortal } from "@angular/cdk/portal";
|
|
4
4
|
import { MatchListView, MatchListViewUnion, RoundStageStructureView, RoundStageStructureWithMatchesView, RoundType } from "@ethlete/types";
|
|
5
5
|
import { BehaviorSubject, Observable, Subject, Subscriber, Subscription } from "rxjs";
|
|
@@ -5617,7 +5617,7 @@ export declare const INPUT_TOKEN: InjectionToken<InputDirective<unknown, HTMLEle
|
|
|
5617
5617
|
/**
|
|
5618
5618
|
* @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.
|
|
5619
5619
|
*/
|
|
5620
|
-
export declare class InputDirective<T = unknown, J extends HTMLElement = HTMLElement> implements OnInit, OnDestroy {
|
|
5620
|
+
export declare class InputDirective<T = unknown, J extends HTMLElement = HTMLElement> implements OnInit, DoCheck, OnDestroy {
|
|
5621
5621
|
private readonly _injector;
|
|
5622
5622
|
private readonly _inputStateService;
|
|
5623
5623
|
private readonly _formFieldStateService;
|
|
@@ -5628,6 +5628,8 @@ export declare class InputDirective<T = unknown, J extends HTMLElement = HTMLEle
|
|
|
5628
5628
|
private readonly _elementRef;
|
|
5629
5629
|
protected _neverEmptyInputs: string[];
|
|
5630
5630
|
private _implicitControl?;
|
|
5631
|
+
private _watchedControl?;
|
|
5632
|
+
private readonly _control$;
|
|
5631
5633
|
private get control();
|
|
5632
5634
|
private readonly _id;
|
|
5633
5635
|
readonly autocomplete: import("@angular/core").InputSignal<string | null>;
|
|
@@ -5671,6 +5673,8 @@ export declare class InputDirective<T = unknown, J extends HTMLElement = HTMLEle
|
|
|
5671
5673
|
readonly onInternalUpdate$: Observable<"internal">;
|
|
5672
5674
|
readonly onExternalUpdate$: Observable<"external">;
|
|
5673
5675
|
constructor();
|
|
5676
|
+
ngDoCheck(): void;
|
|
5677
|
+
private _syncControl;
|
|
5674
5678
|
ngOnInit(): void;
|
|
5675
5679
|
ngOnDestroy(): void;
|
|
5676
5680
|
focusInputVia(origin?: FocusOrigin): void;
|
|
@@ -7449,6 +7453,7 @@ export declare class ComboboxDirective implements OnInit {
|
|
|
7449
7453
|
removeSelectedOption(option: unknown): void;
|
|
7450
7454
|
open(): void;
|
|
7451
7455
|
close(): void;
|
|
7456
|
+
_closeFromOutsideClick(): void;
|
|
7452
7457
|
focus(): void;
|
|
7453
7458
|
selectInputAndOpen(): void;
|
|
7454
7459
|
writeValueFromOption(option: unknown): void;
|
|
@@ -8106,6 +8111,7 @@ export declare class SelectDirective<T extends SelectDirectiveBodyComponentBase>
|
|
|
8106
8111
|
trackByFn: TrackByFunction<SelectOptionDirective>;
|
|
8107
8112
|
open(): void;
|
|
8108
8113
|
close(): void;
|
|
8114
|
+
_closeFromOutsideClick(): void;
|
|
8109
8115
|
clearValue(): void;
|
|
8110
8116
|
writeValueFromOption(option: SelectOptionDirective): void;
|
|
8111
8117
|
focus(): void;
|
|
@@ -11956,6 +11962,7 @@ export declare class SortDirective implements OnChanges, OnDestroy, OnInit {
|
|
|
11956
11962
|
private readonly _defaultOptions;
|
|
11957
11963
|
sortables: Map<string, Sortable>;
|
|
11958
11964
|
readonly _stateChanges: Subject<void>;
|
|
11965
|
+
private _controlSubscription;
|
|
11959
11966
|
_isInitialized: boolean;
|
|
11960
11967
|
_pendingSubscribers: Subscriber<void>[] | null;
|
|
11961
11968
|
initialized: Observable<void>;
|
|
@@ -11975,7 +11982,8 @@ export declare class SortDirective implements OnChanges, OnDestroy, OnInit {
|
|
|
11975
11982
|
sort(sortable: Sortable): void;
|
|
11976
11983
|
getNextSortDirection(sortable: Sortable): SortDirection;
|
|
11977
11984
|
ngOnInit(): void;
|
|
11978
|
-
|
|
11985
|
+
private _watchControls;
|
|
11986
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
11979
11987
|
ngOnDestroy(): void;
|
|
11980
11988
|
_markInitialized(): void;
|
|
11981
11989
|
_notifySubscriber(subscriber: Subscriber<void>): void;
|