|
3 | 3 | /*
|
4 | 4 | * Usage: [source,python]
|
5 | 5 | *
|
6 |
| - * Default style: [source.default,python] |
| 6 | + * Text wrap style: [source.wrap,python] |
| 7 | + * Hide language title style: [source.hidelang,python] |
7 | 8 | */
|
8 |
| - |
9 |
| -.listingblock:not(.default) .content { |
10 |
| - display: grid; |
| 9 | +.doc code.hljs { |
| 10 | + color: var(--ds-text-secondary); |
11 | 11 | }
|
12 | 12 |
|
13 |
| -.listingblock:not(.default) .content .source-toolbox { |
| 13 | +.doc .highlightjs { |
14 | 14 | position: relative;
|
15 |
| - padding: var(--ds-space-1) var(--ds-space-2); |
16 |
| - visibility: visible; |
17 |
| - justify-content: flex-end; |
18 |
| - background: var(--ds-neutral-100); |
19 |
| - grid-row-start: 1; |
| 15 | +} |
| 16 | + |
| 17 | +.doc .listingblock:not(.wrap) .highlightjs { |
| 18 | + text-wrap: nowrap; |
| 19 | +} |
| 20 | + |
| 21 | +.doc .listingblock .title { |
| 22 | + @include text-label; |
| 23 | + |
| 24 | + display: flex; |
| 25 | + font-style: normal; |
| 26 | + color: var(--ds-text-primary); |
| 27 | + margin-bottom: 0; |
| 28 | + padding: var(--ds-space-h) var(--ds-space-2); |
| 29 | + background: var(--ds-background-level2); |
20 | 30 | border-top-left-radius: calc(6 / var(--rem-base) * 1rem);
|
21 | 31 | border-top-right-radius: calc(6 / var(--rem-base) * 1rem);
|
22 |
| - top: 0; |
23 |
| - left: 0; |
| 32 | + border: 1px solid transparent; |
24 | 33 | }
|
25 | 34 |
|
26 |
| -.listingblock:not(.default) .content .source-toolbox .source-lang::after { |
27 |
| - display: none; |
| 35 | +.doc .listingblock .title .source-lang { |
| 36 | + margin-left: auto; |
| 37 | + text-transform: uppercase; |
28 | 38 | }
|
29 | 39 |
|
30 |
| -.listingblock:not(.default) .content .source-toolbox .copy-button { |
31 |
| - justify-content: flex-end; |
32 |
| - flex-direction: column-reverse; |
| 40 | +.doc .source-toolbox { |
| 41 | + position: absolute; |
| 42 | + right: 0; |
| 43 | + padding: 1.25rem; |
| 44 | + height: calc(100% - 6px); |
| 45 | + margin: 1px; |
| 46 | + border-radius: 6px; |
33 | 47 | }
|
34 | 48 |
|
35 |
| -.source-toolbox .copy-button > .material-icons { |
36 |
| - font-size: calc(16 / var(--rem-base) * 1rem); |
| 49 | +html[data-theme="light"] .doc .source-toolbox { |
| 50 | + background: linear-gradient(to right, rgba(247, 247, 247, 0), rgb(247, 247, 247), rgb(247, 247, 247) 20%); |
37 | 51 | }
|
38 | 52 |
|
39 |
| -.listingblock:not(.default) .content .source-toolbox .source-lang { |
40 |
| - color: var(--ds-text-primary); |
41 |
| - text-transform: capitalize; |
42 |
| - font-family: var(--body-font-family); |
43 |
| - line-height: 1.5; |
44 |
| - letter-spacing: 0.65px; |
45 |
| - font-weight: var(--body-font-weight-bold); |
46 |
| - flex: 1; |
| 53 | +html[data-theme="dark"] .doc .source-toolbox { |
| 54 | + background: linear-gradient(to right, rgba(35, 35, 36, 0), rgb(35, 35, 36), rgb(35, 35, 36) 20%); |
47 | 55 | }
|
48 | 56 |
|
49 |
| -.listingblock:not(.default) .source-toolbox .copy-toast:not(:only-child)::after { |
50 |
| - transform: rotate(90deg) translateX(135%) translateY(-45%); |
| 57 | +.doc .source-toolbox .copy-toast { |
| 58 | + font-size: calc(12 / var(--rem-base) * 1rem); |
| 59 | + font-family: "Roboto Flex", sans-serif; |
| 60 | + font-weight: 400; |
| 61 | + display: inline-flex; |
| 62 | + justify-content: center; |
| 63 | + position: absolute; |
| 64 | + background-color: var(--ds-background-tooltip); |
| 65 | + border-radius: 0.25em; |
| 66 | + padding: 0.5em; |
| 67 | + color: var(--ds-text-inverse); |
| 68 | + cursor: auto; |
| 69 | + opacity: 0; |
| 70 | + visibility: hidden; |
| 71 | + transition: opacity 0.5s ease 0.5s, visibility 0s linear 1s; |
| 72 | + text-wrap: nowrap; |
| 73 | + white-space: nowrap; |
| 74 | + transform: translateX(-2.35rem) translateY(-5rem); |
| 75 | + z-index: 20; |
| 76 | +} |
| 77 | + |
| 78 | +.doc .source-toolbox .copy-toast::after { |
| 79 | + content: ""; |
| 80 | + position: absolute; |
| 81 | + bottom: 0; |
| 82 | + width: 1em; |
| 83 | + height: 1em; |
| 84 | + border: 0.55em solid transparent; |
| 85 | + border-left-color: var(--ds-background-tooltip); |
| 86 | + transform: rotate(90deg) translateX(100%); |
51 | 87 | }
|
52 | 88 |
|
53 |
| -.listingblock:not(.default) .source-toolbox .copy-button:not(:only-child) .copy-toast { |
54 |
| - margin: 0 0 var(--ds-space-2h) 0; |
| 89 | +.doc .source-toolbox .copy-button.clicked .copy-toast { |
| 90 | + opacity: 1; |
| 91 | + visibility: visible; |
| 92 | + transition: none; |
55 | 93 | }
|
56 | 94 |
|
57 |
| -.listingblock:not(.default) .source-toolbox .copy-button:only-child .copy-toast { |
58 |
| - margin: 0 0 calc(14 / var(--rem-base) * 1rem) 0; |
| 95 | +.doc .source-toolbox .copy-button { |
| 96 | + padding: var(--ds-space-1); |
| 97 | + background: var(--ds-background-level1); |
| 98 | + border-radius: 6px; |
| 99 | + line-height: 1; |
| 100 | + display: flex; |
| 101 | + |
| 102 | + @apply transition-colors; |
| 103 | + |
| 104 | + &:hover { |
| 105 | + background: var(--ds-background-level2); |
| 106 | + } |
59 | 107 | }
|
60 | 108 |
|
61 |
| -.listingblock:not(.default) .hljs { |
62 |
| - border-top-left-radius: 0; |
63 |
| - border-top-right-radius: 0; |
64 |
| - border-top-color: var(--ds-neutral-100); |
| 109 | +.doc .source-toolbox .copy-button .material-icons { |
| 110 | + font-size: calc(16 / var(--rem-base) * 1rem); |
| 111 | + user-select: none; |
65 | 112 | }
|
66 | 113 |
|
67 |
| -.listingblock .source-toolbox { |
68 |
| - right: var(--ds-space-2); |
| 114 | +.doc .source-toolbox + .hljs { |
| 115 | + padding-right: var(--ds-space-7); |
69 | 116 | }
|
70 | 117 |
|
71 |
| -html[data-theme="dark"] .listingblock:not(.default) .content .source-toolbox { |
72 |
| - background: var(--ds-neutral-700); |
| 118 | +.doc .listingblock.nolang .title .source-lang { |
| 119 | + display: none; |
73 | 120 | }
|
74 | 121 |
|
75 |
| -html[data-theme="dark"] .listingblock:not(.default) .hljs { |
76 |
| - border-top-color: var(--ds-neutral-700); |
| 122 | +.doc .listingblock .title + .content .highlightjs .hljs, |
| 123 | +.doc .listingblock .title + .content pre:not(.highlightjs) { |
| 124 | + border-top: 0; |
| 125 | + border-top-left-radius: 0; |
| 126 | + border-top-right-radius: 0; |
77 | 127 | }
|
78 | 128 |
|
79 | 129 | /*
|
|
0 commit comments