@carbonid1/design-system 5.18.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carbonid1/design-system",
3
- "version": "5.18.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
+ }