Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 
 

580 строки
14 KiB

  1. // /**
  2. // * Copyright © Magento, Inc. All rights reserved.
  3. // * See COPYING.txt for license details.
  4. // */
  5. //
  6. // Typography
  7. // _____________________________________________
  8. .lib-font-face(
  9. @family-name,
  10. @font-path,
  11. @font-format: false,
  12. @font-weight: normal,
  13. @font-style: normal,
  14. @font-display: auto,
  15. @font-type: false
  16. ) when (@font-format = false) {
  17. @font-face {
  18. font-family: @family-name;
  19. src: url('@{font-path}.woff2') format('woff2'),
  20. url('@{font-path}.woff') format('woff');
  21. font-weight: @font-weight;
  22. font-style: @font-style;
  23. font-display: @font-display;
  24. }
  25. }
  26. // When need specify font format also should define font type include
  27. // The available types for @font-type are 'woff', 'woff2', 'truetype', 'opentype', 'embedded-opentype', and 'svg'
  28. // Enclose it in single quotes
  29. // _____________________________________________
  30. .lib-font-face(
  31. @family-name,
  32. @font-path,
  33. @font-format: false,
  34. @font-weight: normal,
  35. @font-style: normal,
  36. @font-display: auto,
  37. @font-type: false
  38. ) when not (@font-format = false) and not (@font-type = false) {
  39. @font-face {
  40. font-family: @family-name;
  41. src: url('@{font-path}.@{font-format}') format(@font-type);
  42. font-weight: @font-weight;
  43. font-style: @font-style;
  44. font-display: @font-display;
  45. }
  46. }
  47. // Rem font size
  48. .lib-font-size(@sizeValue) when not (ispercentage(@sizeValue)) and not (@sizeValue = false) and (isunit(@sizeValue, @font-size-unit)) {
  49. .lib-css(font-size, @sizeValue);
  50. }
  51. .lib-font-size(@sizeValue) when not (ispercentage(@sizeValue)) and not (@sizeValue = false) and (isunit(@sizeValue, em)) {
  52. .lib-css(font-size, @sizeValue);
  53. }
  54. .lib-font-size(@sizeValue) when not (ispercentage(@sizeValue)) and not (@sizeValue = false) and not (isunit(@sizeValue, em)) and not (isunit(@sizeValue, @font-size-unit)) {
  55. .lib-font-size-value(@sizeValue);
  56. .lib-css(font-size, @fontValue);
  57. }
  58. // Rem line height
  59. .lib-line-height(@heightValue) when not (@heightValue = false) and not (@heightValue = normal) and not (ispercentage(@heightValue)) {
  60. .lib-font-size-value(@heightValue);
  61. .lib-css(line-height, @fontValue);
  62. }
  63. .lib-line-height(@heightValue) when (ispercentage(@heightValue)) and not (@heightValue = false) {
  64. .lib-css(line-height, @heightValue);
  65. }
  66. .lib-line-height(@heightValue) when (@heightValue = normal) {
  67. .lib-css(line-height, @heightValue);
  68. }
  69. .lib-wrap-words() {
  70. overflow-wrap: break-word;
  71. word-wrap: break-word;
  72. -ms-word-break: break-all;
  73. word-break: break-word;
  74. .lib-hyphens();
  75. }
  76. .lib-text-overflow() {
  77. overflow: hidden;
  78. text-overflow: ellipsis;
  79. white-space: nowrap;
  80. }
  81. .lib-text-hide() {
  82. background-color: transparent;
  83. border: 0;
  84. color: transparent;
  85. font: ~'0/0' a;
  86. text-shadow: none;
  87. }
  88. // Optional hyphenation
  89. .lib-hyphens(@mode: auto) {
  90. -webkit-hyphens: @mode;
  91. -moz-hyphens: @mode;
  92. -ms-hyphens: @mode; // IE10+
  93. hyphens: @mode;
  94. }
  95. .lib-typography(
  96. @_font-size: @font-size__base,
  97. @_color: @text__color,
  98. @_font-family: @font-family__base,
  99. @_font-weight: @font-weight__regular,
  100. @_line-height: @line-height__base,
  101. @_font-style: @font-style__base
  102. ) {
  103. .lib-css(color, @_color);
  104. .lib-css(font-family, @_font-family);
  105. .lib-css(font-style, @_font-style);
  106. .lib-css(font-weight, @_font-weight);
  107. .lib-css(line-height, @_line-height);
  108. .lib-font-size(@_font-size);
  109. }
  110. .lib-list-reset-styles(@_margin: 0, @_padding: 0) {
  111. .lib-css(margin, @_margin);
  112. .lib-css(padding, @_padding);
  113. list-style: none none;
  114. }
  115. .lib-list-inline() {
  116. .lib-list-reset-styles();
  117. > li {
  118. display: inline-block;
  119. vertical-align: top;
  120. }
  121. }
  122. .lib-link(
  123. @_link-color: @link__color,
  124. @_link-text-decoration: @link__text-decoration,
  125. @_link-color-visited: @link__visited__color,
  126. @_link-text-decoration-visited: @link__visited__text-decoration,
  127. @_link-color-hover: @link__hover__color,
  128. @_link-text-decoration-hover: @link__hover__text-decoration,
  129. @_link-color-active: @link__active__color,
  130. @_link-text-decoration-active: @link__active__text-decoration
  131. ) {
  132. .lib-css(color, @_link-color);
  133. .lib-css(text-decoration, @_link-text-decoration);
  134. &:visited {
  135. .lib-css(color, @_link-color-visited);
  136. .lib-css(text-decoration, @_link-text-decoration-visited);
  137. }
  138. &:hover {
  139. .lib-css(color, @_link-color-hover);
  140. .lib-css(text-decoration, @_link-text-decoration-hover);
  141. }
  142. &:active {
  143. .lib-css(color,@_link-color-active);
  144. .lib-css(text-decoration, @_link-text-decoration-active);
  145. }
  146. }
  147. .lib-heading(@_heading_level: h1) {
  148. @_font-color: "@{_heading_level}__font-color";
  149. @_font-size: "@{_heading_level}__font-size";
  150. @_font-family: "@{_heading_level}__font-family";
  151. @_font-weight: "@{_heading_level}__font-weight";
  152. @_line-height: "@{_heading_level}__line-height";
  153. @_font-style: "@{_heading_level}__font-style";
  154. @_margin-top: "@{_heading_level}__margin-top";
  155. @_margin-bottom: "@{_heading_level}__margin-bottom";
  156. .lib-typography(
  157. @@_font-size,
  158. @@_font-color,
  159. @@_font-family,
  160. @@_font-weight,
  161. @@_line-height,
  162. @@_font-style
  163. );
  164. & {
  165. .lib-font-size-value(@@_margin-top);
  166. .lib-css(margin-top, @fontValue);
  167. }
  168. & {
  169. .lib-font-size-value(@@_margin-bottom);
  170. .lib-css(margin-bottom, @fontValue);
  171. }
  172. }
  173. //
  174. // Base typography
  175. // ---------------------------------------------
  176. .lib-typography__base(
  177. @_abbr-border-color: @abbr__border-color,
  178. @_dfn-font-style: @font-style__emphasis,
  179. @_emphasis-font-style: @font-style__emphasis,
  180. @_hr-border-color: @hr__border-color,
  181. @_hr-border-style: @hr__border-style,
  182. @_hr-border-width: @hr__border-width,
  183. @_hr-margin-bottom: @line-height__computed,
  184. @_hr-margin-top: @line-height__computed,
  185. @_mark-background-color: @mark__background-color,
  186. @_mark-color: @mark__color,
  187. @_p-margin-bottom: @p__margin-bottom,
  188. @_p-margin-top: @p__margin-top,
  189. @_root-font-size: @root__font-size,
  190. @_small-font-size: @font-size__s,
  191. @_strong-font-weight: @font-weight__bold,
  192. @_sub-sup-font-size: (@font-size__xs/@font-size__base)*100%
  193. ) {
  194. html {
  195. .lib-css(font-size, @_root-font-size);
  196. -webkit-text-size-adjust: 100%;
  197. -ms-text-size-adjust: 100%;
  198. font-size-adjust: 100%;
  199. }
  200. body {
  201. .lib-typography();
  202. }
  203. p {
  204. & {
  205. .lib-font-size-value(@_p-margin-top);
  206. .lib-css(margin-top, @fontValue);
  207. }
  208. & {
  209. .lib-font-size-value(@_p-margin-bottom);
  210. .lib-css(margin-bottom, @fontValue);
  211. }
  212. }
  213. // Abbreviations and acronyms
  214. abbr[title] {
  215. .lib-css(border-bottom, 1px dotted @_abbr-border-color);
  216. cursor: help;
  217. }
  218. b,
  219. strong {
  220. .lib-css(font-weight, @_strong-font-weight);
  221. }
  222. em,
  223. i {
  224. .lib-css(font-style, @_emphasis-font-style);
  225. }
  226. mark {
  227. .lib-css(background, @_mark-background-color);
  228. .lib-css(color, @_mark-color);
  229. }
  230. small,
  231. .small {
  232. .lib-css(font-size, @_small-font-size);
  233. }
  234. hr {
  235. border: 0;
  236. .lib-css(border-top, @_hr-border-width @_hr-border-style @_hr-border-color);
  237. .lib-css(margin-bottom, @_hr-margin-bottom);
  238. .lib-css(margin-top, @_hr-margin-top);
  239. }
  240. sub,
  241. sup {
  242. .lib-css(font-size, @_sub-sup-font-size);
  243. line-height: 0;
  244. position: relative;
  245. vertical-align: baseline;
  246. }
  247. sup {
  248. top: -.5em;
  249. }
  250. sub {
  251. bottom: -.25em;
  252. }
  253. dfn {
  254. .lib-css(font-style, @_dfn-font-style);
  255. }
  256. }
  257. //
  258. // Headings
  259. // ---------------------------------------------
  260. .lib-typography-headings(
  261. @_heading-small-color: @heading__small-color,
  262. @_heading-small-line-height: @heading__small-line-height,
  263. @_heading-small-size: @heading__small-size
  264. ) {
  265. h1 {
  266. .lib-heading(h1);
  267. }
  268. h2 {
  269. .lib-heading(h2);
  270. }
  271. h3 {
  272. .lib-heading(h3);
  273. }
  274. h4 {
  275. .lib-heading(h4);
  276. }
  277. h5 {
  278. .lib-heading(h5);
  279. }
  280. h6 {
  281. .lib-heading(h6);
  282. }
  283. h1, h2, h3, h4, h5, h6 {
  284. small,
  285. .small {
  286. .lib-typography(
  287. @_heading-small-size,
  288. @_heading-small-color,
  289. @_line-height: @_heading-small-line-height
  290. );
  291. }
  292. }
  293. }
  294. //
  295. // Links
  296. // ---------------------------------------------
  297. .lib-typography-links() {
  298. a,
  299. .alink {
  300. .lib-link();
  301. }
  302. }
  303. //
  304. // Unordered and Ordered lists
  305. // ---------------------------------------------
  306. .lib-typography-lists(
  307. @_list-margin-bottom: @list__margin-bottom,
  308. @_list-margin-top: @list__margin-top,
  309. @_list-item-margin-bottom: @list-item__margin-bottom,
  310. @_list-item-margin-top: @list-item__margin-top,
  311. @_dl-margin-bottom: @dl__margin-bottom,
  312. @_dl-margin-top: @dl__margin-top,
  313. @_dd-margin-bottom: @dd__margin-bottom,
  314. @_dd-margin-top: @dd__margin-top,
  315. @_dt-font-weight: @dt__font-weight,
  316. @_dt-margin-bottom: @dt__margin-bottom,
  317. @_dt-margin-top: @dt__margin-top
  318. ) {
  319. ul,
  320. ol {
  321. & {
  322. .lib-font-size-value(@_list-margin-top);
  323. .lib-css(margin-top, @fontValue);
  324. }
  325. & {
  326. .lib-font-size-value(@_list-margin-bottom);
  327. .lib-css(margin-bottom, @fontValue);
  328. }
  329. > li {
  330. & {
  331. .lib-font-size-value(@_list-item-margin-top);
  332. .lib-css(margin-top, @fontValue);
  333. }
  334. & {
  335. .lib-font-size-value(@_list-item-margin-bottom);
  336. .lib-css(margin-bottom, @fontValue);
  337. }
  338. }
  339. ul,
  340. ol {
  341. margin-bottom: 0;
  342. }
  343. }
  344. dl {
  345. .lib-css(margin-bottom, @_dl-margin-bottom);
  346. .lib-css(margin-top, @_dl-margin-top);
  347. }
  348. dt {
  349. .lib-css(font-weight, @_dt-font-weight);
  350. .lib-css(margin-bottom, @_dt-margin-bottom);
  351. .lib-css(margin-top, @_dt-margin-top);
  352. }
  353. dd {
  354. .lib-css(margin-bottom, @_dd-margin-bottom);
  355. .lib-css(margin-top, @_dd-margin-top);
  356. margin-left: 0;
  357. }
  358. }
  359. //
  360. // Code (inline and block)
  361. // ---------------------------------------------
  362. .lib-typography-code(
  363. @_font-family-monospace: @font-family__monospace,
  364. @_code-background-color: @code__background-color,
  365. @_code-color: @code__color,
  366. @_code-font-size: @code__font-size,
  367. @_code-padding: @code__padding,
  368. @_kbd-background-color: @kbd__background-color,
  369. @_kbd-color: @kbd__color,
  370. @_kbd-font-size: @code__font-size,
  371. @_kbd-padding: @code__padding,
  372. @_pre-background-color: @pre__background-color,
  373. @_pre-border-color: @pre__border-color,
  374. @_pre-border-width: @pre__border-width,
  375. @_pre-color: @pre__color,
  376. @_pre-font-size: @code__font-size,
  377. @_pre-line-height: @line-height__base,
  378. @_pre-margin: 0 0 @indent__s,
  379. @_pre-padding: @indent__s
  380. ) {
  381. code,
  382. kbd,
  383. pre,
  384. samp {
  385. .lib-css(font-family, @_font-family-monospace);
  386. }
  387. // Inline code
  388. code {
  389. .lib-css(background, @_code-background-color);
  390. .lib-css(color, @_code-color);
  391. .lib-css(padding, @_code-padding);
  392. .lib-font-size(@_code-font-size);
  393. white-space: nowrap;
  394. }
  395. // User input typically entered via keyboard
  396. kbd {
  397. .lib-css(background, @_kbd-background-color);
  398. .lib-css(color, @_kbd-color);
  399. .lib-css(padding, @_kbd-padding);
  400. .lib-font-size(@_kbd-font-size);
  401. }
  402. // Blocks of code
  403. pre {
  404. .lib-css(background, @_pre-background-color);
  405. .lib-css(border, @_pre-border-width solid @_pre-border-color);
  406. .lib-css(color, @_pre-color);
  407. .lib-css(line-height, @_pre-line-height);
  408. .lib-css(margin, @_pre-margin);
  409. .lib-css(padding, @_pre-padding);
  410. .lib-font-size(@_pre-font-size);
  411. display: block;
  412. word-wrap: break-word;
  413. code {
  414. background-color: transparent;
  415. border-radius: 0;
  416. color: inherit;
  417. font-size: inherit;
  418. padding: 0;
  419. white-space: pre-wrap;
  420. }
  421. }
  422. }
  423. //
  424. // Blockquotes
  425. // ---------------------------------------------
  426. .lib-typography-blockquote(
  427. @_blockquote-border-color: @blockquote__border-color,
  428. @_blockquote-border-width: @blockquote__border-width,
  429. @_blockquote-font-size: @blockquote__font-size,
  430. @_blockquote-font-style: @blockquote__font-style,
  431. @_blockquote-margin: @blockquote__margin,
  432. @_blockquote-padding: @blockquote__padding,
  433. @_blockquote-small-before-content: @blockquote__content-before,
  434. @_blockquote-small-color: @blockquote-small__color,
  435. @_blockquote-small-font-size: @blockquote-small__font-size,
  436. @_blockquote-small-line-height: @line-height__base,
  437. @_blockquote-cite: @cite__font-style,
  438. @_cite: @cite__font-style
  439. ) {
  440. blockquote {
  441. .lib-css(border-left, @_blockquote-border-width solid @_blockquote-border-color);
  442. .lib-css(margin, @_blockquote-margin);
  443. .lib-css(padding, @_blockquote-padding);
  444. .lib-typography(
  445. @_font-size: @_blockquote-font-size,
  446. @_font-style: @_blockquote-font-style
  447. );
  448. p,
  449. ul,
  450. ol {
  451. &:last-child {
  452. margin-bottom: 0;
  453. }
  454. }
  455. footer,
  456. small,
  457. .small {
  458. .lib-css(color, @_blockquote-small-color);
  459. .lib-css(line-height, @_blockquote-small-line-height);
  460. .lib-font-size(@_blockquote-small-font-size);
  461. display: block;
  462. &:before {
  463. .lib-css(content, @_blockquote-small-before-content);
  464. }
  465. }
  466. cite {
  467. .lib-css(font-style, @_blockquote-cite);
  468. }
  469. }
  470. // Quotes
  471. blockquote {
  472. &:before,
  473. &:after {
  474. content: '';
  475. }
  476. }
  477. q {
  478. quotes: none;
  479. &:before,
  480. &:after {
  481. content: '';
  482. content: none;
  483. }
  484. }
  485. // Undo browser default styling
  486. cite {
  487. .lib-css(font-style, @_cite);
  488. }
  489. }
  490. //
  491. // All typography
  492. // ---------------------------------------------
  493. .lib-typography-all() {
  494. .lib-typography__base();
  495. .lib-typography-headings();
  496. .lib-typography-links();
  497. .lib-typography-lists();
  498. .lib-typography-code();
  499. .lib-typography-blockquote();
  500. }