@wawjs/ngx-bos 22.0.0 → 22.0.2

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.
Files changed (56) hide show
  1. package/AGENTS.md +23 -23
  2. package/README.md +105 -105
  3. package/RELEASES.md +41 -15
  4. package/ai/architecture.md +40 -40
  5. package/ai/code-style.md +33 -33
  6. package/ai/decisions/2026-06-02-browser-only-bos-spa.md +16 -16
  7. package/ai/decisions/2026-06-02-package-boundary.md +22 -22
  8. package/ai/decisions/2026-06-02-version-start.md +12 -12
  9. package/ai/decisions/index.md +7 -7
  10. package/ai/onboarding.md +19 -19
  11. package/ai/task-execution.md +35 -35
  12. package/ai/tooling.md +33 -33
  13. package/fesm2022/wawjs-ngx-bos.mjs +138 -98
  14. package/fesm2022/wawjs-ngx-bos.mjs.map +1 -1
  15. package/package.json +1 -1
  16. package/src/feature/file/file.component.html +1 -1
  17. package/src/feature/file/file.component.ts +236 -220
  18. package/src/feature/file/file.interface.ts +12 -12
  19. package/src/feature/file/file.service.ts +35 -34
  20. package/src/feature/file/pages/files/files.component.html +2 -2
  21. package/src/feature/file/pages/files/files.component.ts +117 -117
  22. package/src/feature/file/pages/files/files.routes.ts +9 -9
  23. package/src/feature/file/selectors/file/file-selector.component.html +2 -5
  24. package/src/feature/file/selectors/file/file-selector.component.ts +24 -27
  25. package/src/feature/user/guards/admins.guard.ts +22 -22
  26. package/src/feature/user/guards/authenticated.guard.ts +14 -14
  27. package/src/feature/user/guards/guest.guard.ts +14 -14
  28. package/src/feature/user/pages/clients/clients.component.ts +45 -45
  29. package/src/feature/user/pages/clients/clients.routes.ts +1 -1
  30. package/src/feature/user/pages/users/users.component.html +3 -2
  31. package/src/feature/user/pages/users/users.component.scss +12 -0
  32. package/src/feature/user/pages/users/users.component.ts +78 -45
  33. package/src/feature/user/pages/users/users.routes.ts +1 -1
  34. package/src/feature/user/selectors/user/user-selector.component.ts +17 -17
  35. package/src/feature/user/user.const.ts +3 -3
  36. package/src/feature/user/user.form.ts +54 -54
  37. package/src/feature/user/user.interface.ts +12 -12
  38. package/src/feature/user/user.service.ts +178 -176
  39. package/src/form-components/ace/ace.component.ts +210 -210
  40. package/src/form-components/button/button.component.ts +31 -31
  41. package/src/form-components/file/file.component.ts +91 -91
  42. package/src/form-components/form-bridge.interface.ts +27 -27
  43. package/src/form-components/index.ts +85 -85
  44. package/src/form-components/input/input.component.html +1 -0
  45. package/src/form-components/input/input.component.ts +31 -31
  46. package/src/form-components/select/select.component.html +2 -2
  47. package/src/form-components/select/select.component.ts +31 -31
  48. package/src/form-components/tinymce/tinymce.component.ts +221 -221
  49. package/src/ngx-bos.config.ts +55 -55
  50. package/src/pages/form/form.component.ts +86 -86
  51. package/src/pages/form/form.routes.ts +1 -1
  52. package/src/pages/forms/forms.component.ts +15 -15
  53. package/src/pages/forms/forms.routes.ts +1 -1
  54. package/src/pipes/phone.pipe.ts +17 -17
  55. package/src/public-api.ts +36 -36
  56. package/types/wawjs-ngx-bos.d.ts +13 -9
@@ -1,210 +1,210 @@
1
- import {
2
- Component,
3
- OnInit,
4
- TemplateRef,
5
- inject,
6
- viewChild,
7
- } from '@angular/core';
8
- import { AceComponent, AceConfigInterface } from '@wawjs/ngx-ace';
9
- import { FormService } from '@wawjs/ngx-form';
10
- import { FormBridgeData } from '../form-bridge.interface';
11
-
12
- interface Interface {}
13
-
14
- const DEFAULT_ACE_CONFIG: AceConfigInterface = {
15
- // keep empty if you don’t want global defaults
16
- };
17
-
18
- @Component({
19
- templateUrl: './ace.component.html',
20
- styleUrl: './ace.component.scss',
21
- imports: [AceComponent],
22
- })
23
- export class AceFormComponent implements OnInit {
24
- private readonly _form = inject(FormService);
25
-
26
- readonly templateRef =
27
- viewChild.required<TemplateRef<Interface>>('templateRef');
28
-
29
- ngOnInit(): void {
30
- this._form.addTemplateComponent<Interface>('Ace', this.templateRef());
31
- }
32
-
33
- /* ------------ value bridge (Signal Forms + legacy) ------------ */
34
-
35
- getValue(data: FormBridgeData): string {
36
- const key = (data?.key as string | null) ?? null;
37
-
38
- // Signal Forms field (preferred)
39
- if (data?.field) {
40
- try {
41
- const state = data.field();
42
- if (state?.value && typeof state.value === 'function') {
43
- return (state.value() as string) ?? '';
44
- }
45
- } catch {
46
- // fall through
47
- }
48
- }
49
-
50
- // Model signal
51
- if (data?.model && typeof data.model === 'function' && key) {
52
- const current = data.model() as Record<string, unknown>;
53
- return (current?.[key] as string) ?? '';
54
- }
55
-
56
- // Legacy submission object
57
- if (!key || !data?.submition) return '';
58
- return (data.submition[key] as string) ?? '';
59
- }
60
-
61
- onValueChange(data: FormBridgeData, value: string): void {
62
- const key = (data?.key as string | null) ?? null;
63
-
64
- // 1) Signal Forms field
65
- if (data?.field) {
66
- try {
67
- const state = data.field();
68
- if (state?.value?.set) state.value.set(value);
69
- } catch {
70
- // ignore and fall through
71
- }
72
- }
73
- // 2) Model signal
74
- else if (
75
- data?.model &&
76
- typeof data.model.update === 'function' &&
77
- key
78
- ) {
79
- data.model.update((current: Record<string, unknown>) => ({
80
- ...current,
81
- [key]: value,
82
- }));
83
- }
84
- // 3) Legacy submission object
85
- else if (data?.submition && key) {
86
- data.submition[key] = value;
87
- }
88
-
89
- if (typeof data?.wChange === 'function') data.wChange();
90
- }
91
-
92
- /* ------------ config / props helpers ------------ */
93
-
94
- getConfig(data: FormBridgeData): AceConfigInterface {
95
- const props = (data?.props ?? {}) as Record<string, unknown>;
96
- const config: AceConfigInterface = { ...DEFAULT_ACE_CONFIG };
97
-
98
- const toNumber = (v: unknown): number | undefined => {
99
- if (v === null || v === undefined || v === '') return undefined;
100
- const n = Number(v);
101
- return Number.isNaN(n) ? undefined : n;
102
- };
103
-
104
- // Layout
105
- const minLines = toNumber(props['minLines']);
106
- const maxLines = toNumber(props['maxLines']);
107
- const tabSize = toNumber(props['tabSize']);
108
-
109
- if (
110
- props['fontSize'] !== undefined &&
111
- props['fontSize'] !== null &&
112
- props['fontSize'] !== ''
113
- ) {
114
- config.fontSize = String(props['fontSize']);
115
- }
116
- if (minLines !== undefined) config.minLines = minLines;
117
- if (maxLines !== undefined) config.maxLines = maxLines;
118
- if (tabSize !== undefined) config.tabSize = tabSize;
119
-
120
- // Behavior toggles
121
- if (typeof props['useSoftTabs'] === 'boolean')
122
- config.useSoftTabs = props['useSoftTabs'];
123
- if (typeof props['wrap'] === 'boolean') config.wrap = props['wrap'];
124
- if (typeof props['showLineNumbers'] === 'boolean')
125
- config.showLineNumbers = props['showLineNumbers'];
126
- if (typeof props['showGutter'] === 'boolean')
127
- config.showGutter = props['showGutter'];
128
- if (typeof props['highlightActiveLine'] === 'boolean')
129
- config.highlightActiveLine = props['highlightActiveLine'];
130
- if (typeof props['showPrintMargin'] === 'boolean')
131
- config.showPrintMargin = props['showPrintMargin'];
132
- if (typeof props['readOnly'] === 'boolean')
133
- config.readOnly = props['readOnly'];
134
- if (typeof props['useWorker'] === 'boolean')
135
- config.useWorker = props['useWorker'];
136
-
137
- // Local config object from props
138
- const localConfig = props['config'];
139
- if (
140
- localConfig &&
141
- typeof localConfig === 'object' &&
142
- !Array.isArray(localConfig)
143
- ) {
144
- Object.assign(config, localConfig as Partial<AceConfigInterface>);
145
- }
146
-
147
- // Per-field config (code-level override)
148
- const fieldConfig = data?.field?.['Config'];
149
- if (
150
- fieldConfig &&
151
- typeof fieldConfig === 'object' &&
152
- !Array.isArray(fieldConfig)
153
- ) {
154
- Object.assign(config, fieldConfig as Partial<AceConfigInterface>);
155
- }
156
-
157
- // Extra config JSON string
158
- const configJson = props['configJson'];
159
- if (typeof configJson === 'string' && configJson.trim()) {
160
- try {
161
- const json: unknown = JSON.parse(configJson);
162
- if (json && typeof json === 'object' && !Array.isArray(json)) {
163
- Object.assign(config, json as Partial<AceConfigInterface>);
164
- }
165
- } catch {
166
- // invalid JSON -> ignore
167
- }
168
- }
169
-
170
- return config;
171
- }
172
-
173
- getMode(data: FormBridgeData): string {
174
- const propsMode = data?.props?.['mode'];
175
- const fieldMode = data?.field?.['Mode'];
176
-
177
- if (propsMode) return String(propsMode);
178
- if (fieldMode) return String(fieldMode);
179
-
180
- return 'text';
181
- }
182
-
183
- getTheme(data: FormBridgeData): string {
184
- const propsTheme = data?.props?.['theme'];
185
- const fieldTheme = data?.field?.['Theme'];
186
-
187
- if (propsTheme) return String(propsTheme);
188
- if (fieldTheme) return String(fieldTheme);
189
-
190
- return 'github';
191
- }
192
-
193
- isDisabled(data: FormBridgeData): boolean {
194
- return !!(
195
- data?.props?.['disabled'] ||
196
- data?.component?.disabled ||
197
- data?.field?.['Disabled']
198
- );
199
- }
200
-
201
- getUseAceClass(data: FormBridgeData): boolean {
202
- const prop = data?.props?.['useAceClass'];
203
- if (typeof prop === 'boolean') return prop;
204
-
205
- const field = data?.field?.['UseAceClass'];
206
- if (typeof field === 'boolean') return field;
207
-
208
- return true;
209
- }
210
- }
1
+ import {
2
+ Component,
3
+ OnInit,
4
+ TemplateRef,
5
+ inject,
6
+ viewChild,
7
+ } from '@angular/core';
8
+ import { AceComponent, AceConfigInterface } from '@wawjs/ngx-ace';
9
+ import { FormService } from '@wawjs/ngx-form';
10
+ import { FormBridgeData } from '../form-bridge.interface';
11
+
12
+ interface Interface {}
13
+
14
+ const DEFAULT_ACE_CONFIG: AceConfigInterface = {
15
+ // keep empty if you don’t want global defaults
16
+ };
17
+
18
+ @Component({
19
+ templateUrl: './ace.component.html',
20
+ styleUrl: './ace.component.scss',
21
+ imports: [AceComponent],
22
+ })
23
+ export class AceFormComponent implements OnInit {
24
+ private readonly _form = inject(FormService);
25
+
26
+ readonly templateRef =
27
+ viewChild.required<TemplateRef<Interface>>('templateRef');
28
+
29
+ ngOnInit(): void {
30
+ this._form.addTemplateComponent<Interface>('Ace', this.templateRef());
31
+ }
32
+
33
+ /* ------------ value bridge (Signal Forms + legacy) ------------ */
34
+
35
+ getValue(data: FormBridgeData): string {
36
+ const key = (data?.key as string | null) ?? null;
37
+
38
+ // Signal Forms field (preferred)
39
+ if (data?.field) {
40
+ try {
41
+ const state = data.field();
42
+ if (state?.value && typeof state.value === 'function') {
43
+ return (state.value() as string) ?? '';
44
+ }
45
+ } catch {
46
+ // fall through
47
+ }
48
+ }
49
+
50
+ // Model signal
51
+ if (data?.model && typeof data.model === 'function' && key) {
52
+ const current = data.model() as Record<string, unknown>;
53
+ return (current?.[key] as string) ?? '';
54
+ }
55
+
56
+ // Legacy submission object
57
+ if (!key || !data?.submition) return '';
58
+ return (data.submition[key] as string) ?? '';
59
+ }
60
+
61
+ onValueChange(data: FormBridgeData, value: string): void {
62
+ const key = (data?.key as string | null) ?? null;
63
+
64
+ // 1) Signal Forms field
65
+ if (data?.field) {
66
+ try {
67
+ const state = data.field();
68
+ if (state?.value?.set) state.value.set(value);
69
+ } catch {
70
+ // ignore and fall through
71
+ }
72
+ }
73
+ // 2) Model signal
74
+ else if (
75
+ data?.model &&
76
+ typeof data.model.update === 'function' &&
77
+ key
78
+ ) {
79
+ data.model.update((current: Record<string, unknown>) => ({
80
+ ...current,
81
+ [key]: value,
82
+ }));
83
+ }
84
+ // 3) Legacy submission object
85
+ else if (data?.submition && key) {
86
+ data.submition[key] = value;
87
+ }
88
+
89
+ if (typeof data?.wChange === 'function') data.wChange();
90
+ }
91
+
92
+ /* ------------ config / props helpers ------------ */
93
+
94
+ getConfig(data: FormBridgeData): AceConfigInterface {
95
+ const props = (data?.props ?? {}) as Record<string, unknown>;
96
+ const config: AceConfigInterface = { ...DEFAULT_ACE_CONFIG };
97
+
98
+ const toNumber = (v: unknown): number | undefined => {
99
+ if (v === null || v === undefined || v === '') return undefined;
100
+ const n = Number(v);
101
+ return Number.isNaN(n) ? undefined : n;
102
+ };
103
+
104
+ // Layout
105
+ const minLines = toNumber(props['minLines']);
106
+ const maxLines = toNumber(props['maxLines']);
107
+ const tabSize = toNumber(props['tabSize']);
108
+
109
+ if (
110
+ props['fontSize'] !== undefined &&
111
+ props['fontSize'] !== null &&
112
+ props['fontSize'] !== ''
113
+ ) {
114
+ config.fontSize = String(props['fontSize']);
115
+ }
116
+ if (minLines !== undefined) config.minLines = minLines;
117
+ if (maxLines !== undefined) config.maxLines = maxLines;
118
+ if (tabSize !== undefined) config.tabSize = tabSize;
119
+
120
+ // Behavior toggles
121
+ if (typeof props['useSoftTabs'] === 'boolean')
122
+ config.useSoftTabs = props['useSoftTabs'];
123
+ if (typeof props['wrap'] === 'boolean') config.wrap = props['wrap'];
124
+ if (typeof props['showLineNumbers'] === 'boolean')
125
+ config.showLineNumbers = props['showLineNumbers'];
126
+ if (typeof props['showGutter'] === 'boolean')
127
+ config.showGutter = props['showGutter'];
128
+ if (typeof props['highlightActiveLine'] === 'boolean')
129
+ config.highlightActiveLine = props['highlightActiveLine'];
130
+ if (typeof props['showPrintMargin'] === 'boolean')
131
+ config.showPrintMargin = props['showPrintMargin'];
132
+ if (typeof props['readOnly'] === 'boolean')
133
+ config.readOnly = props['readOnly'];
134
+ if (typeof props['useWorker'] === 'boolean')
135
+ config.useWorker = props['useWorker'];
136
+
137
+ // Local config object from props
138
+ const localConfig = props['config'];
139
+ if (
140
+ localConfig &&
141
+ typeof localConfig === 'object' &&
142
+ !Array.isArray(localConfig)
143
+ ) {
144
+ Object.assign(config, localConfig as Partial<AceConfigInterface>);
145
+ }
146
+
147
+ // Per-field config (code-level override)
148
+ const fieldConfig = data?.field?.['Config'];
149
+ if (
150
+ fieldConfig &&
151
+ typeof fieldConfig === 'object' &&
152
+ !Array.isArray(fieldConfig)
153
+ ) {
154
+ Object.assign(config, fieldConfig as Partial<AceConfigInterface>);
155
+ }
156
+
157
+ // Extra config JSON string
158
+ const configJson = props['configJson'];
159
+ if (typeof configJson === 'string' && configJson.trim()) {
160
+ try {
161
+ const json: unknown = JSON.parse(configJson);
162
+ if (json && typeof json === 'object' && !Array.isArray(json)) {
163
+ Object.assign(config, json as Partial<AceConfigInterface>);
164
+ }
165
+ } catch {
166
+ // invalid JSON -> ignore
167
+ }
168
+ }
169
+
170
+ return config;
171
+ }
172
+
173
+ getMode(data: FormBridgeData): string {
174
+ const propsMode = data?.props?.['mode'];
175
+ const fieldMode = data?.field?.['Mode'];
176
+
177
+ if (propsMode) return String(propsMode);
178
+ if (fieldMode) return String(fieldMode);
179
+
180
+ return 'text';
181
+ }
182
+
183
+ getTheme(data: FormBridgeData): string {
184
+ const propsTheme = data?.props?.['theme'];
185
+ const fieldTheme = data?.field?.['Theme'];
186
+
187
+ if (propsTheme) return String(propsTheme);
188
+ if (fieldTheme) return String(fieldTheme);
189
+
190
+ return 'github';
191
+ }
192
+
193
+ isDisabled(data: FormBridgeData): boolean {
194
+ return !!(
195
+ data?.props?.['disabled'] ||
196
+ data?.component?.disabled ||
197
+ data?.field?.['Disabled']
198
+ );
199
+ }
200
+
201
+ getUseAceClass(data: FormBridgeData): boolean {
202
+ const prop = data?.props?.['useAceClass'];
203
+ if (typeof prop === 'boolean') return prop;
204
+
205
+ const field = data?.field?.['UseAceClass'];
206
+ if (typeof field === 'boolean') return field;
207
+
208
+ return true;
209
+ }
210
+ }
@@ -1,31 +1,31 @@
1
- import {
2
- Component,
3
- OnInit,
4
- TemplateRef,
5
- inject,
6
- viewChild,
7
- } from '@angular/core';
8
- import { ButtonComponent, buttonDefaults } from '@wawjs/ngx-ui';
9
- import { FormService } from '@wawjs/ngx-form';
10
-
11
- interface ButtonTemplateContext {}
12
-
13
- @Component({
14
- imports: [ButtonComponent],
15
- templateUrl: './button.component.html',
16
- })
17
- export class ButtonFormComponent implements OnInit {
18
- private readonly _formService = inject(FormService);
19
-
20
- readonly templateRef =
21
- viewChild.required<TemplateRef<ButtonTemplateContext>>('templateRef');
22
-
23
- readonly buttonDefaults = buttonDefaults;
24
-
25
- ngOnInit(): void {
26
- this._formService.addTemplateComponent<ButtonTemplateContext>(
27
- 'Button',
28
- this.templateRef(),
29
- );
30
- }
31
- }
1
+ import {
2
+ Component,
3
+ OnInit,
4
+ TemplateRef,
5
+ inject,
6
+ viewChild,
7
+ } from '@angular/core';
8
+ import { ButtonComponent, buttonDefaults } from '@wawjs/ngx-ui';
9
+ import { FormService } from '@wawjs/ngx-form';
10
+
11
+ interface ButtonTemplateContext {}
12
+
13
+ @Component({
14
+ imports: [ButtonComponent],
15
+ templateUrl: './button.component.html',
16
+ })
17
+ export class ButtonFormComponent implements OnInit {
18
+ private readonly _formService = inject(FormService);
19
+
20
+ readonly templateRef =
21
+ viewChild.required<TemplateRef<ButtonTemplateContext>>('templateRef');
22
+
23
+ readonly buttonDefaults = buttonDefaults;
24
+
25
+ ngOnInit(): void {
26
+ this._formService.addTemplateComponent<ButtonTemplateContext>(
27
+ 'Button',
28
+ this.templateRef(),
29
+ );
30
+ }
31
+ }
@@ -1,91 +1,91 @@
1
- import {
2
- Component,
3
- OnInit,
4
- TemplateRef,
5
- inject,
6
- viewChild,
7
- } from '@angular/core';
8
- import { FileComponent, fileDefaults } from '../../feature/file';
9
- import { FormService } from '@wawjs/ngx-form';
10
- import { FormBridgeData } from '../form-bridge.interface';
11
-
12
- interface FileTemplateContext {}
13
-
14
- @Component({
15
- imports: [FileComponent],
16
- templateUrl: './file.component.html',
17
- })
18
- export class FileFormComponent implements OnInit {
19
- private readonly _formService = inject(FormService);
20
-
21
- readonly templateRef =
22
- viewChild.required<TemplateRef<FileTemplateContext>>('templateRef');
23
-
24
- readonly fileDefaults = fileDefaults;
25
-
26
- ngOnInit(): void {
27
- this._formService.addTemplateComponent<FileTemplateContext>(
28
- 'File',
29
- this.templateRef(),
30
- );
31
- }
32
-
33
- /* ------------ value bridge (Signal Forms + model + legacy) ------------ */
34
-
35
- getValue(data: FormBridgeData): any {
36
- const key = (data?.key as string | null) ?? null;
37
-
38
- // 1) Signal Forms field (preferred)
39
- if (data?.field) {
40
- try {
41
- const state = data.field();
42
- if (state?.value && typeof state.value === 'function') {
43
- return state.value();
44
- }
45
- } catch {
46
- // fall through
47
- }
48
- }
49
-
50
- // 2) Model signal
51
- if (data?.model && typeof data.model === 'function' && key) {
52
- const current = data.model() as Record<string, unknown>;
53
- return current?.[key];
54
- }
55
-
56
- // 3) Legacy submission object
57
- if (!key || !data?.submition) return null;
58
- return data.submition[key] ?? null;
59
- }
60
-
61
- onValueChange(data: FormBridgeData, value: unknown): void {
62
- const key = (data?.key as string | null) ?? null;
63
-
64
- // 1) Signal Forms field
65
- if (data?.field) {
66
- try {
67
- const state = data.field();
68
- if (state?.value?.set) state.value.set(value);
69
- } catch {
70
- // ignore and fall through
71
- }
72
- }
73
- // 2) Model signal
74
- else if (
75
- data?.model &&
76
- typeof data.model.update === 'function' &&
77
- key
78
- ) {
79
- data.model.update((current: Record<string, unknown>) => ({
80
- ...current,
81
- [key]: value,
82
- }));
83
- }
84
- // 3) Legacy submission object
85
- else if (data?.submition && key) {
86
- data.submition[key] = value;
87
- }
88
-
89
- if (typeof data?.wChange === 'function') data.wChange();
90
- }
91
- }
1
+ import {
2
+ Component,
3
+ OnInit,
4
+ TemplateRef,
5
+ inject,
6
+ viewChild,
7
+ } from '@angular/core';
8
+ import { FileComponent, fileDefaults } from '../../feature/file';
9
+ import { FormService } from '@wawjs/ngx-form';
10
+ import { FormBridgeData } from '../form-bridge.interface';
11
+
12
+ interface FileTemplateContext {}
13
+
14
+ @Component({
15
+ imports: [FileComponent],
16
+ templateUrl: './file.component.html',
17
+ })
18
+ export class FileFormComponent implements OnInit {
19
+ private readonly _formService = inject(FormService);
20
+
21
+ readonly templateRef =
22
+ viewChild.required<TemplateRef<FileTemplateContext>>('templateRef');
23
+
24
+ readonly fileDefaults = fileDefaults;
25
+
26
+ ngOnInit(): void {
27
+ this._formService.addTemplateComponent<FileTemplateContext>(
28
+ 'File',
29
+ this.templateRef(),
30
+ );
31
+ }
32
+
33
+ /* ------------ value bridge (Signal Forms + model + legacy) ------------ */
34
+
35
+ getValue(data: FormBridgeData): any {
36
+ const key = (data?.key as string | null) ?? null;
37
+
38
+ // 1) Signal Forms field (preferred)
39
+ if (data?.field) {
40
+ try {
41
+ const state = data.field();
42
+ if (state?.value && typeof state.value === 'function') {
43
+ return state.value();
44
+ }
45
+ } catch {
46
+ // fall through
47
+ }
48
+ }
49
+
50
+ // 2) Model signal
51
+ if (data?.model && typeof data.model === 'function' && key) {
52
+ const current = data.model() as Record<string, unknown>;
53
+ return current?.[key];
54
+ }
55
+
56
+ // 3) Legacy submission object
57
+ if (!key || !data?.submition) return null;
58
+ return data.submition[key] ?? null;
59
+ }
60
+
61
+ onValueChange(data: FormBridgeData, value: unknown): void {
62
+ const key = (data?.key as string | null) ?? null;
63
+
64
+ // 1) Signal Forms field
65
+ if (data?.field) {
66
+ try {
67
+ const state = data.field();
68
+ if (state?.value?.set) state.value.set(value);
69
+ } catch {
70
+ // ignore and fall through
71
+ }
72
+ }
73
+ // 2) Model signal
74
+ else if (
75
+ data?.model &&
76
+ typeof data.model.update === 'function' &&
77
+ key
78
+ ) {
79
+ data.model.update((current: Record<string, unknown>) => ({
80
+ ...current,
81
+ [key]: value,
82
+ }));
83
+ }
84
+ // 3) Legacy submission object
85
+ else if (data?.submition && key) {
86
+ data.submition[key] = value;
87
+ }
88
+
89
+ if (typeof data?.wChange === 'function') data.wChange();
90
+ }
91
+ }