@slotted/styles 0.0.0-stage → 0.1.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (254) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +10 -2
  3. package/package.json +276 -3
  4. package/src/accordion/accordion.css +96 -0
  5. package/src/accordion/accordion.tokens.json +14 -0
  6. package/src/action-bar/action-bar.css +455 -0
  7. package/src/action-bar/action-bar.tokens.json +50 -0
  8. package/src/action-sheet/action-sheet.css +462 -0
  9. package/src/action-sheet/action-sheet.tokens.json +59 -0
  10. package/src/alert/alert.css +764 -0
  11. package/src/alert/alert.tokens.json +77 -0
  12. package/src/app-shell/app-shell.css +1899 -0
  13. package/src/app-shell/app-shell.tokens.json +88 -0
  14. package/src/aspect-ratio/aspect-ratio.css +131 -0
  15. package/src/aspect-ratio/aspect-ratio.tokens.json +1 -0
  16. package/src/attachment/attachment.css +906 -0
  17. package/src/attachment/attachment.tokens.json +85 -0
  18. package/src/avatar/avatar.css +598 -0
  19. package/src/avatar/avatar.tokens.json +64 -0
  20. package/src/avatar-group/avatar-group.css +268 -0
  21. package/src/avatar-group/avatar-group.tokens.json +16 -0
  22. package/src/badge/badge.css +462 -0
  23. package/src/badge/badge.tokens.json +58 -0
  24. package/src/breadcrumb/breadcrumb.css +441 -0
  25. package/src/breadcrumb/breadcrumb.tokens.json +50 -0
  26. package/src/button/button.css +754 -0
  27. package/src/button/button.tokens.json +72 -0
  28. package/src/button-group/button-group.css +455 -0
  29. package/src/button-group/button-group.tokens.json +11 -0
  30. package/src/calendar/calendar.css +846 -0
  31. package/src/calendar/calendar.tokens.json +67 -0
  32. package/src/card/card.css +602 -0
  33. package/src/card/card.tokens.json +68 -0
  34. package/src/carousel/carousel.css +860 -0
  35. package/src/carousel/carousel.tokens.json +62 -0
  36. package/src/cascader/cascader.css +1320 -0
  37. package/src/cascader/cascader.tokens.json +103 -0
  38. package/src/chart/chart.css +1473 -0
  39. package/src/chart/chart.tokens.json +107 -0
  40. package/src/checkbox/checkbox.css +1011 -0
  41. package/src/checkbox/checkbox.tokens.json +102 -0
  42. package/src/checkbox-group/checkbox-group.css +70 -0
  43. package/src/checkbox-group/checkbox-group.tokens.json +6 -0
  44. package/src/code-block/code-block.css +555 -0
  45. package/src/code-block/code-block.tokens.json +69 -0
  46. package/src/collapsible/collapsible.css +546 -0
  47. package/src/collapsible/collapsible.tokens.json +55 -0
  48. package/src/color-picker/color-picker.css +607 -0
  49. package/src/color-picker/color-picker.tokens.json +58 -0
  50. package/src/column-manager/column-manager.css +452 -0
  51. package/src/column-manager/column-manager.tokens.json +43 -0
  52. package/src/combobox/combobox.css +1048 -0
  53. package/src/combobox/combobox.tokens.json +112 -0
  54. package/src/command-palette/command-palette.css +1000 -0
  55. package/src/command-palette/command-palette.tokens.json +75 -0
  56. package/src/container/container.css +198 -0
  57. package/src/container/container.tokens.json +18 -0
  58. package/src/context-menu/context-menu.css +104 -0
  59. package/src/context-menu/context-menu.tokens.json +11 -0
  60. package/src/currency-field/currency-field.css +787 -0
  61. package/src/currency-field/currency-field.tokens.json +80 -0
  62. package/src/dashboard-grid/dashboard-grid.css +748 -0
  63. package/src/dashboard-grid/dashboard-grid.tokens.json +67 -0
  64. package/src/data-grid/data-grid.css +2484 -0
  65. package/src/data-grid/data-grid.tokens.json +100 -0
  66. package/src/data-list/data-list.css +455 -0
  67. package/src/data-list/data-list.tokens.json +35 -0
  68. package/src/date-field/date-field.css +560 -0
  69. package/src/date-field/date-field.tokens.json +80 -0
  70. package/src/date-picker/date-picker.css +420 -0
  71. package/src/date-picker/date-picker.tokens.json +49 -0
  72. package/src/date-range-picker/date-range-picker.css +983 -0
  73. package/src/date-range-picker/date-range-picker.tokens.json +109 -0
  74. package/src/datetime-field/datetime-field.css +850 -0
  75. package/src/datetime-field/datetime-field.tokens.json +91 -0
  76. package/src/datetime-picker/datetime-picker.css +843 -0
  77. package/src/datetime-picker/datetime-picker.tokens.json +78 -0
  78. package/src/datetime-range-picker/datetime-range-picker.css +1375 -0
  79. package/src/datetime-range-picker/datetime-range-picker.tokens.json +135 -0
  80. package/src/description-list/description-list.css +675 -0
  81. package/src/description-list/description-list.tokens.json +66 -0
  82. package/src/detail-panel/detail-panel.css +329 -0
  83. package/src/detail-panel/detail-panel.tokens.json +33 -0
  84. package/src/dialog/dialog.css +968 -0
  85. package/src/dialog/dialog.tokens.json +66 -0
  86. package/src/divider/divider.css +131 -0
  87. package/src/divider/divider.tokens.json +18 -0
  88. package/src/drawer/drawer.css +1303 -0
  89. package/src/drawer/drawer.tokens.json +75 -0
  90. package/src/entity-picker/entity-picker.css +1367 -0
  91. package/src/entity-picker/entity-picker.tokens.json +118 -0
  92. package/src/event-calendar/event-calendar.css +2148 -0
  93. package/src/event-calendar/event-calendar.tokens.json +87 -0
  94. package/src/field/field.css +707 -0
  95. package/src/field/field.tokens.json +58 -0
  96. package/src/field-group/field-group.css +226 -0
  97. package/src/field-group/field-group.tokens.json +33 -0
  98. package/src/filter-bar/filter-bar.css +1306 -0
  99. package/src/filter-bar/filter-bar.tokens.json +78 -0
  100. package/src/form/form.css +218 -0
  101. package/src/form/form.tokens.json +32 -0
  102. package/src/fullscreen/fullscreen.css +376 -0
  103. package/src/fullscreen/fullscreen.tokens.json +50 -0
  104. package/src/grid/grid.css +173 -0
  105. package/src/grid/grid.tokens.json +20 -0
  106. package/src/highlight/highlight.css +135 -0
  107. package/src/highlight/highlight.tokens.json +16 -0
  108. package/src/hover-card/hover-card.css +93 -0
  109. package/src/hover-card/hover-card.tokens.json +17 -0
  110. package/src/icon/icon.css +136 -0
  111. package/src/icon/icon.tokens.json +14 -0
  112. package/src/image/image.css +449 -0
  113. package/src/image/image.tokens.json +27 -0
  114. package/src/import-export-center/import-export-center.css +1175 -0
  115. package/src/import-export-center/import-export-center.tokens.json +84 -0
  116. package/src/inline/inline.css +149 -0
  117. package/src/inline/inline.tokens.json +14 -0
  118. package/src/inline-message/inline-message.css +396 -0
  119. package/src/inline-message/inline-message.tokens.json +19 -0
  120. package/src/kbd/kbd.css +490 -0
  121. package/src/kbd/kbd.tokens.json +40 -0
  122. package/src/link/link.css +237 -0
  123. package/src/link/link.tokens.json +25 -0
  124. package/src/list/list.css +240 -0
  125. package/src/list/list.tokens.json +42 -0
  126. package/src/list-item/list-item.css +937 -0
  127. package/src/list-item/list-item.tokens.json +114 -0
  128. package/src/listbox/listbox.css +674 -0
  129. package/src/listbox/listbox.tokens.json +72 -0
  130. package/src/loading-overlay/loading-overlay.css +730 -0
  131. package/src/loading-overlay/loading-overlay.tokens.json +48 -0
  132. package/src/markdown/markdown.css +168 -0
  133. package/src/markdown/markdown.tokens.json +18 -0
  134. package/src/menu/menu.css +817 -0
  135. package/src/menu/menu.tokens.json +78 -0
  136. package/src/menubar/menubar.css +170 -0
  137. package/src/menubar/menubar.tokens.json +32 -0
  138. package/src/message/message.css +1453 -0
  139. package/src/message/message.tokens.json +85 -0
  140. package/src/message-scroller/message-scroller.css +371 -0
  141. package/src/message-scroller/message-scroller.tokens.json +47 -0
  142. package/src/multi-select/multi-select.css +1427 -0
  143. package/src/multi-select/multi-select.tokens.json +114 -0
  144. package/src/navigation-menu/navigation-menu.css +1029 -0
  145. package/src/navigation-menu/navigation-menu.tokens.json +70 -0
  146. package/src/notification-center/notification-center.css +856 -0
  147. package/src/notification-center/notification-center.tokens.json +84 -0
  148. package/src/number-field/number-field.css +794 -0
  149. package/src/number-field/number-field.tokens.json +80 -0
  150. package/src/otp-input/otp-input.css +525 -0
  151. package/src/otp-input/otp-input.tokens.json +69 -0
  152. package/src/page/page.css +179 -0
  153. package/src/page/page.tokens.json +20 -0
  154. package/src/page-header/page-header.css +1181 -0
  155. package/src/page-header/page-header.tokens.json +71 -0
  156. package/src/pagination/pagination.css +500 -0
  157. package/src/pagination/pagination.tokens.json +56 -0
  158. package/src/popover/popover.css +526 -0
  159. package/src/popover/popover.tokens.json +60 -0
  160. package/src/progress-indicator/progress-indicator.css +1584 -0
  161. package/src/progress-indicator/progress-indicator.tokens.json +50 -0
  162. package/src/prompt-composer/prompt-composer.css +680 -0
  163. package/src/prompt-composer/prompt-composer.tokens.json +99 -0
  164. package/src/prose/prose.css +733 -0
  165. package/src/prose/prose.tokens.json +79 -0
  166. package/src/radio-group/radio-group.css +778 -0
  167. package/src/radio-group/radio-group.tokens.json +103 -0
  168. package/src/rating/rating.css +1071 -0
  169. package/src/rating/rating.tokens.json +88 -0
  170. package/src/result-state/result-state.css +980 -0
  171. package/src/result-state/result-state.tokens.json +63 -0
  172. package/src/runtime-properties.mjs +321 -0
  173. package/src/saved-views/saved-views.css +394 -0
  174. package/src/saved-views/saved-views.tokens.json +41 -0
  175. package/src/scroll-area/scroll-area.css +481 -0
  176. package/src/scroll-area/scroll-area.tokens.json +15 -0
  177. package/src/section/section.css +177 -0
  178. package/src/section/section.tokens.json +39 -0
  179. package/src/segmented-control/segmented-control.css +564 -0
  180. package/src/segmented-control/segmented-control.tokens.json +67 -0
  181. package/src/select/select.css +1593 -0
  182. package/src/select/select.tokens.json +110 -0
  183. package/src/side-navigation/side-navigation.css +1096 -0
  184. package/src/side-navigation/side-navigation.tokens.json +87 -0
  185. package/src/skeleton/skeleton.css +431 -0
  186. package/src/skeleton/skeleton.tokens.json +29 -0
  187. package/src/slider/slider.css +792 -0
  188. package/src/slider/slider.tokens.json +75 -0
  189. package/src/sparkline/sparkline.css +282 -0
  190. package/src/sparkline/sparkline.tokens.json +45 -0
  191. package/src/spinner/spinner.css +224 -0
  192. package/src/spinner/spinner.tokens.json +8 -0
  193. package/src/split-button/split-button.css +253 -0
  194. package/src/split-button/split-button.tokens.json +12 -0
  195. package/src/splitter/splitter.css +336 -0
  196. package/src/splitter/splitter.tokens.json +24 -0
  197. package/src/stack/stack.css +128 -0
  198. package/src/stack/stack.tokens.json +14 -0
  199. package/src/stat-card/stat-card.css +641 -0
  200. package/src/stat-card/stat-card.tokens.json +95 -0
  201. package/src/status-indicator/status-indicator.css +481 -0
  202. package/src/status-indicator/status-indicator.tokens.json +38 -0
  203. package/src/stepper/stepper.css +629 -0
  204. package/src/stepper/stepper.tokens.json +72 -0
  205. package/src/switch/switch.css +703 -0
  206. package/src/switch/switch.tokens.json +75 -0
  207. package/src/table/table.css +1482 -0
  208. package/src/table/table.tokens.json +69 -0
  209. package/src/table-of-contents/table-of-contents.css +533 -0
  210. package/src/table-of-contents/table-of-contents.tokens.json +53 -0
  211. package/src/tabs/tabs.css +998 -0
  212. package/src/tabs/tabs.tokens.json +82 -0
  213. package/src/tag/tag.css +768 -0
  214. package/src/tag/tag.tokens.json +85 -0
  215. package/src/tags-input/tags-input.css +757 -0
  216. package/src/tags-input/tags-input.tokens.json +84 -0
  217. package/src/text-field/text-field.css +900 -0
  218. package/src/text-field/text-field.tokens.json +87 -0
  219. package/src/textarea/textarea.css +365 -0
  220. package/src/textarea/textarea.tokens.json +59 -0
  221. package/src/time-field/time-field.css +719 -0
  222. package/src/time-field/time-field.tokens.json +86 -0
  223. package/src/time-picker/time-picker.css +665 -0
  224. package/src/time-picker/time-picker.tokens.json +66 -0
  225. package/src/time-range-picker/time-range-picker.css +1287 -0
  226. package/src/time-range-picker/time-range-picker.tokens.json +134 -0
  227. package/src/timeline/timeline.css +1596 -0
  228. package/src/timeline/timeline.tokens.json +96 -0
  229. package/src/toast/toast.css +943 -0
  230. package/src/toast/toast.tokens.json +90 -0
  231. package/src/toggle/toggle.css +290 -0
  232. package/src/toggle/toggle.tokens.json +54 -0
  233. package/src/toggle-group/toggle-group.css +463 -0
  234. package/src/toggle-group/toggle-group.tokens.json +54 -0
  235. package/src/toolbar/toolbar.css +434 -0
  236. package/src/toolbar/toolbar.tokens.json +49 -0
  237. package/src/tooltip/tooltip.css +368 -0
  238. package/src/tooltip/tooltip.tokens.json +39 -0
  239. package/src/top-navigation/top-navigation.css +1287 -0
  240. package/src/top-navigation/top-navigation.tokens.json +91 -0
  241. package/src/tour/tour.css +680 -0
  242. package/src/tour/tour.tokens.json +67 -0
  243. package/src/transfer/transfer.css +571 -0
  244. package/src/transfer/transfer.tokens.json +49 -0
  245. package/src/tree/tree.css +1000 -0
  246. package/src/tree/tree.tokens.json +80 -0
  247. package/src/typography/typography.css +211 -0
  248. package/src/typography/typography.tokens.json +31 -0
  249. package/src/upload/upload.css +1706 -0
  250. package/src/upload/upload.tokens.json +123 -0
  251. package/src/visually-hidden/visually-hidden.css +52 -0
  252. package/src/visually-hidden/visually-hidden.tokens.json +1 -0
  253. package/src/wizard/wizard.css +740 -0
  254. package/src/wizard/wizard.tokens.json +63 -0
@@ -0,0 +1,555 @@
1
+ @layer slotted.components {
2
+ /**
3
+ * A block of source: a header that names the file and holds the two
4
+ * controls, a body that is a `scroll-area`, and inside it a `pre` whose
5
+ * every line is a grid row — the number, the marker, the tokens.
6
+ *
7
+ * The fence agrees with `prose`'s in every measure, so a Markdown page that
8
+ * upgrades a fence to this family moves nothing: the sunken ground, the
9
+ * subtle edge, the medium radius, the same inset, the mono face at the small
10
+ * step. Colour for a kind of word comes from the theme's own code scale and
11
+ * never from an engine, which is what lets a scheme switch reach every one.
12
+ *
13
+ * The type does not follow density; the inset and the gutter do. Code at
14
+ * `dense` is still read one character at a time.
15
+ */
16
+ [data-ui='code-block'] {
17
+ --_ground: var(--slotted-code-block-surface, var(--slotted-surface-sunken, Canvas));
18
+ --_edge: var(--slotted-code-block-border-color, var(--slotted-border-subtle, GrayText));
19
+ --_ink: var(--slotted-code-block-color, var(--slotted-text, CanvasText));
20
+ --_muted: var(--slotted-code-block-color-muted, var(--slotted-text-muted, GrayText));
21
+ --_radius: var(--slotted-code-block-radius, var(--slotted-radius-md, 6px));
22
+ --_inset-block: var(--slotted-code-block-inset-block, var(--slotted-space-5, 0.75rem));
23
+ --_inset-inline: var(--slotted-code-block-inset-inline, var(--slotted-space-6, 1rem));
24
+ --_font-size: var(--slotted-code-block-font-size, var(--slotted-font-size-sm, 0.8125rem));
25
+ --_line-height: var(--slotted-code-block-line-height, var(--slotted-line-height-md, 1.5));
26
+ --_line: calc(var(--_font-size) * var(--_line-height));
27
+ --_icon: var(--slotted-control-icon-size-md, 16px);
28
+ --_hit: calc((var(--slotted-target-min, 24px) - var(--_icon)) / 2);
29
+ --_duration: var(--slotted-control-transition-duration, var(--slotted-duration-short));
30
+ --_easing: var(--slotted-control-transition-easing, var(--slotted-easing-standard));
31
+ /**
32
+ * The gutter: as many characters as the last number has, plus half the
33
+ * inset on each side. `--slotted-code-block-digits` is written by the
34
+ * binding from the line count — a fact about the content, not a token.
35
+ */
36
+ --_digits: var(--slotted-code-block-digits, 1);
37
+ --_gutter: calc(var(--_digits) * 1ch + var(--slotted-space-4, 0.5rem) * 2);
38
+ /**
39
+ * A marked line tints the ground from the tone's text role at the band
40
+ * share the highlight scale states, for the reason that scale gives: a
41
+ * tone's surface role is a ground, and a fill from it takes `string` in
42
+ * the light scheme below the text ratio.
43
+ */
44
+ --_tint: var(--slotted-highlight-tint-opacity, 0.075);
45
+
46
+ background-color: var(--_ground);
47
+ border: var(--slotted-border-width-thin, 1px) solid var(--_edge);
48
+ border-radius: var(--_radius);
49
+ box-sizing: border-box;
50
+ color: var(--_ink);
51
+ display: grid;
52
+ font-family: var(--slotted-code-block-font-family, var(--slotted-font-family-mono, monospace));
53
+ font-size: var(--_font-size);
54
+ grid-template-rows: auto minmax(0, 1fr) auto;
55
+ line-height: var(--_line-height);
56
+ min-inline-size: 0;
57
+ position: relative;
58
+ }
59
+
60
+ /* ── Header ─────────────────────────────────────────────────────────────
61
+ *
62
+ * The filename, the language at the end, and the two controls. It keeps the
63
+ * page's direction while the code below keeps its own, so a title reads in
64
+ * the reader's language and the code in its own.
65
+ */
66
+ [data-ui='code-block'] > [data-part='header'] {
67
+ align-items: center;
68
+ border-block-end: var(--slotted-border-width-thin, 1px) solid var(--_edge);
69
+ display: flex;
70
+ font-family: var(--slotted-font-family-sans, inherit);
71
+ font-size: var(--slotted-font-size-sm, 0.8125rem);
72
+ gap: var(--slotted-control-gap-sm, 6px);
73
+ min-inline-size: 0;
74
+ padding-block: var(--slotted-space-3, 0.375rem);
75
+ padding-inline: var(--_inset-inline) var(--slotted-space-4, 0.5rem);
76
+ }
77
+
78
+ /* The file's kind, an `Icon` the binding draws from the name's extension. */
79
+ [data-ui='code-block'] > [data-part='header'] > [data-part='icon'] {
80
+ --slotted-icon-size: var(--_icon);
81
+
82
+ block-size: var(--_icon);
83
+ color: var(--_muted);
84
+ display: flex;
85
+ flex: none;
86
+ inline-size: var(--_icon);
87
+ }
88
+
89
+ [data-ui='code-block'] > [data-part='header'] > [data-part='title'] {
90
+ font-family: var(--slotted-code-block-font-family, var(--slotted-font-family-mono, monospace));
91
+ min-inline-size: 0;
92
+ overflow: hidden;
93
+ text-overflow: ellipsis;
94
+ white-space: nowrap;
95
+ }
96
+
97
+ [data-ui='code-block'] > [data-part='header'] > [data-part='language'] {
98
+ color: var(--_muted);
99
+ font-size: var(--slotted-font-size-xs, 0.75rem);
100
+ letter-spacing: 0.02em;
101
+ margin-inline-start: auto;
102
+ text-transform: uppercase;
103
+ }
104
+
105
+ [data-ui='code-block'] > [data-part='header'] > [data-part='title'] + [data-part='language'],
106
+ [data-ui='code-block'] > [data-part='header'] > [data-part='icon'] + [data-part='language'] {
107
+ margin-inline-start: auto;
108
+ }
109
+
110
+ [data-ui='code-block'] > [data-part='header'] > [data-part='actions'] {
111
+ align-items: center;
112
+ display: flex;
113
+ gap: var(--slotted-space-1, 0.125rem);
114
+ margin-inline-start: auto;
115
+ }
116
+
117
+ [data-ui='code-block'] > [data-part='header'] > [data-part='language'] + [data-part='actions'] {
118
+ margin-inline-start: var(--slotted-space-3, 0.375rem);
119
+ }
120
+
121
+ /**
122
+ * A block with no header at all keeps its controls: they float over the
123
+ * inline end of the first line, on the ground's own colour, so the code
124
+ * beneath them is still there when the pointer leaves.
125
+ */
126
+ [data-ui='code-block'] > [data-part='actions'] {
127
+ align-items: center;
128
+ background-color: var(--_ground);
129
+ border-radius: var(--slotted-control-radius, 4px);
130
+ display: flex;
131
+ gap: var(--slotted-space-1, 0.125rem);
132
+ inset-block-start: var(--slotted-space-2, 0.25rem);
133
+ inset-inline-end: var(--slotted-space-2, 0.25rem);
134
+ position: absolute;
135
+ z-index: 1;
136
+ }
137
+
138
+ /* ── The two controls, description-list's ────────────────────────────── */
139
+
140
+ /* Each holds an `Icon`: text-wrap, and copy that turns to a check once done. */
141
+ [data-ui='code-block'] :is([data-part='copy'], [data-part='wrap']) {
142
+ --slotted-icon-size: var(--_icon);
143
+
144
+ align-items: center;
145
+ appearance: none;
146
+ background: none;
147
+ block-size: var(--slotted-target-min, 24px);
148
+ border: 0;
149
+ border-radius: var(--slotted-control-radius, var(--slotted-radius-sm, 4px));
150
+ color: var(--_muted);
151
+ cursor: pointer;
152
+ display: inline-flex;
153
+ font: inherit;
154
+ inline-size: var(--slotted-target-min, 24px);
155
+ justify-content: center;
156
+ padding: var(--_hit);
157
+ transition:
158
+ color var(--_duration) var(--_easing),
159
+ background-color var(--_duration) var(--_easing);
160
+ }
161
+
162
+ /* On a finger the target is the comfortable size in both axes and the box
163
+ is the one a mouse sees: a transparent `::before` centred on each control
164
+ reaches 44 pixels, and the ground and the ring stay square. The two
165
+ stand two pixels apart, so neither reaches across the edge they share. */
166
+ @media (pointer: coarse) {
167
+ [data-ui='code-block'] :is([data-part='copy'], [data-part='wrap']) {
168
+ position: relative;
169
+ }
170
+
171
+ [data-ui='code-block'] :is([data-part='copy'], [data-part='wrap'])::before {
172
+ content: '';
173
+ inset: min(0px, calc((100% - var(--slotted-target-comfortable, 44px)) / 2));
174
+ position: absolute;
175
+ }
176
+
177
+ [data-ui='code-block'] [data-part='wrap']:has(+ [data-part='copy'])::before {
178
+ inset-inline-end: 0;
179
+ }
180
+
181
+ [data-ui='code-block'] [data-part='wrap'] + [data-part='copy']::before {
182
+ inset-inline-start: 0;
183
+ }
184
+ }
185
+
186
+ [data-ui='code-block']
187
+ :is([data-part='copy'], [data-part='wrap']):enabled:not([data-complete]):hover {
188
+ background-color: var(--slotted-tone-secondary-subtle-hover, ButtonFace);
189
+ color: var(--_ink);
190
+ }
191
+
192
+ [data-ui='code-block']
193
+ :is([data-part='copy'], [data-part='wrap']):enabled:not([data-complete]):active {
194
+ background-color: var(--slotted-tone-secondary-subtle-active, ButtonFace);
195
+ }
196
+
197
+ [data-ui='code-block'] [data-part='wrap'][data-pressed] {
198
+ background-color: var(--slotted-tone-accent-surface, Canvas);
199
+ color: var(--slotted-tone-accent-text, CanvasText);
200
+ }
201
+
202
+ /** A copy that finished: the mark changes as well as the colour, and returns on its own. */
203
+ [data-ui='code-block'] [data-part='copy'][data-complete] {
204
+ color: var(--slotted-tone-success-text, CanvasText);
205
+ }
206
+
207
+ [data-ui='code-block']
208
+ :is([data-part='copy'], [data-part='wrap'], [data-part='reveal']):focus-visible {
209
+ outline: var(--slotted-focus-ring-width, 2px) solid var(--slotted-focus-ring-color, Highlight);
210
+ outline-offset: var(--slotted-focus-ring-offset, 2px);
211
+ }
212
+
213
+ /* ── Body ───────────────────────────────────────────────────────────────
214
+ *
215
+ * A `scroll-area` worn as `data-ui`: the region role, the tab stop and the
216
+ * name exist only while the code overflows, and the bar is the platform's.
217
+ * The block's radius reaches it through `inherit`, and the mask
218
+ * scroll-area draws at an overflowing edge is what a wide line fades into.
219
+ */
220
+ [data-ui='code-block'] > [data-part='body'] {
221
+ border-radius: 0 0 var(--_radius) var(--_radius);
222
+ min-inline-size: 0;
223
+ }
224
+
225
+ [data-ui='code-block'] > [data-part='body']:first-child {
226
+ border-radius: var(--_radius);
227
+ }
228
+
229
+ [data-ui='code-block'] > [data-part='body'][data-max-lines] > [data-part='viewport'] {
230
+ max-block-size: calc(
231
+ var(--slotted-code-block-max-lines) * var(--_line) + var(--_inset-block) * 2
232
+ );
233
+ }
234
+
235
+ [data-ui='code-block'] > [data-part='body'] > [data-part='viewport']:focus-visible {
236
+ outline: var(--slotted-focus-ring-width, 2px) solid var(--slotted-focus-ring-color, Highlight);
237
+ outline-offset: calc(var(--slotted-focus-ring-offset, 2px) * -1);
238
+ }
239
+
240
+ [data-ui='code-block'] [data-part='pre'] {
241
+ /**
242
+ * Code reads left to right whatever the page does: the order of the
243
+ * characters is what the code means. `prose` decided it for a fence.
244
+ */
245
+ direction: ltr;
246
+ font: inherit;
247
+ margin: 0;
248
+ min-inline-size: max-content;
249
+ padding-block: var(--_inset-block);
250
+ tab-size: var(--slotted-code-block-tab-size, 2);
251
+ white-space: pre;
252
+ }
253
+
254
+ [data-ui='code-block'][data-wrap] [data-part='pre'] {
255
+ min-inline-size: 0;
256
+ overflow-wrap: anywhere;
257
+ white-space: pre-wrap;
258
+ }
259
+
260
+ [data-ui='code-block'] [data-part='code'] {
261
+ display: grid;
262
+ font: inherit;
263
+ grid-template-columns: minmax(0, 1fr);
264
+ }
265
+
266
+ /* ── A line ─────────────────────────────────────────────────────────────
267
+ *
268
+ * Three columns: the number, the marker, the text. The two gutters take
269
+ * `user-select: none` so a selection across the block copies code and
270
+ * nothing else, and `aria-hidden` so a reader hears the code and not a
271
+ * count. Under wrap, the continuation of a line is indented to the line's
272
+ * own leading whitespace — the binding measures it once into
273
+ * `--slotted-code-block-indent`, in characters.
274
+ */
275
+ [data-ui='code-block'] [data-part='line'] {
276
+ --_indent: calc(var(--slotted-code-block-indent, 0) * 1ch);
277
+ box-sizing: border-box;
278
+ display: grid;
279
+ grid-template-columns: var(--_number, 0px) var(--_marker, 0px) minmax(0, 1fr);
280
+ min-block-size: var(--_line);
281
+ padding-inline: var(--_inset-inline);
282
+ position: relative;
283
+ }
284
+
285
+ [data-ui='code-block'][data-line-numbers] [data-part='line'] {
286
+ --_number: var(--_gutter);
287
+ padding-inline-start: 0;
288
+ }
289
+
290
+ /** The number is in the DOM whether or not it is drawn, so turning numbers on moves no line. */
291
+ [data-ui='code-block']:not([data-line-numbers]) [data-part='number'] {
292
+ display: none;
293
+ }
294
+
295
+ [data-ui='code-block'][data-marks] [data-part='line'] {
296
+ --_marker: var(--slotted-space-6, 1rem);
297
+ }
298
+
299
+ [data-ui='code-block'] [data-part='number'] {
300
+ color: var(--_muted);
301
+ font-variant-numeric: tabular-nums;
302
+ grid-column: 1;
303
+ padding-inline-end: var(--slotted-space-4, 0.5rem);
304
+ text-align: end;
305
+ user-select: none;
306
+ }
307
+
308
+ [data-ui='code-block'] [data-part='marker'] {
309
+ grid-column: 2;
310
+ text-align: center;
311
+ user-select: none;
312
+ }
313
+
314
+ [data-ui='code-block'] [data-part='line'] > [data-part='token'],
315
+ [data-ui='code-block'] [data-part='line'] > [data-part='text'] {
316
+ grid-column: 3;
317
+ }
318
+
319
+ /** The tokens flow as one inline run inside the third column. */
320
+ [data-ui='code-block'] [data-part='line'] > [data-part='text'] {
321
+ display: block;
322
+ min-inline-size: 0;
323
+ }
324
+
325
+ [data-ui='code-block'][data-wrap] [data-part='line'] > [data-part='text'] {
326
+ padding-inline-start: var(--_indent);
327
+ text-indent: calc(var(--_indent) * -1);
328
+ }
329
+
330
+ /* ── Scopes ─────────────────────────────────────────────────────────── */
331
+
332
+ [data-ui='code-block'] [data-token='comment'] {
333
+ color: var(--slotted-code-comment, var(--slotted-text-muted, GrayText));
334
+ font-style: italic;
335
+ }
336
+ [data-ui='code-block'] [data-token='keyword'] {
337
+ color: var(--slotted-code-keyword, var(--slotted-text, CanvasText));
338
+ }
339
+ [data-ui='code-block'] [data-token='string'] {
340
+ color: var(--slotted-code-string, var(--slotted-text, CanvasText));
341
+ }
342
+ [data-ui='code-block'] [data-token='number'] {
343
+ color: var(--slotted-code-number, var(--slotted-text, CanvasText));
344
+ }
345
+ [data-ui='code-block'] [data-token='function'] {
346
+ color: var(--slotted-code-function, var(--slotted-text, CanvasText));
347
+ }
348
+ [data-ui='code-block'] [data-token='type'] {
349
+ color: var(--slotted-code-type, var(--slotted-text, CanvasText));
350
+ }
351
+ [data-ui='code-block'] [data-token='variable'] {
352
+ color: var(--slotted-code-variable, var(--slotted-text, CanvasText));
353
+ }
354
+ [data-ui='code-block'] [data-token='property'] {
355
+ color: var(--slotted-code-property, var(--slotted-text, CanvasText));
356
+ }
357
+ [data-ui='code-block'] [data-token='punctuation'] {
358
+ color: var(--slotted-code-punctuation, var(--slotted-text, CanvasText));
359
+ }
360
+ [data-ui='code-block'] [data-token='tag'] {
361
+ color: var(--slotted-code-tag, var(--slotted-text, CanvasText));
362
+ }
363
+ [data-ui='code-block'] [data-token='attribute'] {
364
+ color: var(--slotted-code-attribute, var(--slotted-text, CanvasText));
365
+ }
366
+ [data-ui='code-block'] [data-token='constant'] {
367
+ color: var(--slotted-code-constant, var(--slotted-text, CanvasText));
368
+ }
369
+
370
+ /* ── Marks ──────────────────────────────────────────────────────────────
371
+ *
372
+ * A tint of the tone's text over the ground, a bar at the inline start for
373
+ * a highlight and the two levels, and a sign in the marker column for the
374
+ * diff pair. The sign is text in a gutter nobody can select, so it never
375
+ * reaches a clipboard.
376
+ */
377
+ [data-ui='code-block'] [data-part='line'][data-mark] {
378
+ --_tone: var(--slotted-tone-accent-text, CanvasText);
379
+ background-color: color-mix(in srgb, var(--_tone) calc(var(--_tint) * 100%), transparent);
380
+ }
381
+
382
+ [data-ui='code-block']
383
+ [data-part='line']:is(
384
+ [data-mark='highlight'],
385
+ [data-mark='error'],
386
+ [data-mark='warning']
387
+ )::before {
388
+ background-color: var(--_tone);
389
+ content: '';
390
+ inline-size: var(--slotted-border-width-thick, 2px);
391
+ inset-block: 0;
392
+ inset-inline-start: 0;
393
+ position: absolute;
394
+ }
395
+
396
+ [data-ui='code-block'] [data-part='line'][data-mark='add'] {
397
+ --_tone: var(--slotted-tone-success-text, CanvasText);
398
+ }
399
+
400
+ [data-ui='code-block'] [data-part='line'][data-mark='remove'] {
401
+ --_tone: var(--slotted-tone-danger-text, CanvasText);
402
+ }
403
+
404
+ [data-ui='code-block'] [data-part='line'][data-mark='error'] {
405
+ --_tone: var(--slotted-tone-danger-text, CanvasText);
406
+ }
407
+
408
+ [data-ui='code-block'] [data-part='line'][data-mark='warning'] {
409
+ --_tone: var(--slotted-tone-warning-text, CanvasText);
410
+ }
411
+
412
+ [data-ui='code-block'] [data-part='line'][data-mark='add'] > [data-part='marker']::before {
413
+ color: var(--_tone);
414
+ content: '+';
415
+ }
416
+
417
+ [data-ui='code-block'] [data-part='line'][data-mark='remove'] > [data-part='marker']::before {
418
+ color: var(--_tone);
419
+ content: '−';
420
+ }
421
+
422
+ [data-ui='code-block'] [data-part='line'][data-mark='remove'] > [data-part='text'] {
423
+ opacity: 0.72;
424
+ }
425
+
426
+ /**
427
+ * Focus: every line outside the range is dimmed and blurred, and the block
428
+ * lifts the dim when the pointer is over it or focus is inside, so a reader
429
+ * who wants the rest can have it. The blur is decoration and goes under
430
+ * reduced motion with the transition; the dim stays, because it is the
431
+ * information.
432
+ */
433
+ [data-ui='code-block'] [data-part='line'][data-dim] {
434
+ color: var(--_muted);
435
+ filter: blur(1px);
436
+ transition:
437
+ filter var(--slotted-duration-medium) var(--slotted-easing-standard),
438
+ color var(--slotted-duration-medium) var(--slotted-easing-standard);
439
+ }
440
+
441
+ [data-ui='code-block'] [data-part='line'][data-dim] [data-part='token'] {
442
+ color: inherit;
443
+ }
444
+
445
+ [data-ui='code-block']:not([data-loading]):is(:hover, :focus-within)
446
+ [data-part='line'][data-dim] {
447
+ color: var(--_ink);
448
+ filter: none;
449
+ }
450
+
451
+ [data-ui='code-block']:not([data-loading]):is(:hover, :focus-within)
452
+ [data-part='line'][data-dim]
453
+ [data-part='token'] {
454
+ color: revert-layer;
455
+ }
456
+
457
+ /* ── Collapse ───────────────────────────────────────────────────────────
458
+ *
459
+ * Past `collapseAfter` lines the body takes a maximum and the last visible
460
+ * line fades into the reveal control through a mask on the viewport; the
461
+ * hidden lines stay in the DOM and in a selection. Revealed, the limit
462
+ * goes and the control reads "show less".
463
+ */
464
+ [data-ui='code-block'][data-collapse]:not([data-revealed])
465
+ > [data-part='body']
466
+ > [data-part='viewport'] {
467
+ --_visible: calc(var(--slotted-code-block-collapse) * var(--_line) + var(--_inset-block));
468
+ mask-image: linear-gradient(
469
+ to bottom,
470
+ #000 calc(var(--_visible) - var(--_line)),
471
+ transparent var(--_visible)
472
+ );
473
+ max-block-size: var(--_visible);
474
+ overflow-y: hidden;
475
+ }
476
+
477
+ [data-ui='code-block'] > [data-part='reveal'] {
478
+ appearance: none;
479
+ background: none;
480
+ border: 0;
481
+ border-block-start: var(--slotted-border-width-thin, 1px) solid var(--_edge);
482
+ color: var(--slotted-tone-accent-text, LinkText);
483
+ cursor: pointer;
484
+ font-family: var(--slotted-font-family-sans, inherit);
485
+ font-size: var(--slotted-font-size-sm, 0.8125rem);
486
+ font-weight: var(--slotted-font-weight-medium, 500);
487
+ min-block-size: var(--slotted-control-height-sm, 30px);
488
+ padding-block: 0;
489
+ padding-inline: var(--_inset-inline);
490
+ text-align: start;
491
+ transition: background-color var(--_duration) var(--_easing);
492
+ }
493
+
494
+ /** The control is flush with the block's edge, so its ring is drawn inside it and takes the block's corners. */
495
+ [data-ui='code-block'] > [data-part='reveal']:focus-visible {
496
+ border-end-end-radius: var(--_radius);
497
+ border-end-start-radius: var(--_radius);
498
+ outline-offset: calc(var(--slotted-focus-ring-offset, 2px) * -1);
499
+ }
500
+
501
+ [data-ui='code-block'] > [data-part='reveal']:enabled:hover {
502
+ background-color: var(--slotted-tone-accent-subtle-hover, ButtonFace);
503
+ }
504
+
505
+ [data-ui='code-block'] > [data-part='reveal']:enabled:active {
506
+ background-color: var(--slotted-tone-accent-subtle-active, ButtonFace);
507
+ }
508
+
509
+ /* ── Loading, empty ─────────────────────────────────────────────────── */
510
+
511
+ [data-ui='code-block'][data-loading] [data-part='code'] {
512
+ gap: var(--slotted-space-3, 0.375rem);
513
+ padding-inline: var(--_inset-inline);
514
+ }
515
+
516
+ [data-ui='code-block'][data-loading] [data-part='code'] > [data-ui='skeleton'] {
517
+ block-size: var(--_font-size);
518
+ }
519
+
520
+ @media (prefers-reduced-motion: reduce) {
521
+ [data-ui='code-block'] [data-part='line'][data-dim] {
522
+ filter: none;
523
+ }
524
+ }
525
+
526
+ @media (forced-colors: active) {
527
+ /* The system owns the palette: a mark keeps its bar and its sign and loses its tint; the dim goes. */
528
+ [data-ui='code-block'] [data-part='line'][data-mark] {
529
+ background-color: transparent;
530
+ }
531
+
532
+ [data-ui='code-block'] [data-part='line'][data-dim] {
533
+ color: inherit;
534
+ filter: none;
535
+ }
536
+ }
537
+
538
+ @media print {
539
+ [data-ui='code-block'] [data-part='pre'] {
540
+ min-inline-size: 0;
541
+ overflow-wrap: anywhere;
542
+ white-space: pre-wrap;
543
+ }
544
+
545
+ [data-ui='code-block'][data-collapse] > [data-part='body'] > [data-part='viewport'] {
546
+ mask-image: none;
547
+ max-block-size: none;
548
+ }
549
+
550
+ [data-ui='code-block'] > [data-part='reveal'],
551
+ [data-ui='code-block'] [data-part='wrap'] {
552
+ display: none;
553
+ }
554
+ }
555
+ }
@@ -0,0 +1,69 @@
1
+ [
2
+ "--slotted-border-subtle",
3
+ "--slotted-border-width-thick",
4
+ "--slotted-border-width-thin",
5
+ "--slotted-code-attribute",
6
+ "--slotted-code-block-border-color",
7
+ "--slotted-code-block-color",
8
+ "--slotted-code-block-color-muted",
9
+ "--slotted-code-block-font-family",
10
+ "--slotted-code-block-font-size",
11
+ "--slotted-code-block-inset-block",
12
+ "--slotted-code-block-inset-inline",
13
+ "--slotted-code-block-line-height",
14
+ "--slotted-code-block-radius",
15
+ "--slotted-code-block-surface",
16
+ "--slotted-code-block-tab-size",
17
+ "--slotted-code-comment",
18
+ "--slotted-code-constant",
19
+ "--slotted-code-function",
20
+ "--slotted-code-keyword",
21
+ "--slotted-code-number",
22
+ "--slotted-code-property",
23
+ "--slotted-code-punctuation",
24
+ "--slotted-code-string",
25
+ "--slotted-code-tag",
26
+ "--slotted-code-type",
27
+ "--slotted-code-variable",
28
+ "--slotted-control-gap-sm",
29
+ "--slotted-control-height-sm",
30
+ "--slotted-control-icon-size-md",
31
+ "--slotted-control-radius",
32
+ "--slotted-control-transition-duration",
33
+ "--slotted-control-transition-easing",
34
+ "--slotted-duration-medium",
35
+ "--slotted-duration-short",
36
+ "--slotted-easing-standard",
37
+ "--slotted-focus-ring-color",
38
+ "--slotted-focus-ring-offset",
39
+ "--slotted-focus-ring-width",
40
+ "--slotted-font-family-mono",
41
+ "--slotted-font-family-sans",
42
+ "--slotted-font-size-sm",
43
+ "--slotted-font-size-xs",
44
+ "--slotted-font-weight-medium",
45
+ "--slotted-highlight-tint-opacity",
46
+ "--slotted-line-height-md",
47
+ "--slotted-radius-md",
48
+ "--slotted-radius-sm",
49
+ "--slotted-space-1",
50
+ "--slotted-space-2",
51
+ "--slotted-space-3",
52
+ "--slotted-space-4",
53
+ "--slotted-space-5",
54
+ "--slotted-space-6",
55
+ "--slotted-surface-sunken",
56
+ "--slotted-target-comfortable",
57
+ "--slotted-target-min",
58
+ "--slotted-text",
59
+ "--slotted-text-muted",
60
+ "--slotted-tone-accent-subtle-active",
61
+ "--slotted-tone-accent-subtle-hover",
62
+ "--slotted-tone-accent-surface",
63
+ "--slotted-tone-accent-text",
64
+ "--slotted-tone-danger-text",
65
+ "--slotted-tone-secondary-subtle-active",
66
+ "--slotted-tone-secondary-subtle-hover",
67
+ "--slotted-tone-success-text",
68
+ "--slotted-tone-warning-text"
69
+ ]