xjs.css 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. /* XJS library styles
  2. * This file centralizes all runtime UI CSS used by the library.
  3. * Currently includes: Layer popup (layer-*)
  4. */
  5. /* =========================
  6. Layer (layer-*)
  7. ========================= */
  8. .layer-overlay {
  9. position: fixed;
  10. top: 0;
  11. left: 0;
  12. width: 100%;
  13. height: 100%;
  14. background: rgba(0, 0, 0, 0.4);
  15. display: flex;
  16. justify-content: center;
  17. align-items: center;
  18. z-index: 1000;
  19. opacity: 0;
  20. transition: opacity 0.3s;
  21. }
  22. .layer-overlay.show {
  23. opacity: 1;
  24. }
  25. .layer-popup {
  26. background: #fff;
  27. border-radius: 8px;
  28. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  29. width: 32em;
  30. max-width: 90%;
  31. padding: 1.5em;
  32. display: flex;
  33. flex-direction: column;
  34. align-items: center;
  35. position: relative;
  36. z-index: 1;
  37. transform: scale(0.92);
  38. transition: transform 0.26s ease;
  39. font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  40. }
  41. .layer-overlay.show .layer-popup {
  42. transform: scale(1);
  43. }
  44. .layer-title {
  45. font-size: 1.8em;
  46. font-weight: 600;
  47. color: #333;
  48. margin: 0 0 0.5em;
  49. text-align: center;
  50. }
  51. .layer-content {
  52. font-size: 1.125em;
  53. color: #545454;
  54. margin-bottom: 1.5em;
  55. text-align: center;
  56. line-height: 1.5;
  57. }
  58. .layer-actions {
  59. display: flex;
  60. justify-content: center;
  61. gap: 1em;
  62. width: 100%;
  63. }
  64. .layer-button {
  65. border: none;
  66. border-radius: 4px;
  67. padding: 0.6em 1.2em;
  68. font-size: 1em;
  69. cursor: pointer;
  70. transition: background-color 0.2s, box-shadow 0.2s;
  71. color: #fff;
  72. }
  73. .layer-confirm {
  74. background-color: #3085d6;
  75. }
  76. .layer-confirm:hover {
  77. background-color: #2b77c0;
  78. }
  79. .layer-cancel {
  80. background-color: #aaa;
  81. }
  82. .layer-cancel:hover {
  83. background-color: #999;
  84. }
  85. .layer-icon {
  86. position: relative;
  87. box-sizing: content-box;
  88. width: 5em;
  89. height: 5em;
  90. margin: 0.5em auto 1.8em;
  91. border: 0.25em solid rgba(0, 0, 0, 0);
  92. border-radius: 50%;
  93. font-family: inherit;
  94. line-height: 5em;
  95. cursor: default;
  96. user-select: none;
  97. /* Ring sweep angles (match SweetAlert2 success feel) */
  98. --layer-ring-start-rotate: -45deg;
  99. /* End is one full turn from start so it "sweeps then settles" */
  100. --layer-ring-end-rotate: -405deg;
  101. }
  102. /* SVG mark content (kept), sits above the ring */
  103. .layer-icon svg {
  104. width: 100%;
  105. height: 100%;
  106. display: block;
  107. overflow: visible;
  108. position: relative;
  109. z-index: 3;
  110. }
  111. .layer-svg-ring,
  112. .layer-svg-mark {
  113. fill: none;
  114. stroke-linecap: round;
  115. stroke-linejoin: round;
  116. }
  117. .layer-svg-ring {
  118. stroke-width: 4.5;
  119. opacity: 0.95;
  120. }
  121. .layer-svg-mark {
  122. stroke-width: 6;
  123. }
  124. .layer-svg-dot {
  125. transform-box: fill-box;
  126. transform-origin: center;
  127. }
  128. /* =========================================
  129. "success-like" ring (shared by all icons)
  130. - we reuse the success ring pieces/rotation for every icon type
  131. - color is driven by currentColor
  132. ========================================= */
  133. .layer-icon.success { border-color: #a5dc86; color: #a5dc86; }
  134. .layer-icon.error { border-color: #f27474; color: #f27474; }
  135. .layer-icon.warning { border-color: #f8bb86; color: #f8bb86; }
  136. .layer-icon.info { border-color: #3fc3ee; color: #3fc3ee; }
  137. .layer-icon.question { border-color: #b18cff; color: #b18cff; }
  138. /* Keep ring sweep logic identical across built-in icons (match success). */
  139. .layer-icon .layer-success-ring {
  140. position: absolute;
  141. z-index: 2;
  142. top: -0.25em;
  143. left: -0.25em;
  144. box-sizing: content-box;
  145. width: 100%;
  146. height: 100%;
  147. border: 0.25em solid currentColor;
  148. opacity: 0.3;
  149. border-radius: 50%;
  150. }
  151. .layer-icon .layer-success-fix {
  152. position: absolute;
  153. z-index: 1;
  154. top: 0.5em;
  155. left: 1.625em;
  156. width: 0.4375em;
  157. height: 5.625em;
  158. transform: rotate(-45deg);
  159. background-color: #fff; /* adjusted at runtime to popup bg */
  160. }
  161. .layer-icon .layer-success-circular-line-left,
  162. .layer-icon .layer-success-circular-line-right {
  163. position: absolute;
  164. width: 3.75em;
  165. height: 7.5em;
  166. border-radius: 50%;
  167. background-color: #fff; /* adjusted at runtime to popup bg */
  168. }
  169. .layer-icon .layer-success-circular-line-left {
  170. top: -0.4375em;
  171. left: -2.0635em;
  172. transform: rotate(-45deg);
  173. transform-origin: 3.75em 3.75em;
  174. border-radius: 7.5em 0 0 7.5em;
  175. }
  176. .layer-icon .layer-success-circular-line-right {
  177. top: -0.6875em;
  178. left: 1.875em;
  179. transform: rotate(-45deg);
  180. transform-origin: 0 3.75em;
  181. border-radius: 0 7.5em 7.5em 0;
  182. }
  183. /* Clip ONLY the success tick (do not clip the ring sweep masks) */
  184. .layer-icon .layer-success-mark {
  185. position: absolute;
  186. inset: 0;
  187. border-radius: 50%;
  188. overflow: hidden;
  189. z-index: 3;
  190. pointer-events: none;
  191. }
  192. .layer-icon .layer-success-line-tip,
  193. .layer-icon .layer-success-line-long {
  194. display: block;
  195. position: absolute;
  196. z-index: 2;
  197. height: 0.3125em;
  198. border-radius: 0.125em;
  199. background-color: currentColor;
  200. }
  201. .layer-icon .layer-success-line-tip {
  202. top: 2.875em;
  203. left: 0.8125em;
  204. width: 1.5625em;
  205. transform: rotate(45deg);
  206. }
  207. .layer-icon .layer-success-line-long {
  208. top: 2.375em;
  209. right: 0.5em;
  210. width: 2.9375em;
  211. transform: rotate(-45deg);
  212. }
  213. /* Triggered when icon has .layer-icon-show */
  214. .layer-icon.layer-icon-show .layer-success-line-tip {
  215. animation: layer-animate-success-line-tip 0.75s;
  216. }
  217. .layer-icon.layer-icon-show .layer-success-line-long {
  218. animation: layer-animate-success-line-long 0.75s;
  219. }
  220. .layer-icon.layer-icon-show .layer-success-circular-line-right {
  221. animation: layer-rotate-icon-circular-line 4.25s ease-in;
  222. }
  223. @keyframes layer-animate-success-line-tip {
  224. 0% {
  225. top: 1.1875em;
  226. left: 0.0625em;
  227. width: 0;
  228. }
  229. 54% {
  230. top: 1.0625em;
  231. left: 0.125em;
  232. width: 0;
  233. }
  234. 70% {
  235. top: 2.1875em;
  236. left: -0.375em;
  237. width: 3.125em;
  238. }
  239. 84% {
  240. top: 3em;
  241. left: 1.3125em;
  242. width: 1.0625em;
  243. }
  244. 100% {
  245. top: 2.8125em;
  246. left: 0.8125em;
  247. width: 1.5625em;
  248. }
  249. }
  250. @keyframes layer-animate-success-line-long {
  251. 0% {
  252. top: 3.375em;
  253. right: 2.875em;
  254. width: 0;
  255. }
  256. 65% {
  257. top: 3.375em;
  258. right: 2.875em;
  259. width: 0;
  260. }
  261. 84% {
  262. top: 2.1875em;
  263. right: 0;
  264. width: 3.4375em;
  265. }
  266. 100% {
  267. top: 2.375em;
  268. right: 0.5em;
  269. width: 2.9375em;
  270. }
  271. }
  272. @keyframes layer-rotate-icon-circular-line {
  273. 0% { transform: rotate(var(--layer-ring-start-rotate)); }
  274. 5% { transform: rotate(var(--layer-ring-start-rotate)); }
  275. 12% { transform: rotate(var(--layer-ring-end-rotate)); }
  276. 100% { transform: rotate(var(--layer-ring-end-rotate)); } /* match 12% so it "sweeps then stops" */
  277. }
  278. /* (Other icon shapes stay SVG-driven; only the ring animation is unified above) */