@ng-desktop/forms 0.3.0 → 0.4.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.
package/README.md CHANGED
@@ -1,14 +1,86 @@
1
- # @ng-desktop/forms
1
+ # `@ng-desktop/forms`
2
2
 
3
- Angular ControlValueAccessor directives for Native GTK4 / WinUI 3 / AppKit widgets (<ng-entry>, <ng-switch>, <ng-checkbox>, <ng-slider>, <ng-select>)
3
+ First-class Angular Signal Forms (`[formField]` via `FormValueControl` / `FormCheckboxControl`) and `ControlValueAccessor` directives (`ReactiveFormsModule`, `FormsModule`) wired directly to native GTK4 / WinUI 3 / AppKit desktop widgets.
4
4
 
5
- Part of **[NgDesktop Engine](https://github.com/Gaspar1992/ng-desktop-engine)** — Native desktop rendering engine for Angular 22+ (`GTK4`, `WinUI 3`, `AppKit`).
6
-
7
- ## Installation
5
+ ## Install
8
6
 
9
7
  ```bash
10
- pnpm add @ng-desktop/forms
8
+ pnpm add @ng-desktop/forms @ng-desktop/platform
9
+ ```
10
+
11
+ Peer dependencies: `@angular/core >= 22.0.0`, `@angular/forms >= 22.0.0`, `@ng-desktop/platform`.
12
+
13
+ ## Quick Usage — Angular Signal Forms (`[formField]`)
14
+
15
+ ```ts
16
+ import { Component, signal } from '@angular/core';
17
+ import { form, max, min, NATIVE_SIGNAL_FORM_DIRECTIVES, required } from '@ng-desktop/forms';
18
+ import { NATIVE_UI_DIRECTIVES } from '@ng-desktop/platform';
19
+
20
+ @Component({
21
+ selector: 'app-preferences',
22
+ standalone: true,
23
+ imports: [NATIVE_UI_DIRECTIVES, NATIVE_SIGNAL_FORM_DIRECTIVES],
24
+ template: `
25
+ <ng-box orientation="vertical" spacing="10px">
26
+ <ng-entry placeholder="Display name" [formField]="settingsForm.name" />
27
+ <ng-switch [formField]="settingsForm.enabled" />
28
+ <ng-slider [formField]="settingsForm.volume" />
29
+ </ng-box>
30
+ `,
31
+ })
32
+ export class PreferencesComponent {
33
+ readonly model = signal({ name: 'Ada', enabled: true, volume: 75 });
34
+
35
+ readonly settingsForm = form(this.model, (path) => {
36
+ required(path.name);
37
+ min(path.volume, 0);
38
+ max(path.volume, 100);
39
+ });
40
+ }
41
+ ```
42
+
43
+ Standard HTML form elements (`<input [formField]>`, `<textarea [formField]>`, `<select [formField]>`) also work out of the box without `CUSTOM_ELEMENTS_SCHEMA`. Schema states (`disabled`, `readonly`, `hidden`, `min`/`max`, `maxLength`, `invalid`, `touched`, `dirty`, `focusBoundControl()`) propagate automatically to native attributes and CSS classes (`ng-invalid`, `ng-touched`, `ng-dirty`).
44
+
45
+ ## Quick Usage — Reactive & Template Forms
46
+
47
+ `NATIVE_FORM_DIRECTIVES` includes both the Signal Forms controls and the classic `ControlValueAccessor` directives:
48
+
49
+ ```ts
50
+ import { Component } from '@angular/core';
51
+ import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
52
+ import { NATIVE_FORM_DIRECTIVES } from '@ng-desktop/forms';
53
+ import { NATIVE_UI_DIRECTIVES } from '@ng-desktop/platform';
54
+
55
+ @Component({
56
+ selector: 'app-legacy-preferences',
57
+ standalone: true,
58
+ imports: [ReactiveFormsModule, NATIVE_FORM_DIRECTIVES, NATIVE_UI_DIRECTIVES],
59
+ template: `
60
+ <ng-box [formGroup]="form" orientation="vertical" spacing="10px">
61
+ <ng-entry placeholder="Display name" formControlName="name" />
62
+ <ng-switch formControlName="enabled" />
63
+ <ng-slider min="0" max="100" formControlName="volume" />
64
+ </ng-box>
65
+ `,
66
+ })
67
+ export class LegacyPreferencesComponent {
68
+ readonly form = new FormGroup({
69
+ name: new FormControl('', { nonNullable: true }),
70
+ enabled: new FormControl(true, { nonNullable: true }),
71
+ volume: new FormControl(75, { nonNullable: true }),
72
+ });
73
+ }
11
74
  ```
12
75
 
13
- - Repository path: `packages/forms-native`
14
- - Documentation & Ecosystem Guide: https://github.com/Gaspar1992/ng-desktop-engine/blob/main/docs/ECOSYSTEM_COMPATIBILITY.md
76
+ ## Key Exports
77
+
78
+ - **Bundles:** `NATIVE_SIGNAL_FORM_DIRECTIVES` (Signal Forms `[formField]`), `NATIVE_FORM_DIRECTIVES` (all Signal Forms + CVA directives)
79
+ - **Signal Forms Controls:** `NativeTextFieldControl` (`FormValueControl<string>`), `NativeBooleanFieldControl` (`FormCheckboxControl`), `NativeNumberFieldControl` (`FormValueControl<number>`)
80
+ - **Re-exported Signal Forms APIs:** `form`, `schema`, `FormField`, `FormRoot`, `required`, `min`, `max`, `minLength`, `maxLength`, `pattern`, `email`, `disabled`, `readonly`, `hidden`, `debounce`, `submit`, `validate`, `provideSignalFormsConfig`
81
+ - **Classic CVAs:** `NativeTextValueAccessor`, `NativeBooleanValueAccessor`, `NativeNumberValueAccessor`
82
+
83
+ ## Documentation
84
+
85
+ - [Getting Started with External Angular 22+ & Nx Apps](../../docs/GETTING_STARTED.md)
86
+ - [Architectural Roadmap & OS Maturity Matrix](../../ROADMAP.md)
@@ -1,2 +1,11 @@
1
- export { NATIVE_FORM_DIRECTIVES, NativeBooleanValueAccessor, NativeNumberValueAccessor, NativeTextValueAccessor, } from './value-accessors';
2
- //# sourceMappingURL=index.d.ts.map
1
+ import { FormField } from '@angular/forms/signals';
2
+ import { NativeBooleanFieldControl, NativeNumberFieldControl, NativeTextFieldControl } from './signal-forms';
3
+ import { NativeBooleanValueAccessor, NativeNumberValueAccessor, NativeTextValueAccessor } from './value-accessors';
4
+ export { NativeBooleanValueAccessor, NativeNumberValueAccessor, NativeTextValueAccessor, } from './value-accessors';
5
+ export { NATIVE_SIGNAL_FORM_DIRECTIVES, NativeBooleanFieldControl, NativeNumberFieldControl, NativeTextFieldControl, } from './signal-forms';
6
+ export { disabled, email, form, FormField, FormRoot, hidden, max, maxLength, min, minLength, pattern, provideSignalFormsConfig, readonly, required, schema, submit, validate, type FieldState, type FieldTree, type FormCheckboxControl, type FormUiControl, type FormValueControl, type ValidationError, } from '@angular/forms/signals';
7
+ /**
8
+ * Unified standalone directive bundle supporting both Reactive/Template forms (`[formControl]`,
9
+ * `[formControlName]`, `[(ngModel)]`) and Angular Signal Forms (`[formField]`).
10
+ */
11
+ export declare const NATIVE_FORM_DIRECTIVES: readonly [typeof NativeTextValueAccessor, typeof NativeBooleanValueAccessor, typeof NativeNumberValueAccessor, typeof FormField, typeof NativeTextFieldControl, typeof NativeBooleanFieldControl, typeof NativeNumberFieldControl];
package/fesm2022/index.js CHANGED
@@ -1,2 +1,19 @@
1
- export { NATIVE_FORM_DIRECTIVES, NativeBooleanValueAccessor, NativeNumberValueAccessor, NativeTextValueAccessor, } from './value-accessors.js';
2
- //# sourceMappingURL=index.js.map
1
+ import { FormField } from '@angular/forms/signals';
2
+ import { NativeBooleanFieldControl, NativeNumberFieldControl, NativeTextFieldControl, } from './signal-forms.js';
3
+ import { NativeBooleanValueAccessor, NativeNumberValueAccessor, NativeTextValueAccessor, } from './value-accessors.js';
4
+ export { NativeBooleanValueAccessor, NativeNumberValueAccessor, NativeTextValueAccessor, } from './value-accessors.js';
5
+ export { NATIVE_SIGNAL_FORM_DIRECTIVES, NativeBooleanFieldControl, NativeNumberFieldControl, NativeTextFieldControl, } from './signal-forms.js';
6
+ export { disabled, email, form, FormField, FormRoot, hidden, max, maxLength, min, minLength, pattern, provideSignalFormsConfig, readonly, required, schema, submit, validate, } from '@angular/forms/signals';
7
+ /**
8
+ * Unified standalone directive bundle supporting both Reactive/Template forms (`[formControl]`,
9
+ * `[formControlName]`, `[(ngModel)]`) and Angular Signal Forms (`[formField]`).
10
+ */
11
+ export const NATIVE_FORM_DIRECTIVES = [
12
+ NativeTextValueAccessor,
13
+ NativeBooleanValueAccessor,
14
+ NativeNumberValueAccessor,
15
+ FormField,
16
+ NativeTextFieldControl,
17
+ NativeBooleanFieldControl,
18
+ NativeNumberFieldControl,
19
+ ];
@@ -0,0 +1,87 @@
1
+ import { InputSignal, OnDestroy } from '@angular/core';
2
+ import { FormCheckboxControl, FormField, FormValueControl, type ValidationError } from '@angular/forms/signals';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * First-class Angular Signal Forms `FormValueControl<string>` binding `[formField]` onto native
6
+ * text widgets (`<ng-entry>`, `<ng-search-entry>`, `<ng-password-entry>`, `<ng-text-view>`, `<input>`, `<textarea>`).
7
+ */
8
+ export declare class NativeTextFieldControl implements FormValueControl<string>, OnDestroy {
9
+ private readonly renderer;
10
+ private readonly elementRef;
11
+ private readonly unlistenFns;
12
+ readonly value: import("@angular/core").ModelSignal<string>;
13
+ readonly disabled: InputSignal<boolean>;
14
+ readonly readonly: InputSignal<boolean>;
15
+ readonly hidden: InputSignal<boolean>;
16
+ readonly required: InputSignal<boolean>;
17
+ readonly invalid: InputSignal<boolean>;
18
+ readonly touched: InputSignal<boolean>;
19
+ readonly dirty: InputSignal<boolean>;
20
+ readonly name: InputSignal<string>;
21
+ readonly minLength: InputSignal<number | undefined>;
22
+ readonly maxLength: InputSignal<number | undefined>;
23
+ readonly errors: InputSignal<readonly ValidationError.WithOptionalFieldTree[]>;
24
+ readonly touch: import("@angular/core").OutputEmitterRef<void>;
25
+ constructor();
26
+ focus(): void;
27
+ ngOnDestroy(): void;
28
+ static ɵfac: i0.ɵɵFactoryDeclaration<NativeTextFieldControl, never>;
29
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NativeTextFieldControl, "ng-entry[formField],gtk-entry[formField],ng-search-entry[formField],gtk-search-entry[formField],ng-password-entry[formField],gtk-password-entry[formField],ng-text-view[formField],gtk-text-view[formField],adw-entry-row[formField],adw-password-entry-row[formField],input[formField]:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=number]),textarea[formField]", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "hidden": { "alias": "hidden"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "touched": { "alias": "touched"; "required": false; "isSignal": true; }; "dirty": { "alias": "dirty"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "minLength": { "alias": "minLength"; "required": false; "isSignal": true; }; "maxLength": { "alias": "maxLength"; "required": false; "isSignal": true; }; "errors": { "alias": "errors"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "touch": "touch"; }, never, never, true, never>;
30
+ }
31
+ /**
32
+ * First-class Angular Signal Forms `FormCheckboxControl` binding `[formField]` onto native boolean
33
+ * widgets (`<ng-switch>`, `<ng-checkbox>`, `<ng-check>`, `<ng-check-button>`, `<gtk-switch>`, `<gtk-check-button>`).
34
+ */
35
+ export declare class NativeBooleanFieldControl implements FormCheckboxControl, OnDestroy {
36
+ private readonly renderer;
37
+ private readonly elementRef;
38
+ private readonly unlistenFns;
39
+ readonly checked: import("@angular/core").ModelSignal<boolean>;
40
+ readonly disabled: InputSignal<boolean>;
41
+ readonly readonly: InputSignal<boolean>;
42
+ readonly hidden: InputSignal<boolean>;
43
+ readonly required: InputSignal<boolean>;
44
+ readonly invalid: InputSignal<boolean>;
45
+ readonly touched: InputSignal<boolean>;
46
+ readonly dirty: InputSignal<boolean>;
47
+ readonly name: InputSignal<string>;
48
+ readonly errors: InputSignal<readonly ValidationError.WithOptionalFieldTree[]>;
49
+ readonly touch: import("@angular/core").OutputEmitterRef<void>;
50
+ constructor();
51
+ focus(): void;
52
+ ngOnDestroy(): void;
53
+ static ɵfac: i0.ɵɵFactoryDeclaration<NativeBooleanFieldControl, never>;
54
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NativeBooleanFieldControl, "ng-switch[formField],gtk-switch[formField],ng-checkbox[formField],ng-check[formField],ng-check-button[formField],gtk-check-button[formField],adw-switch-row[formField]", never, { "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "hidden": { "alias": "hidden"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "touched": { "alias": "touched"; "required": false; "isSignal": true; }; "dirty": { "alias": "dirty"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "errors": { "alias": "errors"; "required": false; "isSignal": true; }; }, { "checked": "checkedChange"; "touch": "touch"; }, never, never, true, never>;
55
+ }
56
+ /**
57
+ * First-class Angular Signal Forms `FormValueControl<number>` binding `[formField]` onto native
58
+ * numeric/selection widgets (`<ng-slider>`, `<ng-spin-button>`, `<ng-select>`, `<select>`, `<input type="number|range">`).
59
+ */
60
+ export declare class NativeNumberFieldControl implements FormValueControl<number>, OnDestroy {
61
+ private readonly renderer;
62
+ private readonly elementRef;
63
+ private readonly unlistenFns;
64
+ readonly value: import("@angular/core").ModelSignal<number>;
65
+ readonly disabled: InputSignal<boolean>;
66
+ readonly readonly: InputSignal<boolean>;
67
+ readonly hidden: InputSignal<boolean>;
68
+ readonly required: InputSignal<boolean>;
69
+ readonly invalid: InputSignal<boolean>;
70
+ readonly touched: InputSignal<boolean>;
71
+ readonly dirty: InputSignal<boolean>;
72
+ readonly name: InputSignal<string>;
73
+ readonly min: InputSignal<number | undefined>;
74
+ readonly max: InputSignal<number | undefined>;
75
+ readonly errors: InputSignal<readonly ValidationError.WithOptionalFieldTree[]>;
76
+ readonly touch: import("@angular/core").OutputEmitterRef<void>;
77
+ constructor();
78
+ focus(): void;
79
+ ngOnDestroy(): void;
80
+ static ɵfac: i0.ɵɵFactoryDeclaration<NativeNumberFieldControl, never>;
81
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NativeNumberFieldControl, "ng-slider[formField],ng-scale[formField],gtk-scale[formField],ng-select[formField],ng-dropdown[formField],gtk-dropdown[formField],gtk-drop-down[formField],ng-spin-button[formField],gtk-spin-button[formField],adw-combo-row[formField],adw-spin-row[formField],select[formField],input[type=number][formField],input[type=range][formField]", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "hidden": { "alias": "hidden"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "touched": { "alias": "touched"; "required": false; "isSignal": true; }; "dirty": { "alias": "dirty"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "errors": { "alias": "errors"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "touch": "touch"; }, never, never, true, never>;
82
+ }
83
+ /**
84
+ * Convenience standalone directive bundle enabling Angular Signal Forms (`[formField]`) on all
85
+ * native text, boolean, numeric, and mapped standard HTML widgets.
86
+ */
87
+ export declare const NATIVE_SIGNAL_FORM_DIRECTIVES: readonly [typeof FormField, typeof NativeTextFieldControl, typeof NativeBooleanFieldControl, typeof NativeNumberFieldControl];
@@ -0,0 +1,310 @@
1
+ import { Directive, effect, ElementRef, inject, input, model, output, Renderer2, } from '@angular/core';
2
+ import { FormField, } from '@angular/forms/signals';
3
+ import { SELECT_NUMBER_TAGS } from './value-accessors.js';
4
+ import * as i0 from "@angular/core";
5
+ function syncBooleanStateAttr(renderer, el, attrName, active, activeValue, inactiveValue, stateFlag) {
6
+ const current = el.attributes.get(attrName);
7
+ if (active) {
8
+ stateFlag.applied = true;
9
+ if (current !== activeValue) {
10
+ renderer.setAttribute(el, attrName, activeValue);
11
+ }
12
+ return;
13
+ }
14
+ if ((stateFlag.applied || current === activeValue) && current !== inactiveValue) {
15
+ renderer.setAttribute(el, attrName, inactiveValue);
16
+ }
17
+ }
18
+ function syncStateClass(renderer, el, className, active) {
19
+ if (active && !el.classes.has(className)) {
20
+ renderer.addClass(el, className);
21
+ }
22
+ else if (!active && el.classes.has(className)) {
23
+ renderer.removeClass(el, className);
24
+ }
25
+ }
26
+ /**
27
+ * Attaches reactive `effect()` synchronizers projecting Signal Forms `FormUiControl` status
28
+ * signals onto native widget attributes, ARIA flags, and CSS classes without redundant commands.
29
+ */
30
+ function bindNativeSignalUiEffects(renderer, el, ui) {
31
+ const disabledFlag = { applied: false };
32
+ const readonlyFlag = { applied: false };
33
+ const hiddenFlag = { applied: false };
34
+ const requiredFlag = { applied: false };
35
+ const invalidFlag = { applied: false };
36
+ effect(() => {
37
+ syncBooleanStateAttr(renderer, el, 'sensitive', ui.disabled(), 'false', 'true', disabledFlag);
38
+ syncBooleanStateAttr(renderer, el, 'aria-disabled', ui.disabled(), 'true', 'false', {
39
+ applied: disabledFlag.applied,
40
+ });
41
+ });
42
+ effect(() => {
43
+ const isReadonly = ui.readonly();
44
+ syncBooleanStateAttr(renderer, el, 'editable', isReadonly, 'false', 'true', readonlyFlag);
45
+ syncBooleanStateAttr(renderer, el, 'aria-readonly', isReadonly, 'true', 'false', {
46
+ applied: readonlyFlag.applied,
47
+ });
48
+ });
49
+ effect(() => {
50
+ syncBooleanStateAttr(renderer, el, 'visible', ui.hidden(), 'false', 'true', hiddenFlag);
51
+ });
52
+ effect(() => {
53
+ syncBooleanStateAttr(renderer, el, 'aria-required', ui.required(), 'true', 'false', requiredFlag);
54
+ });
55
+ effect(() => {
56
+ const isInvalid = ui.invalid();
57
+ syncStateClass(renderer, el, 'ng-invalid', isInvalid);
58
+ syncBooleanStateAttr(renderer, el, 'aria-invalid', isInvalid, 'true', 'false', invalidFlag);
59
+ });
60
+ effect(() => {
61
+ syncStateClass(renderer, el, 'ng-touched', ui.touched());
62
+ });
63
+ effect(() => {
64
+ syncStateClass(renderer, el, 'ng-dirty', ui.dirty());
65
+ });
66
+ effect(() => {
67
+ const fieldName = ui.name();
68
+ if (fieldName && el.attributes.get('name') !== fieldName) {
69
+ renderer.setAttribute(el, 'name', fieldName);
70
+ }
71
+ });
72
+ }
73
+ function syncDefinedNumericAttr(renderer, el, attrName, val) {
74
+ if (val === undefined || !Number.isFinite(val)) {
75
+ return;
76
+ }
77
+ const next = String(val);
78
+ if (el.attributes.get(attrName) !== next) {
79
+ renderer.setAttribute(el, attrName, next);
80
+ }
81
+ }
82
+ /**
83
+ * First-class Angular Signal Forms `FormValueControl<string>` binding `[formField]` onto native
84
+ * text widgets (`<ng-entry>`, `<ng-search-entry>`, `<ng-password-entry>`, `<ng-text-view>`, `<input>`, `<textarea>`).
85
+ */
86
+ export class NativeTextFieldControl {
87
+ renderer = inject(Renderer2);
88
+ elementRef = inject(ElementRef);
89
+ unlistenFns = [];
90
+ value = model('', /* @ts-ignore */
91
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
92
+ disabled = input(false, /* @ts-ignore */
93
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
94
+ readonly = input(false, /* @ts-ignore */
95
+ ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
96
+ hidden = input(false, /* @ts-ignore */
97
+ ...(ngDevMode ? [{ debugName: "hidden" }] : /* istanbul ignore next */ []));
98
+ required = input(false, /* @ts-ignore */
99
+ ...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
100
+ invalid = input(false, /* @ts-ignore */
101
+ ...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
102
+ touched = input(false, /* @ts-ignore */
103
+ ...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
104
+ dirty = input(false, /* @ts-ignore */
105
+ ...(ngDevMode ? [{ debugName: "dirty" }] : /* istanbul ignore next */ []));
106
+ name = input('', /* @ts-ignore */
107
+ ...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
108
+ minLength = input(undefined, /* @ts-ignore */
109
+ ...(ngDevMode ? [{ debugName: "minLength" }] : /* istanbul ignore next */ []));
110
+ maxLength = input(undefined, /* @ts-ignore */
111
+ ...(ngDevMode ? [{ debugName: "maxLength" }] : /* istanbul ignore next */ []));
112
+ errors = input([], /* @ts-ignore */
113
+ ...(ngDevMode ? [{ debugName: "errors" }] : /* istanbul ignore next */ []));
114
+ touch = output();
115
+ constructor() {
116
+ const el = this.elementRef.nativeElement;
117
+ bindNativeSignalUiEffects(this.renderer, el, this);
118
+ effect(() => {
119
+ const normalized = this.value() ?? '';
120
+ if (el.attributes.get('value') !== normalized || el.textContent !== normalized) {
121
+ this.renderer.setValue(el, normalized);
122
+ this.renderer.setAttribute(el, 'value', normalized);
123
+ }
124
+ });
125
+ effect(() => {
126
+ syncDefinedNumericAttr(this.renderer, el, 'max-length', this.maxLength());
127
+ });
128
+ this.unlistenFns.push(this.renderer.listen(el, 'input', (event) => {
129
+ const payload = event;
130
+ const nextText = typeof payload?.value === 'string' ? payload.value : String(payload?.value ?? '');
131
+ el.textContent = nextText;
132
+ el.attributes.set('value', nextText);
133
+ this.value.set(nextText);
134
+ }), this.renderer.listen(el, 'blur', () => {
135
+ this.touch.emit();
136
+ }));
137
+ }
138
+ focus() {
139
+ this.elementRef.nativeElement.focus?.();
140
+ }
141
+ ngOnDestroy() {
142
+ for (const unlisten of this.unlistenFns) {
143
+ unlisten();
144
+ }
145
+ }
146
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: NativeTextFieldControl, deps: [], target: i0.ɵɵFactoryTarget.Directive });
147
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.3.0", type: NativeTextFieldControl, isStandalone: true, selector: "ng-entry[formField],gtk-entry[formField],ng-search-entry[formField],gtk-search-entry[formField],ng-password-entry[formField],gtk-password-entry[formField],ng-text-view[formField],gtk-text-view[formField],adw-entry-row[formField],adw-password-entry-row[formField],input[formField]:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=number]),textarea[formField]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, dirty: { classPropertyName: "dirty", publicName: "dirty", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, minLength: { classPropertyName: "minLength", publicName: "minLength", isSignal: true, isRequired: false, transformFunction: null }, maxLength: { classPropertyName: "maxLength", publicName: "maxLength", isSignal: true, isRequired: false, transformFunction: null }, errors: { classPropertyName: "errors", publicName: "errors", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", touch: "touch" }, ngImport: i0 });
148
+ }
149
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: NativeTextFieldControl, decorators: [{
150
+ type: Directive,
151
+ args: [{
152
+ selector: 'ng-entry[formField],gtk-entry[formField],ng-search-entry[formField],gtk-search-entry[formField],ng-password-entry[formField],gtk-password-entry[formField],ng-text-view[formField],gtk-text-view[formField],adw-entry-row[formField],adw-password-entry-row[formField],input[formField]:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=number]),textarea[formField]',
153
+ standalone: true,
154
+ }]
155
+ }], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], dirty: [{ type: i0.Input, args: [{ isSignal: true, alias: "dirty", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], minLength: [{ type: i0.Input, args: [{ isSignal: true, alias: "minLength", required: false }] }], maxLength: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxLength", required: false }] }], errors: [{ type: i0.Input, args: [{ isSignal: true, alias: "errors", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }] } });
156
+ /**
157
+ * First-class Angular Signal Forms `FormCheckboxControl` binding `[formField]` onto native boolean
158
+ * widgets (`<ng-switch>`, `<ng-checkbox>`, `<ng-check>`, `<ng-check-button>`, `<gtk-switch>`, `<gtk-check-button>`).
159
+ */
160
+ export class NativeBooleanFieldControl {
161
+ renderer = inject(Renderer2);
162
+ elementRef = inject(ElementRef);
163
+ unlistenFns = [];
164
+ checked = model(false, /* @ts-ignore */
165
+ ...(ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []));
166
+ disabled = input(false, /* @ts-ignore */
167
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
168
+ readonly = input(false, /* @ts-ignore */
169
+ ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
170
+ hidden = input(false, /* @ts-ignore */
171
+ ...(ngDevMode ? [{ debugName: "hidden" }] : /* istanbul ignore next */ []));
172
+ required = input(false, /* @ts-ignore */
173
+ ...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
174
+ invalid = input(false, /* @ts-ignore */
175
+ ...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
176
+ touched = input(false, /* @ts-ignore */
177
+ ...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
178
+ dirty = input(false, /* @ts-ignore */
179
+ ...(ngDevMode ? [{ debugName: "dirty" }] : /* istanbul ignore next */ []));
180
+ name = input('', /* @ts-ignore */
181
+ ...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
182
+ errors = input([], /* @ts-ignore */
183
+ ...(ngDevMode ? [{ debugName: "errors" }] : /* istanbul ignore next */ []));
184
+ touch = output();
185
+ constructor() {
186
+ const el = this.elementRef.nativeElement;
187
+ bindNativeSignalUiEffects(this.renderer, el, this);
188
+ effect(() => {
189
+ const nextBool = Boolean(this.checked());
190
+ const nextAttr = nextBool ? 'true' : 'false';
191
+ if (el.attributes.get('active') !== nextAttr) {
192
+ this.renderer.setAttribute(el, 'active', nextAttr);
193
+ }
194
+ el.checked = nextBool;
195
+ });
196
+ this.unlistenFns.push(this.renderer.listen(el, 'toggled', (event) => {
197
+ const payload = event;
198
+ const active = typeof payload?.checked === 'boolean' ? payload.checked : Boolean(payload?.value);
199
+ el.checked = active;
200
+ this.checked.set(active);
201
+ this.touch.emit();
202
+ }), this.renderer.listen(el, 'blur', () => {
203
+ this.touch.emit();
204
+ }));
205
+ }
206
+ focus() {
207
+ this.elementRef.nativeElement.focus?.();
208
+ }
209
+ ngOnDestroy() {
210
+ for (const unlisten of this.unlistenFns) {
211
+ unlisten();
212
+ }
213
+ }
214
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: NativeBooleanFieldControl, deps: [], target: i0.ɵɵFactoryTarget.Directive });
215
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.3.0", type: NativeBooleanFieldControl, isStandalone: true, selector: "ng-switch[formField],gtk-switch[formField],ng-checkbox[formField],ng-check[formField],ng-check-button[formField],gtk-check-button[formField],adw-switch-row[formField]", inputs: { checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, dirty: { classPropertyName: "dirty", publicName: "dirty", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, errors: { classPropertyName: "errors", publicName: "errors", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange", touch: "touch" }, ngImport: i0 });
216
+ }
217
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: NativeBooleanFieldControl, decorators: [{
218
+ type: Directive,
219
+ args: [{
220
+ selector: 'ng-switch[formField],gtk-switch[formField],ng-checkbox[formField],ng-check[formField],ng-check-button[formField],gtk-check-button[formField],adw-switch-row[formField]',
221
+ standalone: true,
222
+ }]
223
+ }], ctorParameters: () => [], propDecorators: { checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], dirty: [{ type: i0.Input, args: [{ isSignal: true, alias: "dirty", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], errors: [{ type: i0.Input, args: [{ isSignal: true, alias: "errors", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }] } });
224
+ /**
225
+ * First-class Angular Signal Forms `FormValueControl<number>` binding `[formField]` onto native
226
+ * numeric/selection widgets (`<ng-slider>`, `<ng-spin-button>`, `<ng-select>`, `<select>`, `<input type="number|range">`).
227
+ */
228
+ export class NativeNumberFieldControl {
229
+ renderer = inject(Renderer2);
230
+ elementRef = inject(ElementRef);
231
+ unlistenFns = [];
232
+ value = model(0, /* @ts-ignore */
233
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
234
+ disabled = input(false, /* @ts-ignore */
235
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
236
+ readonly = input(false, /* @ts-ignore */
237
+ ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
238
+ hidden = input(false, /* @ts-ignore */
239
+ ...(ngDevMode ? [{ debugName: "hidden" }] : /* istanbul ignore next */ []));
240
+ required = input(false, /* @ts-ignore */
241
+ ...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
242
+ invalid = input(false, /* @ts-ignore */
243
+ ...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
244
+ touched = input(false, /* @ts-ignore */
245
+ ...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
246
+ dirty = input(false, /* @ts-ignore */
247
+ ...(ngDevMode ? [{ debugName: "dirty" }] : /* istanbul ignore next */ []));
248
+ name = input('', /* @ts-ignore */
249
+ ...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
250
+ min = input(undefined, /* @ts-ignore */
251
+ ...(ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []));
252
+ max = input(undefined, /* @ts-ignore */
253
+ ...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
254
+ errors = input([], /* @ts-ignore */
255
+ ...(ngDevMode ? [{ debugName: "errors" }] : /* istanbul ignore next */ []));
256
+ touch = output();
257
+ constructor() {
258
+ const el = this.elementRef.nativeElement;
259
+ const attrKey = SELECT_NUMBER_TAGS.has(el.tag) || el.tag === 'select' ? 'selected' : 'value';
260
+ bindNativeSignalUiEffects(this.renderer, el, this);
261
+ effect(() => {
262
+ const nextStr = String(this.value() ?? 0);
263
+ if (el.attributes.get(attrKey) !== nextStr) {
264
+ this.renderer.setAttribute(el, attrKey, nextStr);
265
+ }
266
+ });
267
+ effect(() => {
268
+ syncDefinedNumericAttr(this.renderer, el, 'min', this.min());
269
+ });
270
+ effect(() => {
271
+ syncDefinedNumericAttr(this.renderer, el, 'max', this.max());
272
+ });
273
+ this.unlistenFns.push(this.renderer.listen(el, 'value-changed', (event) => {
274
+ const payload = event;
275
+ const numValue = Number(payload?.value ?? 0);
276
+ el.attributes.set(attrKey, String(numValue));
277
+ this.value.set(numValue);
278
+ this.touch.emit();
279
+ }), this.renderer.listen(el, 'blur', () => {
280
+ this.touch.emit();
281
+ }));
282
+ }
283
+ focus() {
284
+ this.elementRef.nativeElement.focus?.();
285
+ }
286
+ ngOnDestroy() {
287
+ for (const unlisten of this.unlistenFns) {
288
+ unlisten();
289
+ }
290
+ }
291
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: NativeNumberFieldControl, deps: [], target: i0.ɵɵFactoryTarget.Directive });
292
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.3.0", type: NativeNumberFieldControl, isStandalone: true, selector: "ng-slider[formField],ng-scale[formField],gtk-scale[formField],ng-select[formField],ng-dropdown[formField],gtk-dropdown[formField],gtk-drop-down[formField],ng-spin-button[formField],gtk-spin-button[formField],adw-combo-row[formField],adw-spin-row[formField],select[formField],input[type=number][formField],input[type=range][formField]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, dirty: { classPropertyName: "dirty", publicName: "dirty", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, errors: { classPropertyName: "errors", publicName: "errors", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", touch: "touch" }, ngImport: i0 });
293
+ }
294
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: NativeNumberFieldControl, decorators: [{
295
+ type: Directive,
296
+ args: [{
297
+ selector: 'ng-slider[formField],ng-scale[formField],gtk-scale[formField],ng-select[formField],ng-dropdown[formField],gtk-dropdown[formField],gtk-drop-down[formField],ng-spin-button[formField],gtk-spin-button[formField],adw-combo-row[formField],adw-spin-row[formField],select[formField],input[type=number][formField],input[type=range][formField]',
298
+ standalone: true,
299
+ }]
300
+ }], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], dirty: [{ type: i0.Input, args: [{ isSignal: true, alias: "dirty", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], errors: [{ type: i0.Input, args: [{ isSignal: true, alias: "errors", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }] } });
301
+ /**
302
+ * Convenience standalone directive bundle enabling Angular Signal Forms (`[formField]`) on all
303
+ * native text, boolean, numeric, and mapped standard HTML widgets.
304
+ */
305
+ export const NATIVE_SIGNAL_FORM_DIRECTIVES = [
306
+ FormField,
307
+ NativeTextFieldControl,
308
+ NativeBooleanFieldControl,
309
+ NativeNumberFieldControl,
310
+ ];
@@ -1,8 +1,9 @@
1
1
  import { OnDestroy } from '@angular/core';
2
2
  import { ControlValueAccessor } from '@angular/forms';
3
3
  import * as i0 from "@angular/core";
4
+ export declare const SELECT_NUMBER_TAGS: Set<string>;
4
5
  /**
5
- * Angular `ControlValueAccessor` for `<ng-entry>` / `<gtk-entry>` text input widgets.
6
+ * Angular `ControlValueAccessor` for `<ng-entry>` / `<gtk-entry>` / `<adw-entry-row>` text input widgets.
6
7
  * Bridges `GtkEditable::changed` (`input`) native signals and `gtk_editable_set_text`.
7
8
  */
8
9
  export declare class NativeTextValueAccessor implements ControlValueAccessor, OnDestroy {
@@ -18,11 +19,11 @@ export declare class NativeTextValueAccessor implements ControlValueAccessor, On
18
19
  setDisabledState(isDisabled: boolean): void;
19
20
  ngOnDestroy(): void;
20
21
  static ɵfac: i0.ɵɵFactoryDeclaration<NativeTextValueAccessor, never>;
21
- static ɵdir: i0.ɵɵDirectiveDeclaration<NativeTextValueAccessor, "ng-entry[formControlName],ng-entry[formControl],ng-entry[ngModel],gtk-entry[formControlName],gtk-entry[formControl],gtk-entry[ngModel],ng-search-entry[formControlName],ng-search-entry[formControl],ng-search-entry[ngModel],ng-password-entry[formControlName],ng-password-entry[formControl],ng-password-entry[ngModel],ng-text-view[formControlName],ng-text-view[formControl],ng-text-view[ngModel]", never, {}, {}, never, never, true, never>;
22
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NativeTextValueAccessor, "ng-entry[formControlName],ng-entry[formControl],ng-entry[ngModel],gtk-entry[formControlName],gtk-entry[formControl],gtk-entry[ngModel],ng-search-entry[formControlName],ng-search-entry[formControl],ng-search-entry[ngModel],gtk-search-entry[formControlName],gtk-search-entry[formControl],gtk-search-entry[ngModel],ng-password-entry[formControlName],ng-password-entry[formControl],ng-password-entry[ngModel],gtk-password-entry[formControlName],gtk-password-entry[formControl],gtk-password-entry[ngModel],ng-text-view[formControlName],ng-text-view[formControl],ng-text-view[ngModel],gtk-text-view[formControlName],gtk-text-view[formControl],gtk-text-view[ngModel],adw-entry-row[formControlName],adw-entry-row[formControl],adw-entry-row[ngModel],adw-password-entry-row[formControlName],adw-password-entry-row[formControl],adw-password-entry-row[ngModel]", never, {}, {}, never, never, true, never>;
22
23
  }
23
24
  /**
24
25
  * Angular `ControlValueAccessor` for boolean native widgets:
25
- * `<ng-switch>`, `<ng-checkbox>`, `<ng-check>`, `<gtk-switch>`, `<gtk-check-button>`.
26
+ * `<ng-switch>`, `<ng-checkbox>`, `<ng-check>`, `<gtk-switch>`, `<gtk-check-button>`, `<adw-switch-row>`.
26
27
  */
27
28
  export declare class NativeBooleanValueAccessor implements ControlValueAccessor, OnDestroy {
28
29
  private readonly renderer;
@@ -37,11 +38,12 @@ export declare class NativeBooleanValueAccessor implements ControlValueAccessor,
37
38
  setDisabledState(isDisabled: boolean): void;
38
39
  ngOnDestroy(): void;
39
40
  static ɵfac: i0.ɵɵFactoryDeclaration<NativeBooleanValueAccessor, never>;
40
- static ɵdir: i0.ɵɵDirectiveDeclaration<NativeBooleanValueAccessor, "ng-switch[formControlName],ng-switch[formControl],ng-switch[ngModel],ng-checkbox[formControlName],ng-checkbox[formControl],ng-checkbox[ngModel],ng-check[formControlName],ng-check[formControl],ng-check[ngModel]", never, {}, {}, never, never, true, never>;
41
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NativeBooleanValueAccessor, "ng-switch[formControlName],ng-switch[formControl],ng-switch[ngModel],ng-checkbox[formControlName],ng-checkbox[formControl],ng-checkbox[ngModel],ng-check[formControlName],ng-check[formControl],ng-check[ngModel],ng-check-button[formControlName],ng-check-button[formControl],ng-check-button[ngModel],gtk-switch[formControlName],gtk-switch[formControl],gtk-switch[ngModel],gtk-check-button[formControlName],gtk-check-button[formControl],gtk-check-button[ngModel],adw-switch-row[formControlName],adw-switch-row[formControl],adw-switch-row[ngModel]", never, {}, {}, never, never, true, never>;
41
42
  }
42
43
  /**
43
44
  * Angular `ControlValueAccessor` for numeric/index native widgets:
44
- * `<ng-slider>`, `<ng-scale>`, `<ng-select>`, `<ng-dropdown>`.
45
+ * `<ng-slider>`, `<ng-scale>`, `<gtk-scale>`, `<ng-select>`, `<ng-dropdown>`, `<gtk-dropdown>`,
46
+ * `<gtk-drop-down>`, `<ng-spin-button>`, `<gtk-spin-button>`, `<adw-combo-row>`, `<adw-spin-row>`.
45
47
  */
46
48
  export declare class NativeNumberValueAccessor implements ControlValueAccessor, OnDestroy {
47
49
  private readonly renderer;
@@ -56,7 +58,6 @@ export declare class NativeNumberValueAccessor implements ControlValueAccessor,
56
58
  setDisabledState(isDisabled: boolean): void;
57
59
  ngOnDestroy(): void;
58
60
  static ɵfac: i0.ɵɵFactoryDeclaration<NativeNumberValueAccessor, never>;
59
- static ɵdir: i0.ɵɵDirectiveDeclaration<NativeNumberValueAccessor, "ng-slider[formControlName],ng-slider[formControl],ng-slider[ngModel],ng-scale[formControlName],ng-scale[formControl],ng-scale[ngModel],ng-select[formControlName],ng-select[formControl],ng-select[ngModel],ng-dropdown[formControlName],ng-dropdown[formControl],ng-dropdown[ngModel],ng-spin-button[formControlName],ng-spin-button[formControl],ng-spin-button[ngModel]", never, {}, {}, never, never, true, never>;
61
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NativeNumberValueAccessor, "ng-slider[formControlName],ng-slider[formControl],ng-slider[ngModel],ng-scale[formControlName],ng-scale[formControl],ng-scale[ngModel],gtk-scale[formControlName],gtk-scale[formControl],gtk-scale[ngModel],ng-select[formControlName],ng-select[formControl],ng-select[ngModel],ng-dropdown[formControlName],ng-dropdown[formControl],ng-dropdown[ngModel],gtk-dropdown[formControlName],gtk-dropdown[formControl],gtk-dropdown[ngModel],gtk-drop-down[formControlName],gtk-drop-down[formControl],gtk-drop-down[ngModel],ng-spin-button[formControlName],ng-spin-button[formControl],ng-spin-button[ngModel],gtk-spin-button[formControlName],gtk-spin-button[formControl],gtk-spin-button[ngModel],adw-combo-row[formControlName],adw-combo-row[formControl],adw-combo-row[ngModel],adw-spin-row[formControlName],adw-spin-row[formControl],adw-spin-row[ngModel]", never, {}, {}, never, never, true, never>;
60
62
  }
61
63
  export declare const NATIVE_FORM_DIRECTIVES: readonly [typeof NativeTextValueAccessor, typeof NativeBooleanValueAccessor, typeof NativeNumberValueAccessor];
62
- //# sourceMappingURL=value-accessors.d.ts.map
@@ -1,8 +1,15 @@
1
1
  import { Directive, ElementRef, forwardRef, inject, Renderer2 } from '@angular/core';
2
2
  import { NG_VALUE_ACCESSOR } from '@angular/forms';
3
3
  import * as i0 from "@angular/core";
4
+ export const SELECT_NUMBER_TAGS = new Set([
5
+ 'ng-select',
6
+ 'ng-dropdown',
7
+ 'gtk-dropdown',
8
+ 'gtk-drop-down',
9
+ 'adw-combo-row',
10
+ ]);
4
11
  /**
5
- * Angular `ControlValueAccessor` for `<ng-entry>` / `<gtk-entry>` text input widgets.
12
+ * Angular `ControlValueAccessor` for `<ng-entry>` / `<gtk-entry>` / `<adw-entry-row>` text input widgets.
6
13
  * Bridges `GtkEditable::changed` (`input`) native signals and `gtk_editable_set_text`.
7
14
  */
8
15
  export class NativeTextValueAccessor {
@@ -43,8 +50,8 @@ export class NativeTextValueAccessor {
43
50
  unlisten();
44
51
  }
45
52
  }
46
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: NativeTextValueAccessor, deps: [], target: i0.ɵɵFactoryTarget.Directive });
47
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.2.6", type: NativeTextValueAccessor, isStandalone: true, selector: "ng-entry[formControlName],ng-entry[formControl],ng-entry[ngModel],gtk-entry[formControlName],gtk-entry[formControl],gtk-entry[ngModel],ng-search-entry[formControlName],ng-search-entry[formControl],ng-search-entry[ngModel],ng-password-entry[formControlName],ng-password-entry[formControl],ng-password-entry[ngModel],ng-text-view[formControlName],ng-text-view[formControl],ng-text-view[ngModel]", providers: [
53
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: NativeTextValueAccessor, deps: [], target: i0.ɵɵFactoryTarget.Directive });
54
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.3.0", type: NativeTextValueAccessor, isStandalone: true, selector: "ng-entry[formControlName],ng-entry[formControl],ng-entry[ngModel],gtk-entry[formControlName],gtk-entry[formControl],gtk-entry[ngModel],ng-search-entry[formControlName],ng-search-entry[formControl],ng-search-entry[ngModel],gtk-search-entry[formControlName],gtk-search-entry[formControl],gtk-search-entry[ngModel],ng-password-entry[formControlName],ng-password-entry[formControl],ng-password-entry[ngModel],gtk-password-entry[formControlName],gtk-password-entry[formControl],gtk-password-entry[ngModel],ng-text-view[formControlName],ng-text-view[formControl],ng-text-view[ngModel],gtk-text-view[formControlName],gtk-text-view[formControl],gtk-text-view[ngModel],adw-entry-row[formControlName],adw-entry-row[formControl],adw-entry-row[ngModel],adw-password-entry-row[formControlName],adw-password-entry-row[formControl],adw-password-entry-row[ngModel]", providers: [
48
55
  {
49
56
  provide: NG_VALUE_ACCESSOR,
50
57
  useExisting: forwardRef(() => NativeTextValueAccessor),
@@ -52,10 +59,10 @@ export class NativeTextValueAccessor {
52
59
  },
53
60
  ], ngImport: i0 });
54
61
  }
55
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: NativeTextValueAccessor, decorators: [{
62
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: NativeTextValueAccessor, decorators: [{
56
63
  type: Directive,
57
64
  args: [{
58
- selector: 'ng-entry[formControlName],ng-entry[formControl],ng-entry[ngModel],gtk-entry[formControlName],gtk-entry[formControl],gtk-entry[ngModel],ng-search-entry[formControlName],ng-search-entry[formControl],ng-search-entry[ngModel],ng-password-entry[formControlName],ng-password-entry[formControl],ng-password-entry[ngModel],ng-text-view[formControlName],ng-text-view[formControl],ng-text-view[ngModel]',
65
+ selector: 'ng-entry[formControlName],ng-entry[formControl],ng-entry[ngModel],gtk-entry[formControlName],gtk-entry[formControl],gtk-entry[ngModel],ng-search-entry[formControlName],ng-search-entry[formControl],ng-search-entry[ngModel],gtk-search-entry[formControlName],gtk-search-entry[formControl],gtk-search-entry[ngModel],ng-password-entry[formControlName],ng-password-entry[formControl],ng-password-entry[ngModel],gtk-password-entry[formControlName],gtk-password-entry[formControl],gtk-password-entry[ngModel],ng-text-view[formControlName],ng-text-view[formControl],ng-text-view[ngModel],gtk-text-view[formControlName],gtk-text-view[formControl],gtk-text-view[ngModel],adw-entry-row[formControlName],adw-entry-row[formControl],adw-entry-row[ngModel],adw-password-entry-row[formControlName],adw-password-entry-row[formControl],adw-password-entry-row[ngModel]',
59
66
  standalone: true,
60
67
  providers: [
61
68
  {
@@ -68,7 +75,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.6", ngImpor
68
75
  }], ctorParameters: () => [] });
69
76
  /**
70
77
  * Angular `ControlValueAccessor` for boolean native widgets:
71
- * `<ng-switch>`, `<ng-checkbox>`, `<ng-check>`, `<gtk-switch>`, `<gtk-check-button>`.
78
+ * `<ng-switch>`, `<ng-checkbox>`, `<ng-check>`, `<gtk-switch>`, `<gtk-check-button>`, `<adw-switch-row>`.
72
79
  */
73
80
  export class NativeBooleanValueAccessor {
74
81
  renderer = inject(Renderer2);
@@ -104,8 +111,8 @@ export class NativeBooleanValueAccessor {
104
111
  unlisten();
105
112
  }
106
113
  }
107
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: NativeBooleanValueAccessor, deps: [], target: i0.ɵɵFactoryTarget.Directive });
108
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.2.6", type: NativeBooleanValueAccessor, isStandalone: true, selector: "ng-switch[formControlName],ng-switch[formControl],ng-switch[ngModel],ng-checkbox[formControlName],ng-checkbox[formControl],ng-checkbox[ngModel],ng-check[formControlName],ng-check[formControl],ng-check[ngModel]", providers: [
114
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: NativeBooleanValueAccessor, deps: [], target: i0.ɵɵFactoryTarget.Directive });
115
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.3.0", type: NativeBooleanValueAccessor, isStandalone: true, selector: "ng-switch[formControlName],ng-switch[formControl],ng-switch[ngModel],ng-checkbox[formControlName],ng-checkbox[formControl],ng-checkbox[ngModel],ng-check[formControlName],ng-check[formControl],ng-check[ngModel],ng-check-button[formControlName],ng-check-button[formControl],ng-check-button[ngModel],gtk-switch[formControlName],gtk-switch[formControl],gtk-switch[ngModel],gtk-check-button[formControlName],gtk-check-button[formControl],gtk-check-button[ngModel],adw-switch-row[formControlName],adw-switch-row[formControl],adw-switch-row[ngModel]", providers: [
109
116
  {
110
117
  provide: NG_VALUE_ACCESSOR,
111
118
  useExisting: forwardRef(() => NativeBooleanValueAccessor),
@@ -113,10 +120,10 @@ export class NativeBooleanValueAccessor {
113
120
  },
114
121
  ], ngImport: i0 });
115
122
  }
116
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: NativeBooleanValueAccessor, decorators: [{
123
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: NativeBooleanValueAccessor, decorators: [{
117
124
  type: Directive,
118
125
  args: [{
119
- selector: 'ng-switch[formControlName],ng-switch[formControl],ng-switch[ngModel],ng-checkbox[formControlName],ng-checkbox[formControl],ng-checkbox[ngModel],ng-check[formControlName],ng-check[formControl],ng-check[ngModel]',
126
+ selector: 'ng-switch[formControlName],ng-switch[formControl],ng-switch[ngModel],ng-checkbox[formControlName],ng-checkbox[formControl],ng-checkbox[ngModel],ng-check[formControlName],ng-check[formControl],ng-check[ngModel],ng-check-button[formControlName],ng-check-button[formControl],ng-check-button[ngModel],gtk-switch[formControlName],gtk-switch[formControl],gtk-switch[ngModel],gtk-check-button[formControlName],gtk-check-button[formControl],gtk-check-button[ngModel],adw-switch-row[formControlName],adw-switch-row[formControl],adw-switch-row[ngModel]',
120
127
  standalone: true,
121
128
  providers: [
122
129
  {
@@ -129,7 +136,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.6", ngImpor
129
136
  }], ctorParameters: () => [] });
130
137
  /**
131
138
  * Angular `ControlValueAccessor` for numeric/index native widgets:
132
- * `<ng-slider>`, `<ng-scale>`, `<ng-select>`, `<ng-dropdown>`.
139
+ * `<ng-slider>`, `<ng-scale>`, `<gtk-scale>`, `<ng-select>`, `<ng-dropdown>`, `<gtk-dropdown>`,
140
+ * `<gtk-drop-down>`, `<ng-spin-button>`, `<gtk-spin-button>`, `<adw-combo-row>`, `<adw-spin-row>`.
133
141
  */
134
142
  export class NativeNumberValueAccessor {
135
143
  renderer = inject(Renderer2);
@@ -142,7 +150,7 @@ export class NativeNumberValueAccessor {
142
150
  this.unlistenFns.push(this.renderer.listen(el, 'value-changed', (event) => {
143
151
  const payload = event;
144
152
  const numValue = Number(payload?.value ?? 0);
145
- const attrKey = el.tag === 'ng-select' || el.tag === 'ng-dropdown' ? 'selected' : 'value';
153
+ const attrKey = SELECT_NUMBER_TAGS.has(el.tag) ? 'selected' : 'value';
146
154
  el.attributes.set(attrKey, String(numValue));
147
155
  this.onChange(numValue);
148
156
  this.onTouched();
@@ -151,7 +159,7 @@ export class NativeNumberValueAccessor {
151
159
  writeValue(value) {
152
160
  const numValue = Number(value ?? 0);
153
161
  const el = this.elementRef.nativeElement;
154
- const attrKey = el.tag === 'ng-select' || el.tag === 'ng-dropdown' ? 'selected' : 'value';
162
+ const attrKey = SELECT_NUMBER_TAGS.has(el.tag) ? 'selected' : 'value';
155
163
  this.renderer.setAttribute(el, attrKey, String(numValue));
156
164
  }
157
165
  registerOnChange(fn) {
@@ -168,8 +176,8 @@ export class NativeNumberValueAccessor {
168
176
  unlisten();
169
177
  }
170
178
  }
171
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: NativeNumberValueAccessor, deps: [], target: i0.ɵɵFactoryTarget.Directive });
172
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.2.6", type: NativeNumberValueAccessor, isStandalone: true, selector: "ng-slider[formControlName],ng-slider[formControl],ng-slider[ngModel],ng-scale[formControlName],ng-scale[formControl],ng-scale[ngModel],ng-select[formControlName],ng-select[formControl],ng-select[ngModel],ng-dropdown[formControlName],ng-dropdown[formControl],ng-dropdown[ngModel],ng-spin-button[formControlName],ng-spin-button[formControl],ng-spin-button[ngModel]", providers: [
179
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: NativeNumberValueAccessor, deps: [], target: i0.ɵɵFactoryTarget.Directive });
180
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.3.0", type: NativeNumberValueAccessor, isStandalone: true, selector: "ng-slider[formControlName],ng-slider[formControl],ng-slider[ngModel],ng-scale[formControlName],ng-scale[formControl],ng-scale[ngModel],gtk-scale[formControlName],gtk-scale[formControl],gtk-scale[ngModel],ng-select[formControlName],ng-select[formControl],ng-select[ngModel],ng-dropdown[formControlName],ng-dropdown[formControl],ng-dropdown[ngModel],gtk-dropdown[formControlName],gtk-dropdown[formControl],gtk-dropdown[ngModel],gtk-drop-down[formControlName],gtk-drop-down[formControl],gtk-drop-down[ngModel],ng-spin-button[formControlName],ng-spin-button[formControl],ng-spin-button[ngModel],gtk-spin-button[formControlName],gtk-spin-button[formControl],gtk-spin-button[ngModel],adw-combo-row[formControlName],adw-combo-row[formControl],adw-combo-row[ngModel],adw-spin-row[formControlName],adw-spin-row[formControl],adw-spin-row[ngModel]", providers: [
173
181
  {
174
182
  provide: NG_VALUE_ACCESSOR,
175
183
  useExisting: forwardRef(() => NativeNumberValueAccessor),
@@ -177,10 +185,10 @@ export class NativeNumberValueAccessor {
177
185
  },
178
186
  ], ngImport: i0 });
179
187
  }
180
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: NativeNumberValueAccessor, decorators: [{
188
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: NativeNumberValueAccessor, decorators: [{
181
189
  type: Directive,
182
190
  args: [{
183
- selector: 'ng-slider[formControlName],ng-slider[formControl],ng-slider[ngModel],ng-scale[formControlName],ng-scale[formControl],ng-scale[ngModel],ng-select[formControlName],ng-select[formControl],ng-select[ngModel],ng-dropdown[formControlName],ng-dropdown[formControl],ng-dropdown[ngModel],ng-spin-button[formControlName],ng-spin-button[formControl],ng-spin-button[ngModel]',
191
+ selector: 'ng-slider[formControlName],ng-slider[formControl],ng-slider[ngModel],ng-scale[formControlName],ng-scale[formControl],ng-scale[ngModel],gtk-scale[formControlName],gtk-scale[formControl],gtk-scale[ngModel],ng-select[formControlName],ng-select[formControl],ng-select[ngModel],ng-dropdown[formControlName],ng-dropdown[formControl],ng-dropdown[ngModel],gtk-dropdown[formControlName],gtk-dropdown[formControl],gtk-dropdown[ngModel],gtk-drop-down[formControlName],gtk-drop-down[formControl],gtk-drop-down[ngModel],ng-spin-button[formControlName],ng-spin-button[formControl],ng-spin-button[ngModel],gtk-spin-button[formControlName],gtk-spin-button[formControl],gtk-spin-button[ngModel],adw-combo-row[formControlName],adw-combo-row[formControl],adw-combo-row[ngModel],adw-spin-row[formControlName],adw-spin-row[formControl],adw-spin-row[ngModel]',
184
192
  standalone: true,
185
193
  providers: [
186
194
  {
@@ -196,4 +204,3 @@ export const NATIVE_FORM_DIRECTIVES = [
196
204
  NativeBooleanValueAccessor,
197
205
  NativeNumberValueAccessor,
198
206
  ];
199
- //# sourceMappingURL=value-accessors.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ng-desktop/forms",
3
- "version": "0.3.0",
4
- "description": "Angular ControlValueAccessor directives for Native GTK4 / WinUI 3 / AppKit widgets (<ng-entry>, <ng-switch>, <ng-checkbox>, <ng-slider>, <ng-select>)",
3
+ "version": "0.4.1",
4
+ "description": "Angular Signal Forms ([formField]) & ControlValueAccessor directives for Native GTK4 / WinUI 3 / AppKit widgets (<ng-entry>, <ng-switch>, <ng-checkbox>, <ng-slider>, <ng-select>)",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "angular",
@@ -30,7 +30,8 @@
30
30
  "files": [
31
31
  "fesm2022",
32
32
  "README.md",
33
- "LICENSE"
33
+ "LICENSE",
34
+ "!**/*.map"
34
35
  ],
35
36
  "main": "./fesm2022/index.js",
36
37
  "module": "./fesm2022/index.js",
@@ -47,6 +48,6 @@
47
48
  "peerDependencies": {
48
49
  "@angular/core": ">=22.0.0",
49
50
  "@angular/forms": ">=22.0.0",
50
- "@ng-desktop/platform": ">=0.3.0"
51
+ "@ng-desktop/platform": ">=0.4.0"
51
52
  }
52
53
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/forms-native/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,0BAA0B,EAC1B,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/forms-native/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,0BAA0B,EAC1B,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC","sourcesContent":["export {\n NATIVE_FORM_DIRECTIVES,\n NativeBooleanValueAccessor,\n NativeNumberValueAccessor,\n NativeTextValueAccessor,\n} from './value-accessors';\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"value-accessors.d.ts","sourceRoot":"","sources":["../../../../packages/forms-native/src/value-accessors.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6C,SAAS,EAAa,MAAM,eAAe,CAAC;AAChG,OAAO,EAAE,oBAAoB,EAAqB,MAAM,gBAAgB,CAAC;;AAWzE;;;GAGG;AACH,qBAYa,uBAAwB,YAAW,oBAAoB,EAAE,SAAS;IAC7E,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;IAC9C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAqD;IAChF,OAAO,CAAC,QAAQ,CAAqC;IACrD,OAAO,CAAC,SAAS,CAAwB;IACzC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAyB;;IAmBrD,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAOhC,gBAAgB,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;IAInD,iBAAiB,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI;IAIvC,gBAAgB,CAAC,UAAU,EAAE,OAAO,GAAG,IAAI;IAQ3C,WAAW,IAAI,IAAI;yCA/CR,uBAAuB;2C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I,CAAC,QAAQ,CAAC,YAAY,CACxB,IAAI,CAAC,UAAU,CAAC,aAAa,EAC7B,WAAW,EACX,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAC9B,CAAC;IACJ,CAAC;IAED,WAAW;QACT,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACxC,QAAQ,EAAE,CAAC;QACb,CAAC;IACH,CAAC;uGAhDU,yBAAyB;2FAAzB,yBAAyB,yZARzB;YACT;gBACE,OAAO,EAAE,iBAAiB;gBAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,yBAAyB,CAAC;gBACxD,KAAK,EAAE,IAAI;aACZ;SACF;;2FAEU,yBAAyB;kBAZrC,SAAS;mBAAC;oBACT,QAAQ,EACN,4WAA4W;oBAC9W,UAAU,EAAE,IAAI;oBAChB,SAAS,EAAE;wBACT;4BACE,OAAO,EAAE,iBAAiB;4BAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,0BAA0B,CAAC;4BACxD,KAAK,EAAE,IAAI;yBACZ;qBACF;iBACF;;AAoDD,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,uBAAuB;IACvB,0BAA0B;IAC1B,yBAAyB;CACjB,CAAC","sourcesContent":["import { Directive, ElementRef, forwardRef, inject, OnDestroy, Renderer2 } from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { NativeElementNode } from '@ng-desktop/platform';\n\ninterface NativeWidgetEvent {\n type?: string;\n targetId?: string;\n value?: string | number | boolean;\n checked?: boolean;\n detail?: unknown;\n}\n\n/**\n * Angular `ControlValueAccessor` for `<ng-entry>` / `<gtk-entry>` text input widgets.\n * Bridges `GtkEditable::changed` (`input`) native signals and `gtk_editable_set_text`.\n */\n@Directive({\n selector:\n 'ng-entry[formControlName],ng-entry[formControl],ng-entry[ngModel],gtk-entry[formControlName],gtk-entry[formControl],gtk-entry[ngModel],ng-search-entry[formControlName],ng-search-entry[formControl],ng-search-entry[ngModel],ng-password-entry[formControlName],ng-password-entry[formControl],ng-password-entry[ngModel],ng-text-view[formControlName],ng-text-view[formControl],ng-text-view[ngModel]',\n standalone: true,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => NativeTextValueAccessor),\n multi: true,\n },\n ],\n})\nexport class NativeTextValueAccessor implements ControlValueAccessor, OnDestroy {\n private readonly renderer = inject(Renderer2);\n private readonly elementRef = inject<ElementRef<NativeElementNode>>(ElementRef);\n private onChange: (value: string) => void = () => {};\n private onTouched: () => void = () => {};\n private readonly unlistenFns: Array<() => void> = [];\n\n constructor() {\n const el = this.elementRef.nativeElement;\n this.unlistenFns.push(\n this.renderer.listen(el, 'input', (event: unknown) => {\n const payload = event as NativeWidgetEvent | undefined;\n const nextText =\n typeof payload?.value === 'string' ? payload.value : String(payload?.value ?? '');\n el.textContent = nextText;\n el.attributes.set('value', nextText);\n this.onChange(nextText);\n }),\n this.renderer.listen(el, 'blur', () => {\n this.onTouched();\n }),\n );\n }\n\n writeValue(value: unknown): void {\n const normalized = value === null || value === undefined ? '' : String(value);\n const el = this.elementRef.nativeElement;\n this.renderer.setValue(el, normalized);\n this.renderer.setAttribute(el, 'value', normalized);\n }\n\n registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.renderer.setAttribute(\n this.elementRef.nativeElement,\n 'sensitive',\n isDisabled ? 'false' : 'true',\n );\n }\n\n ngOnDestroy(): void {\n for (const unlisten of this.unlistenFns) {\n unlisten();\n }\n }\n}\n\n/**\n * Angular `ControlValueAccessor` for boolean native widgets:\n * `<ng-switch>`, `<ng-checkbox>`, `<ng-check>`, `<gtk-switch>`, `<gtk-check-button>`.\n */\n@Directive({\n selector:\n 'ng-switch[formControlName],ng-switch[formControl],ng-switch[ngModel],ng-checkbox[formControlName],ng-checkbox[formControl],ng-checkbox[ngModel],ng-check[formControlName],ng-check[formControl],ng-check[ngModel]',\n standalone: true,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => NativeBooleanValueAccessor),\n multi: true,\n },\n ],\n})\nexport class NativeBooleanValueAccessor implements ControlValueAccessor, OnDestroy {\n private readonly renderer = inject(Renderer2);\n private readonly elementRef = inject<ElementRef<NativeElementNode>>(ElementRef);\n private onChange: (value: boolean) => void = () => {};\n private onTouched: () => void = () => {};\n private readonly unlistenFns: Array<() => void> = [];\n\n constructor() {\n const el = this.elementRef.nativeElement;\n this.unlistenFns.push(\n this.renderer.listen(el, 'toggled', (event: unknown) => {\n const payload = event as NativeWidgetEvent | undefined;\n const active =\n typeof payload?.checked === 'boolean' ? payload.checked : Boolean(payload?.value);\n el.attributes.set('active', active ? 'true' : 'false');\n this.onChange(active);\n this.onTouched();\n }),\n );\n }\n\n writeValue(value: unknown): void {\n const active = Boolean(value);\n this.renderer.setAttribute(this.elementRef.nativeElement, 'active', active ? 'true' : 'false');\n }\n\n registerOnChange(fn: (value: boolean) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.renderer.setAttribute(\n this.elementRef.nativeElement,\n 'sensitive',\n isDisabled ? 'false' : 'true',\n );\n }\n\n ngOnDestroy(): void {\n for (const unlisten of this.unlistenFns) {\n unlisten();\n }\n }\n}\n\n/**\n * Angular `ControlValueAccessor` for numeric/index native widgets:\n * `<ng-slider>`, `<ng-scale>`, `<ng-select>`, `<ng-dropdown>`.\n */\n@Directive({\n selector:\n 'ng-slider[formControlName],ng-slider[formControl],ng-slider[ngModel],ng-scale[formControlName],ng-scale[formControl],ng-scale[ngModel],ng-select[formControlName],ng-select[formControl],ng-select[ngModel],ng-dropdown[formControlName],ng-dropdown[formControl],ng-dropdown[ngModel],ng-spin-button[formControlName],ng-spin-button[formControl],ng-spin-button[ngModel]',\n standalone: true,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => NativeNumberValueAccessor),\n multi: true,\n },\n ],\n})\nexport class NativeNumberValueAccessor implements ControlValueAccessor, OnDestroy {\n private readonly renderer = inject(Renderer2);\n private readonly elementRef = inject<ElementRef<NativeElementNode>>(ElementRef);\n private onChange: (value: number) => void = () => {};\n private onTouched: () => void = () => {};\n private readonly unlistenFns: Array<() => void> = [];\n\n constructor() {\n const el = this.elementRef.nativeElement;\n this.unlistenFns.push(\n this.renderer.listen(el, 'value-changed', (event: unknown) => {\n const payload = event as NativeWidgetEvent | undefined;\n const numValue = Number(payload?.value ?? 0);\n const attrKey = el.tag === 'ng-select' || el.tag === 'ng-dropdown' ? 'selected' : 'value';\n el.attributes.set(attrKey, String(numValue));\n this.onChange(numValue);\n this.onTouched();\n }),\n );\n }\n\n writeValue(value: unknown): void {\n const numValue = Number(value ?? 0);\n const el = this.elementRef.nativeElement;\n const attrKey = el.tag === 'ng-select' || el.tag === 'ng-dropdown' ? 'selected' : 'value';\n this.renderer.setAttribute(el, attrKey, String(numValue));\n }\n\n registerOnChange(fn: (value: number) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.renderer.setAttribute(\n this.elementRef.nativeElement,\n 'sensitive',\n isDisabled ? 'false' : 'true',\n );\n }\n\n ngOnDestroy(): void {\n for (const unlisten of this.unlistenFns) {\n unlisten();\n }\n }\n}\n\nexport const NATIVE_FORM_DIRECTIVES = [\n NativeTextValueAccessor,\n NativeBooleanValueAccessor,\n NativeNumberValueAccessor,\n] as const;\n"]}