xjs.css 7.3 KB

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