Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(kit): new version of InputNumber has [step] feature #10073

Merged
merged 4 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions projects/cdk/constants/allow-signal-writes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type {CreateEffectOptions} from '@angular/core';
import {VERSION} from '@angular/core';

export const TUI_ALLOW_SIGNAL_WRITES: CreateEffectOptions =
parseInt(VERSION.major, 10) >= 19 ? {} : {allowSignalWrites: true};
1 change: 1 addition & 0 deletions projects/cdk/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './allow-signal-writes';
export * from './empty';
export * from './handlers';
export * from './matchers';
Expand Down
2 changes: 1 addition & 1 deletion projects/cdk/constants/used-icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const TUI_USED_ICONS = [
'@tui.minus',
'@tui.file',
'@tui.trash',
'@tui.plus',
'@tui.phone',
'@tui.heart',
'@tui.heart-filled',
Expand All @@ -55,7 +56,6 @@ export const TUI_USED_ICONS = [
'@tui.rotate-ccw-square',
'@tui.arrow-left',
'@tui.arrow-right',
'@tui.plus',
'@tui.minimize',
'@tui.filter',
'@tui.layout-grid',
Expand Down
18 changes: 4 additions & 14 deletions projects/cdk/utils/miscellaneous/directive-binding.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import type {
CreateEffectOptions,
InjectOptions,
ProviderToken,
Signal,
WritableSignal,
} from '@angular/core';
import {effect, inject, isSignal, signal, VERSION} from '@angular/core';
import type {InjectOptions, ProviderToken, Signal, WritableSignal} from '@angular/core';
import {effect, inject, isSignal, signal} from '@angular/core';
import {TUI_ALLOW_SIGNAL_WRITES} from '@taiga-ui/cdk/constants';

type SignalLikeTypeOf<T> = T extends Signal<infer R> ? R : T;

Expand All @@ -24,11 +19,6 @@ export function tuiDirectiveBinding<
const result: any = isSignal(initial) ? initial : signal(initial);
const directive: any = inject(token, options);
const output = directive[`${key.toString()}Change`];
const angularVersion = parseInt(VERSION.major, 10);
const isAngular19 = angularVersion >= 19;
const effectOptions: CreateEffectOptions = isAngular19
? {}
: {allowSignalWrites: true};

// TODO: Figure out why effects are executed all the time and not just when result changes (check with Angular 18)
let previous: any;
Expand All @@ -49,7 +39,7 @@ export function tuiDirectiveBinding<
directive.ngOnChanges?.({});
output?.emit?.(value);
previous = value;
}, effectOptions);
}, TUI_ALLOW_SIGNAL_WRITES);

return result;
}
18 changes: 10 additions & 8 deletions projects/demo-playwright/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,16 @@ export default defineConfig({
viewport: DEFAULT_VIEWPORT,
},
},
{
name: 'webkit',
use: {
...devices['Desktop Safari'],
viewport: DEFAULT_VIEWPORT,
},
},
],
process.env.CI
? {
name: 'webkit',
use: {
...devices['Desktop Safari'],
viewport: DEFAULT_VIEWPORT,
},
}
: null,
].filter(<T>(x: T | null): x is T => !!x),
expect: {
toHaveScreenshot: {
animations: 'disabled',
Expand Down
Loading
Loading