@seanyeh77/ui 0.48.2 → 0.49.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.
package/dist/styles.css CHANGED
@@ -686,6 +686,105 @@ label:has(> .ui-switch) {
686
686
  stroke: var(--surface);
687
687
  stroke-width: 2;
688
688
  }
689
+
690
+ /* Text on a data fill (ZoneMap zones, FloorPlan labels): the pick of textOn() for each step, per theme, so it follows a
691
+ theme switch without a render. */
692
+ :is(.ui-zone, .ui-fp-label)[data-fill='heat-1'] {
693
+ color: #ffffff;
694
+ }
695
+ :is(.ui-zone, .ui-fp-label)[data-fill='heat-2'] {
696
+ color: #171512;
697
+ }
698
+ :is(.ui-zone, .ui-fp-label)[data-fill='heat-3'] {
699
+ color: #171512;
700
+ }
701
+ :is(.ui-zone, .ui-fp-label)[data-fill='heat-4'] {
702
+ color: #171512;
703
+ }
704
+ :is(.ui-zone, .ui-fp-label)[data-fill='heat-5'] {
705
+ color: #171512;
706
+ }
707
+ :is(.ui-zone, .ui-fp-label)[data-fill='heat-6'] {
708
+ color: #171512;
709
+ }
710
+ :is(.ui-zone, .ui-fp-label)[data-fill='heat-7'] {
711
+ color: #ffffff;
712
+ }
713
+ :is(.ui-zone, .ui-fp-label)[data-fill='diverge-neg-strong'] {
714
+ color: #ffffff;
715
+ }
716
+ :is(.ui-zone, .ui-fp-label)[data-fill='diverge-neg'] {
717
+ color: #171512;
718
+ }
719
+ :is(.ui-zone, .ui-fp-label)[data-fill='diverge-zero'] {
720
+ color: #171512;
721
+ }
722
+ :is(.ui-zone, .ui-fp-label)[data-fill='diverge-pos'] {
723
+ color: #171512;
724
+ }
725
+ :is(.ui-zone, .ui-fp-label)[data-fill='diverge-pos-strong'] {
726
+ color: #ffffff;
727
+ }
728
+ :is(.ui-zone, .ui-fp-label)[data-fill='chart-1'] {
729
+ color: #ffffff;
730
+ }
731
+ :is(.ui-zone, .ui-fp-label)[data-fill='chart-2'] {
732
+ color: #171512;
733
+ }
734
+ :is(.ui-zone, .ui-fp-label)[data-fill='chart-3'] {
735
+ color: #171512;
736
+ }
737
+ :is(.ui-zone, .ui-fp-label)[data-fill='chart-4'] {
738
+ color: #171512;
739
+ }
740
+ [data-theme='dark'] :is(.ui-zone, .ui-fp-label)[data-fill='heat-1'] {
741
+ color: #ffffff;
742
+ }
743
+ [data-theme='dark'] :is(.ui-zone, .ui-fp-label)[data-fill='heat-2'] {
744
+ color: #171512;
745
+ }
746
+ [data-theme='dark'] :is(.ui-zone, .ui-fp-label)[data-fill='heat-3'] {
747
+ color: #171512;
748
+ }
749
+ [data-theme='dark'] :is(.ui-zone, .ui-fp-label)[data-fill='heat-4'] {
750
+ color: #ffffff;
751
+ }
752
+ [data-theme='dark'] :is(.ui-zone, .ui-fp-label)[data-fill='heat-5'] {
753
+ color: #171512;
754
+ }
755
+ [data-theme='dark'] :is(.ui-zone, .ui-fp-label)[data-fill='heat-6'] {
756
+ color: #171512;
757
+ }
758
+ [data-theme='dark'] :is(.ui-zone, .ui-fp-label)[data-fill='heat-7'] {
759
+ color: #171512;
760
+ }
761
+ [data-theme='dark'] :is(.ui-zone, .ui-fp-label)[data-fill='diverge-neg-strong'] {
762
+ color: #171512;
763
+ }
764
+ [data-theme='dark'] :is(.ui-zone, .ui-fp-label)[data-fill='diverge-neg'] {
765
+ color: #171512;
766
+ }
767
+ [data-theme='dark'] :is(.ui-zone, .ui-fp-label)[data-fill='diverge-zero'] {
768
+ color: #ffffff;
769
+ }
770
+ [data-theme='dark'] :is(.ui-zone, .ui-fp-label)[data-fill='diverge-pos'] {
771
+ color: #171512;
772
+ }
773
+ [data-theme='dark'] :is(.ui-zone, .ui-fp-label)[data-fill='diverge-pos-strong'] {
774
+ color: #171512;
775
+ }
776
+ [data-theme='dark'] :is(.ui-zone, .ui-fp-label)[data-fill='chart-1'] {
777
+ color: #171512;
778
+ }
779
+ [data-theme='dark'] :is(.ui-zone, .ui-fp-label)[data-fill='chart-2'] {
780
+ color: #171512;
781
+ }
782
+ [data-theme='dark'] :is(.ui-zone, .ui-fp-label)[data-fill='chart-3'] {
783
+ color: #171512;
784
+ }
785
+ [data-theme='dark'] :is(.ui-zone, .ui-fp-label)[data-fill='chart-4'] {
786
+ color: #171512;
787
+ }
689
788
  /* Link: accent text, always underlined (a link in a sentence is told apart by more than its colour), a thin line
690
789
  that thickens on hover. Bare <a> in Markdown or older content gets the same look from base.css. */
691
790
  .ui-textlink {
@@ -705,6 +804,60 @@ label:has(> .ui-switch) {
705
804
  margin-left: 2px;
706
805
  vertical-align: -2px;
707
806
  }
807
+ .ui-tooltip {
808
+ padding: 6px 10px;
809
+ border-radius: var(--radius-chip);
810
+ background: var(--ink);
811
+ color: var(--bg);
812
+ font-size: var(--text-small);
813
+ font-weight: 600;
814
+ line-height: 1.4;
815
+ white-space: nowrap;
816
+ pointer-events: none;
817
+ animation: ui-pop-scale var(--dur-tooltip) var(--ease-spring) both;
818
+ }
819
+ .ui-tooltip {
820
+ transform-origin: var(--transform-origin);
821
+ }
822
+ /* Closing: no animation left to wait for, so the popup leaves at once (an entrance still running kept it on screen). */
823
+ .ui-tooltip[data-ending-style] {
824
+ animation: none;
825
+ }
826
+ .ui-tooltip.is-wrap {
827
+ max-width: min(360px, calc(100vw - 2 * var(--space-3)));
828
+ font-weight: 400;
829
+ line-height: 20px;
830
+ white-space: normal;
831
+ }
832
+ .ui-tooltip-arrow {
833
+ position: absolute;
834
+ width: 8px;
835
+ height: 8px;
836
+ background: inherit;
837
+ transform: rotate(45deg);
838
+ }
839
+ .ui-tooltip[data-side='top'] .ui-tooltip-arrow {
840
+ bottom: -4px;
841
+ }
842
+ .ui-tooltip[data-side='bottom'] .ui-tooltip-arrow {
843
+ top: -4px;
844
+ }
845
+ .ui-tooltip[data-side='right'] .ui-tooltip-arrow {
846
+ left: -4px;
847
+ }
848
+ .ui-tooltip[data-side='left'] .ui-tooltip-arrow {
849
+ right: -4px;
850
+ }
851
+
852
+ @media (prefers-reduced-motion: reduce) {
853
+ .ui-tooltip {
854
+ animation: ui-pop-fade var(--dur-hover) ease both;
855
+ }
856
+ }
857
+ .ui-tooltip-positioner {
858
+ z-index: var(--z-tooltip);
859
+ pointer-events: none;
860
+ }
708
861
  /* Inline code */
709
862
  .ui-code {
710
863
  font-family: var(--font-mono);
@@ -765,6 +918,28 @@ label:has(> .ui-switch) {
765
918
  font-size: var(--text-small);
766
919
  white-space: nowrap;
767
920
  }
921
+ /* A location in a phone card (DataTable under 600 px) is no wider than the card's value column: the folders are cut
922
+ with 「…」 first and the file name and line stay (codemap/…/tshelper.ts:42); a file name wider than the column is
923
+ cut at its end. InlineCode shows the whole path in a Tooltip while it is cut. Desktop tables and text keep the
924
+ plain inline link. */
925
+ @media (max-width: 599px) {
926
+ .ui-dt-body .ui-code.is-link.is-location {
927
+ display: inline-flex;
928
+ max-width: 100%;
929
+ }
930
+ .ui-dt-body .ui-code.is-link.is-location > .ui-code-dir {
931
+ flex: 0 1 auto;
932
+ min-width: 1ch;
933
+ overflow: hidden;
934
+ text-overflow: ellipsis;
935
+ }
936
+ .ui-dt-body .ui-code.is-link.is-location > .ui-code-file {
937
+ flex: 0 0 auto;
938
+ max-width: 100%;
939
+ overflow: hidden;
940
+ text-overflow: ellipsis;
941
+ }
942
+ }
768
943
  /* In a table cell a location is often a target on its own, beside the row's other links: its box is about 17 px of
769
944
  13 px text. Vertical padding on an inline box grows the box it is clicked by to at least 24 px (WCAG 2.5.8) and
770
945
  moves neither the line nor the row; there is no background, so nothing shows. Desktop rows only: in a phone card
@@ -2175,60 +2350,6 @@ div.ui-toast[role='status'] {
2175
2350
  font-weight: 700;
2176
2351
  fill: var(--ink);
2177
2352
  }
2178
- .ui-tooltip {
2179
- padding: 6px 10px;
2180
- border-radius: var(--radius-chip);
2181
- background: var(--ink);
2182
- color: var(--bg);
2183
- font-size: var(--text-small);
2184
- font-weight: 600;
2185
- line-height: 1.4;
2186
- white-space: nowrap;
2187
- pointer-events: none;
2188
- animation: ui-pop-scale var(--dur-tooltip) var(--ease-spring) both;
2189
- }
2190
- .ui-tooltip {
2191
- transform-origin: var(--transform-origin);
2192
- }
2193
- /* Closing: no animation left to wait for, so the popup leaves at once (an entrance still running kept it on screen). */
2194
- .ui-tooltip[data-ending-style] {
2195
- animation: none;
2196
- }
2197
- .ui-tooltip.is-wrap {
2198
- max-width: min(360px, calc(100vw - 2 * var(--space-3)));
2199
- font-weight: 400;
2200
- line-height: 20px;
2201
- white-space: normal;
2202
- }
2203
- .ui-tooltip-arrow {
2204
- position: absolute;
2205
- width: 8px;
2206
- height: 8px;
2207
- background: inherit;
2208
- transform: rotate(45deg);
2209
- }
2210
- .ui-tooltip[data-side='top'] .ui-tooltip-arrow {
2211
- bottom: -4px;
2212
- }
2213
- .ui-tooltip[data-side='bottom'] .ui-tooltip-arrow {
2214
- top: -4px;
2215
- }
2216
- .ui-tooltip[data-side='right'] .ui-tooltip-arrow {
2217
- left: -4px;
2218
- }
2219
- .ui-tooltip[data-side='left'] .ui-tooltip-arrow {
2220
- right: -4px;
2221
- }
2222
-
2223
- @media (prefers-reduced-motion: reduce) {
2224
- .ui-tooltip {
2225
- animation: ui-pop-fade var(--dur-hover) ease both;
2226
- }
2227
- }
2228
- .ui-tooltip-positioner {
2229
- z-index: var(--z-tooltip);
2230
- pointer-events: none;
2231
- }
2232
2353
  .ui-iconbtn {
2233
2354
  display: inline-flex;
2234
2355
  align-items: center;
@@ -9587,103 +9708,6 @@ button.ui-md-link.is-row {
9587
9708
  background: CanvasText;
9588
9709
  }
9589
9710
  }
9590
- .ui-zone[data-fill='heat-1'] {
9591
- color: #ffffff;
9592
- }
9593
- .ui-zone[data-fill='heat-2'] {
9594
- color: #171512;
9595
- }
9596
- .ui-zone[data-fill='heat-3'] {
9597
- color: #171512;
9598
- }
9599
- .ui-zone[data-fill='heat-4'] {
9600
- color: #171512;
9601
- }
9602
- .ui-zone[data-fill='heat-5'] {
9603
- color: #171512;
9604
- }
9605
- .ui-zone[data-fill='heat-6'] {
9606
- color: #171512;
9607
- }
9608
- .ui-zone[data-fill='heat-7'] {
9609
- color: #ffffff;
9610
- }
9611
- .ui-zone[data-fill='diverge-neg-strong'] {
9612
- color: #ffffff;
9613
- }
9614
- .ui-zone[data-fill='diverge-neg'] {
9615
- color: #171512;
9616
- }
9617
- .ui-zone[data-fill='diverge-zero'] {
9618
- color: #171512;
9619
- }
9620
- .ui-zone[data-fill='diverge-pos'] {
9621
- color: #171512;
9622
- }
9623
- .ui-zone[data-fill='diverge-pos-strong'] {
9624
- color: #ffffff;
9625
- }
9626
- .ui-zone[data-fill='chart-1'] {
9627
- color: #ffffff;
9628
- }
9629
- .ui-zone[data-fill='chart-2'] {
9630
- color: #171512;
9631
- }
9632
- .ui-zone[data-fill='chart-3'] {
9633
- color: #171512;
9634
- }
9635
- .ui-zone[data-fill='chart-4'] {
9636
- color: #171512;
9637
- }
9638
- [data-theme='dark'] .ui-zone[data-fill='heat-1'] {
9639
- color: #ffffff;
9640
- }
9641
- [data-theme='dark'] .ui-zone[data-fill='heat-2'] {
9642
- color: #171512;
9643
- }
9644
- [data-theme='dark'] .ui-zone[data-fill='heat-3'] {
9645
- color: #171512;
9646
- }
9647
- [data-theme='dark'] .ui-zone[data-fill='heat-4'] {
9648
- color: #ffffff;
9649
- }
9650
- [data-theme='dark'] .ui-zone[data-fill='heat-5'] {
9651
- color: #171512;
9652
- }
9653
- [data-theme='dark'] .ui-zone[data-fill='heat-6'] {
9654
- color: #171512;
9655
- }
9656
- [data-theme='dark'] .ui-zone[data-fill='heat-7'] {
9657
- color: #171512;
9658
- }
9659
- [data-theme='dark'] .ui-zone[data-fill='diverge-neg-strong'] {
9660
- color: #171512;
9661
- }
9662
- [data-theme='dark'] .ui-zone[data-fill='diverge-neg'] {
9663
- color: #171512;
9664
- }
9665
- [data-theme='dark'] .ui-zone[data-fill='diverge-zero'] {
9666
- color: #ffffff;
9667
- }
9668
- [data-theme='dark'] .ui-zone[data-fill='diverge-pos'] {
9669
- color: #171512;
9670
- }
9671
- [data-theme='dark'] .ui-zone[data-fill='diverge-pos-strong'] {
9672
- color: #171512;
9673
- }
9674
- [data-theme='dark'] .ui-zone[data-fill='chart-1'] {
9675
- color: #171512;
9676
- }
9677
- [data-theme='dark'] .ui-zone[data-fill='chart-2'] {
9678
- color: #171512;
9679
- }
9680
- [data-theme='dark'] .ui-zone[data-fill='chart-3'] {
9681
- color: #171512;
9682
- }
9683
- [data-theme='dark'] .ui-zone[data-fill='chart-4'] {
9684
- color: #171512;
9685
- }
9686
-
9687
9711
  /* ZoneMap: zones on a grid, filled by value. Name 16 px and state on one line, the figure 31 px with a 16 px unit,
9688
9712
  one 13 px detail line. Selected: an ink outline 4 px outside; attention: a 4 px warning or danger border. */
9689
9713
  .ui-zonemap {
@@ -9785,6 +9809,271 @@ button.ui-md-link.is-row {
9785
9809
  .ui-zone.is-empty .ui-zone-name {
9786
9810
  color: var(--ink);
9787
9811
  }
9812
+ /* FloorPlan: zones with any outline in an SVG, labels as HTML on top (the same size at every zoom). Fills, the 4 px
9813
+ attention border, the forecast stripes, the selection outline (ink, 2 px, 4 px outside) and the label type follow
9814
+ ZoneMap. */
9815
+ .ui-floorplan {
9816
+ display: flex;
9817
+ flex-direction: column;
9818
+ gap: var(--space-3);
9819
+ min-width: 0;
9820
+ }
9821
+ .ui-floorplan.is-fill {
9822
+ flex: 1 1 auto;
9823
+ min-height: 0;
9824
+ }
9825
+ .ui-fp-box {
9826
+ position: relative;
9827
+ width: 100%;
9828
+ min-height: 240px;
9829
+ max-height: 640px;
9830
+ overflow: hidden;
9831
+ border-radius: var(--radius-md);
9832
+ }
9833
+ .ui-floorplan.is-fill .ui-fp-box {
9834
+ flex: 1 1 auto;
9835
+ max-height: none;
9836
+ }
9837
+ .ui-fp-svg {
9838
+ position: absolute;
9839
+ inset: 0;
9840
+ display: block;
9841
+ width: 100%;
9842
+ height: 100%;
9843
+ touch-action: none;
9844
+ -webkit-user-select: none;
9845
+ user-select: none;
9846
+ }
9847
+ .ui-fp-shell {
9848
+ fill: var(--surface-sub);
9849
+ stroke: var(--line-strong);
9850
+ stroke-width: 1.5px;
9851
+ vector-effect: non-scaling-stroke;
9852
+ }
9853
+ .ui-fp-zone {
9854
+ cursor: pointer;
9855
+ outline: none;
9856
+ }
9857
+ .ui-fp-fill {
9858
+ stroke: var(--surface);
9859
+ stroke-width: 1.5px;
9860
+ stroke-linejoin: round;
9861
+ vector-effect: non-scaling-stroke;
9862
+ }
9863
+ .ui-fp-zone.is-warning .ui-fp-tone {
9864
+ stroke: var(--warning);
9865
+ }
9866
+ .ui-fp-zone.is-danger .ui-fp-tone {
9867
+ stroke: var(--danger);
9868
+ }
9869
+ .ui-fp-stripe {
9870
+ fill: var(--forecast-stripe);
9871
+ }
9872
+ .ui-fp-empty {
9873
+ fill: transparent;
9874
+ stroke: var(--line-strong);
9875
+ stroke-width: 1px;
9876
+ stroke-dasharray: 4 3;
9877
+ vector-effect: non-scaling-stroke;
9878
+ }
9879
+ .ui-fp-edge {
9880
+ fill: none;
9881
+ stroke: var(--ink-muted);
9882
+ stroke-width: 1.5px;
9883
+ stroke-dasharray: 5 4;
9884
+ vector-effect: non-scaling-stroke;
9885
+ pointer-events: none;
9886
+ }
9887
+ .ui-fp-group {
9888
+ fill: var(--ink-muted);
9889
+ pointer-events: none;
9890
+ }
9891
+
9892
+ /* Labels: centred on the zone's label point, sized by FloorPlan (width and height set inline). */
9893
+ .ui-fp-labels {
9894
+ position: absolute;
9895
+ inset: 0;
9896
+ pointer-events: none;
9897
+ }
9898
+ .ui-fp-labels > * {
9899
+ position: absolute;
9900
+ box-sizing: border-box;
9901
+ overflow: hidden;
9902
+ white-space: nowrap;
9903
+ }
9904
+ .ui-fp-label {
9905
+ display: flex;
9906
+ flex-direction: column;
9907
+ align-items: center;
9908
+ justify-content: center;
9909
+ color: var(--ink);
9910
+ text-align: center;
9911
+ }
9912
+ .ui-fp-name {
9913
+ max-width: 100%;
9914
+ overflow: hidden;
9915
+ text-overflow: ellipsis;
9916
+ font-size: var(--text-body);
9917
+ font-weight: 600;
9918
+ line-height: 22px;
9919
+ }
9920
+ .ui-fp-value {
9921
+ font-family: var(--font-mono);
9922
+ font-size: var(--text-h3);
9923
+ font-weight: 700;
9924
+ line-height: 32px;
9925
+ font-variant-numeric: tabular-nums;
9926
+ }
9927
+ .ui-fp-unit {
9928
+ font-family: var(--font-sans);
9929
+ font-size: var(--text-body);
9930
+ font-weight: 500;
9931
+ }
9932
+ .ui-fp-state {
9933
+ font-size: var(--text-small);
9934
+ font-weight: 600;
9935
+ line-height: 20px;
9936
+ }
9937
+ .ui-fp-label.is-muted .ui-fp-name {
9938
+ font-size: var(--text-small);
9939
+ line-height: 20px;
9940
+ }
9941
+ .ui-fp-label.is-muted .ui-fp-value {
9942
+ font-size: var(--text-body);
9943
+ line-height: 22px;
9944
+ }
9945
+ .ui-fp-label.is-muted .ui-fp-unit {
9946
+ font-size: var(--text-small);
9947
+ }
9948
+ .ui-fp-label.is-empty .ui-fp-state {
9949
+ color: var(--ink-muted);
9950
+ font-weight: 400;
9951
+ }
9952
+ /* One line on a pill of its own ground: slender zones, and zones too small for the full label. */
9953
+ .ui-fp-pill {
9954
+ padding: 0 8px;
9955
+ border: 1px solid var(--line-strong);
9956
+ border-radius: var(--radius-full);
9957
+ background: var(--surface);
9958
+ color: var(--ink);
9959
+ font-size: var(--text-small);
9960
+ font-weight: 600;
9961
+ line-height: 22px;
9962
+ text-align: center;
9963
+ }
9964
+ .ui-fp-pill.is-empty {
9965
+ color: var(--ink-muted);
9966
+ }
9967
+ .ui-fp-num {
9968
+ font-family: var(--font-mono);
9969
+ font-variant-numeric: tabular-nums;
9970
+ }
9971
+ .ui-fp-group-name {
9972
+ padding: 0 6px;
9973
+ border-radius: var(--radius-xs);
9974
+ background: var(--surface);
9975
+ color: var(--ink-muted);
9976
+ font-size: var(--text-small);
9977
+ font-weight: 600;
9978
+ line-height: 22px;
9979
+ }
9980
+
9981
+ /* Tooltip: the look of Tooltip, beside the pointer (or the label point, for keyboard focus). */
9982
+ .ui-fp-tip {
9983
+ position: absolute;
9984
+ z-index: var(--z-raised);
9985
+ display: flex;
9986
+ flex-direction: column;
9987
+ max-width: 240px;
9988
+ padding: 6px 10px;
9989
+ border-radius: var(--radius-chip);
9990
+ background: var(--ink);
9991
+ color: var(--bg);
9992
+ font-size: var(--text-small);
9993
+ line-height: 20px;
9994
+ pointer-events: none;
9995
+ }
9996
+ .ui-fp-tip-name {
9997
+ font-weight: 600;
9998
+ }
9999
+
10000
+ .ui-fp-controls {
10001
+ position: absolute;
10002
+ right: var(--space-2);
10003
+ bottom: var(--space-2);
10004
+ display: flex;
10005
+ gap: var(--space-1);
10006
+ }
10007
+ .ui-fp-controls > * {
10008
+ background: var(--surface);
10009
+ }
10010
+
10011
+ /* Legend: the heat scale with its ends, the watch and limit marks, and a note when there are muted zones. */
10012
+ .ui-fp-legend {
10013
+ display: flex;
10014
+ flex-wrap: wrap;
10015
+ align-items: center;
10016
+ gap: var(--space-2) var(--space-4);
10017
+ color: var(--ink-muted);
10018
+ font-size: var(--text-small);
10019
+ line-height: 20px;
10020
+ }
10021
+ .ui-fp-scale {
10022
+ display: inline-flex;
10023
+ align-items: center;
10024
+ gap: var(--space-2);
10025
+ }
10026
+ .ui-fp-bar {
10027
+ position: relative;
10028
+ display: inline-flex;
10029
+ width: 168px;
10030
+ height: 12px;
10031
+ border-radius: var(--radius-xs);
10032
+ }
10033
+ .ui-fp-bar > span:not(.ui-fp-tick) {
10034
+ flex: 1;
10035
+ }
10036
+ .ui-fp-bar > span:first-child {
10037
+ border-radius: var(--radius-xs) 0 0 var(--radius-xs);
10038
+ }
10039
+ .ui-fp-bar > span:nth-child(7) {
10040
+ border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
10041
+ }
10042
+ .ui-fp-tick {
10043
+ position: absolute;
10044
+ top: -4px;
10045
+ width: 2px;
10046
+ height: 20px;
10047
+ margin-left: -1px;
10048
+ }
10049
+ .ui-fp-tick.is-warning,
10050
+ .ui-fp-key.is-warning::before {
10051
+ background: var(--warning);
10052
+ }
10053
+ .ui-fp-tick.is-danger,
10054
+ .ui-fp-key.is-danger::before {
10055
+ background: var(--danger);
10056
+ }
10057
+ .ui-fp-key {
10058
+ display: inline-flex;
10059
+ align-items: center;
10060
+ gap: 6px;
10061
+ }
10062
+ .ui-fp-key::before {
10063
+ content: '';
10064
+ width: 2px;
10065
+ height: 14px;
10066
+ }
10067
+ .ui-fp-key.is-muted::before {
10068
+ width: 14px;
10069
+ border-radius: 3px;
10070
+ background: color-mix(in srgb, var(--heat-4) 40%, var(--surface));
10071
+ box-shadow: inset 0 0 0 1px var(--line);
10072
+ }
10073
+ .ui-fp-pill .ui-fp-unit {
10074
+ font-size: inherit;
10075
+ font-weight: inherit;
10076
+ }
9788
10077
  /* EventTimeline: newest first; time, kind icon (no fill), what happened. */
9789
10078
  .ui-events {
9790
10079
  margin: 0;
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## 用法
4
4
 
5
- 資料用的顏色:圖表的類別色、熱度色階、差值發散色階,以及預測值的斜線紋理;全部有淺色與深色兩套,由 `tokens.css` 提供。用 LineChart、BarChart、ZoneMap 時已經套好;自己畫資料時讀這份。
5
+ 資料用的顏色:圖表的類別色、熱度色階、差值發散色階,以及預測值的斜線紋理;全部有淺色與深色兩套,由 `tokens.css` 提供。用 LineChart、BarChart、ZoneMap、FloorPlan 時已經套好;自己畫資料時讀這份。
6
6
 
7
7
  ```js
8
8
  h('div', { style: { background: 'var(--' + UI.heatToken(24.6, 20, 30) + ')', color: UI.textOn(UI.heatToken(24.6, 20, 30)) } }, '24.6 °C');
@@ -0,0 +1,43 @@
1
+ # FloorPlan
2
+
3
+ ## 用法
4
+
5
+ 多邊形平面圖:分區是任意外框(L 形、凹形、分成好幾塊、有洞),依數值填熱度色階,每區寫名稱、主數值和狀態,可以縮放平移。分區排在規則格線上時用 ZoneMap。
6
+
7
+ ```js
8
+ h(UI.FloorPlan, {
9
+ label: '機房平面圖',
10
+ value: sel,
11
+ onChange: setSel,
12
+ min: 20, max: 30, warn: 27, limit: 30,
13
+ groups: [{ id: 'north', name: '北側機櫃列' }],
14
+ zones: [
15
+ { id: 'a', name: '冷通道 A', value: 23.1, unit: '°C', outline: [[[[2, 2], [14, 2], [14, 8], [8, 8], [8, 14], [2, 14]]]], label: [5, 5] },
16
+ { id: 'f', name: '機櫃區 F', value: 29.6, unit: '°C', tone: 'danger', state: '超過上限', group: 'north', outline: [[[[16, 17], [26, 17], [26, 22], [16, 22]]]], label: [21, 19.5] },
17
+ { id: 'e', name: '走道 E', value: 22.4, unit: '°C', emphasis: 'muted', outline: [[[[16, 14], [38, 14], [38, 16], [16, 16]]]], label: [27, 15] },
18
+ ],
19
+ });
20
+ ```
21
+
22
+ - 分區的欄位和 ZoneMap 的 `Zone` 相同(`tone`、`state`、`forecast`、`detail`、`fill`、`value: null` 是沒有資料),`area` 換成 `outline` 和 `label`。
23
+ - `outline` 是 MultiPolygon,單位公尺,y 向上是北:`[多邊形][環][點][x, y]`,每個多邊形的第一個環是外框,其餘是洞。元件自己翻轉 y、算出視角。
24
+ - `label` 是標籤的位置,由呼叫端算好(例如內部離邊最遠的點),一定要在外框裡。
25
+ - 寬度小於 600 px 時圖很小,大部分標籤會被捨棄:旁邊附 DataTable 的清單檢視,列出同樣的分區。
26
+ - `warn`、`limit` 只畫在圖例上,數值由呼叫端給,元件不假設門檻。
27
+
28
+ ## 細節
29
+
30
+ - 標籤:在分區裡放得下時寫名稱(16 px 半粗)、主數值(25 px Geist Mono,單位 16 px)和狀態(13 px 半粗);外框包圍盒長寬比大於 4 的細長分區,或完整標籤放不下時,改用一行膠囊(13 px,`surface` 底);膠囊也會和別的標籤重疊時不顯示。標籤一律同樣大小,放大後放得下的就會出現。
31
+ - 標籤的優先序:primary 在 muted 之前,各自面積小的先;被捨棄的分區仍然有游標提示,也在 Tab 順序裡。
32
+ - `emphasis: 'muted'`:次要區域,填色是原色 40 % 混 `surface`,標籤 13 px 名稱加 16 px 數值,字用 `ink`;可以選,`tone` 的 4 px 內框和「⚠」照常顯示;螢幕閱讀器多念「次要」。有 muted 分區時圖例多一行「淡色=次要區域」。
33
+ - 填色、字色、4 px 注意內框、預測斜線、沒有資料的虛線框、數值和單位之間的空格,都和 ZoneMap 相同(見 `ui docs ZoneMap`)。
34
+ - 選取:`ink` 色 2 px 外框,在分區外 4 px。鍵盤焦點:`focus` 色 2 px 外框,緊貼分區外側,並顯示提示。
35
+ - `groups`:同一組的分區外面畫一圈 1.5 px `ink-muted` 細框(沿著整組的外形),左上角寫組名(13 px)。不計算也不顯示整組的數值。
36
+ - `shell`:建築外框,`surface-sub` 底加 `line-strong` 邊。`edges`:分區之間的邊界,1.5 px `ink-muted` 虛線。
37
+ - 縮放與平移:滾輪、雙指縮放、拖曳平移;右下角「放大」「縮小」「重設視角」;鍵盤在圖上(包括分區上)按 + − 縮放、方向鍵平移。最多放大 8 倍,全景時不能平移。按鈕和鍵盤的變化有 200 ms 的動畫,`prefers-reduced-motion` 時直接跳過去。拖曳超過 4 px 不算點選。
38
+ - 鍵盤:每個分區是按鈕,Tab 順序和標籤的優先序相同;Enter 或空白鍵選取(`aria-pressed`)。螢幕閱讀器念「機櫃區 F,29.6 °C,超過上限,進氣 27.9 °C」。沒有資料的分區不能選。
39
+ - 提示:滑鼠停在分區上或鍵盤聚焦時顯示名稱、數值、狀態、`detail`。
40
+ - 觸控:寬度小於 600 px 或觸控螢幕上,畫面上小於 48 px 的分區在標籤位置多一個 48 px 的圓形點擊範圍。圖上的手勢都交給地圖(`touch-action: none`),頁面要在圖外捲動。
41
+ - 大小:沒有 `fill` 時照外框的比例,高 240~640 px;放在 ConsoleLayout 的主視覺卡片裡時加 `fill`,撐滿卡片的高度(最少 240 px),和 ZoneMap 的 `fill` 相同。
42
+ - 標籤的寬度用固定的估算(中文 1 em、Geist Mono 0.6 em),網頁字型載入前後、伺服器渲染時排法都一樣。
43
+ - 30 個分區、每區 30 個點時,縮放與游標提示只重算標籤位置,路徑不重算。
@@ -28,7 +28,7 @@
28
28
  一段說明裡常常同時出現程式的名稱和它所在的檔案,例如「`VirtualRouter._sync_as` `harness/controller.py:540` 呼叫 …」。這兩種連結用 `look` 換成不同外觀,不再是兩個一樣的灰底底線塊:
29
29
 
30
30
  - `look="name"`:函式、類別、變數,點了跳到定義。強調文字色(`accent-text`)的 Geist Mono,周圍文字的 0.875 倍,沒有底色也沒有底線;滑過或鍵盤焦點時出現 1 px 底線(離文字 3 px),焦點另有和其他控制項一樣的 2 px `focus` 外框。
31
- - `look="location"`:檔案和行號。灰色(`ink-muted`)、13 px(次要文字的大小,比內文小一號),不斷行;滑過或焦點時變強調文字色加底線。
31
+ - `look="location"`:檔案和行號。灰色(`ink-muted`)、13 px(次要文字的大小,比內文小一號),不斷行;滑過或焦點時變強調文字色加底線。空間不夠時(DataTable 的手機卡片,值的那一欄比路徑窄)不超出,改用「…」截斷:先截資料夾,留下檔名和行號(`codemap/…/tshelper.ts:42`),檔名本身也放不下時截在檔名尾端;截斷時滑過、點一下或鍵盤焦點會用 Tooltip 顯示完整路徑,點擊照樣前往連結,螢幕閱讀器念的名稱仍是完整路徑。桌面的表格和句子裡維持原樣。
32
32
  - 兩種都一定要給 `href` 或 `onClick`,沒有的話 TypeScript 不會編譯:不指向任何地方的文字維持灰底(預設的 `look="chip"`)。
33
33
  - 深色模式下在表格的灰色列(`surface-sub`)上,文字色混入 25% 的 `ink`,對比維持 4.5:1 以上。
34
34