@magmonium/one 0.4.29 → 0.4.31

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 (78) hide show
  1. package/assets/docs/en/app-release.md +0 -11
  2. package/assets/i18n/en.json +2 -0
  3. package/fesm2022/magmonium-one-attribute-value-CLBOZcme.mjs +255 -0
  4. package/fesm2022/magmonium-one-attribute-value-CLBOZcme.mjs.map +1 -0
  5. package/fesm2022/magmonium-one-base-checkbox-D7NYJdU3.mjs +77 -0
  6. package/fesm2022/magmonium-one-base-checkbox-D7NYJdU3.mjs.map +1 -0
  7. package/fesm2022/magmonium-one-base-dropdown-CEDsqaPz.mjs +604 -0
  8. package/fesm2022/magmonium-one-base-dropdown-CEDsqaPz.mjs.map +1 -0
  9. package/fesm2022/magmonium-one-base-input-BOaD-WIi.mjs +183 -0
  10. package/fesm2022/magmonium-one-base-input-BOaD-WIi.mjs.map +1 -0
  11. package/fesm2022/magmonium-one-base-text-D6p6_vsb.mjs +94 -0
  12. package/fesm2022/magmonium-one-base-text-D6p6_vsb.mjs.map +1 -0
  13. package/fesm2022/magmonium-one-button-rVNnp6G8.mjs +1281 -0
  14. package/fesm2022/magmonium-one-button-rVNnp6G8.mjs.map +1 -0
  15. package/fesm2022/magmonium-one-checkbox-rj4XHxb3.mjs +365 -0
  16. package/fesm2022/magmonium-one-checkbox-rj4XHxb3.mjs.map +1 -0
  17. package/fesm2022/magmonium-one-color-utl-CirPzUFk.mjs +449 -0
  18. package/fesm2022/magmonium-one-color-utl-CirPzUFk.mjs.map +1 -0
  19. package/fesm2022/magmonium-one-directives-DOBENX_K.mjs +1285 -0
  20. package/fesm2022/magmonium-one-directives-DOBENX_K.mjs.map +1 -0
  21. package/fesm2022/magmonium-one-file.service-Bo06pU3_.mjs +65 -0
  22. package/fesm2022/magmonium-one-file.service-Bo06pU3_.mjs.map +1 -0
  23. package/fesm2022/magmonium-one-group-Cue4x6tD.mjs +428 -0
  24. package/fesm2022/magmonium-one-group-Cue4x6tD.mjs.map +1 -0
  25. package/fesm2022/magmonium-one-header-DPVnaEOV.mjs +380 -0
  26. package/fesm2022/magmonium-one-header-DPVnaEOV.mjs.map +1 -0
  27. package/fesm2022/magmonium-one-icon-Dso-9RMN.mjs +833 -0
  28. package/fesm2022/magmonium-one-icon-Dso-9RMN.mjs.map +1 -0
  29. package/fesm2022/magmonium-one-image-editor-C7AtzEf6.mjs +438 -0
  30. package/fesm2022/magmonium-one-image-editor-C7AtzEf6.mjs.map +1 -0
  31. package/fesm2022/magmonium-one-image-frame-BTSaUSAi.mjs +116 -0
  32. package/fesm2022/magmonium-one-image-frame-BTSaUSAi.mjs.map +1 -0
  33. package/fesm2022/magmonium-one-input-DqHPorA1.mjs +39 -0
  34. package/fesm2022/magmonium-one-input-DqHPorA1.mjs.map +1 -0
  35. package/fesm2022/magmonium-one-label-B30Q4Vut.mjs +574 -0
  36. package/fesm2022/magmonium-one-label-B30Q4Vut.mjs.map +1 -0
  37. package/fesm2022/magmonium-one-m-ref-Dt0DCm8X.mjs +147 -0
  38. package/fesm2022/magmonium-one-m-ref-Dt0DCm8X.mjs.map +1 -0
  39. package/fesm2022/magmonium-one-menu-BBOnOK4M.mjs +887 -0
  40. package/fesm2022/magmonium-one-menu-BBOnOK4M.mjs.map +1 -0
  41. package/fesm2022/magmonium-one-multi-range-DCOwngql.mjs +458 -0
  42. package/fesm2022/magmonium-one-multi-range-DCOwngql.mjs.map +1 -0
  43. package/fesm2022/magmonium-one-options-asset-D8Gg1yNl.mjs +97 -0
  44. package/fesm2022/magmonium-one-options-asset-D8Gg1yNl.mjs.map +1 -0
  45. package/fesm2022/magmonium-one-otp-DLF7Pq94.mjs +261 -0
  46. package/fesm2022/magmonium-one-otp-DLF7Pq94.mjs.map +1 -0
  47. package/fesm2022/magmonium-one-password-BSOU4RI0.mjs +217 -0
  48. package/fesm2022/magmonium-one-password-BSOU4RI0.mjs.map +1 -0
  49. package/fesm2022/magmonium-one-radio-CYnWLXPZ.mjs +111 -0
  50. package/fesm2022/magmonium-one-radio-CYnWLXPZ.mjs.map +1 -0
  51. package/fesm2022/magmonium-one-range-CmmZAr57.mjs +216 -0
  52. package/fesm2022/magmonium-one-range-CmmZAr57.mjs.map +1 -0
  53. package/fesm2022/magmonium-one-rolldown-runtime-DpJrqANO.mjs +11 -0
  54. package/fesm2022/magmonium-one-selector-DDnBYNLr.mjs +1065 -0
  55. package/fesm2022/magmonium-one-selector-DDnBYNLr.mjs.map +1 -0
  56. package/fesm2022/magmonium-one-size-converter-B-UubQQ0.mjs +1057 -0
  57. package/fesm2022/magmonium-one-size-converter-B-UubQQ0.mjs.map +1 -0
  58. package/fesm2022/magmonium-one-text-FXb-RyBh.mjs +406 -0
  59. package/fesm2022/magmonium-one-text-FXb-RyBh.mjs.map +1 -0
  60. package/fesm2022/magmonium-one-text-output-D2XQWyL0.mjs +296 -0
  61. package/fesm2022/magmonium-one-text-output-D2XQWyL0.mjs.map +1 -0
  62. package/fesm2022/magmonium-one-theme-a7GlFbzE.mjs +1 -0
  63. package/fesm2022/magmonium-one-toggle-C0eTrtkt.mjs +231 -0
  64. package/fesm2022/magmonium-one-toggle-C0eTrtkt.mjs.map +1 -0
  65. package/fesm2022/magmonium-one.mjs +49231 -2
  66. package/fesm2022/magmonium-one.mjs.map +1 -1
  67. package/package.json +8 -8
  68. package/types/magmonium-one.d.ts +13801 -9510
  69. package/fesm2022/magmonium-one-image-editor-DYbS7fRP.mjs +0 -290
  70. package/fesm2022/magmonium-one-image-editor-DYbS7fRP.mjs.map +0 -1
  71. package/fesm2022/magmonium-one-magmonium-one-jBGfJvgl.mjs +0 -41576
  72. package/fesm2022/magmonium-one-magmonium-one-jBGfJvgl.mjs.map +0 -1
  73. package/fesm2022/magmonium-one-otp-DY1B1djA.mjs +0 -201
  74. package/fesm2022/magmonium-one-otp-DY1B1djA.mjs.map +0 -1
  75. package/fesm2022/magmonium-one-password-CzMwV84X.mjs +0 -105
  76. package/fesm2022/magmonium-one-password-CzMwV84X.mjs.map +0 -1
  77. package/fesm2022/magmonium-one-toggle-EoE3fKjl.mjs +0 -62
  78. package/fesm2022/magmonium-one-toggle-EoE3fKjl.mjs.map +0 -1
@@ -0,0 +1,183 @@
1
+ import { i as resolveSize } from "./magmonium-one-size-converter-B-UubQQ0.mjs";
2
+ import * as i0 from "@angular/core";
3
+ import { Directive, ElementRef, computed, effect, inject, input, model } from "@angular/core";
4
+ var BaseInputComponent = class BaseInputComponent {
5
+ focused = input(false, ...ngDevMode ? [{ debugName: "focused" }] : /* istanbul ignore next */ []);
6
+ errors = input([], ...ngDevMode ? [{ debugName: "errors" }] : /* istanbul ignore next */ []);
7
+ config = input(...ngDevMode ? [void 0, { debugName: "config" }] : /* istanbul ignore next */ []);
8
+ required = input(false, ...ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []);
9
+ disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
10
+ invalid = input(false, ...ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []);
11
+ touched = model(false, ...ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []);
12
+ readonly = input(false, ...ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []);
13
+ elementRef = inject(ElementRef);
14
+ applyConfigSize = effect(() => {
15
+ const size = this.config()?.size;
16
+ const el = this.elementRef.nativeElement;
17
+ if (size) {
18
+ const resolved = resolveSize(size);
19
+ el.style.setProperty("--input-size", resolved);
20
+ el.style.fontSize = resolved;
21
+ } else {
22
+ el.style.removeProperty("--input-size");
23
+ el.style.removeProperty("font-size");
24
+ }
25
+ }, ...ngDevMode ? [{ debugName: "applyConfigSize" }] : /* istanbul ignore next */ []);
26
+ showErrors = computed(() => (this.touched() === true || this.touched() + "" === "true") && (this.invalid() === true || this.invalid() + "" === "true"), ...ngDevMode ? [{ debugName: "showErrors" }] : /* istanbul ignore next */ []);
27
+ static ɵfac = i0.ɵɵngDeclareFactory({
28
+ minVersion: "12.0.0",
29
+ version: "22.2.1",
30
+ ngImport: i0,
31
+ type: BaseInputComponent,
32
+ deps: [],
33
+ target: i0.ɵɵFactoryTarget.Directive
34
+ });
35
+ static ɵdir = i0.ɵɵngDeclareDirective({
36
+ minVersion: "17.1.0",
37
+ version: "22.2.1",
38
+ type: BaseInputComponent,
39
+ isStandalone: true,
40
+ inputs: {
41
+ focused: {
42
+ classPropertyName: "focused",
43
+ publicName: "focused",
44
+ isSignal: true,
45
+ isRequired: false,
46
+ transformFunction: null
47
+ },
48
+ errors: {
49
+ classPropertyName: "errors",
50
+ publicName: "errors",
51
+ isSignal: true,
52
+ isRequired: false,
53
+ transformFunction: null
54
+ },
55
+ config: {
56
+ classPropertyName: "config",
57
+ publicName: "config",
58
+ isSignal: true,
59
+ isRequired: false,
60
+ transformFunction: null
61
+ },
62
+ required: {
63
+ classPropertyName: "required",
64
+ publicName: "required",
65
+ isSignal: true,
66
+ isRequired: false,
67
+ transformFunction: null
68
+ },
69
+ disabled: {
70
+ classPropertyName: "disabled",
71
+ publicName: "disabled",
72
+ isSignal: true,
73
+ isRequired: false,
74
+ transformFunction: null
75
+ },
76
+ invalid: {
77
+ classPropertyName: "invalid",
78
+ publicName: "invalid",
79
+ isSignal: true,
80
+ isRequired: false,
81
+ transformFunction: null
82
+ },
83
+ touched: {
84
+ classPropertyName: "touched",
85
+ publicName: "touched",
86
+ isSignal: true,
87
+ isRequired: false,
88
+ transformFunction: null
89
+ },
90
+ readonly: {
91
+ classPropertyName: "readonly",
92
+ publicName: "readonly",
93
+ isSignal: true,
94
+ isRequired: false,
95
+ transformFunction: null
96
+ }
97
+ },
98
+ outputs: { touched: "touchedChange" },
99
+ ngImport: i0
100
+ });
101
+ };
102
+ i0.ɵɵngDeclareClassMetadata({
103
+ minVersion: "12.0.0",
104
+ version: "22.2.1",
105
+ ngImport: i0,
106
+ type: BaseInputComponent,
107
+ decorators: [{
108
+ type: Directive,
109
+ args: [{}]
110
+ }],
111
+ propDecorators: {
112
+ focused: [{
113
+ type: i0.Input,
114
+ args: [{
115
+ isSignal: true,
116
+ alias: "focused",
117
+ required: false
118
+ }]
119
+ }],
120
+ errors: [{
121
+ type: i0.Input,
122
+ args: [{
123
+ isSignal: true,
124
+ alias: "errors",
125
+ required: false
126
+ }]
127
+ }],
128
+ config: [{
129
+ type: i0.Input,
130
+ args: [{
131
+ isSignal: true,
132
+ alias: "config",
133
+ required: false
134
+ }]
135
+ }],
136
+ required: [{
137
+ type: i0.Input,
138
+ args: [{
139
+ isSignal: true,
140
+ alias: "required",
141
+ required: false
142
+ }]
143
+ }],
144
+ disabled: [{
145
+ type: i0.Input,
146
+ args: [{
147
+ isSignal: true,
148
+ alias: "disabled",
149
+ required: false
150
+ }]
151
+ }],
152
+ invalid: [{
153
+ type: i0.Input,
154
+ args: [{
155
+ isSignal: true,
156
+ alias: "invalid",
157
+ required: false
158
+ }]
159
+ }],
160
+ touched: [{
161
+ type: i0.Input,
162
+ args: [{
163
+ isSignal: true,
164
+ alias: "touched",
165
+ required: false
166
+ }]
167
+ }, {
168
+ type: i0.Output,
169
+ args: ["touchedChange"]
170
+ }],
171
+ readonly: [{
172
+ type: i0.Input,
173
+ args: [{
174
+ isSignal: true,
175
+ alias: "readonly",
176
+ required: false
177
+ }]
178
+ }]
179
+ }
180
+ });
181
+ export { BaseInputComponent as t };
182
+
183
+ //# sourceMappingURL=magmonium-one-base-input-BOaD-WIi.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"magmonium-one-base-input-BOaD-WIi.mjs","names":[],"sources":["../../../../libs/one/src/lib/shared/ui/input/lib/base-input.ts"],"sourcesContent":["import {\n Directive,\n ElementRef,\n effect,\n inject,\n input,\n model,\n computed,\n InputSignal,\n ModelSignal,\n} from '@angular/core';\nimport { ValidationError, WithOptionalFieldTree } from '@angular/forms/signals';\nimport { Size } from '../../../enum/scaling/size';\nimport { Input } from '../model/input';\nimport { resolveSize } from '../../../functions/size/size-converter';\n\n@Directive({})\nexport class BaseInputComponent<T extends Input = Input> {\n public focused: InputSignal<boolean> = input<boolean>(false);\n public errors: InputSignal<readonly WithOptionalFieldTree<ValidationError>[]> =\n input<readonly WithOptionalFieldTree<ValidationError>[]>([]);\n public config: InputSignal<Partial<T> | undefined> = input<\n Partial<T> | undefined\n >();\n public required: InputSignal<boolean> = input<boolean>(false);\n public disabled: InputSignal<boolean> = input<boolean>(false);\n public invalid: InputSignal<boolean> = input<boolean>(false);\n public touched: ModelSignal<boolean> = model<boolean>(false);\n public readonly: InputSignal<boolean> = input<boolean>(false);\n\n protected readonly elementRef = inject(ElementRef);\n\n // SectionFormItem stamps Size onto config; inputs scale via CSS var\n // so size changes update without destroying the field. Uses CSS var because\n // host may have display: contents, but CSS vars still inherit to children.\n private readonly applyConfigSize = effect(() => {\n const configWithSize = this.config() as Partial<Input> & { size?: Size };\n const size = configWithSize?.size;\n const el = this.elementRef.nativeElement as HTMLElement;\n if (size) {\n const resolved = resolveSize(size);\n el.style.setProperty('--input-size', resolved);\n // Some input variants declare their own font-size on the rendered\n // control. Keep the actual input text synchronized with the size that\n // drives its geometry instead of relying only on inherited variables.\n el.style.fontSize = resolved;\n } else {\n el.style.removeProperty('--input-size');\n el.style.removeProperty('font-size');\n }\n });\n\n public showErrors = computed(() => \n (this.touched() === true || this.touched() + '' === 'true') && \n (this.invalid() === true || this.invalid() + '' === 'true')\n );\n}\n"],"mappings":";;;AAiBA,IAAa,qBAAb,MAAa,mBAAkB;CACtB,UAAgC,MAAe,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CACrD,SACL,MAAyD,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CACvD,SAA8C,MAElD,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CACI,WAAiC,MAAe,OAAM,GAAA,YAAA,CAAA,EAAA,WAA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AAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,QAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,QAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,SAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,SAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,SAAA,EAAA,SAAA,gBAAA;EAAA,UAAA;CAAA,CAAA;;AAAlB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAkB,YAAA,CAAA;EAD9B,MAAA;EAAU,MAAA,CAAA,CAAA,CAAE"}
@@ -0,0 +1,94 @@
1
+ import { t as BaseInputComponent } from "./magmonium-one-base-input-BOaD-WIi.mjs";
2
+ import * as i0 from "@angular/core";
3
+ import { DOCUMENT, Directive, afterRenderEffect, computed, inject, model, signal, viewChild } from "@angular/core";
4
+ var BaseTextInputComponent = class BaseTextInputComponent extends BaseInputComponent {
5
+ value = model();
6
+ inputElement = viewChild("inputElement", ...ngDevMode ? [{ debugName: "inputElement" }] : /* istanbul ignore next */ []);
7
+ document = inject(DOCUMENT);
8
+ autofocused;
9
+ constructor() {
10
+ super();
11
+ afterRenderEffect(() => {
12
+ const element = this.inputElement();
13
+ if (!this.focused() || !element) return;
14
+ const node = element.nativeElement;
15
+ if (this.autofocused === node) return;
16
+ const active = this.document.activeElement;
17
+ if (active && active !== this.document.body && active !== node) return;
18
+ this.autofocused = node;
19
+ node.focus();
20
+ });
21
+ }
22
+ isFocused = signal(false, ...ngDevMode ? [{ debugName: "isFocused" }] : /* istanbul ignore next */ []);
23
+ iconColor = computed(() => {
24
+ if (this.showErrors()) return "error";
25
+ if (this.isFocused()) return "focus";
26
+ return "border";
27
+ }, ...ngDevMode ? [{ debugName: "iconColor" }] : /* istanbul ignore next */ []);
28
+ setValue = (value) => {
29
+ this.value.set(value);
30
+ this.touched.set(true);
31
+ };
32
+ static ɵfac = i0.ɵɵngDeclareFactory({
33
+ minVersion: "12.0.0",
34
+ version: "22.2.1",
35
+ ngImport: i0,
36
+ type: BaseTextInputComponent,
37
+ deps: [],
38
+ target: i0.ɵɵFactoryTarget.Directive
39
+ });
40
+ static ɵdir = i0.ɵɵngDeclareDirective({
41
+ minVersion: "17.2.0",
42
+ version: "22.2.1",
43
+ type: BaseTextInputComponent,
44
+ isStandalone: true,
45
+ inputs: { value: {
46
+ classPropertyName: "value",
47
+ publicName: "value",
48
+ isSignal: true,
49
+ isRequired: false,
50
+ transformFunction: null
51
+ } },
52
+ outputs: { value: "valueChange" },
53
+ viewQueries: [{
54
+ propertyName: "inputElement",
55
+ first: true,
56
+ predicate: ["inputElement"],
57
+ descendants: true,
58
+ isSignal: true
59
+ }],
60
+ usesInheritance: true,
61
+ ngImport: i0
62
+ });
63
+ };
64
+ i0.ɵɵngDeclareClassMetadata({
65
+ minVersion: "12.0.0",
66
+ version: "22.2.1",
67
+ ngImport: i0,
68
+ type: BaseTextInputComponent,
69
+ decorators: [{
70
+ type: Directive,
71
+ args: [{}]
72
+ }],
73
+ ctorParameters: () => [],
74
+ propDecorators: {
75
+ value: [{
76
+ type: i0.Input,
77
+ args: [{
78
+ isSignal: true,
79
+ alias: "value",
80
+ required: false
81
+ }]
82
+ }, {
83
+ type: i0.Output,
84
+ args: ["valueChange"]
85
+ }],
86
+ inputElement: [{
87
+ type: i0.ViewChild,
88
+ args: ["inputElement", { isSignal: true }]
89
+ }]
90
+ }
91
+ });
92
+ export { BaseTextInputComponent as t };
93
+
94
+ //# sourceMappingURL=magmonium-one-base-text-D6p6_vsb.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"magmonium-one-base-text-D6p6_vsb.mjs","names":[],"sources":["../../../../libs/one/src/lib/shared/ui/input/ui/text/base-text.ts"],"sourcesContent":["import {\n afterRenderEffect,\n computed,\n Directive,\n DOCUMENT,\n ElementRef,\n inject,\n model,\n ModelSignal,\n signal,\n viewChild,\n} from '@angular/core';\nimport { FormValueControl } from '@angular/forms/signals';\nimport { Input, TextInput } from '../../model/input';\nimport { BaseInputComponent } from '../../lib/base-input';\n\n@Directive({})\nexport class BaseTextInputComponent<T extends Input = TextInput>\n extends BaseInputComponent<T>\n implements FormValueControl<string>\n{\n public value = model<string>() as ModelSignal<string>;\n\n private inputElement =\n viewChild<ElementRef<HTMLInputElement>>('inputElement');\n\n private readonly document = inject(DOCUMENT);\n\n /** The element this field has already claimed the caret for, once. */\n private autofocused: HTMLInputElement | undefined;\n\n constructor() {\n super();\n afterRenderEffect(() => {\n const element = this.inputElement();\n if (!this.focused() || !element) return;\n\n const node = element.nativeElement;\n // Once per element. A form that re-renders — an inspector rebuilt on\n // every store change — mounts a fresh input each time, and a focus per\n // mount is a focus per keystroke somewhere else on the screen.\n if (this.autofocused === node) return;\n\n // And never out of a surface the User is already working in. Same rule\n // the form makes for its own first field: a caret that has been placed\n // is theirs, not the next form's to take.\n const active = this.document.activeElement;\n if (active && active !== this.document.body && active !== node) return;\n\n this.autofocused = node;\n node.focus();\n });\n }\n\n public readonly isFocused = signal(false);\n\n // Icon tracks the wrapper's border: =input-wrapper paints $error on error,\n // the focus tint on focus, and the border color at rest.\n public readonly iconColor = computed(() => {\n if (this.showErrors()) return 'error';\n if (this.isFocused()) return 'focus';\n return 'border';\n });\n\n protected readonly setValue = (value: string) => {\n this.value.set(value);\n this.tou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