variables-spacing.pcss.css

Same filename and directory in other branches
  1. main core/themes/default_admin/css/_variables/variables-spacing.pcss.css

Spacing & layout-dimension custom properties.

The canonical --admin-space-* scale, the density-aware --admin-space-density-* scale ([data-gin-layout-density]), and layout dimensions/offsets (toolbar, sidebar, sticky). Consolidated from the former --space-* / --gin-spacing-* / --gin-spacing-density-* systems as part of https://www.drupal.org/i/3582351. The theme is alpha; the old token names are removed outright with no deprecation aliases.

Values are authored in px; the build's px-to-rem step converts them.

File

core/themes/default_admin/css/_variables/variables-spacing.pcss.css

View source
  1. /**
  2. * @file
  3. * Spacing & layout-dimension custom properties.
  4. *
  5. * The canonical --admin-space-* scale, the density-aware --admin-space-density-*
  6. * scale ([data-gin-layout-density]), and layout dimensions/offsets (toolbar,
  7. * sidebar, sticky). Consolidated from the former --space-* / --gin-spacing-* /
  8. * --gin-spacing-density-* systems as part of
  9. * https://www.drupal.org/i/3582351. The theme is alpha; the old token
  10. * names are removed outright with no deprecation aliases.
  11. *
  12. * Values are authored in px; the build's px-to-rem step converts them.
  13. */
  14. @import "../base/media-queries.pcss.css";
  15. :root {
  16. /**
  17. * Spacing scale.
  18. */
  19. --admin-space-3xs: 2px;
  20. --admin-space-2xs: 4px;
  21. --admin-space-xs: 8px;
  22. --admin-space-s: 12px;
  23. --admin-space-m: 16px;
  24. --admin-space-l: 24px;
  25. --admin-space-xl: 32px;
  26. --admin-space-2xl: 48px;
  27. --admin-space-3xl: 64px;
  28. /*
  29. * Layout dimensions & offsets.
  30. *
  31. * Namespaced --admin-theme-* (not --admin-toolbar-*) on purpose: core's
  32. * navigation / admin_toolbar module already owns the --admin-toolbar-* token
  33. * family (--admin-toolbar-color-*, --admin-toolbar-sidebar-width, …). These
  34. * are *this theme's* layout-geometry tokens, so they get their own
  35. * --admin-theme-* namespace to keep ownership unambiguous in the public API.
  36. *
  37. * --admin-theme-sidebar-width is written by the theme's JS at runtime
  38. * (migration/js/init.js, sidebar.js); the toolbar offsets derive in CSS from
  39. * core's --drupal-displace-offset-* (see navigation.pcss.css). Values declared
  40. * here are only the initial/fallback.
  41. */
  42. --admin-theme-height-sticky: 60px;
  43. --admin-theme-toolbar-height: 0px;
  44. --admin-theme-toolbar-secondary-height: 0px;
  45. --admin-theme-toolbar-y-offset: 0px;
  46. --admin-theme-toolbar-x-offset: 0px;
  47. --admin-theme-scroll-offset: 0px;
  48. --admin-theme-sticky-offset: 0px;
  49. --admin-theme-sidebar-small-width: 320px;
  50. --admin-theme-sidebar-min-width: 240px;
  51. --admin-theme-sidebar-width: 320px;
  52. --admin-theme-sidebar-max-width: 560px;
  53. --admin-theme-sidebar-offset: var(--admin-theme-sidebar-width);
  54. @media (--admin-large) {
  55. --admin-theme-sticky-offset: var(--admin-theme-height-sticky);
  56. }
  57. @media (--admin-wide) {
  58. --admin-theme-sidebar-width: 360px;
  59. }
  60. }
  61. /**
  62. * Density-aware spacing scale.
  63. *
  64. * The [data-gin-layout-density] attribute re-declares this scale; the static
  65. * --admin-space-* scale above is intentionally NOT density-aware.
  66. */
  67. :root {
  68. --admin-space-density-2xs: 4px;
  69. --admin-space-density-xs: 8px;
  70. --admin-space-density-s: 12px;
  71. --admin-space-density-m: 16px;
  72. --admin-space-density-l: 24px;
  73. --admin-space-density-xl: 32px;
  74. --admin-space-density-2xl: 48px;
  75. --admin-space-density-3xl: 64px;
  76. &[data-gin-layout-density="small"] {
  77. --admin-space-density-2xs: 0.15625rem; /* 2.5px — authored in rem: below the build's 3px px-to-rem floor. */
  78. --admin-space-density-xs: 5px;
  79. --admin-space-density-s: 7.5px;
  80. --admin-space-density-m: 10px;
  81. --admin-space-density-l: 15px;
  82. --admin-space-density-xl: 20px;
  83. --admin-space-density-2xl: 30px;
  84. --admin-space-density-3xl: 40px;
  85. }
  86. &[data-gin-layout-density="medium"] {
  87. --admin-space-density-2xs: 3px;
  88. --admin-space-density-xs: 6px;
  89. --admin-space-density-s: 9px;
  90. --admin-space-density-m: 12px;
  91. --admin-space-density-l: 18px;
  92. --admin-space-density-xl: 24px;
  93. --admin-space-density-2xl: 36px;
  94. --admin-space-density-3xl: 48px;
  95. }
  96. }

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.