xjs.css 8.6 KB

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