_utilities.scss 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619
  1. @use 'sass:map';
  2. @use './variables';
  3. @use '../tools/functions' as *;
  4. $utilities: () !default;
  5. @if ($utilities != false) {
  6. $utilities: map-deep-merge(
  7. (
  8. // Display utilities
  9. "overflow": (
  10. property: overflow,
  11. values: auto hidden visible scroll,
  12. ),
  13. "overflow-x": (
  14. property: overflow-x,
  15. values: auto hidden scroll
  16. ),
  17. "overflow-y": (
  18. property: overflow-y,
  19. values: auto hidden scroll
  20. ),
  21. "display": (
  22. responsive: true,
  23. print: true,
  24. property: display,
  25. class: d,
  26. values: none inline inline-block block table table-row table-cell flex inline-flex
  27. ),
  28. "float": (
  29. responsive: true,
  30. print: true,
  31. property: float,
  32. class: float,
  33. values: none left right
  34. ),
  35. "float:rtl": (
  36. responsive: true,
  37. print: true,
  38. property: float,
  39. class: float,
  40. values: (
  41. end: left,
  42. start: right,
  43. )
  44. ),
  45. "float:ltr": (
  46. responsive: true,
  47. print: true,
  48. property: float,
  49. class: float,
  50. values: (
  51. end: right,
  52. start: left,
  53. )
  54. ),
  55. // Flex utilities
  56. "flex": (
  57. responsive: true,
  58. property: flex,
  59. values: (
  60. fill: 1 1 auto,
  61. '1-1': 1 1 auto,
  62. '1-0': 1 0 auto,
  63. '0-1': 0 1 auto,
  64. '0-0': 0 0 auto,
  65. '1-1-100': 1 1 100%,
  66. '1-0-100': 1 0 100%,
  67. '0-1-100': 0 1 100%,
  68. '0-0-100': 0 0 100%,
  69. '1-1-0': 1 1 0,
  70. '1-0-0': 1 0 0,
  71. '0-1-0': 0 1 0,
  72. '0-0-0': 0 0 0,
  73. )
  74. ),
  75. "flex-direction": (
  76. responsive: true,
  77. property: flex-direction,
  78. class: flex,
  79. values: row column row-reverse column-reverse
  80. ),
  81. "flex-grow": (
  82. responsive: true,
  83. property: flex-grow,
  84. class: flex,
  85. values: (
  86. grow-0: 0,
  87. grow-1: 1,
  88. )
  89. ),
  90. "flex-shrink": (
  91. responsive: true,
  92. property: flex-shrink,
  93. class: flex,
  94. values: (
  95. shrink-0: 0,
  96. shrink-1: 1,
  97. )
  98. ),
  99. "flex-wrap": (
  100. responsive: true,
  101. property: flex-wrap,
  102. class: flex,
  103. values: wrap nowrap wrap-reverse
  104. ),
  105. "justify-content": (
  106. responsive: true,
  107. property: justify-content,
  108. class: justify,
  109. values: (
  110. start: flex-start,
  111. end: flex-end,
  112. center: center,
  113. space-between: space-between,
  114. space-around: space-around,
  115. space-evenly: space-evenly,
  116. )
  117. ),
  118. "align-items": (
  119. responsive: true,
  120. property: align-items,
  121. class: align,
  122. values: (
  123. start: flex-start,
  124. end: flex-end,
  125. center: center,
  126. baseline: baseline,
  127. stretch: stretch,
  128. )
  129. ),
  130. "align-content": (
  131. responsive: true,
  132. property: align-content,
  133. values: (
  134. start: flex-start,
  135. end: flex-end,
  136. center: center,
  137. space-between: space-between,
  138. space-around: space-around,
  139. space-evenly: space-evenly,
  140. stretch: stretch,
  141. )
  142. ),
  143. "align-self": (
  144. responsive: true,
  145. property: align-self,
  146. values: (
  147. auto: auto,
  148. start: flex-start,
  149. end: flex-end,
  150. center: center,
  151. baseline: baseline,
  152. stretch: stretch,
  153. )
  154. ),
  155. "order": (
  156. responsive: true,
  157. property: order,
  158. values: (
  159. first: -1,
  160. 0: 0,
  161. 1: 1,
  162. 2: 2,
  163. 3: 3,
  164. 4: 4,
  165. 5: 5,
  166. 6: 6,
  167. 7: 7,
  168. 8: 8,
  169. 9: 9,
  170. 10: 10,
  171. 11: 11,
  172. 12: 12,
  173. last: 13,
  174. ),
  175. ),
  176. // gap utilities
  177. "gap": (
  178. responsive: true,
  179. property: gap,
  180. class: ga,
  181. values: map.merge(variables.$spacers, (auto: auto))
  182. ),
  183. "gap-row": (
  184. responsive: true,
  185. property: row-gap,
  186. class: gr,
  187. values: map.merge(variables.$spacers, (auto: auto))
  188. ),
  189. "gap-column": (
  190. responsive: true,
  191. property: column-gap,
  192. class: gc,
  193. values: map.merge(variables.$spacers, (auto: auto))
  194. ),
  195. // Margin utilities
  196. "margin": (
  197. responsive: true,
  198. property: margin,
  199. class: ma,
  200. values: map.merge(variables.$spacers, (auto: auto))
  201. ),
  202. "margin-x": (
  203. responsive: true,
  204. property: margin-right margin-left,
  205. class: mx,
  206. values: map.merge(variables.$spacers, (auto: auto))
  207. ),
  208. "margin-y": (
  209. responsive: true,
  210. property: margin-top margin-bottom,
  211. class: my,
  212. values: map.merge(variables.$spacers, (auto: auto))
  213. ),
  214. "margin-top": (
  215. responsive: true,
  216. property: margin-top,
  217. class: mt,
  218. values: map.merge(variables.$spacers, (auto: auto))
  219. ),
  220. "margin-right": (
  221. responsive: true,
  222. property: margin-right,
  223. class: mr,
  224. values: map.merge(variables.$spacers, (auto: auto))
  225. ),
  226. "margin-bottom": (
  227. responsive: true,
  228. property: margin-bottom,
  229. class: mb,
  230. values: map.merge(variables.$spacers, (auto: auto))
  231. ),
  232. "margin-left": (
  233. responsive: true,
  234. property: margin-left,
  235. class: ml,
  236. values: map.merge(variables.$spacers, (auto: auto))
  237. ),
  238. "margin-start": (
  239. responsive: true,
  240. property: margin-inline-start,
  241. class: ms,
  242. values: map.merge(variables.$spacers, (auto: auto))
  243. ),
  244. "margin-end": (
  245. responsive: true,
  246. property: margin-inline-end,
  247. class: me,
  248. values: map.merge(variables.$spacers, (auto: auto))
  249. ),
  250. // Negative margin utilities
  251. "negative-margin": (
  252. responsive: true,
  253. property: margin,
  254. class: ma,
  255. values: variables.$negative-spacers
  256. ),
  257. "negative-margin-x": (
  258. responsive: true,
  259. property: margin-right margin-left,
  260. class: mx,
  261. values: variables.$negative-spacers
  262. ),
  263. "negative-margin-y": (
  264. responsive: true,
  265. property: margin-top margin-bottom,
  266. class: my,
  267. values: variables.$negative-spacers
  268. ),
  269. "negative-margin-top": (
  270. responsive: true,
  271. property: margin-top,
  272. class: mt,
  273. values: variables.$negative-spacers
  274. ),
  275. "negative-margin-right": (
  276. responsive: true,
  277. property: margin-right,
  278. class: mr,
  279. values: variables.$negative-spacers
  280. ),
  281. "negative-margin-bottom": (
  282. responsive: true,
  283. property: margin-bottom,
  284. class: mb,
  285. values: variables.$negative-spacers
  286. ),
  287. "negative-margin-left": (
  288. responsive: true,
  289. property: margin-left,
  290. class: ml,
  291. values: variables.$negative-spacers
  292. ),
  293. "negative-margin-start": (
  294. responsive: true,
  295. property: margin-inline-start,
  296. class: ms,
  297. values: variables.$negative-spacers
  298. ),
  299. "negative-margin-end": (
  300. responsive: true,
  301. property: margin-inline-end,
  302. class: me,
  303. values: variables.$negative-spacers
  304. ),
  305. // Padding utilities
  306. "padding": (
  307. responsive: true,
  308. property: padding,
  309. class: pa,
  310. values: variables.$spacers
  311. ),
  312. "padding-x": (
  313. responsive: true,
  314. property: padding-right padding-left,
  315. class: px,
  316. values: variables.$spacers
  317. ),
  318. "padding-y": (
  319. responsive: true,
  320. property: padding-top padding-bottom,
  321. class: py,
  322. values: variables.$spacers
  323. ),
  324. "padding-top": (
  325. responsive: true,
  326. property: padding-top,
  327. class: pt,
  328. values: variables.$spacers
  329. ),
  330. "padding-right": (
  331. responsive: true,
  332. property: padding-right,
  333. class: pr,
  334. values: variables.$spacers
  335. ),
  336. "padding-bottom": (
  337. responsive: true,
  338. property: padding-bottom,
  339. class: pb,
  340. values: variables.$spacers
  341. ),
  342. "padding-left": (
  343. responsive: true,
  344. property: padding-left,
  345. class: pl,
  346. values: variables.$spacers
  347. ),
  348. "padding-start": (
  349. responsive: true,
  350. property: padding-inline-start,
  351. class: ps,
  352. values: variables.$spacers
  353. ),
  354. "padding-end": (
  355. responsive: true,
  356. property: padding-inline-end,
  357. class: pe,
  358. values: variables.$spacers
  359. ),
  360. // Border radius
  361. "rounded": (
  362. property: border-radius,
  363. class: rounded,
  364. values: variables.$rounded
  365. ),
  366. "rounded-top": (
  367. property: border-top-left-radius border-top-right-radius,
  368. class: rounded-t,
  369. values: variables.$rounded
  370. ),
  371. "rounded-end": (
  372. property: (ltr: border-top-right-radius border-bottom-right-radius, rtl: border-top-left-radius border-bottom-left-radius),
  373. class: rounded-e,
  374. values: variables.$rounded
  375. ),
  376. "rounded-bottom": (
  377. property: border-bottom-left-radius border-bottom-right-radius,
  378. class: rounded-b,
  379. values: variables.$rounded
  380. ),
  381. "rounded-start": (
  382. property: (ltr: border-top-left-radius border-bottom-left-radius, rtl: border-top-right-radius border-bottom-right-radius),
  383. class: rounded-s,
  384. values: variables.$rounded
  385. ),
  386. "rounded-top-start": (
  387. property: (ltr: border-top-left-radius, rtl: border-top-right-radius),
  388. class: rounded-ts,
  389. values: variables.$rounded
  390. ),
  391. "rounded-top-end": (
  392. property: (ltr: border-top-right-radius, rtl: border-top-left-radius),
  393. class: rounded-te,
  394. values: variables.$rounded
  395. ),
  396. "rounded-bottom-end": (
  397. property: (ltr: border-bottom-right-radius, rtl: border-bottom-left-radius),
  398. class: rounded-be,
  399. values: variables.$rounded
  400. ),
  401. "rounded-bottom-start": (
  402. property: (ltr: border-bottom-left-radius, rtl: border-bottom-right-radius),
  403. class: rounded-bs,
  404. values: variables.$rounded
  405. ),
  406. // Border
  407. "border": (
  408. property: border-width border-style border-color,
  409. class: border,
  410. values: variables.$borders
  411. ),
  412. "border-opacity": (
  413. property: --v-border-opacity,
  414. class: border-opacity,
  415. values: variables.$border-opacities
  416. ),
  417. "border-top": (
  418. property: border-block-start-width border-block-start-style border-block-start-color,
  419. class: border-t,
  420. values: variables.$borders
  421. ),
  422. "border-end": (
  423. property: border-inline-end-width border-inline-end-style border-inline-end-color,
  424. class: border-e,
  425. values: variables.$borders
  426. ),
  427. "border-bottom": (
  428. property: border-block-end-width border-block-end-style border-block-end-color,
  429. class: border-b,
  430. values: variables.$borders
  431. ),
  432. "border-start": (
  433. property: border-inline-start-width border-inline-start-style border-inline-start-color,
  434. class: border-s,
  435. values: variables.$borders
  436. ),
  437. "border-style": (
  438. property: border-style,
  439. class: border,
  440. values: solid dashed dotted double none
  441. ),
  442. // Text
  443. "text-align": (
  444. responsive: true,
  445. property: text-align,
  446. class: text,
  447. values: left right center justify start end
  448. ),
  449. "text-decoration": (
  450. property: text-decoration,
  451. class: text-decoration,
  452. values: line-through none overline underline
  453. ),
  454. "white-space": (
  455. property: white-space,
  456. class: text,
  457. values: (
  458. wrap: normal,
  459. no-wrap: nowrap,
  460. pre: pre,
  461. pre-line: pre-line,
  462. pre-wrap: pre-wrap,
  463. )
  464. ),
  465. "overflow-wrap": (
  466. property: overflow-wrap word-break, // word-break for IE & < Edge 18
  467. class: text,
  468. values: (break: break-word)
  469. ),
  470. "opacity": (
  471. property: opacity,
  472. class: opacity,
  473. values: variables.$opacities
  474. ),
  475. "text-opacity": (
  476. property: color,
  477. class: text,
  478. values: (
  479. high-emphasis: rgba(var(--v-theme-on-background), var(--v-high-emphasis-opacity)),
  480. medium-emphasis: rgba(var(--v-theme-on-background), var(--v-medium-emphasis-opacity)),
  481. disabled: rgba(var(--v-theme-on-background), var(--v-disabled-opacity)),
  482. )
  483. ),
  484. "text-overflow": (
  485. property: white-space overflow text-overflow,
  486. class: text,
  487. values: (truncate: nowrap hidden ellipsis)
  488. ),
  489. "typography": (
  490. responsive: true,
  491. property: (
  492. font-size,
  493. font-weight,
  494. line-height,
  495. letter-spacing,
  496. font-family,
  497. text-transform
  498. ),
  499. class: text,
  500. unimportant: (
  501. font-family,
  502. font-weight,
  503. line-height
  504. ),
  505. values: variables.$flat-typography
  506. ),
  507. "text-transform": (
  508. property: text-transform,
  509. class: text,
  510. values: none capitalize lowercase uppercase
  511. ),
  512. "font-weight": (
  513. property: font-weight,
  514. class: font-weight,
  515. values: variables.$font-weights
  516. ),
  517. "font-italic": (
  518. property: font-style,
  519. class: font,
  520. values: italic
  521. ),
  522. "text-mono": (
  523. property: font-family,
  524. class: text,
  525. values: (
  526. mono: monospace
  527. )
  528. ),
  529. // Position
  530. "position": (
  531. property: position,
  532. class: position,
  533. values: static relative fixed absolute sticky
  534. ),
  535. "top": (
  536. property: top,
  537. class: top,
  538. values: 0
  539. ),
  540. "right": (
  541. property: right,
  542. class: right,
  543. values: 0
  544. ),
  545. "bottom": (
  546. property: bottom,
  547. class: bottom,
  548. values: 0
  549. ),
  550. "left": (
  551. property: left,
  552. class: left,
  553. values: 0
  554. ),
  555. // Cursor
  556. "cursor": (
  557. property: cursor,
  558. class: cursor,
  559. values: auto default pointer wait text move help not-allowed progress grab grabbing none
  560. ),
  561. // Sizing
  562. "fill-height": (
  563. property: height,
  564. class: fill,
  565. values: (
  566. height: 100%
  567. )
  568. ),
  569. "height": (
  570. property: height,
  571. responsive: true,
  572. class: h,
  573. values: (
  574. auto: auto,
  575. screen: 100vh,
  576. 0: 0,
  577. 25: 25%,
  578. 50: 50%,
  579. 75: 75%,
  580. 100: 100%
  581. )
  582. ),
  583. "height-screen": (
  584. property: height,
  585. class: h,
  586. values: (
  587. screen: 100dvh
  588. )
  589. ),
  590. "width": (
  591. property: width,
  592. responsive: true,
  593. class: w,
  594. values: (
  595. auto: auto,
  596. 0: 0,
  597. 25: 25%,
  598. 33: 33%,
  599. 50: 50%,
  600. 66: 66%,
  601. 75: 75%,
  602. 100: 100%
  603. )
  604. )
  605. ),
  606. $utilities
  607. );
  608. } @else {
  609. $utilities: ();
  610. }