@jacshuo/onyx 2.6.0 → 2.7.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.
@@ -1,6 +1,7 @@
1
1
  /* TypewriterText.css — cursor animations */
2
2
 
3
3
  /* ── Block cursor blink ────────────────────────────────── */
4
+
4
5
  @keyframes tw-blink {
5
6
  0%,
6
7
  100% {
@@ -12,6 +13,7 @@
12
13
  }
13
14
 
14
15
  /* ── Gentle fade-out on completion ───────────────────────── */
16
+
15
17
  @keyframes tw-cursor-out {
16
18
  0% {
17
19
  opacity: 1;
@@ -25,6 +27,7 @@
25
27
  }
26
28
 
27
29
  /* ── Image fade-in for rich mode ─────────────────────────── */
30
+
28
31
  @keyframes tw-img-fade-in {
29
32
  from {
30
33
  opacity: 0;
@@ -37,6 +40,7 @@
37
40
  }
38
41
 
39
42
  /* ── Base cursor element ─────────────────────────────────── */
43
+
40
44
  .tw-cursor {
41
45
  display: inline-block;
42
46
  line-height: 1;
@@ -50,17 +54,20 @@
50
54
  }
51
55
 
52
56
  /* Thinking / waiting — slow, step-style blink */
57
+
53
58
  .tw-cursor--blink {
54
59
  animation: tw-blink 1s step-end infinite;
55
60
  }
56
61
 
57
62
  /* Actively typing — solid, no blink */
63
+
58
64
  .tw-cursor--solid {
59
65
  opacity: 1;
60
66
  animation: none;
61
67
  }
62
68
 
63
69
  /* Done — fade away */
70
+
64
71
  .tw-cursor--out {
65
72
  animation: tw-cursor-out 0.6s ease-out forwards;
66
73
  pointer-events: none;
@@ -71,6 +78,7 @@
71
78
  ═══════════════════════════════════════════════════════════ */
72
79
 
73
80
  /* ── Prose container ─────────────────────────────────────── */
81
+
74
82
  .tw-rich-prose {
75
83
  font-size: 0.875rem;
76
84
  line-height: 1.75;
@@ -84,6 +92,7 @@
84
92
  }
85
93
 
86
94
  /* ── Headings ────────────────────────────────────────────── */
95
+
87
96
  .tw-rich-prose h1,
88
97
  .tw-rich-prose h2,
89
98
  .tw-rich-prose h3,
@@ -109,21 +118,26 @@
109
118
  .tw-rich-prose h1 {
110
119
  font-size: 1.5rem;
111
120
  }
121
+
112
122
  .tw-rich-prose h2 {
113
123
  font-size: 1.25rem;
114
124
  }
125
+
115
126
  .tw-rich-prose h3 {
116
127
  font-size: 1.125rem;
117
128
  }
129
+
118
130
  .tw-rich-prose h4 {
119
131
  font-size: 1rem;
120
132
  }
133
+
121
134
  .tw-rich-prose h5,
122
135
  .tw-rich-prose h6 {
123
136
  font-size: 0.875rem;
124
137
  }
125
138
 
126
139
  /* ── Paragraphs ──────────────────────────────────────────── */
140
+
127
141
  .tw-rich-prose p {
128
142
  margin-top: 0.625rem;
129
143
  margin-bottom: 0.625rem;
@@ -138,6 +152,7 @@
138
152
  }
139
153
 
140
154
  /* ── Inline code ─────────────────────────────────────────── */
155
+
141
156
  .tw-rich-prose :not(pre) > code {
142
157
  background-color: var(--color-primary-100);
143
158
  color: var(--color-primary-700);
@@ -156,6 +171,7 @@
156
171
  }
157
172
 
158
173
  /* ── Fenced code blocks ──────────────────────────────────── */
174
+
159
175
  .tw-rich-prose pre {
160
176
  background-color: var(--color-primary-100);
161
177
  border: 1px solid var(--color-primary-200);
@@ -183,6 +199,7 @@
183
199
  }
184
200
 
185
201
  /* ── Blockquotes ─────────────────────────────────────────── */
202
+
186
203
  .tw-rich-prose blockquote {
187
204
  border-left: 3px solid var(--color-primary-400);
188
205
  padding: 0.375rem 0 0.375rem 1rem;
@@ -197,6 +214,7 @@
197
214
  }
198
215
 
199
216
  /* ── Lists ───────────────────────────────────────────────── */
217
+
200
218
  .tw-rich-prose ul,
201
219
  .tw-rich-prose ol {
202
220
  padding-left: 1.5rem;
@@ -221,6 +239,7 @@
221
239
  }
222
240
 
223
241
  /* ── Horizontal rule ─────────────────────────────────────── */
242
+
224
243
  .tw-rich-prose hr {
225
244
  border: none;
226
245
  border-top: 1px solid var(--color-primary-200);
@@ -232,6 +251,7 @@
232
251
  }
233
252
 
234
253
  /* ── Links ───────────────────────────────────────────────── */
254
+
235
255
  .tw-rich-prose a {
236
256
  color: var(--color-primary-600);
237
257
  text-decoration: underline;
@@ -251,6 +271,7 @@
251
271
  }
252
272
 
253
273
  /* ── strong / em baseline ────────────────────────────────── */
274
+
254
275
  .tw-rich-prose strong {
255
276
  font-weight: 700;
256
277
  }
@@ -264,12 +285,14 @@
264
285
  ═══════════════════════════════════════════════════════════ */
265
286
 
266
287
  /* Figure wrapper */
288
+
267
289
  .tw-rich-img-wrap {
268
290
  display: block;
269
291
  margin: 0.875rem 0;
270
292
  }
271
293
 
272
294
  /* Actual image */
295
+
273
296
  .tw-rich-img {
274
297
  display: block;
275
298
  max-width: 100%;
@@ -283,6 +306,7 @@
283
306
  }
284
307
 
285
308
  /* Error state overlay (hidden by default) */
309
+
286
310
  .tw-rich-img-error {
287
311
  display: none;
288
312
  flex-direction: column;
@@ -306,6 +330,7 @@
306
330
  }
307
331
 
308
332
  /* Toggle error state via JS class added by the image error handler */
333
+
309
334
  .tw-rich-img-wrap--error .tw-rich-img {
310
335
  display: none;
311
336
  }
@@ -313,3 +338,48 @@
313
338
  .tw-rich-img-wrap--error .tw-rich-img-error {
314
339
  display: flex;
315
340
  }
341
+
342
+ /* ═══════════════════════════════════════════════════════════
343
+ LATEX / KATEX — math formula rendering
344
+ Requires: @import 'katex/dist/katex.min.css' in your app CSS.
345
+ ═══════════════════════════════════════════════════════════ */
346
+
347
+ /* ── Display (block) math ────────────────────────────────── */
348
+
349
+ .tw-rich-prose .katex-display {
350
+ display: block;
351
+ margin: 0.875rem 0;
352
+ overflow-x: auto;
353
+ overflow-y: hidden;
354
+ text-align: center;
355
+ }
356
+
357
+ /* ── Inline math ─────────────────────────────────────────── */
358
+
359
+ .tw-rich-prose .katex {
360
+ font-size: 1.05em;
361
+ line-height: 1.2;
362
+ }
363
+
364
+ /* ── Dark-mode: KaTeX inherits color by default, but
365
+ the KaTeX SVG path elements need a nudge ─────────────── */
366
+
367
+ .dark .tw-rich-prose .katex {
368
+ color: inherit;
369
+ }
370
+
371
+ /* ── Fallback for failed / unsupported LaTeX ────────────── */
372
+
373
+ .tw-latex-raw {
374
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
375
+ font-size: 0.8125em;
376
+ color: var(--color-warning-600);
377
+ background-color: var(--color-warning-50);
378
+ padding: 0.1em 0.3em;
379
+ border-radius: 0.25rem;
380
+ }
381
+
382
+ .dark .tw-latex-raw {
383
+ color: var(--color-warning-400);
384
+ background-color: color-mix(in srgb, var(--color-warning-900) 40%, transparent);
385
+ }
package/dist/styles.css CHANGED
@@ -7303,6 +7303,35 @@
7303
7303
  .tw-rich-img-wrap--error .tw-rich-img-error {
7304
7304
  display: flex;
7305
7305
  }
7306
+ .tw-rich-prose .katex-display {
7307
+ display: block;
7308
+ margin: 0.875rem 0;
7309
+ overflow-x: auto;
7310
+ overflow-y: hidden;
7311
+ text-align: center;
7312
+ }
7313
+ .tw-rich-prose .katex {
7314
+ font-size: 1.05em;
7315
+ line-height: 1.2;
7316
+ }
7317
+ .dark .tw-rich-prose .katex {
7318
+ color: inherit;
7319
+ }
7320
+ .tw-latex-raw {
7321
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
7322
+ font-size: 0.8125em;
7323
+ color: var(--color-warning-600);
7324
+ background-color: var(--color-warning-50);
7325
+ padding: 0.1em 0.3em;
7326
+ border-radius: 0.25rem;
7327
+ }
7328
+ .dark .tw-latex-raw {
7329
+ color: var(--color-warning-400);
7330
+ background-color: color-mix(in srgb, oklch(40.8% 0.123 38.172) 40%, transparent);
7331
+ @supports (color: color-mix(in lab, red, red)) {
7332
+ background-color: color-mix(in srgb, var(--color-warning-900) 40%, transparent);
7333
+ }
7334
+ }
7306
7335
  .slider-root * {
7307
7336
  user-select: none;
7308
7337
  }
@@ -7576,6 +7605,43 @@ circle.chart-dot:hover, circle.chart-dot.chart-dot--active {
7576
7605
  font-size: 16px !important;
7577
7606
  }
7578
7607
  }
7608
+ * {
7609
+ scrollbar-width: thin;
7610
+ scrollbar-color: transparent transparent;
7611
+ }
7612
+ :hover {
7613
+ scrollbar-color: rgba(156, 163, 175, 0.4) transparent;
7614
+ }
7615
+ .dark :hover {
7616
+ scrollbar-color: rgba(75, 85, 99, 0.5) transparent;
7617
+ }
7618
+ ::-webkit-scrollbar {
7619
+ width: 6px;
7620
+ height: 6px;
7621
+ }
7622
+ ::-webkit-scrollbar-track {
7623
+ background: transparent;
7624
+ }
7625
+ ::-webkit-scrollbar-thumb {
7626
+ background: transparent;
7627
+ border-radius: 9999px;
7628
+ transition: background 0.2s;
7629
+ }
7630
+ :hover::-webkit-scrollbar-thumb {
7631
+ background: rgba(156, 163, 175, 0.4);
7632
+ }
7633
+ :hover::-webkit-scrollbar-thumb:hover {
7634
+ background: rgba(156, 163, 175, 0.6);
7635
+ }
7636
+ .dark ::-webkit-scrollbar-thumb {
7637
+ background: transparent;
7638
+ }
7639
+ .dark :hover::-webkit-scrollbar-thumb {
7640
+ background: rgba(75, 85, 99, 0.5);
7641
+ }
7642
+ .dark :hover::-webkit-scrollbar-thumb:hover {
7643
+ background: rgba(75, 85, 99, 0.7);
7644
+ }
7579
7645
  }
7580
7646
  @property --tw-translate-x {
7581
7647
  syntax: "*";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jacshuo/onyx",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "description": "Cross-platform React UI component library — works in web & Electron",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -99,8 +99,10 @@
99
99
  "@tiptap/pm": "^3.20.4",
100
100
  "@tiptap/react": "^3.20.4",
101
101
  "@tiptap/starter-kit": "^3.20.4",
102
+ "@types/katex": "^0.16.8",
102
103
  "class-variance-authority": "^0.7.1",
103
104
  "clsx": "^2.1.1",
105
+ "katex": "^0.16.40",
104
106
  "lucide-react": "^0.577.0",
105
107
  "marked": "^17.0.5",
106
108
  "shiki": "^4.0.2",