xjs.css 7.6 KB

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