_border.scss 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /* ==================
  2. 边框
  3. ==================== */
  4. /* -- 实线 -- */
  5. .border {
  6. overflow: initial !important;
  7. @at-root [class*='border'],
  8. [class*='dashed'] {
  9. position: relative;
  10. &.dline {
  11. --ui-Border: var(--ui-BG-3);
  12. }
  13. &::after {
  14. content: ' ';
  15. width: 200%;
  16. height: 200%;
  17. position: absolute;
  18. z-index: 0;
  19. top: 0;
  20. left: 0;
  21. transform: scale(0.5);
  22. transform-origin: 0 0;
  23. pointer-events: none;
  24. box-sizing: border-box;
  25. border-radius: inherit;
  26. }
  27. &.radius::after {
  28. border-radius: calc(#{$radius} * 2);
  29. }
  30. &.round::after {
  31. border-radius: #{$round-pill};
  32. }
  33. }
  34. &::after {
  35. border: 1px solid var(--ui-Border);
  36. }
  37. &s::after {
  38. border: 4rpx solid var(--ui-Border);
  39. }
  40. &ss::after {
  41. border: 8rpx solid var(--ui-Border);
  42. }
  43. @each $value in (top, right, bottom, left) {
  44. &-#{$value}::after {
  45. border-#{$value}: 1px solid var(--ui-Border);
  46. }
  47. &s-#{$value}::after {
  48. border-#{$value}: 4rpx solid var(--ui-Border);
  49. }
  50. &ss-#{$value}::after {
  51. border-#{$value}: 8rpx solid var(--ui-Border);
  52. }
  53. }
  54. }
  55. /* -- 虚线 -- */
  56. .dashed {
  57. &::after {
  58. border: 4rpx dashed var(--ui-Border);
  59. }
  60. &s::after {
  61. border: 6rpx dashed var(--ui-Border);
  62. }
  63. @each $value in (top, right, bottom, left) {
  64. &-#{$value}::after {
  65. border-#{$value}: 4rpx dashed var(--ui-Border);
  66. }
  67. &s-#{$value}::after {
  68. border-#{$value}: 6rpx dashed var(--ui-Border);
  69. }
  70. }
  71. }
  72. @each $color, $value in map-merge($colors, map-merge($darks, $grays)) {
  73. .border-#{$color}::after,
  74. .border-#{$color}[class*='-shine']::before {
  75. border-color: $value !important;
  76. }
  77. }
  78. @each $value in (a, b, c, d, e) {
  79. .main-#{$value}-border::after,
  80. .main-#{$value}-border[class*='-shine']::before {
  81. border-color: var(--main-#{$value}) !important;
  82. }
  83. }
  84. .dashed-shine,
  85. .dasheds-shine {
  86. position: relative;
  87. overflow: hidden;
  88. &::after,
  89. &::before {
  90. border-style: dashed;
  91. border-color: var(--ui-Border);
  92. animation: shineafter 1s infinite linear;
  93. width: calc(200% + 40px);
  94. height: 200%;
  95. border-width: 2px 0;
  96. }
  97. &::before {
  98. content: ' ';
  99. position: absolute;
  100. transform: scale(0.5);
  101. transform-origin: 0 0;
  102. pointer-events: none;
  103. box-sizing: border-box;
  104. animation: shinebefore 1s infinite linear;
  105. width: 200%;
  106. height: calc(200% + 40px);
  107. border-width: 0 2px;
  108. }
  109. }
  110. .dasheds-shine {
  111. &::after,
  112. &::before {
  113. border-width: 4px 0;
  114. }
  115. &::before {
  116. border-width: 0 4px;
  117. }
  118. }
  119. @keyframes shineafter {
  120. 0% {
  121. top: 0;
  122. left: -22px;
  123. }
  124. 100% {
  125. top: 0px;
  126. left: 0px;
  127. }
  128. }
  129. @keyframes shinebefore {
  130. 0% {
  131. top: -22px;
  132. left: 0;
  133. }
  134. 100% {
  135. top: 0px;
  136. left: 0px;
  137. }
  138. }