@attrx/role-morphic 0.1.0 → 0.2.0

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.
@@ -0,0 +1,884 @@
1
+ import { T as TemperatureUnit, r as ColorVariant, o as DateVariant } from './types-mbeS1e-k.js';
2
+ export { V as ValidationResult } from './types-mbeS1e-k.js';
3
+
4
+ /**
5
+ * Area Role - Validate Pillar
6
+ *
7
+ * Validação semântica de valores de área.
8
+ * Zero dependências externas - pode ser usado standalone.
9
+ *
10
+ * @example
11
+ * import { validateArea, isValidArea } from '@attrx/role-morphic/area/validate';
12
+ *
13
+ * validateArea(100); // { valid: true, errors: [] }
14
+ * validateArea(-5); // { valid: false, errors: ['Area cannot be negative'] }
15
+ * isValidArea(100); // true
16
+ */
17
+ interface ValidationResult$f {
18
+ valid: boolean;
19
+ errors: string[];
20
+ }
21
+ interface AreaValidationConfig {
22
+ min?: number;
23
+ max?: number;
24
+ integer?: boolean;
25
+ minError?: string;
26
+ maxError?: string;
27
+ }
28
+ /**
29
+ * Configuração padrão de validação para área
30
+ */
31
+ declare const AREA_VALIDATION_CONFIG: AreaValidationConfig;
32
+ /**
33
+ * Valida um valor de área
34
+ *
35
+ * @param value - Valor a ser validado
36
+ * @param config - Configuração customizada (opcional)
37
+ * @returns Resultado da validação com erros se houver
38
+ *
39
+ * @example
40
+ * validateArea(100); // { valid: true, errors: [] }
41
+ * validateArea(-5); // { valid: false, errors: ['Area cannot be negative'] }
42
+ * validateArea(150, { max: 100 }) // { valid: false, errors: ['Value must be at most 100'] }
43
+ */
44
+ declare function validateArea(value: unknown, config?: AreaValidationConfig): ValidationResult$f;
45
+ /**
46
+ * Verifica se um valor de área é válido
47
+ *
48
+ * @param value - Valor a ser validado
49
+ * @param config - Configuração customizada (opcional)
50
+ * @returns true se válido, false caso contrário
51
+ *
52
+ * @example
53
+ * isValidArea(100); // true
54
+ * isValidArea(-5); // false
55
+ */
56
+ declare function isValidArea(value: unknown, config?: AreaValidationConfig): boolean;
57
+
58
+ /**
59
+ * Length Role - Validate Pillar
60
+ *
61
+ * Validação semântica de valores de comprimento.
62
+ * Zero dependências externas - pode ser usado standalone.
63
+ *
64
+ * @example
65
+ * import { validateLength, isValidLength } from '@attrx/role-morphic/length/validate';
66
+ *
67
+ * validateLength(100); // { valid: true, errors: [] }
68
+ * validateLength(-5); // { valid: false, errors: ['Length cannot be negative'] }
69
+ * isValidLength(100); // true
70
+ */
71
+ interface ValidationResult$e {
72
+ valid: boolean;
73
+ errors: string[];
74
+ }
75
+ interface LengthValidationConfig {
76
+ min?: number;
77
+ max?: number;
78
+ integer?: boolean;
79
+ minError?: string;
80
+ maxError?: string;
81
+ }
82
+ /**
83
+ * Configuração padrão de validação para comprimento
84
+ * Length é magnitude escalar, portanto não-negativo por padrão
85
+ */
86
+ declare const LENGTH_VALIDATION_CONFIG: LengthValidationConfig;
87
+ /**
88
+ * Valida um valor de comprimento
89
+ *
90
+ * @param value - Valor a ser validado
91
+ * @param config - Configuração customizada (opcional)
92
+ * @returns Resultado da validação com erros se houver
93
+ *
94
+ * @example
95
+ * validateLength(100); // { valid: true, errors: [] }
96
+ * validateLength(-5); // { valid: false, errors: ['Length cannot be negative'] }
97
+ * validateLength(-5, { min: undefined }); // { valid: true, errors: [] } - permite negativo
98
+ */
99
+ declare function validateLength(value: unknown, config?: LengthValidationConfig): ValidationResult$e;
100
+ /**
101
+ * Verifica se um valor de comprimento é válido
102
+ *
103
+ * @param value - Valor a ser validado
104
+ * @param config - Configuração customizada (opcional)
105
+ * @returns true se válido, false caso contrário
106
+ *
107
+ * @example
108
+ * isValidLength(100); // true
109
+ * isValidLength(-5); // false
110
+ */
111
+ declare function isValidLength(value: unknown, config?: LengthValidationConfig): boolean;
112
+
113
+ /**
114
+ * Mass Role - Validate Pillar
115
+ *
116
+ * Validação semântica de valores de massa.
117
+ * Zero dependências externas - pode ser usado standalone.
118
+ *
119
+ * @example
120
+ * import { validateMass, isValidMass } from '@attrx/role-morphic/mass/validate';
121
+ *
122
+ * validateMass(100); // { valid: true, errors: [] }
123
+ * validateMass(-5); // { valid: false, errors: ['Mass cannot be negative'] }
124
+ * isValidMass(100); // true
125
+ */
126
+ interface ValidationResult$d {
127
+ valid: boolean;
128
+ errors: string[];
129
+ }
130
+ interface MassValidationConfig {
131
+ min?: number;
132
+ max?: number;
133
+ integer?: boolean;
134
+ minError?: string;
135
+ maxError?: string;
136
+ }
137
+ /**
138
+ * Configuração padrão de validação para massa
139
+ */
140
+ declare const MASS_VALIDATION_CONFIG: MassValidationConfig;
141
+ /**
142
+ * Valida um valor de massa
143
+ *
144
+ * @param value - Valor a ser validado
145
+ * @param config - Configuração customizada (opcional)
146
+ * @returns Resultado da validação com erros se houver
147
+ *
148
+ * @example
149
+ * validateMass(100); // { valid: true, errors: [] }
150
+ * validateMass(-5); // { valid: false, errors: ['Mass cannot be negative'] }
151
+ * validateMass(150, { max: 100 }) // { valid: false, errors: ['Value must be at most 100'] }
152
+ */
153
+ declare function validateMass(value: unknown, config?: MassValidationConfig): ValidationResult$d;
154
+ /**
155
+ * Verifica se um valor de massa é válido
156
+ *
157
+ * @param value - Valor a ser validado
158
+ * @param config - Configuração customizada (opcional)
159
+ * @returns true se válido, false caso contrário
160
+ *
161
+ * @example
162
+ * isValidMass(100); // true
163
+ * isValidMass(-5); // false
164
+ */
165
+ declare function isValidMass(value: unknown, config?: MassValidationConfig): boolean;
166
+
167
+ /**
168
+ * Temperature Role - Validate Pillar
169
+ *
170
+ * Validação semântica de valores de temperatura.
171
+ * Zero dependências externas - pode ser usado standalone.
172
+ *
173
+ * IMPORTANTE: Temperatura não pode ser abaixo do zero absoluto.
174
+ * O zero absoluto varia por escala:
175
+ * - Celsius: -273.15°C
176
+ * - Fahrenheit: -459.67°F
177
+ * - Kelvin: 0K
178
+ * - Rankine: 0°R
179
+ *
180
+ * @example
181
+ * import { validateTemperature, isValidTemperature } from '@attrx/role-morphic/temperature/validate';
182
+ *
183
+ * validateTemperature(100, 'celsius'); // { valid: true, errors: [] }
184
+ * validateTemperature(-300, 'celsius'); // { valid: false, errors: ['...below absolute zero...'] }
185
+ * validateTemperature(-10, 'kelvin'); // { valid: false, errors: ['...below absolute zero...'] }
186
+ * isValidTemperature(100, 'celsius'); // true
187
+ */
188
+
189
+ interface ValidationResult$c {
190
+ valid: boolean;
191
+ errors: string[];
192
+ }
193
+ interface TemperatureValidationConfig {
194
+ /** Permite temperaturas abaixo do zero absoluto (default: false) */
195
+ allowBelowAbsoluteZero?: boolean;
196
+ /** Valor máximo permitido */
197
+ max?: number;
198
+ /** Mensagem de erro para max */
199
+ maxError?: string;
200
+ }
201
+ /**
202
+ * Valida um valor de temperatura
203
+ *
204
+ * @param value - Valor a ser validado
205
+ * @param unit - Unidade do valor (default: celsius)
206
+ * @param config - Configuração customizada (opcional)
207
+ * @returns Resultado da validação com erros se houver
208
+ *
209
+ * @example
210
+ * validateTemperature(100, 'celsius'); // { valid: true, errors: [] }
211
+ * validateTemperature(-300, 'celsius'); // { valid: false, errors: ['...below absolute zero...'] }
212
+ * validateTemperature(-10, 'kelvin'); // { valid: false, errors: ['...below absolute zero...'] }
213
+ * validateTemperature(0, 'kelvin'); // { valid: true, errors: [] } (0K = zero absoluto)
214
+ * validateTemperature(-459.67, 'fahrenheit'); // { valid: true, errors: [] } (zero absoluto em °F)
215
+ */
216
+ declare function validateTemperature(value: unknown, unit?: TemperatureUnit, config?: TemperatureValidationConfig): ValidationResult$c;
217
+ /**
218
+ * Verifica se um valor de temperatura é válido
219
+ *
220
+ * @param value - Valor a ser validado
221
+ * @param unit - Unidade do valor (default: celsius)
222
+ * @param config - Configuração customizada (opcional)
223
+ * @returns true se válido, false caso contrário
224
+ *
225
+ * @example
226
+ * isValidTemperature(100, 'celsius'); // true
227
+ * isValidTemperature(-300, 'celsius'); // false
228
+ * isValidTemperature(-10, 'kelvin'); // false
229
+ */
230
+ declare function isValidTemperature(value: unknown, unit?: TemperatureUnit, config?: TemperatureValidationConfig): boolean;
231
+
232
+ /**
233
+ * Volume Role - Validate Pillar
234
+ *
235
+ * Validação semântica de valores de volume.
236
+ * Zero dependências externas - pode ser usado standalone.
237
+ *
238
+ * @example
239
+ * import { validateVolume, isValidVolume } from '@attrx/role-morphic/volume/validate';
240
+ *
241
+ * validateVolume(100); // { valid: true, errors: [] }
242
+ * validateVolume(-5); // { valid: false, errors: ['Volume cannot be negative'] }
243
+ * isValidVolume(100); // true
244
+ */
245
+ interface ValidationResult$b {
246
+ valid: boolean;
247
+ errors: string[];
248
+ }
249
+ interface VolumeValidationConfig {
250
+ min?: number;
251
+ max?: number;
252
+ integer?: boolean;
253
+ minError?: string;
254
+ maxError?: string;
255
+ }
256
+ /**
257
+ * Configuração padrão de validação para volume
258
+ */
259
+ declare const VOLUME_VALIDATION_CONFIG: VolumeValidationConfig;
260
+ /**
261
+ * Valida um valor de volume
262
+ *
263
+ * @param value - Valor a ser validado
264
+ * @param config - Configuração customizada (opcional)
265
+ * @returns Resultado da validação com erros se houver
266
+ *
267
+ * @example
268
+ * validateVolume(100); // { valid: true, errors: [] }
269
+ * validateVolume(-5); // { valid: false, errors: ['Volume cannot be negative'] }
270
+ * validateVolume(150, { max: 100 }) // { valid: false, errors: ['Value must be at most 100'] }
271
+ */
272
+ declare function validateVolume(value: unknown, config?: VolumeValidationConfig): ValidationResult$b;
273
+ /**
274
+ * Verifica se um valor de volume é válido
275
+ *
276
+ * @param value - Valor a ser validado
277
+ * @param config - Configuração customizada (opcional)
278
+ * @returns true se válido, false caso contrário
279
+ *
280
+ * @example
281
+ * isValidVolume(100); // true
282
+ * isValidVolume(-5); // false
283
+ */
284
+ declare function isValidVolume(value: unknown, config?: VolumeValidationConfig): boolean;
285
+
286
+ /**
287
+ * Speed Role - Validate Pillar
288
+ *
289
+ * Validação semântica de valores de velocidade.
290
+ * Zero dependências externas - pode ser usado standalone.
291
+ *
292
+ * Nota: Velocidade pode ser negativa (movimento em direção oposta).
293
+ *
294
+ * @example
295
+ * import { validateSpeed, isValidSpeed } from '@attrx/role-morphic/speed/validate';
296
+ *
297
+ * validateSpeed(100); // { valid: true, errors: [] }
298
+ * validateSpeed(-50); // { valid: true, errors: [] } (negativo é válido)
299
+ * isValidSpeed(100); // true
300
+ */
301
+ interface ValidationResult$a {
302
+ valid: boolean;
303
+ errors: string[];
304
+ }
305
+ interface SpeedValidationConfig {
306
+ min?: number;
307
+ max?: number;
308
+ integer?: boolean;
309
+ minError?: string;
310
+ maxError?: string;
311
+ }
312
+ /**
313
+ * Valida um valor de velocidade
314
+ *
315
+ * @param value - Valor a ser validado
316
+ * @param config - Configuração customizada (opcional)
317
+ * @returns Resultado da validação com erros se houver
318
+ *
319
+ * @example
320
+ * validateSpeed(100); // { valid: true, errors: [] }
321
+ * validateSpeed(-50); // { valid: true, errors: [] }
322
+ * validateSpeed(150, { max: 120 }) // { valid: false, errors: ['Value must be at most 120'] }
323
+ */
324
+ declare function validateSpeed(value: unknown, config?: SpeedValidationConfig): ValidationResult$a;
325
+ /**
326
+ * Verifica se um valor de velocidade é válido
327
+ *
328
+ * @param value - Valor a ser validado
329
+ * @param config - Configuração customizada (opcional)
330
+ * @returns true se válido, false caso contrário
331
+ *
332
+ * @example
333
+ * isValidSpeed(100); // true
334
+ * isValidSpeed(-50); // true (negativo é válido)
335
+ */
336
+ declare function isValidSpeed(value: unknown, config?: SpeedValidationConfig): boolean;
337
+
338
+ /**
339
+ * Energy Role - Validate Pillar
340
+ *
341
+ * Validação semântica de valores de energia.
342
+ * Zero dependências externas - pode ser usado standalone.
343
+ *
344
+ * @example
345
+ * import { validateEnergy, isValidEnergy } from '@attrx/role-morphic/energy/validate';
346
+ *
347
+ * validateEnergy(100); // { valid: true, errors: [] }
348
+ * validateEnergy(-5); // { valid: false, errors: ['Energy cannot be negative'] }
349
+ * isValidEnergy(100); // true
350
+ */
351
+ interface ValidationResult$9 {
352
+ valid: boolean;
353
+ errors: string[];
354
+ }
355
+ interface EnergyValidationConfig {
356
+ min?: number;
357
+ max?: number;
358
+ integer?: boolean;
359
+ minError?: string;
360
+ maxError?: string;
361
+ }
362
+ /**
363
+ * Configuração padrão de validação para energia
364
+ */
365
+ declare const ENERGY_VALIDATION_CONFIG: EnergyValidationConfig;
366
+ /**
367
+ * Valida um valor de energia
368
+ *
369
+ * @param value - Valor a ser validado
370
+ * @param config - Configuração customizada (opcional)
371
+ * @returns Resultado da validação com erros se houver
372
+ *
373
+ * @example
374
+ * validateEnergy(100); // { valid: true, errors: [] }
375
+ * validateEnergy(-5); // { valid: false, errors: ['Energy cannot be negative'] }
376
+ * validateEnergy(150, { max: 100 }) // { valid: false, errors: ['Value must be at most 100'] }
377
+ */
378
+ declare function validateEnergy(value: unknown, config?: EnergyValidationConfig): ValidationResult$9;
379
+ /**
380
+ * Verifica se um valor de energia é válido
381
+ *
382
+ * @param value - Valor a ser validado
383
+ * @param config - Configuração customizada (opcional)
384
+ * @returns true se válido, false caso contrário
385
+ *
386
+ * @example
387
+ * isValidEnergy(100); // true
388
+ * isValidEnergy(-5); // false
389
+ */
390
+ declare function isValidEnergy(value: unknown, config?: EnergyValidationConfig): boolean;
391
+
392
+ /**
393
+ * Power Role - Validate Pillar
394
+ *
395
+ * Validação de valores de potência.
396
+ * ZERO dependências de outros pilares - totalmente standalone.
397
+ *
398
+ * @example
399
+ * import { validatePower, isValidPower } from '@attrx/role-morphic/power/validate';
400
+ *
401
+ * validatePower(100); // { valid: true, errors: [] }
402
+ * validatePower(-5); // { valid: false, errors: ['Power cannot be negative'] }
403
+ * isValidPower(100); // true
404
+ */
405
+ interface PowerValidationConfig {
406
+ /** Valor mínimo permitido (default: 0) */
407
+ min?: number;
408
+ /** Valor máximo permitido */
409
+ max?: number;
410
+ /** Mensagem de erro para valor abaixo do mínimo */
411
+ minError?: string;
412
+ /** Mensagem de erro para valor acima do máximo */
413
+ maxError?: string;
414
+ /** Permitir valores negativos (default: false) */
415
+ allowNegative?: boolean;
416
+ }
417
+ interface ValidationResult$8 {
418
+ valid: boolean;
419
+ errors: string[];
420
+ }
421
+ declare const POWER_VALIDATION_CONFIG: PowerValidationConfig;
422
+ /**
423
+ * Valida um valor de potência
424
+ *
425
+ * @param value - Valor a validar
426
+ * @param config - Configuração de validação (opcional)
427
+ * @returns Resultado da validação com lista de erros
428
+ *
429
+ * @example
430
+ * validatePower(100); // { valid: true, errors: [] }
431
+ * validatePower(-5); // { valid: false, errors: ['Power cannot be negative'] }
432
+ * validatePower(-5, { allowNegative: true }); // { valid: true, errors: [] }
433
+ * validatePower(1000, { max: 500 }); // { valid: false, errors: ['Value must be at most 500'] }
434
+ */
435
+ declare function validatePower(value: unknown, config?: PowerValidationConfig): ValidationResult$8;
436
+ /**
437
+ * Verifica se valor de potência é válido (helper booleano)
438
+ *
439
+ * @param value - Valor a validar
440
+ * @param config - Configuração de validação (opcional)
441
+ * @returns true se válido, false caso contrário
442
+ *
443
+ * @example
444
+ * isValidPower(100); // true
445
+ * isValidPower(-5); // false
446
+ */
447
+ declare function isValidPower(value: unknown, config?: PowerValidationConfig): boolean;
448
+
449
+ /**
450
+ * Pressure Role - Validate Pillar
451
+ *
452
+ * Validação de valores de pressão.
453
+ * ZERO dependências de outros pilares - totalmente standalone.
454
+ *
455
+ * @example
456
+ * import { validatePressure, isValidPressure } from '@attrx/role-morphic/pressure/validate';
457
+ *
458
+ * validatePressure(100); // { valid: true, errors: [] }
459
+ * validatePressure(-5); // { valid: false, errors: ['Pressure cannot be negative'] }
460
+ * isValidPressure(100); // true
461
+ */
462
+ interface PressureValidationConfig {
463
+ /** Valor mínimo permitido (default: 0) */
464
+ min?: number;
465
+ /** Valor máximo permitido */
466
+ max?: number;
467
+ /** Mensagem de erro para valor abaixo do mínimo */
468
+ minError?: string;
469
+ /** Mensagem de erro para valor acima do máximo */
470
+ maxError?: string;
471
+ /** Permitir valores negativos (default: false) */
472
+ allowNegative?: boolean;
473
+ }
474
+ interface ValidationResult$7 {
475
+ valid: boolean;
476
+ errors: string[];
477
+ }
478
+ declare const PRESSURE_VALIDATION_CONFIG: PressureValidationConfig;
479
+ /**
480
+ * Valida um valor de pressão
481
+ *
482
+ * @param value - Valor a validar
483
+ * @param config - Configuração de validação (opcional)
484
+ * @returns Resultado da validação com lista de erros
485
+ *
486
+ * @example
487
+ * validatePressure(100); // { valid: true, errors: [] }
488
+ * validatePressure(-5); // { valid: false, errors: ['Pressure cannot be negative'] }
489
+ * validatePressure(-5, { allowNegative: true }); // { valid: true, errors: [] }
490
+ * validatePressure(1000, { max: 500 }); // { valid: false, errors: ['Value must be at most 500'] }
491
+ */
492
+ declare function validatePressure(value: unknown, config?: PressureValidationConfig): ValidationResult$7;
493
+ /**
494
+ * Verifica se valor de pressão é válido (helper booleano)
495
+ *
496
+ * @param value - Valor a validar
497
+ * @param config - Configuração de validação (opcional)
498
+ * @returns true se válido, false caso contrário
499
+ *
500
+ * @example
501
+ * isValidPressure(100); // true
502
+ * isValidPressure(-5); // false
503
+ */
504
+ declare function isValidPressure(value: unknown, config?: PressureValidationConfig): boolean;
505
+
506
+ /**
507
+ * Frequency Role - Validate Pillar
508
+ *
509
+ * Validação de valores de frequência.
510
+ * ZERO dependências de outros pilares - totalmente standalone.
511
+ *
512
+ * @example
513
+ * import { validateFrequency, isValidFrequency } from '@attrx/role-morphic/frequency/validate';
514
+ *
515
+ * validateFrequency(100); // { valid: true, errors: [] }
516
+ * validateFrequency(-5); // { valid: false, errors: ['Frequency cannot be negative'] }
517
+ * isValidFrequency(100); // true
518
+ */
519
+ interface FrequencyValidationConfig {
520
+ /** Valor mínimo permitido (default: 0) */
521
+ min?: number;
522
+ /** Valor máximo permitido */
523
+ max?: number;
524
+ /** Mensagem de erro para valor abaixo do mínimo */
525
+ minError?: string;
526
+ /** Mensagem de erro para valor acima do máximo */
527
+ maxError?: string;
528
+ /** Permitir valores negativos (default: false) */
529
+ allowNegative?: boolean;
530
+ }
531
+ interface ValidationResult$6 {
532
+ valid: boolean;
533
+ errors: string[];
534
+ }
535
+ declare const FREQUENCY_VALIDATION_CONFIG: FrequencyValidationConfig;
536
+ /**
537
+ * Valida um valor de frequência
538
+ *
539
+ * @param value - Valor a validar
540
+ * @param config - Configuração de validação (opcional)
541
+ * @returns Resultado da validação com lista de erros
542
+ *
543
+ * @example
544
+ * validateFrequency(100); // { valid: true, errors: [] }
545
+ * validateFrequency(-5); // { valid: false, errors: ['Frequency cannot be negative'] }
546
+ * validateFrequency(-5, { allowNegative: true }); // { valid: true, errors: [] }
547
+ * validateFrequency(1000, { max: 500 }); // { valid: false, errors: ['Value must be at most 500'] }
548
+ */
549
+ declare function validateFrequency(value: unknown, config?: FrequencyValidationConfig): ValidationResult$6;
550
+ /**
551
+ * Verifica se valor de frequência é válido (helper booleano)
552
+ *
553
+ * @param value - Valor a validar
554
+ * @param config - Configuração de validação (opcional)
555
+ * @returns true se válido, false caso contrário
556
+ *
557
+ * @example
558
+ * isValidFrequency(100); // true
559
+ * isValidFrequency(-5); // false
560
+ */
561
+ declare function isValidFrequency(value: unknown, config?: FrequencyValidationConfig): boolean;
562
+
563
+ /**
564
+ * Angle Role - Validate Pillar
565
+ *
566
+ * Validação de valores de ângulo.
567
+ * ZERO dependências de outros pilares - totalmente standalone.
568
+ *
569
+ * Nota: Ângulos podem ser negativos (rotação anti-horária) e maiores que 360° (múltiplas voltas).
570
+ *
571
+ * @example
572
+ * import { validateAngle, isValidAngle } from '@attrx/role-morphic/angle/validate';
573
+ *
574
+ * validateAngle(90); // { valid: true, errors: [] }
575
+ * validateAngle(-45); // { valid: true, errors: [] }
576
+ * validateAngle(720); // { valid: true, errors: [] }
577
+ * isValidAngle(90); // true
578
+ */
579
+ interface AngleValidationConfig {
580
+ /** Valor mínimo permitido */
581
+ min?: number;
582
+ /** Valor máximo permitido */
583
+ max?: number;
584
+ /** Mensagem de erro para valor abaixo do mínimo */
585
+ minError?: string;
586
+ /** Mensagem de erro para valor acima do máximo */
587
+ maxError?: string;
588
+ }
589
+ interface ValidationResult$5 {
590
+ valid: boolean;
591
+ errors: string[];
592
+ }
593
+ /**
594
+ * Valida um valor de ângulo
595
+ *
596
+ * @param value - Valor a validar
597
+ * @param config - Configuração de validação (opcional)
598
+ * @returns Resultado da validação com lista de erros
599
+ *
600
+ * @example
601
+ * validateAngle(90); // { valid: true, errors: [] }
602
+ * validateAngle(-45); // { valid: true, errors: [] }
603
+ * validateAngle(90, { max: 180 }); // { valid: true, errors: [] }
604
+ * validateAngle(270, { max: 180 }); // { valid: false, errors: ['...'] }
605
+ */
606
+ declare function validateAngle(value: unknown, config?: AngleValidationConfig): ValidationResult$5;
607
+ /**
608
+ * Verifica se valor de ângulo é válido (helper booleano)
609
+ *
610
+ * @param value - Valor a validar
611
+ * @param config - Configuração de validação (opcional)
612
+ * @returns true se válido, false caso contrário
613
+ *
614
+ * @example
615
+ * isValidAngle(90); // true
616
+ * isValidAngle(-45); // true
617
+ * isValidAngle(NaN); // false
618
+ */
619
+ declare function isValidAngle(value: unknown, config?: AngleValidationConfig): boolean;
620
+
621
+ /**
622
+ * Time Role - Validate Pillar
623
+ *
624
+ * Validação de valores de tempo/duração.
625
+ * ZERO dependências de outros pilares - totalmente standalone.
626
+ *
627
+ * @example
628
+ * import { validateTime, isValidTime } from '@attrx/role-morphic/time/validate';
629
+ *
630
+ * validateTime(100); // { valid: true, errors: [] }
631
+ * validateTime(-5); // { valid: false, errors: ['Time cannot be negative'] }
632
+ * isValidTime(100); // true
633
+ */
634
+ interface TimeValidationConfig {
635
+ /** Valor mínimo permitido (default: 0) */
636
+ min?: number;
637
+ /** Valor máximo permitido */
638
+ max?: number;
639
+ /** Mensagem de erro para valor abaixo do mínimo */
640
+ minError?: string;
641
+ /** Mensagem de erro para valor acima do máximo */
642
+ maxError?: string;
643
+ /** Permitir valores negativos (default: false) */
644
+ allowNegative?: boolean;
645
+ }
646
+ interface ValidationResult$4 {
647
+ valid: boolean;
648
+ errors: string[];
649
+ }
650
+ declare const TIME_VALIDATION_CONFIG: TimeValidationConfig;
651
+ /**
652
+ * Valida um valor de tempo
653
+ *
654
+ * @param value - Valor a validar
655
+ * @param config - Configuração de validação (opcional)
656
+ * @returns Resultado da validação com lista de erros
657
+ *
658
+ * @example
659
+ * validateTime(100); // { valid: true, errors: [] }
660
+ * validateTime(-5); // { valid: false, errors: ['Time cannot be negative'] }
661
+ * validateTime(-5, { allowNegative: true }); // { valid: true, errors: [] }
662
+ */
663
+ declare function validateTime(value: unknown, config?: TimeValidationConfig): ValidationResult$4;
664
+ /**
665
+ * Verifica se valor de tempo é válido (helper booleano)
666
+ *
667
+ * @param value - Valor a validar
668
+ * @param config - Configuração de validação (opcional)
669
+ * @returns true se válido, false caso contrário
670
+ *
671
+ * @example
672
+ * isValidTime(100); // true
673
+ * isValidTime(-5); // false
674
+ */
675
+ declare function isValidTime(value: unknown, config?: TimeValidationConfig): boolean;
676
+
677
+ /**
678
+ * Digital Role - Validate Pillar
679
+ *
680
+ * Validação de valores de armazenamento digital.
681
+ * ZERO dependências de outros pilares - totalmente standalone.
682
+ *
683
+ * @example
684
+ * import { validateDigital, isValidDigital } from '@attrx/role-morphic/digital/validate';
685
+ *
686
+ * validateDigital(100); // { valid: true, errors: [] }
687
+ * validateDigital(-5); // { valid: false, errors: ['Digital storage cannot be negative'] }
688
+ * isValidDigital(100); // true
689
+ */
690
+ interface DigitalValidationConfig {
691
+ /** Valor mínimo permitido (default: 0) */
692
+ min?: number;
693
+ /** Valor máximo permitido */
694
+ max?: number;
695
+ /** Mensagem de erro para valor abaixo do mínimo */
696
+ minError?: string;
697
+ /** Mensagem de erro para valor acima do máximo */
698
+ maxError?: string;
699
+ /** Permitir valores negativos (default: false) */
700
+ allowNegative?: boolean;
701
+ }
702
+ interface ValidationResult$3 {
703
+ valid: boolean;
704
+ errors: string[];
705
+ }
706
+ declare const DIGITAL_VALIDATION_CONFIG: DigitalValidationConfig;
707
+ /**
708
+ * Valida um valor de armazenamento digital
709
+ *
710
+ * @param value - Valor a validar
711
+ * @param config - Configuração de validação (opcional)
712
+ * @returns Resultado da validação com lista de erros
713
+ *
714
+ * @example
715
+ * validateDigital(100); // { valid: true, errors: [] }
716
+ * validateDigital(-5); // { valid: false, errors: ['Digital storage cannot be negative'] }
717
+ * validateDigital(-5, { allowNegative: true }); // { valid: true, errors: [] }
718
+ */
719
+ declare function validateDigital(value: unknown, config?: DigitalValidationConfig): ValidationResult$3;
720
+ /**
721
+ * Verifica se valor de armazenamento digital é válido (helper booleano)
722
+ *
723
+ * @param value - Valor a validar
724
+ * @param config - Configuração de validação (opcional)
725
+ * @returns true se válido, false caso contrário
726
+ *
727
+ * @example
728
+ * isValidDigital(100); // true
729
+ * isValidDigital(-5); // false
730
+ */
731
+ declare function isValidDigital(value: unknown, config?: DigitalValidationConfig): boolean;
732
+
733
+ /**
734
+ * Color Role - Validate Pillar
735
+ *
736
+ * Validação de valores de cor.
737
+ * ZERO dependências de outros pilares - totalmente standalone.
738
+ *
739
+ * @example
740
+ * import { validateColor, isValidColor } from '@attrx/role-morphic/color/validate';
741
+ *
742
+ * validateColor('hex', '#ff0000'); // { valid: true, errors: [] }
743
+ * validateColor('rgb_object', { r: 255, g: 0, b: 0 }); // { valid: true, errors: [] }
744
+ * validateColor('hex', 'invalid'); // { valid: false, errors: [...] }
745
+ */
746
+
747
+ type ValidationResult$2 = {
748
+ valid: boolean;
749
+ errors: string[];
750
+ };
751
+ /**
752
+ * Valida valor de cor para uma variante específica
753
+ *
754
+ * @param variant - Variante a validar
755
+ * @param value - Valor a validar
756
+ * @returns Resultado da validação
757
+ *
758
+ * @example
759
+ * validateColor('hex', '#ff0000');
760
+ * // { valid: true, errors: [] }
761
+ *
762
+ * validateColor('hex', 'invalid');
763
+ * // { valid: false, errors: ['Invalid hex color format'] }
764
+ */
765
+ declare function validateColor(variant: ColorVariant, value: unknown): ValidationResult$2;
766
+ /**
767
+ * Verifica se valor é válido para uma variante específica (retorna boolean)
768
+ *
769
+ * @example
770
+ * isValidColorVariant('hex', '#ff0000'); // true
771
+ * isValidColorVariant('hex', 'invalid'); // false
772
+ */
773
+ declare function isValidColorVariant(variant: ColorVariant, value: unknown): boolean;
774
+
775
+ /**
776
+ * Date Role - Validate Pillar
777
+ *
778
+ * Validação de valores de data.
779
+ * ZERO dependências de outros pilares - totalmente standalone.
780
+ *
781
+ * @example
782
+ * import { validateDate, isValidDate } from '@attrx/role-morphic/date/validate';
783
+ *
784
+ * validateDate('iso', '2024-12-05T19:30:00.000Z'); // { valid: true, errors: [] }
785
+ * validateDate('timestamp', 1733425800000); // { valid: true, errors: [] }
786
+ * validateDate('epoch', 1733425800); // { valid: true, errors: [] }
787
+ */
788
+
789
+ type ValidationResult$1 = {
790
+ valid: boolean;
791
+ errors: string[];
792
+ };
793
+ /**
794
+ * Valida valor de data para uma variante específica
795
+ *
796
+ * @param variant - Variante a validar ("iso", "timestamp", "epoch")
797
+ * @param value - Valor a validar
798
+ * @returns Resultado da validação
799
+ *
800
+ * @example
801
+ * validateDate('iso', '2024-12-05T19:30:00.000Z');
802
+ * // { valid: true, errors: [] }
803
+ *
804
+ * validateDate('iso', 'invalid');
805
+ * // { valid: false, errors: ['Invalid ISO 8601 format'] }
806
+ */
807
+ declare function validateDate(variant: DateVariant, value: unknown): ValidationResult$1;
808
+ /**
809
+ * Verifica se valor é válido (retorna boolean)
810
+ *
811
+ * @example
812
+ * isValidDate('iso', '2024-12-05T19:30:00.000Z'); // true
813
+ * isValidDate('iso', 'invalid'); // false
814
+ */
815
+ declare function isValidDate(variant: DateVariant, value: unknown): boolean;
816
+
817
+ /**
818
+ * Currency Role - Validate Pillar
819
+ *
820
+ * Validação semântica de valores monetários.
821
+ * Zero dependências externas - pode ser usado standalone.
822
+ *
823
+ * Currency valida o VALOR NUMÉRICO, não o tipo de moeda.
824
+ * O código da moeda é metadata, usado apenas para formatação.
825
+ *
826
+ * @example
827
+ * import { validateCurrency, isValidCurrency } from '@attrx/role-morphic/currency/validate';
828
+ *
829
+ * validateCurrency(100.50); // { valid: true, errors: [] }
830
+ * validateCurrency(-50); // { valid: false, errors: ['Currency value cannot be negative'] }
831
+ * validateCurrency(100.999, { decimals: 2 }); // { valid: false, errors: ['...too many decimal places'] }
832
+ * isValidCurrency(100.50); // true
833
+ */
834
+ interface ValidationResult {
835
+ valid: boolean;
836
+ errors: string[];
837
+ }
838
+ interface CurrencyValidationConfig {
839
+ /** Valor mínimo permitido (default: 0) */
840
+ min?: number;
841
+ /** Valor máximo permitido */
842
+ max?: number;
843
+ /** Máximo de casas decimais (default: sem limite) */
844
+ decimals?: number;
845
+ /** Permite valores negativos? (default: false) */
846
+ allowNegative?: boolean;
847
+ /** Mensagem de erro para min */
848
+ minError?: string;
849
+ /** Mensagem de erro para max */
850
+ maxError?: string;
851
+ }
852
+ /**
853
+ * Configuração padrão de validação para currency
854
+ */
855
+ declare const CURRENCY_VALIDATION_CONFIG: CurrencyValidationConfig;
856
+ /**
857
+ * Valida um valor monetário
858
+ *
859
+ * @param value - Valor a ser validado
860
+ * @param config - Configuração customizada (opcional)
861
+ * @returns Resultado da validação com erros se houver
862
+ *
863
+ * @example
864
+ * validateCurrency(100.50); // { valid: true, errors: [] }
865
+ * validateCurrency(-50); // { valid: false, errors: ['Currency value cannot be negative'] }
866
+ * validateCurrency(100.999, { decimals: 2 }); // { valid: false, errors: ['Value has too many decimal places (max: 2)'] }
867
+ * validateCurrency(1000000, { max: 10000 }); // { valid: false, errors: ['Value must be at most 10000'] }
868
+ * validateCurrency(-50, { allowNegative: true }); // { valid: true, errors: [] }
869
+ */
870
+ declare function validateCurrency(value: unknown, config?: CurrencyValidationConfig): ValidationResult;
871
+ /**
872
+ * Verifica se um valor monetário é válido
873
+ *
874
+ * @param value - Valor a ser validado
875
+ * @param config - Configuração customizada (opcional)
876
+ * @returns true se válido, false caso contrário
877
+ *
878
+ * @example
879
+ * isValidCurrency(100.50); // true
880
+ * isValidCurrency(-50); // false
881
+ */
882
+ declare function isValidCurrency(value: unknown, config?: CurrencyValidationConfig): boolean;
883
+
884
+ export { AREA_VALIDATION_CONFIG, type AngleValidationConfig, type AreaValidationConfig, CURRENCY_VALIDATION_CONFIG, type CurrencyValidationConfig, DIGITAL_VALIDATION_CONFIG, type DigitalValidationConfig, ENERGY_VALIDATION_CONFIG, type EnergyValidationConfig, FREQUENCY_VALIDATION_CONFIG, type FrequencyValidationConfig, LENGTH_VALIDATION_CONFIG, type LengthValidationConfig, MASS_VALIDATION_CONFIG, type MassValidationConfig, POWER_VALIDATION_CONFIG, PRESSURE_VALIDATION_CONFIG, type PowerValidationConfig, type PressureValidationConfig, type SpeedValidationConfig, TIME_VALIDATION_CONFIG, type TemperatureValidationConfig, type TimeValidationConfig, VOLUME_VALIDATION_CONFIG, type VolumeValidationConfig, isValidAngle, isValidArea, isValidColorVariant, isValidCurrency, isValidDate, isValidDigital, isValidEnergy, isValidFrequency, isValidLength, isValidMass, isValidPower, isValidPressure, isValidSpeed, isValidTemperature, isValidTime, isValidVolume, validateAngle, validateArea, validateColor, validateCurrency, validateDate, validateDigital, validateEnergy, validateFrequency, validateLength, validateMass, validatePower, validatePressure, validateSpeed, validateTemperature, validateTime, validateVolume };