@carbonid1/design-system 5.17.0 → 5.19.0

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.
@@ -4,7 +4,7 @@ import { cn } from '../helpers/cn/cn';
4
4
  import { Button as ButtonPrimitive } from '@base-ui/react/button';
5
5
  import { cva } from 'class-variance-authority';
6
6
  import { Loader2 } from 'lucide-react';
7
- const buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-hidden select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
7
+ const buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-[color,background-color,opacity,transform] outline-hidden select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
8
8
  variants: {
9
9
  variant: {
10
10
  ghost: 'hover:bg-accent aria-expanded:bg-accent dark:hover:bg-accent/50',
@@ -0,0 +1,3 @@
1
+ import type { InputProps } from './Input.types';
2
+ declare const Input: ({ className, ...props }: InputProps) => import("react/jsx-runtime").JSX.Element;
3
+ export { Input };
@@ -0,0 +1,6 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Input as BaseInput } from '@base-ui/react/input';
4
+ import { cn } from '../helpers/cn/cn';
5
+ const Input = ({ className, ...props }) => (_jsx(BaseInput, { ...props, "data-slot": "input", className: cn('border-input-border bg-surface-inset inset-shadow-surface text-foreground placeholder:text-muted-foreground h-9 w-full min-w-0 rounded-lg border px-3 py-1 text-sm outline-hidden dark:inset-shadow-none', 'enabled:hover:border-ring', 'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-3', 'forced-colors:focus-visible:ring-0 forced-colors:focus-visible:outline-2 forced-colors:focus-visible:outline-offset-2 forced-colors:focus-visible:outline-[Highlight]', 'disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50', 'aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 aria-invalid:ring-3', className) }));
6
+ export { Input };
@@ -0,0 +1,3 @@
1
+ import type { Input as BaseInput } from '@base-ui/react/input';
2
+ type InputProps = BaseInput.Props;
3
+ export type { InputProps };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { InputGroupActionProps, InputGroupControlProps, InputGroupRootProps } from './InputGroup.types';
2
+ export declare const InputGroup: {
3
+ Root: ({ className, onPointerDown, ...props }: InputGroupRootProps) => import("react/jsx-runtime").JSX.Element;
4
+ Control: ({ className, ...props }: InputGroupControlProps) => import("react/jsx-runtime").JSX.Element;
5
+ Action: ({ className, variant, size, replacesNativePicker, ...props }: InputGroupActionProps) => import("react/jsx-runtime").JSX.Element;
6
+ };
@@ -0,0 +1,27 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Input as BaseInput } from '@base-ui/react/input';
4
+ import { Button } from '../Button/Button';
5
+ import { cn } from '../helpers/cn/cn';
6
+ const Root = ({ className, onPointerDown, ...props }) => {
7
+ const focusControlFromShell = (event) => {
8
+ onPointerDown?.(event);
9
+ if (event.defaultPrevented || event.button !== 0 || event.target !== event.currentTarget)
10
+ return;
11
+ event.preventDefault();
12
+ event.currentTarget
13
+ .querySelector('[data-slot="input-group-control"]')
14
+ ?.focus();
15
+ };
16
+ return (_jsx("div", { ...props, "data-slot": "input-group", onPointerDown: focusControlFromShell, className: cn('border-input-border bg-surface-inset inset-shadow-surface flex min-h-11 w-full min-w-0 items-center gap-1 rounded-lg border p-2 dark:inset-shadow-none', 'has-[[data-slot=input-group-control]:enabled]:hover:border-ring', 'has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-3', 'has-[[data-slot=input-group-control][aria-invalid=true]]:border-destructive has-[[data-slot=input-group-control][aria-invalid=true]]:ring-destructive/20 dark:has-[[data-slot=input-group-control][aria-invalid=true]]:border-destructive/50 dark:has-[[data-slot=input-group-control][aria-invalid=true]]:ring-destructive/40 has-[[data-slot=input-group-control][aria-invalid=true]]:ring-3', 'forced-colors:has-[[data-slot=input-group-control]:focus-visible]:ring-0 forced-colors:has-[[data-slot=input-group-control]:focus-visible]:outline-2 forced-colors:has-[[data-slot=input-group-control]:focus-visible]:outline-offset-2 forced-colors:has-[[data-slot=input-group-control]:focus-visible]:outline-[Highlight]', '[&:has([data-native-picker-action])_[data-slot=input-group-control]::-webkit-calendar-picker-indicator]:hidden', className) }));
17
+ };
18
+ const Control = ({ className, ...props }) => (_jsx(BaseInput, { ...props, "data-slot": "input-group-control", className: cn('text-foreground placeholder:text-muted-foreground min-w-0 flex-1 bg-transparent px-2 py-1 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50 forced-colors:focus-visible:outline-none', className) }));
19
+ const Action = ({ className, variant = 'subtle', size = 'icon', replacesNativePicker = false, ...props }) => (_jsx(Button, { ...props, "data-slot": "input-group-action", "data-native-picker-action": replacesNativePicker ? '' : undefined, variant: variant, size: size, className: cn('rounded-md',
20
+ // Firefox does not expose its native date indicator to author CSS, so it keeps that
21
+ // affordance and omits the replacement action instead of rendering two calendar buttons.
22
+ replacesNativePicker && 'supports-[-moz-appearance:none]:hidden', className) }));
23
+ export const InputGroup = {
24
+ Root,
25
+ Control,
26
+ Action,
27
+ };
@@ -0,0 +1,10 @@
1
+ import type { Input as BaseInput } from '@base-ui/react/input';
2
+ import type { ComponentPropsWithoutRef } from 'react';
3
+ import type { ButtonProps } from '../Button/Button.types';
4
+ type InputGroupRootProps = ComponentPropsWithoutRef<'div'>;
5
+ type InputGroupControlProps = BaseInput.Props;
6
+ type InputGroupActionProps = ButtonProps & {
7
+ /** Replaces the native date affordance where the browser lets author CSS hide it. */
8
+ replacesNativePicker?: boolean;
9
+ };
10
+ export type { InputGroupActionProps, InputGroupControlProps, InputGroupRootProps };
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.d.ts CHANGED
@@ -3,6 +3,10 @@ export { Badge, badgeVariants } from './Badge/Badge';
3
3
  export type { BadgeProps } from './Badge/Badge.types';
4
4
  export { Button, buttonVariants } from './Button/Button';
5
5
  export type { ButtonProps } from './Button/Button.types';
6
+ export { Input } from './Input/Input';
7
+ export type { InputProps } from './Input/Input.types';
8
+ export { InputGroup } from './InputGroup/InputGroup';
9
+ export type { InputGroupActionProps, InputGroupControlProps, InputGroupRootProps, } from './InputGroup/InputGroup.types';
6
10
  export { Card, cardVariants } from './Card/Card';
7
11
  export type { CardActionProps, CardContentProps, CardDescriptionProps, CardFooterProps, CardHeaderProps, CardRootProps, CardTitleProps, } from './Card/Card.types';
8
12
  export { Kbd, kbdVariants } from './Kbd/Kbd';
package/dist/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import { HotkeysProvider as HotkeysProviderHook, isHotkeyPressed as isHotkeyPressedHook, useHotkeys as useHotkeysHook, useHotkeysContext as useHotkeysContextHook, useRecordHotkeys as useRecordHotkeysHook, } from 'react-hotkeys-hook';
2
2
  export { Badge, badgeVariants } from './Badge/Badge';
3
3
  export { Button, buttonVariants } from './Button/Button';
4
+ export { Input } from './Input/Input';
5
+ export { InputGroup } from './InputGroup/InputGroup';
4
6
  export { Card, cardVariants } from './Card/Card';
5
7
  export { Kbd, kbdVariants } from './Kbd/Kbd';
6
8
  export { Text, textVariants } from './Text/Text';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carbonid1/design-system",
3
- "version": "5.17.0",
3
+ "version": "5.19.0",
4
4
  "description": "Shared React UI primitives + design tokens (themes, postcss config)",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,11 +20,14 @@
20
20
  },
21
21
  "./themes/reader": "./themes/reader.css",
22
22
  "./themes/dashboard": "./themes/dashboard.css",
23
+ "./typesets/base": "./typesets/base.css",
24
+ "./typesets/compact": "./typesets/compact.css",
23
25
  "./postcss": "./postcss.mjs"
24
26
  },
25
27
  "files": [
26
28
  "dist",
27
29
  "themes",
30
+ "typesets",
28
31
  "postcss.mjs",
29
32
  "skills",
30
33
  "scripts"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: design-system
3
- description: 'Shared UI components and design patterns for carbonid1 apps built on @carbonid1/design-system. ALWAYS use when building UI, creating components, adding dropdowns, selects, tooltips, icons, toasts, context menus, badges, or any interactive element. Triggers on: dropdown, select, tooltip, tag, badge, icon, component, UI, using the design system, layout shift, skeleton, context menu, right-click menu, button, theme, palette. To MODIFY @carbonid1/design-system itself — add or change a primitive, token, variant, or the barrel/exports — use the design-system-package skill instead.'
3
+ description: 'Shared UI components and design patterns for carbonid1 apps built on @carbonid1/design-system. ALWAYS use when building UI, creating components, styling Typeset or Markdown prose, adding dropdowns, selects, tooltips, icons, toasts, context menus, badges, or any interactive element. Triggers on: dropdown, select, tooltip, tag, badge, icon, component, UI, typeset, prose, Markdown rendering, using the design system, layout shift, skeleton, context menu, right-click menu, button, theme, palette. To MODIFY @carbonid1/design-system itself — add or change a primitive, token, variant, or the barrel/exports — use the design-system-package skill instead.'
4
4
  ---
5
5
 
6
6
  # Design System
@@ -42,6 +42,20 @@ If you're editing `@carbonid1/design-system` itself (adding a primitive, changin
42
42
  - Tooltip: rely on defaults (`position="top"`, `delay={400}`). Only override when the default is wrong (e.g. header → `position="bottom"`, data-viz progressive disclosure → `delay={600}`, a snappy reveal → a lower `delay`). When a tooltip trigger also opens a popover, pass `disabled={open}`.
43
43
  - Icon toggle state: `<Icon fill={active ? 'currentColor' : 'none'} />` — not two different components.
44
44
 
45
+ ## Typeset prose
46
+
47
+ Typeset owns semantic document presentation; the application still owns parsing, streaming, and
48
+ custom component rendering.
49
+
50
+ ```css
51
+ @import '@carbonid1/design-system/typesets/base';
52
+ @import '@carbonid1/design-system/typesets/compact';
53
+ ```
54
+
55
+ Apply `typeset typeset-compact` to the rendered document root. Import the base stylesheet once, then
56
+ only the presets that application uses. Add `.not-typeset` or `[data-not-typeset]` around injected
57
+ application components that must retain their own design-system styling.
58
+
45
59
  ## Buttons & links
46
60
 
47
61
  - **Active/selected state** — pass `selected` (toolbar toggles, segmented controls, filter chips, tabs, nav links). It applies the selection tokens (`bg-primary/10` + `ring-1 ring-primary/20`, tint held on hover); never hand-layer those classes. `selected` is visual only — set the matching ARIA yourself: `aria-pressed` on toggle buttons, `aria-current` on nav links. It rides both `Button` and `buttonVariants(...)`.
@@ -0,0 +1,420 @@
1
+ /*
2
+ * Based on shadcn/typeset.
3
+ * https://ui.shadcn.com/docs/typeset.
4
+ */
5
+
6
+ @layer components {
7
+ .typeset {
8
+ --typeset-font-body: inherit;
9
+ --typeset-font-heading: var(--font-heading, inherit);
10
+ --typeset-font-mono: var(--font-mono);
11
+ --typeset-size: 1em;
12
+ --typeset-leading: 1.75;
13
+ --typeset-flow: 1.25em;
14
+ }
15
+ }
16
+
17
+ @layer components {
18
+ .typeset {
19
+ font-family: var(--typeset-font-body);
20
+ font-size: calc(var(--typeset-size) * 1.125);
21
+ line-height: var(--typeset-leading);
22
+ color: var(--color-foreground, currentColor);
23
+ overflow-wrap: break-word;
24
+ margin-trim: block-start;
25
+
26
+ @media (min-width: 48rem), print {
27
+ font-size: var(--typeset-size);
28
+ }
29
+
30
+ --typeset-muted: var(
31
+ --color-muted-foreground,
32
+ color-mix(in oklab, currentColor 60%, transparent)
33
+ );
34
+ --typeset-rule: var(--color-border, color-mix(in oklab, currentColor 20%, transparent));
35
+ }
36
+
37
+ .typeset *:not(:where(.not-typeset, [data-not-typeset], .not-typeset *, [data-not-typeset] *)) {
38
+ &:where(p) {
39
+ margin-block-start: var(--typeset-flow);
40
+ margin-block-end: 0;
41
+ }
42
+
43
+ &:where(h1, h2, h3, h4, h5, h6) {
44
+ color: var(--color-foreground, currentColor);
45
+ font-family: var(--typeset-font-heading);
46
+ font-weight: 600;
47
+ margin-block-end: 0;
48
+ }
49
+ &:where(h1) {
50
+ font-size: 1.75em;
51
+ line-height: 1.3;
52
+ margin-block-start: var(--typeset-flow);
53
+ }
54
+ &:where(h2) {
55
+ font-size: 1.25em;
56
+ line-height: 1.4;
57
+ margin-block-start: calc(var(--typeset-flow) * 1.4);
58
+ }
59
+ &:where(h3) {
60
+ font-size: 1.125em;
61
+ line-height: 1.45;
62
+ margin-block-start: var(--typeset-flow);
63
+ }
64
+ &:where(h4) {
65
+ font-size: 1em;
66
+ line-height: 1.5;
67
+ margin-block-start: var(--typeset-flow);
68
+ }
69
+ &:where(h5) {
70
+ font-size: 0.9375em;
71
+ line-height: 1.5;
72
+ margin-block-start: calc(var(--typeset-flow) / 0.9375);
73
+ }
74
+ &:where(h6) {
75
+ font-size: 0.875em;
76
+ line-height: 1.5;
77
+ margin-block-start: calc(var(--typeset-flow) / 0.875);
78
+ }
79
+ &:where([id]) {
80
+ scroll-margin-block-start: var(--typeset-flow);
81
+ }
82
+
83
+ &:where(h1 + *, h2 + *, h3 + *, h4 + *, h5 + *, h6 + *) {
84
+ margin-block-start: 1em;
85
+ }
86
+ &:where(:is(h1, h2, h3, h4) :is(code)) {
87
+ font-size: 0.9em;
88
+ }
89
+
90
+ &:where(a) {
91
+ color: inherit;
92
+ font-weight: 500;
93
+ text-decoration-line: underline;
94
+ text-decoration-color: color-mix(in oklab, currentColor 30%, transparent);
95
+ }
96
+ &:where(a:hover) {
97
+ text-decoration-color: currentColor;
98
+ }
99
+ &:where(a:focus-visible) {
100
+ outline: 2px solid var(--color-ring, currentColor);
101
+ outline-offset: 2px;
102
+ border-radius: 0.125em;
103
+ }
104
+ &:where(:is(h1, h2, h3, h4, h5, h6) :is(a)) {
105
+ font-weight: inherit;
106
+ }
107
+
108
+ &:where(strong, b) {
109
+ font-weight: 600;
110
+ }
111
+ &:where(:is(h1, h2, h3, h4) :is(strong, b)) {
112
+ font-weight: 600;
113
+ }
114
+ &:where(mark) {
115
+ background-color: var(--color-highlight-muted);
116
+ color: var(--color-highlight-foreground);
117
+ padding: 0.05em 0.15em;
118
+ border-radius: 0.2em;
119
+ }
120
+ &:where(abbr[title]) {
121
+ text-decoration-line: underline;
122
+ text-decoration-style: dotted;
123
+ text-underline-offset: 0.2em;
124
+ cursor: help;
125
+ }
126
+ &:where(del, s) {
127
+ color: var(--typeset-muted);
128
+ text-decoration-line: line-through;
129
+ }
130
+ &:where(sup, sub) {
131
+ font-size: 0.75em;
132
+ line-height: 0;
133
+ position: relative;
134
+ vertical-align: baseline;
135
+ }
136
+ &:where(sup) {
137
+ top: -0.5em;
138
+ }
139
+ &:where(sub) {
140
+ bottom: -0.25em;
141
+ }
142
+ &:where(sup a) {
143
+ text-decoration-line: none;
144
+ font-weight: 500;
145
+ }
146
+
147
+ &:where(ul) {
148
+ list-style-type: disc;
149
+ }
150
+ &:where(ol) {
151
+ list-style-type: decimal;
152
+ }
153
+ &:where(ul ul) {
154
+ list-style-type: circle;
155
+ }
156
+ &:where(ul ul ul) {
157
+ list-style-type: square;
158
+ }
159
+ &:where(ol[type='a' i]) {
160
+ list-style-type: lower-alpha;
161
+ }
162
+ &:where(ol[type='i' i]) {
163
+ list-style-type: lower-roman;
164
+ }
165
+ &:where(ol[type='A' s]) {
166
+ list-style-type: upper-alpha;
167
+ }
168
+ &:where(ol[type='I' s]) {
169
+ list-style-type: upper-roman;
170
+ }
171
+ &:where(ul, ol) {
172
+ margin-block-start: var(--typeset-flow);
173
+ margin-block-end: 0;
174
+ padding-inline-start: 1.5em;
175
+ }
176
+ &:where(li) {
177
+ margin-block-start: 0.5em;
178
+ padding-inline-start: 0.4em;
179
+ }
180
+ &:where(li > p, li > ul, li > ol) {
181
+ margin-block-start: 0.5em;
182
+ }
183
+ &:where(ul > li)::marker {
184
+ color: var(--typeset-muted);
185
+ }
186
+ &:where(ol > li)::marker {
187
+ color: var(--typeset-muted);
188
+ }
189
+
190
+ &:where(ul.contains-task-list) {
191
+ list-style-type: none;
192
+ padding-inline-start: 0.25em;
193
+ }
194
+ &:where(li.task-list-item > input[type='checkbox']) {
195
+ margin-inline-end: 0.5em;
196
+ vertical-align: -0.1em;
197
+ accent-color: var(--color-primary, currentColor);
198
+ }
199
+
200
+ &:where(details) {
201
+ margin-block-start: var(--typeset-flow);
202
+ margin-block-end: 0;
203
+ }
204
+ &:where(summary) {
205
+ cursor: pointer;
206
+ font-weight: 500;
207
+ }
208
+ &:where(summary)::marker {
209
+ color: var(--typeset-muted);
210
+ }
211
+
212
+ &:where(kbd) {
213
+ font-family: inherit;
214
+ font-size: 0.85em;
215
+ font-weight: 500;
216
+ border: 1px solid var(--typeset-rule);
217
+ border-block-end-width: 2px;
218
+ border-radius: min(calc(var(--radius, 0.5em) * 0.6), 0.35em);
219
+ padding: 0.0625em 0.35em;
220
+ }
221
+
222
+ &:where(dl) {
223
+ margin-block-start: var(--typeset-flow);
224
+ margin-block-end: 0;
225
+ }
226
+ &:where(dt) {
227
+ font-weight: 500;
228
+ margin-block-start: 1em;
229
+ }
230
+ &:where(dt + dt) {
231
+ margin-block-start: 0.25em;
232
+ }
233
+ &:where(dd) {
234
+ margin-block-start: 0.25em;
235
+ margin-inline-start: 0;
236
+ padding-inline-start: 1em;
237
+ color: var(--typeset-muted);
238
+ }
239
+
240
+ &:where(:not(pre) > code) {
241
+ background-color: var(--color-muted, color-mix(in oklab, currentColor 8%, transparent));
242
+ font-family: var(--typeset-font-mono);
243
+ font-size: 0.85em;
244
+ border-radius: min(calc(var(--radius, 0.5em) * 0.6), 0.35em);
245
+ padding: 0.125em 0.3em;
246
+ }
247
+
248
+ &:where(pre) {
249
+ background-color: var(--color-muted, color-mix(in oklab, currentColor 8%, transparent));
250
+ font-family: var(--typeset-font-mono);
251
+ font-size: 0.875em;
252
+ line-height: 1.5;
253
+ tab-size: 2;
254
+ direction: ltr;
255
+ border-radius: var(--radius, 0.5em);
256
+ padding: 0.75em 1em;
257
+ overflow-x: auto;
258
+ margin-block-start: calc(var(--typeset-flow) / 0.875);
259
+ margin-block-end: 0;
260
+ }
261
+ &:where(pre code) {
262
+ background-color: transparent;
263
+ font-family: inherit;
264
+ font-size: inherit;
265
+ padding: 0;
266
+ border-radius: 0;
267
+ }
268
+
269
+ &:where(blockquote) {
270
+ border-inline-start: 2px solid var(--typeset-rule);
271
+ padding-inline-start: 1em;
272
+ margin-block-start: var(--typeset-flow);
273
+ margin-block-end: 0;
274
+ margin-inline: 0;
275
+ }
276
+
277
+ &:where(hr) {
278
+ border: 0;
279
+ border-block-start: 1px solid var(--typeset-rule);
280
+ margin-block-start: calc(var(--typeset-flow) * 2.4);
281
+ margin-block-end: 0;
282
+ }
283
+ &:where(hr + h1, hr + h2, hr + h3, hr + h4) {
284
+ margin-block-start: var(--typeset-flow);
285
+ }
286
+
287
+ &:where(.footnotes, [data-footnotes]) {
288
+ margin-block-start: calc(var(--typeset-flow) * 2);
289
+ border-block-start: 1px solid var(--typeset-rule);
290
+ padding-block-start: var(--typeset-flow);
291
+ font-size: 0.875em;
292
+ color: var(--typeset-muted);
293
+ }
294
+
295
+ &:where(math[display='block']) {
296
+ margin-block-start: var(--typeset-flow);
297
+ margin-block-end: 0;
298
+ overflow-x: auto;
299
+ overflow-y: hidden;
300
+ padding-block: 0.25em;
301
+ }
302
+
303
+ &:where(img, video) {
304
+ border-radius: var(--radius, 0.5em);
305
+ max-width: 100%;
306
+ height: auto;
307
+ margin-block-start: var(--typeset-flow);
308
+ margin-block-end: 0;
309
+ }
310
+ &:where(p img) {
311
+ margin-block-start: 0;
312
+ }
313
+ &:where(figure) {
314
+ margin-block-start: var(--typeset-flow);
315
+ margin-block-end: 0;
316
+ margin-inline: 0;
317
+ }
318
+ &:where(figcaption, caption) {
319
+ color: var(--typeset-muted);
320
+ font-size: 0.875em;
321
+ text-align: center;
322
+ margin-block-start: calc(0.75em / 0.875);
323
+ }
324
+ &:where(caption) {
325
+ caption-side: bottom;
326
+ }
327
+
328
+ &:where(table) {
329
+ max-width: 100%;
330
+ font-size: 1em;
331
+ line-height: 1.5;
332
+ font-variant-numeric: tabular-nums;
333
+ border-collapse: separate;
334
+ border-spacing: 0;
335
+ border-block-end: 1px solid var(--typeset-rule);
336
+ margin-block-start: var(--typeset-flow);
337
+ margin-block-end: 0;
338
+ }
339
+
340
+ &:where(.typeset-scroll) {
341
+ overflow-x: auto;
342
+ margin-block-start: var(--typeset-flow);
343
+ }
344
+ &:where(.typeset-scroll > *) {
345
+ margin-block-start: 0;
346
+ }
347
+ &:where(.typeset-scroll table) {
348
+ width: max-content;
349
+ max-width: none;
350
+ }
351
+ &:where(thead th) {
352
+ font-weight: 500;
353
+ text-align: start;
354
+ white-space: nowrap;
355
+ padding: 0.65em 1em;
356
+ }
357
+ &:where(:is(tbody, tfoot) :is(td, th)) {
358
+ padding: 0.75em 1em;
359
+ text-align: start;
360
+ vertical-align: top;
361
+ border-block-start: 1px solid var(--typeset-rule);
362
+ }
363
+ &:where(tbody th, tfoot th) {
364
+ font-weight: 500;
365
+ }
366
+ &:where(th:first-child, td:first-child) {
367
+ padding-inline-start: 0;
368
+ }
369
+ &:where(th[align='center'], td[align='center']) {
370
+ text-align: center;
371
+ }
372
+ &:where(th[align='right'], td[align='right']) {
373
+ text-align: end;
374
+ }
375
+
376
+ &:where(li > blockquote, li > table, li > figure) {
377
+ margin-block-start: 0.5em;
378
+ }
379
+ &:where(li > pre) {
380
+ margin-block-start: calc(0.5em / 0.875);
381
+ }
382
+
383
+ @media print {
384
+ &:where(pre, table, blockquote, figure) {
385
+ break-inside: avoid;
386
+ }
387
+ &:where(h1, h2, h3, h4) {
388
+ break-after: avoid;
389
+ }
390
+ }
391
+
392
+ @media (forced-colors: active) {
393
+ &:where(:not(pre) > code) {
394
+ border: 1px solid;
395
+ }
396
+ }
397
+ }
398
+
399
+ .typeset
400
+ > :where(:first-child):not(
401
+ :where(.not-typeset, [data-not-typeset], .not-typeset *, [data-not-typeset] *)
402
+ ),
403
+ .typeset
404
+ > :where(:first-child)
405
+ > :where(:first-child):not(
406
+ :where(.not-typeset, [data-not-typeset], .not-typeset *, [data-not-typeset] *)
407
+ ),
408
+ .typeset
409
+ :where(
410
+ li > :first-child,
411
+ blockquote > :first-child,
412
+ td > :first-child,
413
+ th > :first-child,
414
+ dd > :first-child,
415
+ figure > :first-child,
416
+ figure > picture > img
417
+ ):not(:where(.not-typeset, [data-not-typeset], .not-typeset *, [data-not-typeset] *)) {
418
+ margin-block-start: 0;
419
+ }
420
+ }
@@ -0,0 +1,11 @@
1
+ @layer components {
2
+ .typeset-compact {
3
+ --typeset-font-body: var(--font-sans);
4
+ --typeset-font-heading: var(--font-sans);
5
+ --typeset-font-mono: var(--font-mono);
6
+ --typeset-size: 1rem;
7
+ --typeset-leading: 1.6;
8
+ --typeset-flow: 1em;
9
+ --typeset-measure: 65ch;
10
+ }
11
+ }