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