@messagevisor/catalog 0.7.0 → 0.9.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.
@@ -756,6 +756,48 @@ function FormatRowsTable(props: {
756
756
  );
757
757
  }
758
758
 
759
+ function renderFormatSourceBadge(row: FormatRow) {
760
+ if (row.source === "inherited" && row.from) {
761
+ return (
762
+ <LabelValueBadge
763
+ label="inherited from"
764
+ value={row.from}
765
+ to={getEntityRoute("locale", row.from, setKey)}
766
+ tone="inheritance"
767
+ compact
768
+ />
769
+ );
770
+ }
771
+
772
+ if (row.source === "target") {
773
+ return <LabelValueBadge label="from" value="target" tone="neutral" compact />;
774
+ }
775
+
776
+ return null;
777
+ }
778
+
779
+ function renderFormatSourceMeta(row: FormatRow) {
780
+ if (row.source === "inherited" && row.from) {
781
+ return (
782
+ <div className="text-[10px] font-normal leading-snug text-faint">
783
+ Inherited from{" "}
784
+ <Link
785
+ to={getEntityRoute("locale", row.from, setKey)}
786
+ className="font-medium text-muted hover:text-primary hover:underline"
787
+ >
788
+ {row.from}
789
+ </Link>
790
+ </div>
791
+ );
792
+ }
793
+
794
+ if (row.source === "target") {
795
+ return <div className="text-[10px] font-normal leading-snug text-faint">Target override</div>;
796
+ }
797
+
798
+ return null;
799
+ }
800
+
759
801
  /** Plain text in the cell. Param stays monospace for paths. */
760
802
  function renderSplitSegment(segment: string, role: "type" | "style" | "param") {
761
803
  const body = segmentBody(segment);
@@ -776,6 +818,17 @@ function FormatRowsTable(props: {
776
818
  );
777
819
  }
778
820
 
821
+ function renderSplitStyleCellContent(plan: FormatSplitRowPlan) {
822
+ const sourceMeta = renderFormatSourceMeta(plan.row);
823
+
824
+ return (
825
+ <div className="flex min-w-0 flex-col items-start gap-1.5">
826
+ <div className="w-full min-w-0">{renderSplitSegment(plan.parts.style, "style")}</div>
827
+ {sourceMeta}
828
+ </div>
829
+ );
830
+ }
831
+
779
832
  function bandSurfaceClass(band: number) {
780
833
  return band % 2 === 0 ? "bg-surface" : "bg-elevated/[0.2]";
781
834
  }
@@ -801,8 +854,7 @@ function FormatRowsTable(props: {
801
854
 
802
855
  function renderValueColumn(row: FormatRow, bandAndPaddingClass: string) {
803
856
  const valueText = formatValue(row.value);
804
- const showInheritedBadge = row.source === "inherited" && Boolean(row.from);
805
- const showTargetBadge = row.source === "target";
857
+ const badge = splitPath ? null : renderFormatSourceBadge(row);
806
858
 
807
859
  return (
808
860
  <td className={[bandAndPaddingClass, formatSplitCellBorderClass("value")].join(" ")}>
@@ -815,21 +867,8 @@ function FormatRowsTable(props: {
815
867
  >
816
868
  {highlight ? <SearchHighlight text={valueText} query={highlightNeedle} /> : valueText}
817
869
  </div>
818
- {(showInheritedBadge || showTargetBadge) && (
819
- <div className="flex shrink-0 flex-col items-end justify-center gap-1">
820
- {showInheritedBadge && row.from ? (
821
- <LabelValueBadge
822
- label="inherited from"
823
- value={row.from}
824
- to={getEntityRoute("locale", row.from, setKey)}
825
- tone="inheritance"
826
- compact
827
- />
828
- ) : null}
829
- {showTargetBadge ? (
830
- <LabelValueBadge label="from" value="target" tone="neutral" compact />
831
- ) : null}
832
- </div>
870
+ {badge && (
871
+ <div className="flex shrink-0 flex-col items-end justify-center gap-1">{badge}</div>
833
872
  )}
834
873
  </div>
835
874
  </td>
@@ -896,9 +935,9 @@ function FormatRowsTable(props: {
896
935
  </>
897
936
  ) : (
898
937
  <>
899
- <col className="min-w-0 w-[22%]" />
900
- <col className="min-w-0 w-[36%]" />
901
- <col className="min-w-0 w-[42%]" />
938
+ <col className="min-w-0 w-[28%]" />
939
+ <col className="min-w-0 w-[32%]" />
940
+ <col className="min-w-0 w-[40%]" />
902
941
  </>
903
942
  )
904
943
  ) : showExampleColumn ? (
@@ -912,9 +951,9 @@ function FormatRowsTable(props: {
912
951
  ) : (
913
952
  <>
914
953
  <col className="min-w-0 w-[12%]" />
915
- <col className="min-w-0 w-[18%]" />
916
- <col className="min-w-0 w-[32%]" />
917
- <col className="min-w-0 w-[38%]" />
954
+ <col className="min-w-0 w-[24%]" />
955
+ <col className="min-w-0 w-[28%]" />
956
+ <col className="min-w-0 w-[36%]" />
918
957
  </>
919
958
  )}
920
959
  </colgroup>
@@ -1003,7 +1042,7 @@ function FormatRowsTable(props: {
1003
1042
  formatSplitCellBorderClass("style"),
1004
1043
  ].join(" ")}
1005
1044
  >
1006
- {renderSplitSegment(plan.parts.style, "style")}
1045
+ {renderSplitStyleCellContent(plan)}
1007
1046
  </td>
1008
1047
  ) : null}
1009
1048
  {renderSplitExampleColumn(plan, bandClass)}