@m6d/cortex-react 0.7.0 → 0.8.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/dist/styles.css CHANGED
@@ -55,6 +55,14 @@
55
55
  monospace
56
56
  );
57
57
  --cortex-font-size: 0.8125rem;
58
+ /* These read --cortex-font-size (or the color named) when unset, so they ship
59
+ * unset: declaring one here gives that part its own value.
60
+ *
61
+ * --cortex-font-size-message: 0.875rem; message bubbles and the composer
62
+ * --cortex-font-size-header: 0.875rem; the chat and history titles
63
+ * --cortex-color-send-empty: transparent; the send button with nothing to send
64
+ * --cortex-color-send-empty-text: var(--cortex-color-text-muted);
65
+ */
58
66
  /* The widget's headings read --cortex-font-display and fall back to `inherit`,
59
67
  * so it ships unset on purpose — declaring it here is how you opt in:
60
68
  *
@@ -364,8 +372,13 @@
364
372
  .cortex-widget__container--full .cortex-widget__history-btn {
365
373
  display: none;
366
374
  }
375
+ @media (min-width: 769px) {
376
+ .cortex-widget__container--full > .cortex-widget__screen:nth-child(2) .cortex-widget__new-btn {
377
+ display: none;
378
+ }
379
+ }
367
380
  .cortex-widget__container--full .cortex-widget__chat-title {
368
- font-size: 0.875rem;
381
+ font-size: var(--cortex-font-size-header, 0.875rem);
369
382
  }
370
383
  .cortex-widget__container--full .cortex-widget__chat-header {
371
384
  background: var(--cortex-color-surface);
@@ -464,8 +477,7 @@
464
477
  background: var(--cortex-color-surface);
465
478
  }
466
479
 
467
- .cortex-widget__back-btn,
468
- .cortex-widget__history-btn {
480
+ .cortex-widget__header-btn {
469
481
  flex-shrink: 0;
470
482
  width: 2rem;
471
483
  height: 2rem;
@@ -479,8 +491,7 @@
479
491
  transition: color 0.15s, background-color 0.15s;
480
492
  color: var(--cortex-color-text-muted);
481
493
  }
482
- .cortex-widget__back-btn:hover,
483
- .cortex-widget__history-btn:hover {
494
+ .cortex-widget__header-btn:hover {
484
495
  color: var(--cortex-color-text);
485
496
  background: var(--cortex-color-surface-muted);
486
497
  }
@@ -496,7 +507,7 @@
496
507
 
497
508
  .cortex-widget__chat-title {
498
509
  font-family: var(--cortex-font-display, inherit);
499
- font-size: var(--cortex-font-size);
510
+ font-size: var(--cortex-font-size-header, var(--cortex-font-size));
500
511
  font-weight: 500;
501
512
  color: var(--cortex-color-text-strong);
502
513
  overflow: hidden;
@@ -660,13 +671,8 @@ cortex-llm-usage-chips {
660
671
  border-radius: calc(var(--cortex-radius) * 1.5);
661
672
  border: 1px solid var(--cortex-color-border);
662
673
  padding: 0.375rem;
663
- transition: border-color 0.15s, background-color 0.15s;
664
- }
665
- .cortex-widget__input-box--disabled {
666
- background: var(--cortex-color-surface-muted);
667
- }
668
- .cortex-widget__input-box--enabled {
669
674
  background: color-mix(in oklab, var(--cortex-color-surface-subtle) 45%, var(--cortex-color-surface));
675
+ transition: border-color 0.15s, background-color 0.15s;
670
676
  }
671
677
  .cortex-widget__input-box--enabled:focus-within {
672
678
  border-color: var(--cortex-color-border-strong);
@@ -678,16 +684,23 @@ cortex-llm-usage-chips {
678
684
  background: var(--cortex-color-surface-muted);
679
685
  }
680
686
 
681
- .cortex-widget__textarea {
682
- flex: 1;
687
+ .cortex-widget__textarea,
688
+ .cortex-widget__textarea:focus,
689
+ .cortex-widget__textarea:focus-visible,
690
+ .cortex-widget__textarea:disabled {
683
691
  background: transparent;
684
- resize: none;
685
692
  border: 0;
686
693
  outline: none;
687
- font-size: var(--cortex-font-size);
694
+ box-shadow: none;
695
+ }
696
+
697
+ .cortex-widget__textarea {
698
+ flex: 1;
699
+ resize: none;
700
+ font-size: var(--cortex-font-size-message, var(--cortex-font-size));
688
701
  padding: 0.375rem 0.5rem;
689
702
  min-height: 28px;
690
- max-height: calc(5.5 * var(--cortex-font-size) + 0.75rem);
703
+ max-height: calc(5.5 * var(--cortex-font-size-message, var(--cortex-font-size)) + 0.75rem);
691
704
  overflow-y: auto;
692
705
  line-height: 1.375;
693
706
  color: var(--cortex-color-text-strong);
@@ -701,7 +714,6 @@ cortex-llm-usage-chips {
701
714
  }
702
715
  .cortex-widget__textarea:disabled {
703
716
  cursor: not-allowed;
704
- border: 0;
705
717
  }
706
718
 
707
719
  .cortex-widget__input-actions {
@@ -808,8 +820,8 @@ cortex-llm-usage-chips {
808
820
  cursor: default;
809
821
  }
810
822
  .cortex-widget__send-btn--empty {
811
- background: var(--cortex-color-border);
812
- color: var(--cortex-color-text-muted);
823
+ background: var(--cortex-color-send-empty, transparent);
824
+ color: var(--cortex-color-send-empty-text, var(--cortex-color-text-muted));
813
825
  }
814
826
  .cortex-widget__send-btn--ready {
815
827
  background: var(--cortex-color-primary);
@@ -831,13 +843,13 @@ cortex-llm-usage-chips {
831
843
  align-items: center;
832
844
  gap: 0.75rem;
833
845
  }
834
- .cortex-widget__threads-header .cortex-widget__new-chat-btn {
846
+ .cortex-widget__threads-header .cortex-widget__new-btn {
835
847
  margin-inline-start: auto;
836
848
  }
837
849
 
838
850
  .cortex-widget__threads-title {
839
851
  font-family: var(--cortex-font-display, inherit);
840
- font-size: 0.9375rem;
852
+ font-size: var(--cortex-font-size-header, 0.9375rem);
841
853
  font-weight: 600;
842
854
  color: var(--cortex-color-text-heading);
843
855
  letter-spacing: -0.01em;
@@ -1218,9 +1230,9 @@ cortex-llm-usage-chips {
1218
1230
  position: absolute;
1219
1231
  inset: -0.25rem;
1220
1232
  border-radius: 9999px;
1221
- border: 1.5px solid transparent;
1233
+ border: 1.5px solid color-mix(in oklab, var(--cortex-color-accent) 18%, transparent);
1222
1234
  border-top-color: var(--cortex-color-accent);
1223
- border-right-color: color-mix(in oklab, var(--cortex-color-accent) 40%, transparent);
1235
+ border-right-color: color-mix(in oklab, var(--cortex-color-accent) 45%, transparent);
1224
1236
  }
1225
1237
  .cortex-working-avatar--shown .cortex-working-avatar__ring {
1226
1238
  animation: cortex-tool-spin 1s linear infinite;
@@ -1260,15 +1272,15 @@ cortex-llm-usage-chips {
1260
1272
 
1261
1273
  .cortex-text-bubble--assistant,
1262
1274
  .cortex-subtle-activity,
1263
- .cortex-tool-pill:not(.cortex-tool-pill--gated),
1264
- .cortex-tool-pill:not(.cortex-tool-pill--gated) .cortex-tool-pill__icon {
1275
+ .cortex-tool-pill,
1276
+ .cortex-tool-pill .cortex-tool-pill__icon {
1265
1277
  transition: translate 420ms cubic-bezier(0.76, 0, 0.24, 1) 160ms;
1266
1278
  }
1267
1279
 
1268
1280
  .cortex-message--working-turn .cortex-text-bubble--assistant,
1269
1281
  .cortex-message--working-turn .cortex-subtle-activity,
1270
- .cortex-message--working-turn .cortex-tool-pill:not(.cortex-tool-pill--gated),
1271
- .cortex-message--working-turn .cortex-tool-pill:not(.cortex-tool-pill--gated) .cortex-tool-pill__icon {
1282
+ .cortex-message--working-turn .cortex-tool-pill,
1283
+ .cortex-message--working-turn .cortex-tool-pill .cortex-tool-pill__icon {
1272
1284
  transition-delay: 0s;
1273
1285
  }
1274
1286
  .cortex-message--working-turn .cortex-text-bubble--assistant,
@@ -1279,16 +1291,16 @@ cortex-llm-usage-chips {
1279
1291
  [dir=rtl] .cortex-message--working-turn .cortex-subtle-activity {
1280
1292
  translate: -2rem;
1281
1293
  }
1282
- .cortex-message--working-turn .cortex-tool-pill:not(.cortex-tool-pill--gated) {
1294
+ .cortex-message--working-turn .cortex-tool-pill {
1283
1295
  translate: 0.875rem;
1284
1296
  }
1285
- [dir=rtl] .cortex-message--working-turn .cortex-tool-pill:not(.cortex-tool-pill--gated) {
1297
+ [dir=rtl] .cortex-message--working-turn .cortex-tool-pill {
1286
1298
  translate: -0.875rem;
1287
1299
  }
1288
- .cortex-message--working-turn .cortex-tool-pill:not(.cortex-tool-pill--gated) .cortex-tool-pill__icon {
1300
+ .cortex-message--working-turn .cortex-tool-pill .cortex-tool-pill__icon {
1289
1301
  translate: -0.5rem;
1290
1302
  }
1291
- [dir=rtl] .cortex-message--working-turn .cortex-tool-pill:not(.cortex-tool-pill--gated) .cortex-tool-pill__icon {
1303
+ [dir=rtl] .cortex-message--working-turn .cortex-tool-pill .cortex-tool-pill__icon {
1292
1304
  translate: 0.5rem;
1293
1305
  }
1294
1306
 
@@ -1425,7 +1437,7 @@ cortex-llm-usage-chips {
1425
1437
  max-width: 80%;
1426
1438
  min-width: 0;
1427
1439
  overflow-wrap: anywhere;
1428
- font-size: var(--cortex-font-size);
1440
+ font-size: var(--cortex-font-size-message, var(--cortex-font-size));
1429
1441
  line-height: 1.625;
1430
1442
  padding: 1rem;
1431
1443
  border-radius: calc(var(--cortex-radius) * 2);
@@ -1702,6 +1714,92 @@ cortex-llm-usage-chips {
1702
1714
  color: var(--cortex-color-text-muted);
1703
1715
  }
1704
1716
 
1717
+ .cortex-table-block {
1718
+ display: block;
1719
+ margin: 0.5em 0 0.75em;
1720
+ }
1721
+ .cortex-table-block th {
1722
+ white-space: nowrap;
1723
+ }
1724
+ .cortex-table-block td {
1725
+ max-width: 20rem;
1726
+ }
1727
+ .cortex-table-block table {
1728
+ margin: 0;
1729
+ }
1730
+
1731
+ .cortex-table-block__actions {
1732
+ display: flex;
1733
+ justify-content: flex-end;
1734
+ gap: 0.125rem;
1735
+ min-height: 1.75rem;
1736
+ margin-bottom: 0.25rem;
1737
+ opacity: 0;
1738
+ transition: opacity 0.15s;
1739
+ }
1740
+ .cortex-table-block:hover .cortex-table-block__actions, .cortex-table-block:focus-within .cortex-table-block__actions {
1741
+ opacity: 1;
1742
+ }
1743
+ @media (hover: none) {
1744
+ .cortex-table-block__actions {
1745
+ opacity: 1;
1746
+ }
1747
+ }
1748
+
1749
+ .cortex-table-block__action {
1750
+ flex-shrink: 0;
1751
+ width: 2rem;
1752
+ height: 2rem;
1753
+ border-radius: calc(var(--cortex-radius) * 0.75);
1754
+ display: flex;
1755
+ align-items: center;
1756
+ justify-content: center;
1757
+ background: transparent;
1758
+ border: 0;
1759
+ cursor: pointer;
1760
+ transition: color 0.15s, background-color 0.15s;
1761
+ width: 1.75rem;
1762
+ height: 1.75rem;
1763
+ color: var(--cortex-color-text-muted);
1764
+ }
1765
+ .cortex-table-block__action:hover {
1766
+ color: var(--cortex-color-text);
1767
+ background: var(--cortex-color-hover);
1768
+ }
1769
+
1770
+ .cortex-table-block__dialog {
1771
+ width: min(72rem, 100vw - 2rem);
1772
+ max-width: none;
1773
+ max-height: calc(100vh - 2rem);
1774
+ margin: auto;
1775
+ padding: 0;
1776
+ border: 1px solid var(--cortex-color-border);
1777
+ border-radius: calc(var(--cortex-radius) * 1.5);
1778
+ background: var(--cortex-color-surface);
1779
+ color: var(--cortex-color-text-strong);
1780
+ box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
1781
+ }
1782
+ .cortex-table-block__dialog[open] {
1783
+ display: flex;
1784
+ flex-direction: column;
1785
+ }
1786
+ .cortex-table-block__dialog::backdrop {
1787
+ background: rgba(0, 0, 0, 0.4);
1788
+ }
1789
+
1790
+ .cortex-table-block__dialog-head {
1791
+ display: flex;
1792
+ justify-content: flex-end;
1793
+ gap: 0.125rem;
1794
+ padding: 0.375rem;
1795
+ border-bottom: 1px solid var(--cortex-color-border);
1796
+ }
1797
+
1798
+ .cortex-table-block__dialog-body {
1799
+ overflow: auto;
1800
+ padding: 0 1rem;
1801
+ }
1802
+
1705
1803
  .cortex-reasoning-details {
1706
1804
  width: 100%;
1707
1805
  border-radius: var(--cortex-radius);
@@ -2324,51 +2422,125 @@ details[open] > summary .cortex-debug-tool__chevron {
2324
2422
  font-variant-numeric: tabular-nums;
2325
2423
  }
2326
2424
 
2327
- .cortex-tool-pill--gated {
2425
+ .cortex-approval-card {
2426
+ display: block;
2427
+ max-width: min(100%, 28rem);
2428
+ margin: 0.25rem 0;
2328
2429
  border: 1px solid var(--cortex-color-border);
2329
- border-radius: 9999px;
2330
- background: var(--cortex-color-surface-subtle);
2331
- padding: 0.3rem 0.75rem 0.3rem 0.65rem;
2332
- gap: 0.6rem;
2430
+ border-radius: var(--cortex-radius);
2431
+ background: var(--cortex-color-surface);
2432
+ overflow: hidden;
2333
2433
  }
2334
-
2335
- .cortex-tool-pill--asking {
2336
- padding-inline-end: 0.3rem;
2337
- flex-wrap: wrap;
2434
+ .cortex-approval-card--asking {
2435
+ border-color: color-mix(in oklab, var(--cortex-color-accent) 45%, var(--cortex-color-border));
2436
+ box-shadow: 0 0 0 3px color-mix(in oklab, var(--cortex-color-accent) 10%, transparent);
2338
2437
  }
2339
2438
 
2340
- .cortex-tool-pill__dot {
2341
- width: 0.5rem;
2342
- height: 0.5rem;
2343
- border-radius: 9999px;
2344
- background: var(--cortex-color-accent);
2439
+ .cortex-approval-card__head {
2440
+ display: flex;
2441
+ align-items: center;
2442
+ gap: 0.5rem;
2443
+ padding: 0.625rem 0.75rem 0;
2444
+ font-size: 0.75rem;
2445
+ font-weight: 600;
2446
+ color: var(--cortex-color-accent);
2345
2447
  }
2346
2448
 
2347
- .cortex-tool-pill--gated .cortex-tool-pill__title {
2449
+ .cortex-approval-card__sentence {
2450
+ margin: 0;
2451
+ padding: 0.375rem 0.75rem 0.5rem;
2452
+ font-weight: 600;
2348
2453
  color: var(--cortex-color-text-heading);
2349
- white-space: normal;
2350
2454
  }
2351
2455
 
2352
- .cortex-tool-pill__actions {
2456
+ .cortex-approval-card__sentence--full {
2457
+ padding-top: 0;
2458
+ font-weight: 400;
2459
+ color: var(--cortex-color-text-strong);
2460
+ }
2461
+
2462
+ .cortex-approval-card__rows {
2463
+ display: grid;
2464
+ grid-template-columns: fit-content(40%) minmax(0, 1fr);
2465
+ gap: 0.1875rem 0.75rem;
2466
+ margin: 0;
2467
+ padding: 0 0.75rem 0.75rem;
2468
+ font-size: 0.78125rem;
2469
+ }
2470
+ .cortex-approval-card__rows dt {
2471
+ color: var(--cortex-color-text-secondary);
2472
+ overflow-wrap: anywhere;
2473
+ }
2474
+ .cortex-approval-card__rows dd {
2475
+ max-height: 6rem;
2476
+ margin: 0;
2477
+ overflow-y: auto;
2478
+ white-space: pre-wrap;
2479
+ color: var(--cortex-color-text-strong);
2480
+ overflow-wrap: anywhere;
2481
+ }
2482
+
2483
+ .cortex-approval-card__foot {
2353
2484
  display: flex;
2354
- gap: 0.3rem;
2355
- margin-inline-start: 0.25rem;
2485
+ gap: 0.5rem;
2486
+ padding: 0.625rem 0.75rem;
2487
+ border-top: 1px solid var(--cortex-color-border);
2488
+ background: var(--cortex-color-surface-subtle);
2356
2489
  }
2357
2490
 
2358
- .cortex-tool-pill__action {
2491
+ .cortex-approval-card__button {
2359
2492
  border: 1px solid var(--cortex-color-border-strong);
2360
- border-radius: 9999px;
2361
- background: none;
2362
- padding: 4px 11px;
2493
+ border-radius: calc(var(--cortex-radius) * 0.75);
2494
+ background: var(--cortex-color-surface);
2495
+ padding: 0.375rem 0.875rem;
2363
2496
  font: inherit;
2364
- font-size: 12.5px;
2365
- color: var(--cortex-color-text-secondary);
2497
+ font-size: 0.8125rem;
2498
+ font-weight: 500;
2499
+ color: var(--cortex-color-text-strong);
2366
2500
  cursor: pointer;
2367
2501
  }
2368
- .cortex-tool-pill__action--approve {
2369
- background: var(--cortex-color-accent);
2502
+ .cortex-approval-card__button--approve {
2370
2503
  border-color: var(--cortex-color-accent);
2371
- color: #fff;
2504
+ background: var(--cortex-color-accent);
2505
+ color: var(--cortex-color-primary-foreground);
2506
+ }
2507
+
2508
+ .cortex-approval-card__line {
2509
+ display: flex;
2510
+ align-items: center;
2511
+ gap: 0.5rem;
2512
+ padding: 0.5rem 0.75rem;
2513
+ font-size: 0.8125rem;
2514
+ color: var(--cortex-color-text-secondary);
2515
+ }
2516
+ .cortex-approval-card__line .cortex-tool-pill__icon {
2517
+ flex-shrink: 0;
2518
+ }
2519
+
2520
+ .cortex-approval-card__decision {
2521
+ font-weight: 600;
2522
+ color: var(--cortex-color-text-strong);
2523
+ }
2524
+
2525
+ .cortex-approval-card__summary {
2526
+ min-width: 0;
2527
+ flex: 1;
2528
+ overflow: hidden;
2529
+ text-overflow: ellipsis;
2530
+ white-space: nowrap;
2531
+ }
2532
+
2533
+ .cortex-approval-card__details {
2534
+ flex-shrink: 0;
2535
+ border: 0;
2536
+ background: none;
2537
+ padding: 0;
2538
+ font: inherit;
2539
+ font-size: 0.75rem;
2540
+ color: var(--cortex-color-text-secondary);
2541
+ text-decoration: underline;
2542
+ text-underline-offset: 2px;
2543
+ cursor: pointer;
2372
2544
  }
2373
2545
 
2374
2546
  .cortex-tool-fold {
package/dist/theme.css CHANGED
@@ -63,6 +63,15 @@
63
63
  );
64
64
  --cortex-font-size: 0.8125rem;
65
65
 
66
+ /* These read --cortex-font-size (or the color named) when unset, so they ship
67
+ * unset: declaring one here gives that part its own value.
68
+ *
69
+ * --cortex-font-size-message: 0.875rem; message bubbles and the composer
70
+ * --cortex-font-size-header: 0.875rem; the chat and history titles
71
+ * --cortex-color-send-empty: transparent; the send button with nothing to send
72
+ * --cortex-color-send-empty-text: var(--cortex-color-text-muted);
73
+ */
74
+
66
75
  /* The widget's headings read --cortex-font-display and fall back to `inherit`,
67
76
  * so it ships unset on purpose — declaring it here is how you opt in:
68
77
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m6d/cortex-react",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "React chat widget SDK for cortex servers",
5
5
  "license": "MIT",
6
6
  "sideEffects": [