xjs.css 6.4 KB

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