xjs.css 8.7 KB

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