@carbonid1/design-system 5.18.0 → 6.0.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.
- package/README.md +26 -7
- package/dist/Button/Button.js +2 -1
- package/dist/ContextMenu/ContextMenu.js +9 -8
- package/dist/Dialog/Dialog.js +4 -3
- package/dist/Field/Field.d.ts +10 -0
- package/dist/Field/Field.js +19 -0
- package/dist/Field/Field.types.d.ts +24 -0
- package/dist/Field/Field.types.js +1 -0
- package/dist/Input/Input.js +2 -1
- package/dist/InputGroup/InputGroup.js +4 -3
- package/dist/Menu/Menu.js +9 -8
- package/dist/MeterRing/MeterRing.d.ts +2 -0
- package/dist/MeterRing/MeterRing.js +9 -0
- package/dist/MeterRing/MeterRing.types.d.ts +9 -0
- package/dist/MeterRing/MeterRing.types.js +1 -0
- package/dist/ProgressRing/ProgressRing.d.ts +2 -10
- package/dist/ProgressRing/ProgressRing.js +8 -11
- package/dist/ProgressRing/ProgressRing.types.d.ts +13 -0
- package/dist/ProgressRing/ProgressRing.types.js +1 -0
- package/dist/RingVisual/RingVisual.d.ts +11 -0
- package/dist/RingVisual/RingVisual.js +20 -0
- package/dist/RingVisual/RingVisual.types.d.ts +1 -0
- package/dist/RingVisual/RingVisual.types.js +1 -0
- package/dist/ScrollArea/ScrollArea.js +7 -6
- package/dist/Select/Select.d.ts +48 -1
- package/dist/Select/Select.js +51 -91
- package/dist/Select/Select.types.d.ts +7 -0
- package/dist/Slider/Slider.d.ts +12 -12
- package/dist/Slider/Slider.js +25 -3
- package/dist/Slider/Slider.types.d.ts +34 -0
- package/dist/Slider/Slider.types.js +1 -0
- package/dist/ThemeCycler/ThemeCycler.js +1 -1
- package/dist/Toaster/Toaster.d.ts +4 -2
- package/dist/Toaster/Toaster.js +58 -3
- package/dist/Toaster/Toaster.types.d.ts +26 -0
- package/dist/Toaster/Toaster.types.js +1 -0
- package/dist/Tooltip/Tooltip.d.ts +25 -2
- package/dist/Tooltip/Tooltip.js +30 -114
- package/dist/helpers/mergeStatefulClassName/mergeStatefulClassName.d.ts +3 -0
- package/dist/helpers/mergeStatefulClassName/mergeStatefulClassName.js +4 -0
- package/dist/index.d.ts +11 -4
- package/dist/index.js +3 -2
- package/package.json +6 -5
- package/skills/design-system/SKILL.md +15 -1
- package/typesets/base.css +420 -0
- package/typesets/compact.css +11 -0
- package/dist/helpers/tooltipPlacement/tooltipPlacement.d.ts +0 -38
- package/dist/helpers/tooltipPlacement/tooltipPlacement.js +0 -26
- /package/dist/{ProgressRing/ProgressRing.consts.d.ts → RingVisual/RingVisual.consts.d.ts} +0 -0
- /package/dist/{ProgressRing/ProgressRing.consts.js → RingVisual/RingVisual.consts.js} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { HotkeysProvider as HotkeysProviderHook, isHotkeyPressed as isHotkeyPressedHook, useHotkeys as useHotkeysHook, useRecordHotkeys as useRecordHotkeysHook } from 'react-hotkeys-hook';
|
|
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 type { BadgeProps } from './Badge/Badge.types';
|
|
4
4
|
export { Button, buttonVariants } from './Button/Button';
|
|
5
5
|
export type { ButtonProps } from './Button/Button.types';
|
|
6
6
|
export { Input } from './Input/Input';
|
|
7
7
|
export type { InputProps } from './Input/Input.types';
|
|
8
|
+
export { Field } from './Field/Field';
|
|
9
|
+
export type { FieldControlProps, FieldDescriptionProps, FieldErrorProps, FieldItemProps, FieldLabelProps, FieldRootActions, FieldRootProps, FieldValidityProps, FieldValidityState, } from './Field/Field.types';
|
|
8
10
|
export { InputGroup } from './InputGroup/InputGroup';
|
|
9
11
|
export type { InputGroupActionProps, InputGroupControlProps, InputGroupRootProps, } from './InputGroup/InputGroup.types';
|
|
10
12
|
export { Card, cardVariants } from './Card/Card';
|
|
@@ -14,7 +16,12 @@ export type { KbdProps } from './Kbd/Kbd.types';
|
|
|
14
16
|
export { Text, textVariants } from './Text/Text';
|
|
15
17
|
export type { TextProps, TextPropsDefault } from './Text/Text.types';
|
|
16
18
|
export { ProgressRing } from './ProgressRing/ProgressRing';
|
|
19
|
+
export type { ProgressRingProps } from './ProgressRing/ProgressRing.types';
|
|
20
|
+
export { MeterRing } from './MeterRing/MeterRing';
|
|
21
|
+
export type { MeterRingProps } from './MeterRing/MeterRing.types';
|
|
22
|
+
export type { RingTone } from './RingVisual/RingVisual.types';
|
|
17
23
|
export { Slider } from './Slider/Slider';
|
|
24
|
+
export type { SliderControlProps, SliderIndicatorProps, SliderLabelProps, SliderProps, SliderRootProps, SliderThumbProps, SliderTrackProps, SliderValueProps, } from './Slider/Slider.types';
|
|
18
25
|
export { Switch } from './Switch/Switch';
|
|
19
26
|
export type { SwitchRootProps, SwitchThumbProps } from './Switch/Switch.types';
|
|
20
27
|
export { SegmentedControl } from './SegmentedControl/SegmentedControl';
|
|
@@ -35,12 +42,12 @@ export type { MessageScrollerController, MessageScrollerContentProps, MessageScr
|
|
|
35
42
|
export { Tooltip } from './Tooltip/Tooltip';
|
|
36
43
|
export { ThemeProvider } from './ThemeProvider/ThemeProvider';
|
|
37
44
|
export { ThemeCycler } from './ThemeCycler/ThemeCycler';
|
|
38
|
-
export { Toaster } from './Toaster/Toaster';
|
|
39
|
-
export {
|
|
45
|
+
export { Toaster, toast } from './Toaster/Toaster';
|
|
46
|
+
export type { ToastAction, ToastFunction, ToastId, ToastMessage, ToastOptions, ToasterProps, } from './Toaster/Toaster.types';
|
|
40
47
|
export { useTheme } from 'next-themes';
|
|
41
48
|
export declare const useHotkeys: typeof useHotkeysHook;
|
|
42
49
|
export declare const useRecordHotkeys: typeof useRecordHotkeysHook;
|
|
43
|
-
export declare const useHotkeysContext:
|
|
50
|
+
export declare const useHotkeysContext: typeof useHotkeysContextHook;
|
|
44
51
|
export declare const isHotkeyPressed: typeof isHotkeyPressedHook;
|
|
45
52
|
export declare const HotkeysProvider: typeof HotkeysProviderHook;
|
|
46
53
|
export type { Options, Keys, HotkeyCallback } from 'react-hotkeys-hook';
|
package/dist/index.js
CHANGED
|
@@ -2,11 +2,13 @@ import { HotkeysProvider as HotkeysProviderHook, isHotkeyPressed as isHotkeyPres
|
|
|
2
2
|
export { Badge, badgeVariants } from './Badge/Badge';
|
|
3
3
|
export { Button, buttonVariants } from './Button/Button';
|
|
4
4
|
export { Input } from './Input/Input';
|
|
5
|
+
export { Field } from './Field/Field';
|
|
5
6
|
export { InputGroup } from './InputGroup/InputGroup';
|
|
6
7
|
export { Card, cardVariants } from './Card/Card';
|
|
7
8
|
export { Kbd, kbdVariants } from './Kbd/Kbd';
|
|
8
9
|
export { Text, textVariants } from './Text/Text';
|
|
9
10
|
export { ProgressRing } from './ProgressRing/ProgressRing';
|
|
11
|
+
export { MeterRing } from './MeterRing/MeterRing';
|
|
10
12
|
export { Slider } from './Slider/Slider';
|
|
11
13
|
export { Switch } from './Switch/Switch';
|
|
12
14
|
export { SegmentedControl } from './SegmentedControl/SegmentedControl';
|
|
@@ -21,8 +23,7 @@ export { MessageScroller, useMessageScroller, useMessageScrollerStatus, useMessa
|
|
|
21
23
|
export { Tooltip } from './Tooltip/Tooltip';
|
|
22
24
|
export { ThemeProvider } from './ThemeProvider/ThemeProvider';
|
|
23
25
|
export { ThemeCycler } from './ThemeCycler/ThemeCycler';
|
|
24
|
-
export { Toaster } from './Toaster/Toaster';
|
|
25
|
-
export { toast } from 'sonner';
|
|
26
|
+
export { Toaster, toast } from './Toaster/Toaster';
|
|
26
27
|
export { useTheme } from 'next-themes';
|
|
27
28
|
// Bind react-hotkeys-hook's exports to local consts instead of re-exporting them.
|
|
28
29
|
// Turbopack's dev module-graph analysis can't reliably follow a transitive
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbonid1/design-system",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.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"
|
|
@@ -36,12 +39,11 @@
|
|
|
36
39
|
"lucide-react": "^1.8.0",
|
|
37
40
|
"next-themes": "^0.4.6",
|
|
38
41
|
"react-hotkeys-hook": "^5.2.4",
|
|
39
|
-
"sonner": "^2.0.7",
|
|
40
42
|
"tailwind-merge": "^3.5.0",
|
|
41
43
|
"tailwindcss": "^4.2.0"
|
|
42
44
|
},
|
|
43
45
|
"peerDependencies": {
|
|
44
|
-
"@base-ui/react": "^1.
|
|
46
|
+
"@base-ui/react": "^1.6.0",
|
|
45
47
|
"postcss": "^8.0.0",
|
|
46
48
|
"react": "^19.0.0",
|
|
47
49
|
"react-dom": "^19.0.0"
|
|
@@ -50,7 +52,7 @@
|
|
|
50
52
|
"access": "public"
|
|
51
53
|
},
|
|
52
54
|
"devDependencies": {
|
|
53
|
-
"@base-ui/react": "^1.
|
|
55
|
+
"@base-ui/react": "^1.6.0",
|
|
54
56
|
"@storybook/addon-docs": "^10.3.5",
|
|
55
57
|
"@storybook/addon-mcp": "^0.6.0",
|
|
56
58
|
"@storybook/addon-themes": "^10.3.5",
|
|
@@ -68,7 +70,6 @@
|
|
|
68
70
|
"playwright": "^1.59.1",
|
|
69
71
|
"react": "^19.2.6",
|
|
70
72
|
"react-dom": "^19.2.6",
|
|
71
|
-
"sonner": "^2.0.7",
|
|
72
73
|
"storybook": "^10.3.5",
|
|
73
74
|
"tailwindcss": "^4.2.2",
|
|
74
75
|
"vite": "^8.0.8",
|
|
@@ -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
|
+
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
type Side = 'top' | 'bottom';
|
|
2
|
-
type Rect = {
|
|
3
|
-
left: number;
|
|
4
|
-
top: number;
|
|
5
|
-
bottom: number;
|
|
6
|
-
width: number;
|
|
7
|
-
};
|
|
8
|
-
type Size = {
|
|
9
|
-
width: number;
|
|
10
|
-
height: number;
|
|
11
|
-
};
|
|
12
|
-
type TooltipPlacementInput = {
|
|
13
|
-
/** Trigger (wrapper) rect, viewport-relative — the tooltip is centered on its horizontal midpoint. */
|
|
14
|
-
trigger: Rect;
|
|
15
|
-
/** Measured tooltip box, taken at its un-shifted centered position. */
|
|
16
|
-
tooltip: Size;
|
|
17
|
-
viewport: Size;
|
|
18
|
-
/** Side the caller asked for; kept unless that side lacks room. */
|
|
19
|
-
preferredSide: Side;
|
|
20
|
-
/** Minimum gap to keep between the tooltip and each viewport edge. */
|
|
21
|
-
margin: number;
|
|
22
|
-
/** Gap between the trigger and the tooltip on the chosen side. */
|
|
23
|
-
gap: number;
|
|
24
|
-
};
|
|
25
|
-
export type TooltipPlacement = {
|
|
26
|
-
side: Side;
|
|
27
|
-
/** Pixels to shift the centered tooltip horizontally; 0 leaves it centered. */
|
|
28
|
-
offsetX: number;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Decide where a centered tooltip should sit so it stays within the viewport:
|
|
32
|
-
* shift it horizontally when an edge would cross `margin`, and flip the vertical
|
|
33
|
-
* side when the preferred one lacks room. Pure — the component feeds it measured
|
|
34
|
-
* rects and applies the result. On a viewport too narrow to fit the box, the left
|
|
35
|
-
* edge wins (LTR readers lose the tail, not the start).
|
|
36
|
-
*/
|
|
37
|
-
export declare const computeTooltipPlacement: ({ trigger, tooltip, viewport, preferredSide, margin, gap, }: TooltipPlacementInput) => TooltipPlacement;
|
|
38
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Decide where a centered tooltip should sit so it stays within the viewport:
|
|
3
|
-
* shift it horizontally when an edge would cross `margin`, and flip the vertical
|
|
4
|
-
* side when the preferred one lacks room. Pure — the component feeds it measured
|
|
5
|
-
* rects and applies the result. On a viewport too narrow to fit the box, the left
|
|
6
|
-
* edge wins (LTR readers lose the tail, not the start).
|
|
7
|
-
*/
|
|
8
|
-
export const computeTooltipPlacement = ({ trigger, tooltip, viewport, preferredSide, margin, gap, }) => {
|
|
9
|
-
const triggerCenterX = trigger.left + trigger.width / 2;
|
|
10
|
-
const centeredLeft = triggerCenterX - tooltip.width / 2;
|
|
11
|
-
const centeredRight = centeredLeft + tooltip.width;
|
|
12
|
-
let offsetX = 0;
|
|
13
|
-
if (centeredRight > viewport.width - margin)
|
|
14
|
-
offsetX = viewport.width - margin - centeredRight;
|
|
15
|
-
if (centeredLeft + offsetX < margin)
|
|
16
|
-
offsetX = margin - centeredLeft;
|
|
17
|
-
const spaceAbove = trigger.top;
|
|
18
|
-
const spaceBelow = viewport.height - trigger.bottom;
|
|
19
|
-
const needed = tooltip.height + gap + margin;
|
|
20
|
-
let side = preferredSide;
|
|
21
|
-
if (preferredSide === 'top' && spaceAbove < needed && spaceBelow > spaceAbove)
|
|
22
|
-
side = 'bottom';
|
|
23
|
-
if (preferredSide === 'bottom' && spaceBelow < needed && spaceAbove > spaceBelow)
|
|
24
|
-
side = 'top';
|
|
25
|
-
return { side, offsetX };
|
|
26
|
-
};
|
|
File without changes
|
|
File without changes
|