| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284 |
- /* Visual baseline: deepsuite `@deepseek/md` code-block.css. Highlight colors
- stay on the existing shiki `--shiki-*` sheet (not Prism highlight.css). */
- .block {
- --dsl-code-block-banner-background-color: var(--dsw-alias-markdown-code-block-banner);
- --dsl-code-block-border-radius: 12px;
- /* Local 11/18 instead of the shared --dsw-font-xs-13: the banner scales
- with the markdown 0.875 ladder without shrinking every other xs-13 use. */
- --dsl-code-block-banner-font: 11px/18px var(--dsw-font-family);
- --dsl-code-block-banner-height: 36px;
- --dsl-code-block-content-font: var(--dsw-font-markdown-code-block);
- --dsl-code-block-background: var(--dsw-alias-markdown-code-block);
- position: relative;
- width: 100%;
- max-width: 100%;
- margin: 16px 0;
- color: var(--dsw-alias-label-primary);
- background: var(--dsl-code-block-background);
- border-radius: var(--dsl-code-block-border-radius);
- }
- .block:not(:last-child) {
- margin-bottom: 11px;
- }
- .bannerWrap {
- position: sticky;
- top: 0;
- z-index: 6;
- background-color: var(--dsw-alias-bg-base);
- border-top-left-radius: var(--dsl-code-block-border-radius);
- border-top-right-radius: var(--dsl-code-block-border-radius);
- transition: opacity 160ms ease;
- }
- .block[data-preview] .bannerWrap {
- opacity: 0;
- }
- .block[data-preview]:hover .bannerWrap,
- .block[data-preview]:has(:focus-visible) .bannerWrap {
- opacity: 1;
- }
- .banner {
- background: var(--dsl-code-block-banner-background-color);
- padding: 4px 10px 4px 14px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- gap: 12px;
- font: var(--dsl-code-block-banner-font);
- border-top-left-radius: var(--dsl-code-block-border-radius);
- border-top-right-radius: var(--dsl-code-block-border-radius);
- }
- .infostring {
- color: var(--dsw-alias-label-primary);
- font-family: var(--ds-font-family-code);
- font-size: 11px;
- line-height: 18px;
- min-width: 0;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .action {
- min-height: 28px;
- display: flex;
- align-items: center;
- flex-shrink: 0;
- gap: 2px;
- }
- /* Match the sidebar pane controls: a 28px circle around a 15px glyph. */
- .iconButton {
- display: inline-flex;
- flex: none;
- align-items: center;
- justify-content: center;
- box-sizing: border-box;
- width: 28px;
- height: 28px;
- padding: 6px;
- color: var(--dsw-alias-label-secondary);
- line-height: 1;
- background: transparent;
- border: none;
- border-radius: 28px;
- cursor: pointer;
- }
- .iconButton svg {
- width: 15px;
- height: 15px;
- }
- .iconButton:hover:not(:disabled) {
- background: var(--dsw-alias-interactive-bg-hover);
- }
- .iconButton[aria-pressed='true'] {
- background: var(--dsw-alias-interactive-bg-hover);
- color: var(--dsw-alias-label-primary);
- }
- .iconButton:disabled {
- color: var(--dsw-alias-label-tertiary);
- cursor: default;
- }
- .previewActionSlot,
- .iconSlot {
- display: inline-flex;
- }
- .segments {
- position: relative;
- display: grid;
- grid-auto-flow: column;
- grid-auto-columns: 1fr;
- padding: 2px;
- margin-left: 4px;
- border-radius: 8px;
- background: var(--dsw-alias-interactive-bg-hover);
- isolation: isolate;
- }
- .selection {
- position: absolute;
- inset: 2px;
- width: calc((100% - 4px) / 2);
- border-radius: 6px;
- background: var(--dsw-alias-bg-base);
- transition: transform 160ms ease;
- z-index: -1;
- }
- .segments[data-preview-selected] .selection {
- transform: translateX(100%);
- }
- .segments:has(.sourceOnly) .selection {
- width: calc(100% - 4px);
- }
- .segments button,
- .sourceOnly {
- border: 0;
- background: transparent;
- color: inherit;
- padding: 2px 8px;
- font: inherit;
- white-space: nowrap;
- text-align: center;
- }
- .segments button {
- cursor: pointer;
- }
- .segments button[aria-pressed='false'] {
- color: var(--dsw-alias-label-secondary);
- }
- .body {
- min-height: 0;
- }
- .previewActionSlot[hidden] {
- display: none;
- }
- .sourceHidden {
- visibility: hidden;
- pointer-events: none;
- }
- @media (prefers-reduced-motion: reduce) {
- .selection { transition: none; }
- .bannerWrap { transition: none; }
- }
- @media (hover: none) {
- .block[data-preview] .bannerWrap { opacity: 1; }
- }
- .block :where(pre) {
- font: var(--dsl-code-block-content-font);
- padding: 16px;
- margin: 0 !important;
- overflow-x: auto;
- white-space: pre-wrap;
- word-break: break-all;
- background: var(--dsl-code-block-background);
- /* Bottom radii live on <pre>: overflow:hidden on .block would kill the
- sticky banner, and this opaque fill otherwise squares off the wrapper. */
- border-bottom-left-radius: var(--dsl-code-block-border-radius);
- border-bottom-right-radius: var(--dsl-code-block-border-radius);
- }
- /* Shiki inlines its theme background var; route it to the repo token. */
- .block :where(pre.shiki) {
- background: var(--dsl-code-block-background) !important;
- }
- .block :where(pre) code {
- font: inherit;
- background: none;
- padding: 0;
- }
- .plain {
- color: var(--dsw-alias-label-primary);
- }
- .previewLayer {
- display: grid;
- overflow: auto;
- background: var(--dsl-code-block-background);
- border-bottom-right-radius: var(--dsl-code-block-border-radius);
- border-bottom-left-radius: var(--dsl-code-block-border-radius);
- }
- /* The retained image sizes both views without laying out hidden source. */
- .previewLayer[hidden] {
- display: grid;
- visibility: hidden;
- pointer-events: none;
- }
- .previewable > .body {
- position: absolute;
- inset: 0;
- overflow: auto;
- border-radius: inherit;
- }
- .previewable[data-code-block-header] > .body {
- inset-block-start: var(--dsl-code-block-banner-height);
- }
- .numbered :where(pre) code {
- display: block;
- counter-reset: source-line;
- white-space: normal;
- }
- .numbered :where(pre) code > :global(.line) {
- position: relative;
- display: block;
- min-height: 1lh;
- padding-inline-start: calc(var(--dsl-code-block-line-number-width) + 12px);
- counter-increment: source-line;
- white-space: var(--dsl-code-block-line-white-space, pre-wrap);
- }
- .numbered :where(pre) code > :global(.line)::before {
- position: absolute;
- inset-inline-start: 0;
- width: var(--dsl-code-block-line-number-width);
- color: var(--dsw-alias-label-tertiary);
- text-align: end;
- content: counter(source-line);
- user-select: none;
- }
- @media (max-width: 480px) {
- .banner {
- gap: 4px;
- padding-inline: 8px;
- }
- .segments {
- margin-left: 0;
- }
- .segments button,
- .sourceOnly {
- padding-inline: 4px;
- }
- }
|