@praxisui/metadata-editor 1.0.0-beta.42 → 1.0.0-beta.44

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.
@@ -3678,6 +3678,156 @@ function minLenLeMaxLen(group) {
3678
3678
  return null;
3679
3679
  }
3680
3680
 
3681
+ const HEX_PATTERN = /^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;
3682
+ function clampChannel(value) {
3683
+ return Math.max(0, Math.min(255, Math.round(value)));
3684
+ }
3685
+ function parseHexColor(raw) {
3686
+ const normalized = raw.trim();
3687
+ if (!HEX_PATTERN.test(normalized)) {
3688
+ return null;
3689
+ }
3690
+ const hex = normalized.slice(1);
3691
+ if (hex.length === 3 || hex.length === 4) {
3692
+ return {
3693
+ r: Number.parseInt(hex[0] + hex[0], 16),
3694
+ g: Number.parseInt(hex[1] + hex[1], 16),
3695
+ b: Number.parseInt(hex[2] + hex[2], 16),
3696
+ };
3697
+ }
3698
+ return {
3699
+ r: Number.parseInt(hex.slice(0, 2), 16),
3700
+ g: Number.parseInt(hex.slice(2, 4), 16),
3701
+ b: Number.parseInt(hex.slice(4, 6), 16),
3702
+ };
3703
+ }
3704
+ function parseRgbChannel(token) {
3705
+ const value = token.trim();
3706
+ if (!value.length)
3707
+ return null;
3708
+ if (value.endsWith('%')) {
3709
+ const pct = Number.parseFloat(value.slice(0, -1));
3710
+ if (!Number.isFinite(pct))
3711
+ return null;
3712
+ return clampChannel((pct / 100) * 255);
3713
+ }
3714
+ const numeric = Number.parseFloat(value);
3715
+ if (!Number.isFinite(numeric))
3716
+ return null;
3717
+ return clampChannel(numeric);
3718
+ }
3719
+ function parseRgbColor(raw) {
3720
+ const normalized = raw.trim().toLowerCase();
3721
+ if (!normalized.startsWith('rgb')) {
3722
+ return null;
3723
+ }
3724
+ const parts = normalized.match(/[\d.]+%?/g) ?? [];
3725
+ if (parts.length < 3) {
3726
+ return null;
3727
+ }
3728
+ const [rRaw, gRaw, bRaw] = parts;
3729
+ if (rRaw === undefined || gRaw === undefined || bRaw === undefined) {
3730
+ return null;
3731
+ }
3732
+ const r = parseRgbChannel(rRaw);
3733
+ const g = parseRgbChannel(gRaw);
3734
+ const b = parseRgbChannel(bRaw);
3735
+ if (r === null || g === null || b === null) {
3736
+ return null;
3737
+ }
3738
+ return { r, g, b };
3739
+ }
3740
+ function parseComputedRgbColor(raw) {
3741
+ if (typeof document === 'undefined') {
3742
+ return null;
3743
+ }
3744
+ const probe = document.createElement('span');
3745
+ probe.style.color = '';
3746
+ probe.style.color = raw;
3747
+ if (!probe.style.color) {
3748
+ return null;
3749
+ }
3750
+ const host = document.body ?? document.documentElement;
3751
+ let computed = probe.style.color;
3752
+ if (host) {
3753
+ host.appendChild(probe);
3754
+ try {
3755
+ computed = getComputedStyle(probe).color || computed;
3756
+ }
3757
+ finally {
3758
+ probe.remove();
3759
+ }
3760
+ }
3761
+ return parseRgbColor(computed) ?? parseHexColor(computed);
3762
+ }
3763
+ function normalizeCssColorToRgb(value) {
3764
+ const raw = String(value ?? '').trim();
3765
+ if (!raw.length) {
3766
+ return null;
3767
+ }
3768
+ return parseHexColor(raw) ?? parseRgbColor(raw) ?? parseComputedRgbColor(raw);
3769
+ }
3770
+ function relativeLuminance({ r, g, b }) {
3771
+ const normalize = (channel) => {
3772
+ const value = channel / 255;
3773
+ return value <= 0.03928 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
3774
+ };
3775
+ return 0.2126 * normalize(r) + 0.7152 * normalize(g) + 0.0722 * normalize(b);
3776
+ }
3777
+ function contrastRatio(a, b) {
3778
+ const lumA = relativeLuminance(a);
3779
+ const lumB = relativeLuminance(b);
3780
+ const lighter = Math.max(lumA, lumB);
3781
+ const darker = Math.min(lumA, lumB);
3782
+ return (lighter + 0.05) / (darker + 0.05);
3783
+ }
3784
+ function gradientColorStopValidator(options) {
3785
+ const label = String(options.label || 'Cor').trim() || 'Cor';
3786
+ const compareWith = options.compareWith ?? [];
3787
+ const minContrastRatio = Math.max(1, Number(options.minContrastRatio ?? 1.4));
3788
+ return (control) => {
3789
+ const rawValue = String(control.value ?? '').trim();
3790
+ if (!rawValue.length) {
3791
+ return null;
3792
+ }
3793
+ const currentColor = normalizeCssColorToRgb(rawValue);
3794
+ if (!currentColor) {
3795
+ return {
3796
+ invalidColor: {
3797
+ message: `${label}: informe uma cor CSS valida (ex.: #22c55e).`,
3798
+ },
3799
+ };
3800
+ }
3801
+ const parent = control.parent;
3802
+ if (!parent || !compareWith.length) {
3803
+ return null;
3804
+ }
3805
+ for (const target of compareWith) {
3806
+ const siblingRaw = String(parent.get(target.field)?.value ?? '').trim();
3807
+ if (!siblingRaw.length) {
3808
+ continue;
3809
+ }
3810
+ const siblingColor = normalizeCssColorToRgb(siblingRaw);
3811
+ if (!siblingColor) {
3812
+ continue;
3813
+ }
3814
+ const ratio = contrastRatio(currentColor, siblingColor);
3815
+ if (ratio < minContrastRatio) {
3816
+ return {
3817
+ gradientContrast: {
3818
+ message: `${label}: contraste baixo com ${target.label} ` +
3819
+ `(${ratio.toFixed(2)}:1). Use ao menos ${minContrastRatio.toFixed(1)}:1.`,
3820
+ ratio,
3821
+ minContrastRatio,
3822
+ comparedField: target.field,
3823
+ },
3824
+ };
3825
+ }
3826
+ }
3827
+ return null;
3828
+ };
3829
+ }
3830
+
3681
3831
  function cloneProperty$6(prop) {
3682
3832
  return {
3683
3833
  ...prop,
@@ -3803,6 +3953,61 @@ const filterInlineDistanceRadiusProperties = [
3803
3953
  group: 'Aparencia',
3804
3954
  hint: 'Cor do glow ao redor do centro radial.',
3805
3955
  },
3956
+ {
3957
+ name: 'distanceGradientLowColor',
3958
+ label: 'Gradiente baixo',
3959
+ editorType: 'color',
3960
+ group: 'Aparencia',
3961
+ row: 'distance-gradient-colors',
3962
+ inline: true,
3963
+ hint: 'Cor para valores baixos (fallback padrao: verde).',
3964
+ validators: [
3965
+ gradientColorStopValidator({
3966
+ label: 'Gradiente baixo',
3967
+ compareWith: [{ field: 'distanceGradientMidColor', label: 'Gradiente medio' }],
3968
+ }),
3969
+ ],
3970
+ },
3971
+ {
3972
+ name: 'distanceGradientMidColor',
3973
+ label: 'Gradiente medio',
3974
+ editorType: 'color',
3975
+ group: 'Aparencia',
3976
+ row: 'distance-gradient-colors',
3977
+ inline: true,
3978
+ hint: 'Cor para valores medios (fallback padrao: amarelo/ambar).',
3979
+ validators: [
3980
+ gradientColorStopValidator({
3981
+ label: 'Gradiente medio',
3982
+ compareWith: [
3983
+ { field: 'distanceGradientLowColor', label: 'Gradiente baixo' },
3984
+ { field: 'distanceGradientHighColor', label: 'Gradiente alto' },
3985
+ ],
3986
+ }),
3987
+ ],
3988
+ },
3989
+ {
3990
+ name: 'distanceGradientHighColor',
3991
+ label: 'Gradiente alto',
3992
+ editorType: 'color',
3993
+ group: 'Aparencia',
3994
+ row: 'distance-gradient-colors',
3995
+ inline: true,
3996
+ hint: 'Cor para valores altos (fallback padrao: vermelho).',
3997
+ validators: [
3998
+ gradientColorStopValidator({
3999
+ label: 'Gradiente alto',
4000
+ compareWith: [{ field: 'distanceGradientMidColor', label: 'Gradiente medio' }],
4001
+ }),
4002
+ ],
4003
+ },
4004
+ {
4005
+ name: 'distanceRangeBandOpacity',
4006
+ label: 'Opacidade da faixa (0-1)',
4007
+ editorType: 'number',
4008
+ group: 'Aparencia',
4009
+ hint: 'Opcional. Sobrescreve a opacidade automatica da faixa radial no modo range.',
4010
+ },
3806
4011
  {
3807
4012
  name: 'materialDesign.density',
3808
4013
  label: 'Densidade',
@@ -3854,6 +4059,48 @@ const filterInlineRelativePeriodProperties = [
3854
4059
  editorType: 'checkbox',
3855
4060
  group: 'Formato/Comportamento',
3856
4061
  },
4062
+ {
4063
+ name: 'relativePeriodProgressGradientLowColor',
4064
+ label: 'Gradiente progresso (inicio)',
4065
+ editorType: 'color',
4066
+ group: 'Aparencia',
4067
+ hint: 'Cor inicial da barra de progresso relativa.',
4068
+ validators: [
4069
+ gradientColorStopValidator({
4070
+ label: 'Gradiente progresso (inicio)',
4071
+ compareWith: [{ field: 'relativePeriodProgressGradientMidColor', label: 'Gradiente progresso (meio)' }],
4072
+ }),
4073
+ ],
4074
+ },
4075
+ {
4076
+ name: 'relativePeriodProgressGradientMidColor',
4077
+ label: 'Gradiente progresso (meio)',
4078
+ editorType: 'color',
4079
+ group: 'Aparencia',
4080
+ hint: 'Cor intermediaria da barra de progresso relativa.',
4081
+ validators: [
4082
+ gradientColorStopValidator({
4083
+ label: 'Gradiente progresso (meio)',
4084
+ compareWith: [
4085
+ { field: 'relativePeriodProgressGradientLowColor', label: 'Gradiente progresso (inicio)' },
4086
+ { field: 'relativePeriodProgressGradientHighColor', label: 'Gradiente progresso (fim)' },
4087
+ ],
4088
+ }),
4089
+ ],
4090
+ },
4091
+ {
4092
+ name: 'relativePeriodProgressGradientHighColor',
4093
+ label: 'Gradiente progresso (fim)',
4094
+ editorType: 'color',
4095
+ group: 'Aparencia',
4096
+ hint: 'Cor final da barra de progresso relativa.',
4097
+ validators: [
4098
+ gradientColorStopValidator({
4099
+ label: 'Gradiente progresso (fim)',
4100
+ compareWith: [{ field: 'relativePeriodProgressGradientMidColor', label: 'Gradiente progresso (meio)' }],
4101
+ }),
4102
+ ],
4103
+ },
3857
4104
  {
3858
4105
  name: 'relativePeriodColumns',
3859
4106
  label: 'Colunas do grid',
@@ -3992,6 +4239,48 @@ const filterInlineSentimentProperties = [
3992
4239
  group: 'Aparencia',
3993
4240
  hint: 'Cores fallback usadas quando a opcao nao informar color.',
3994
4241
  },
4242
+ {
4243
+ name: 'sentimentGradientLowColor',
4244
+ label: 'Gradiente sentimento (inicio)',
4245
+ editorType: 'color',
4246
+ group: 'Aparencia',
4247
+ hint: 'Cor inicial do gradiente fallback de sentimento.',
4248
+ validators: [
4249
+ gradientColorStopValidator({
4250
+ label: 'Gradiente sentimento (inicio)',
4251
+ compareWith: [{ field: 'sentimentGradientMidColor', label: 'Gradiente sentimento (meio)' }],
4252
+ }),
4253
+ ],
4254
+ },
4255
+ {
4256
+ name: 'sentimentGradientMidColor',
4257
+ label: 'Gradiente sentimento (meio)',
4258
+ editorType: 'color',
4259
+ group: 'Aparencia',
4260
+ hint: 'Cor intermediaria do gradiente fallback de sentimento.',
4261
+ validators: [
4262
+ gradientColorStopValidator({
4263
+ label: 'Gradiente sentimento (meio)',
4264
+ compareWith: [
4265
+ { field: 'sentimentGradientLowColor', label: 'Gradiente sentimento (inicio)' },
4266
+ { field: 'sentimentGradientHighColor', label: 'Gradiente sentimento (fim)' },
4267
+ ],
4268
+ }),
4269
+ ],
4270
+ },
4271
+ {
4272
+ name: 'sentimentGradientHighColor',
4273
+ label: 'Gradiente sentimento (fim)',
4274
+ editorType: 'color',
4275
+ group: 'Aparencia',
4276
+ hint: 'Cor final do gradiente fallback de sentimento.',
4277
+ validators: [
4278
+ gradientColorStopValidator({
4279
+ label: 'Gradiente sentimento (fim)',
4280
+ compareWith: [{ field: 'sentimentGradientMidColor', label: 'Gradiente sentimento (meio)' }],
4281
+ }),
4282
+ ],
4283
+ },
3995
4284
  {
3996
4285
  name: 'sentimentShowBar',
3997
4286
  label: 'Mostrar barra de sentimento',
@@ -4362,6 +4651,48 @@ const filterInlinePipelineStatusProperties = [
4362
4651
  group: 'Aparencia',
4363
4652
  hint: 'Cores fallback quando a opcao nao informar color.',
4364
4653
  },
4654
+ {
4655
+ name: 'pipelineGradientLowColor',
4656
+ label: 'Gradiente pipeline (inicio)',
4657
+ editorType: 'color',
4658
+ group: 'Aparencia',
4659
+ hint: 'Cor inicial do gradiente fallback da barra/segmentos.',
4660
+ validators: [
4661
+ gradientColorStopValidator({
4662
+ label: 'Gradiente pipeline (inicio)',
4663
+ compareWith: [{ field: 'pipelineGradientMidColor', label: 'Gradiente pipeline (meio)' }],
4664
+ }),
4665
+ ],
4666
+ },
4667
+ {
4668
+ name: 'pipelineGradientMidColor',
4669
+ label: 'Gradiente pipeline (meio)',
4670
+ editorType: 'color',
4671
+ group: 'Aparencia',
4672
+ hint: 'Cor intermediaria do gradiente fallback da barra/segmentos.',
4673
+ validators: [
4674
+ gradientColorStopValidator({
4675
+ label: 'Gradiente pipeline (meio)',
4676
+ compareWith: [
4677
+ { field: 'pipelineGradientLowColor', label: 'Gradiente pipeline (inicio)' },
4678
+ { field: 'pipelineGradientHighColor', label: 'Gradiente pipeline (fim)' },
4679
+ ],
4680
+ }),
4681
+ ],
4682
+ },
4683
+ {
4684
+ name: 'pipelineGradientHighColor',
4685
+ label: 'Gradiente pipeline (fim)',
4686
+ editorType: 'color',
4687
+ group: 'Aparencia',
4688
+ hint: 'Cor final do gradiente fallback da barra/segmentos.',
4689
+ validators: [
4690
+ gradientColorStopValidator({
4691
+ label: 'Gradiente pipeline (fim)',
4692
+ compareWith: [{ field: 'pipelineGradientMidColor', label: 'Gradiente pipeline (meio)' }],
4693
+ }),
4694
+ ],
4695
+ },
4365
4696
  {
4366
4697
  name: 'pipelineEmptyStateText',
4367
4698
  label: 'Texto de estado vazio',
@@ -4542,6 +4873,48 @@ const filterInlineRatingProperties = [
4542
4873
  group: 'Aparência',
4543
4874
  hint: 'Cor para estrelas de notas altas (fallback: verde).',
4544
4875
  },
4876
+ {
4877
+ name: 'ratingGradientLowColor',
4878
+ label: 'Gradiente estrelas (inicio)',
4879
+ editorType: 'color',
4880
+ group: 'Aparência',
4881
+ hint: 'Cor inicial do gradiente aplicado na escala de estrelas.',
4882
+ validators: [
4883
+ gradientColorStopValidator({
4884
+ label: 'Gradiente estrelas (inicio)',
4885
+ compareWith: [{ field: 'ratingGradientMidColor', label: 'Gradiente estrelas (meio)' }],
4886
+ }),
4887
+ ],
4888
+ },
4889
+ {
4890
+ name: 'ratingGradientMidColor',
4891
+ label: 'Gradiente estrelas (meio)',
4892
+ editorType: 'color',
4893
+ group: 'Aparência',
4894
+ hint: 'Cor intermediaria do gradiente aplicado na escala de estrelas.',
4895
+ validators: [
4896
+ gradientColorStopValidator({
4897
+ label: 'Gradiente estrelas (meio)',
4898
+ compareWith: [
4899
+ { field: 'ratingGradientLowColor', label: 'Gradiente estrelas (inicio)' },
4900
+ { field: 'ratingGradientHighColor', label: 'Gradiente estrelas (fim)' },
4901
+ ],
4902
+ }),
4903
+ ],
4904
+ },
4905
+ {
4906
+ name: 'ratingGradientHighColor',
4907
+ label: 'Gradiente estrelas (fim)',
4908
+ editorType: 'color',
4909
+ group: 'Aparência',
4910
+ hint: 'Cor final do gradiente aplicado na escala de estrelas.',
4911
+ validators: [
4912
+ gradientColorStopValidator({
4913
+ label: 'Gradiente estrelas (fim)',
4914
+ compareWith: [{ field: 'ratingGradientMidColor', label: 'Gradiente estrelas (meio)' }],
4915
+ }),
4916
+ ],
4917
+ },
4545
4918
  {
4546
4919
  name: 'ratingBadgeColor',
4547
4920
  label: 'Cor ícone badges',
@@ -4735,6 +5108,48 @@ const filterInlineScorePriorityProperties = [
4735
5108
  group: 'Aparencia',
4736
5109
  hint: 'Cores usadas quando uma faixa nao informa color.',
4737
5110
  },
5111
+ {
5112
+ name: 'scoreGradientLowColor',
5113
+ label: 'Gradiente score (inicio)',
5114
+ editorType: 'color',
5115
+ group: 'Aparencia',
5116
+ hint: 'Cor inicial do gradiente fallback da trilha.',
5117
+ validators: [
5118
+ gradientColorStopValidator({
5119
+ label: 'Gradiente score (inicio)',
5120
+ compareWith: [{ field: 'scoreGradientMidColor', label: 'Gradiente score (meio)' }],
5121
+ }),
5122
+ ],
5123
+ },
5124
+ {
5125
+ name: 'scoreGradientMidColor',
5126
+ label: 'Gradiente score (meio)',
5127
+ editorType: 'color',
5128
+ group: 'Aparencia',
5129
+ hint: 'Cor intermediaria do gradiente fallback da trilha.',
5130
+ validators: [
5131
+ gradientColorStopValidator({
5132
+ label: 'Gradiente score (meio)',
5133
+ compareWith: [
5134
+ { field: 'scoreGradientLowColor', label: 'Gradiente score (inicio)' },
5135
+ { field: 'scoreGradientHighColor', label: 'Gradiente score (fim)' },
5136
+ ],
5137
+ }),
5138
+ ],
5139
+ },
5140
+ {
5141
+ name: 'scoreGradientHighColor',
5142
+ label: 'Gradiente score (fim)',
5143
+ editorType: 'color',
5144
+ group: 'Aparencia',
5145
+ hint: 'Cor final do gradiente fallback da trilha.',
5146
+ validators: [
5147
+ gradientColorStopValidator({
5148
+ label: 'Gradiente score (fim)',
5149
+ compareWith: [{ field: 'scoreGradientMidColor', label: 'Gradiente score (meio)' }],
5150
+ }),
5151
+ ],
5152
+ },
4738
5153
  {
4739
5154
  name: 'scoreValueFallbackColor',
4740
5155
  label: 'Cor fallback valor',