@liveblocks/react-ui 2.25.0-aiprivatebeta8 → 3.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.
Files changed (181) hide show
  1. package/_private/package.json +2 -2
  2. package/dist/_private/index.cjs +14 -12
  3. package/dist/_private/index.cjs.map +1 -1
  4. package/dist/_private/index.d.cts +146 -113
  5. package/dist/_private/index.d.ts +146 -113
  6. package/dist/_private/index.js +10 -5
  7. package/dist/_private/index.js.map +1 -1
  8. package/dist/components/AiChat.cjs +85 -121
  9. package/dist/components/AiChat.cjs.map +1 -1
  10. package/dist/components/AiChat.js +87 -123
  11. package/dist/components/AiChat.js.map +1 -1
  12. package/dist/components/AiTool.cjs +188 -0
  13. package/dist/components/AiTool.cjs.map +1 -0
  14. package/dist/components/AiTool.js +186 -0
  15. package/dist/components/AiTool.js.map +1 -0
  16. package/dist/components/Comment.cjs +259 -238
  17. package/dist/components/Comment.cjs.map +1 -1
  18. package/dist/components/Comment.js +261 -240
  19. package/dist/components/Comment.js.map +1 -1
  20. package/dist/components/Composer.cjs +42 -30
  21. package/dist/components/Composer.cjs.map +1 -1
  22. package/dist/components/Composer.js +44 -32
  23. package/dist/components/Composer.js.map +1 -1
  24. package/dist/components/InboxNotificationList.cjs +11 -3
  25. package/dist/components/InboxNotificationList.cjs.map +1 -1
  26. package/dist/components/InboxNotificationList.js +12 -4
  27. package/dist/components/InboxNotificationList.js.map +1 -1
  28. package/dist/components/Thread.cjs +7 -1
  29. package/dist/components/Thread.cjs.map +1 -1
  30. package/dist/components/Thread.js +8 -2
  31. package/dist/components/Thread.js.map +1 -1
  32. package/dist/components/internal/AiChatAssistantMessage.cjs +75 -199
  33. package/dist/components/internal/AiChatAssistantMessage.cjs.map +1 -1
  34. package/dist/components/internal/AiChatAssistantMessage.js +77 -201
  35. package/dist/components/internal/AiChatAssistantMessage.js.map +1 -1
  36. package/dist/components/internal/AiChatComposer.cjs +1 -1
  37. package/dist/components/internal/AiChatComposer.cjs.map +1 -1
  38. package/dist/components/internal/AiChatComposer.js +1 -1
  39. package/dist/components/internal/AiChatComposer.js.map +1 -1
  40. package/dist/components/internal/AiChatUserMessage.cjs +17 -10
  41. package/dist/components/internal/AiChatUserMessage.cjs.map +1 -1
  42. package/dist/components/internal/AiChatUserMessage.js +17 -10
  43. package/dist/components/internal/AiChatUserMessage.js.map +1 -1
  44. package/dist/components/internal/Button.cjs.map +1 -1
  45. package/dist/components/internal/Button.js.map +1 -1
  46. package/dist/components/internal/CodeBlock.cjs +75 -0
  47. package/dist/components/internal/CodeBlock.cjs.map +1 -0
  48. package/dist/components/internal/CodeBlock.js +73 -0
  49. package/dist/components/internal/CodeBlock.js.map +1 -0
  50. package/dist/components/internal/Dropdown.cjs +1 -1
  51. package/dist/components/internal/Dropdown.cjs.map +1 -1
  52. package/dist/components/internal/Dropdown.js +2 -2
  53. package/dist/components/internal/Dropdown.js.map +1 -1
  54. package/dist/components/internal/Emoji.cjs +12 -4
  55. package/dist/components/internal/Emoji.cjs.map +1 -1
  56. package/dist/components/internal/Emoji.js +12 -4
  57. package/dist/components/internal/Emoji.js.map +1 -1
  58. package/dist/components/internal/EmojiPicker.cjs +1 -1
  59. package/dist/components/internal/EmojiPicker.cjs.map +1 -1
  60. package/dist/components/internal/EmojiPicker.js +2 -2
  61. package/dist/components/internal/EmojiPicker.js.map +1 -1
  62. package/dist/components/internal/InboxNotificationThread.cjs +5 -2
  63. package/dist/components/internal/InboxNotificationThread.cjs.map +1 -1
  64. package/dist/components/internal/InboxNotificationThread.js +6 -3
  65. package/dist/components/internal/InboxNotificationThread.js.map +1 -1
  66. package/dist/components/internal/Prose.cjs +37 -0
  67. package/dist/components/internal/Prose.cjs.map +1 -0
  68. package/dist/components/internal/Prose.js +35 -0
  69. package/dist/components/internal/Prose.js.map +1 -0
  70. package/dist/components/internal/Tooltip.cjs +1 -1
  71. package/dist/components/internal/Tooltip.cjs.map +1 -1
  72. package/dist/components/internal/Tooltip.js +2 -2
  73. package/dist/components/internal/Tooltip.js.map +1 -1
  74. package/dist/config.cjs +9 -9
  75. package/dist/config.cjs.map +1 -1
  76. package/dist/config.js +8 -8
  77. package/dist/config.js.map +1 -1
  78. package/dist/icons/CrossCircleFill.cjs +25 -0
  79. package/dist/icons/CrossCircleFill.cjs.map +1 -0
  80. package/dist/icons/CrossCircleFill.js +23 -0
  81. package/dist/icons/CrossCircleFill.js.map +1 -0
  82. package/dist/icons/MinusCircle.cjs +23 -0
  83. package/dist/icons/MinusCircle.cjs.map +1 -0
  84. package/dist/icons/MinusCircle.js +21 -0
  85. package/dist/icons/MinusCircle.js.map +1 -0
  86. package/dist/icons/index.cjs +4 -0
  87. package/dist/icons/index.cjs.map +1 -1
  88. package/dist/icons/index.js +2 -0
  89. package/dist/icons/index.js.map +1 -1
  90. package/dist/index.cjs +3 -3
  91. package/dist/index.cjs.map +1 -1
  92. package/dist/index.d.cts +270 -22
  93. package/dist/index.d.ts +270 -22
  94. package/dist/index.js +2 -2
  95. package/dist/index.js.map +1 -1
  96. package/dist/overrides.cjs +6 -4
  97. package/dist/overrides.cjs.map +1 -1
  98. package/dist/overrides.js +6 -4
  99. package/dist/overrides.js.map +1 -1
  100. package/dist/primitives/AiMessage/contexts.cjs +18 -0
  101. package/dist/primitives/AiMessage/contexts.cjs.map +1 -0
  102. package/dist/primitives/AiMessage/contexts.js +15 -0
  103. package/dist/primitives/AiMessage/contexts.js.map +1 -0
  104. package/dist/primitives/AiMessage/index.cjs +77 -0
  105. package/dist/primitives/AiMessage/index.cjs.map +1 -0
  106. package/dist/primitives/AiMessage/index.js +75 -0
  107. package/dist/primitives/AiMessage/index.js.map +1 -0
  108. package/dist/primitives/AiMessage/tool-invocation.cjs +70 -0
  109. package/dist/primitives/AiMessage/tool-invocation.cjs.map +1 -0
  110. package/dist/primitives/AiMessage/tool-invocation.js +68 -0
  111. package/dist/primitives/AiMessage/tool-invocation.js.map +1 -0
  112. package/dist/primitives/{internal/Collapsible → Collapsible}/index.cjs +39 -17
  113. package/dist/primitives/Collapsible/index.cjs.map +1 -0
  114. package/dist/primitives/{internal/Collapsible → Collapsible}/index.js +37 -15
  115. package/dist/primitives/Collapsible/index.js.map +1 -0
  116. package/dist/primitives/Comment/index.cjs +5 -4
  117. package/dist/primitives/Comment/index.cjs.map +1 -1
  118. package/dist/primitives/Comment/index.js +5 -4
  119. package/dist/primitives/Comment/index.js.map +1 -1
  120. package/dist/primitives/Composer/index.cjs +49 -41
  121. package/dist/primitives/Composer/index.cjs.map +1 -1
  122. package/dist/primitives/Composer/index.js +50 -42
  123. package/dist/primitives/Composer/index.js.map +1 -1
  124. package/dist/primitives/Composer/slate/plugins/mentions.cjs +4 -4
  125. package/dist/primitives/Composer/slate/plugins/mentions.cjs.map +1 -1
  126. package/dist/primitives/Composer/slate/plugins/mentions.js +4 -4
  127. package/dist/primitives/Composer/slate/plugins/mentions.js.map +1 -1
  128. package/dist/primitives/Composer/utils.cjs +3 -6
  129. package/dist/primitives/Composer/utils.cjs.map +1 -1
  130. package/dist/primitives/Composer/utils.js +3 -6
  131. package/dist/primitives/Composer/utils.js.map +1 -1
  132. package/dist/primitives/{internal/Markdown.cjs → Markdown.cjs} +105 -65
  133. package/dist/primitives/Markdown.cjs.map +1 -0
  134. package/dist/primitives/{internal/Markdown.js → Markdown.js} +106 -65
  135. package/dist/primitives/Markdown.js.map +1 -0
  136. package/dist/primitives/index.cjs +4 -6
  137. package/dist/primitives/index.cjs.map +1 -1
  138. package/dist/primitives/index.d.cts +20 -93
  139. package/dist/primitives/index.d.ts +20 -93
  140. package/dist/primitives/index.js +4 -6
  141. package/dist/primitives/index.js.map +1 -1
  142. package/dist/utils/ErrorBoundary.cjs +48 -0
  143. package/dist/utils/ErrorBoundary.cjs.map +1 -0
  144. package/dist/utils/ErrorBoundary.js +45 -0
  145. package/dist/utils/ErrorBoundary.js.map +1 -0
  146. package/dist/utils/use-controllable-state.cjs +25 -2
  147. package/dist/utils/use-controllable-state.cjs.map +1 -1
  148. package/dist/utils/use-controllable-state.js +25 -3
  149. package/dist/utils/use-controllable-state.js.map +1 -1
  150. package/dist/utils/use-visible.cjs +65 -45
  151. package/dist/utils/use-visible.cjs.map +1 -1
  152. package/dist/utils/use-visible.js +66 -46
  153. package/dist/utils/use-visible.js.map +1 -1
  154. package/dist/version.cjs +1 -1
  155. package/dist/version.cjs.map +1 -1
  156. package/dist/version.js +1 -1
  157. package/dist/version.js.map +1 -1
  158. package/package.json +16 -5
  159. package/primitives/package.json +2 -2
  160. package/src/styles/constants.css +1 -1
  161. package/src/styles/dark/index.css +7 -3
  162. package/src/styles/index.css +572 -252
  163. package/src/styles/utils.css +1 -1
  164. package/styles/dark/attributes.css +1 -1
  165. package/styles/dark/attributes.css.map +1 -1
  166. package/styles/dark/media-query.css +1 -1
  167. package/styles/dark/media-query.css.map +1 -1
  168. package/styles.css +1 -1
  169. package/styles.css.map +1 -1
  170. package/dist/components/AiToolDebugger.cjs +0 -74
  171. package/dist/components/AiToolDebugger.cjs.map +0 -1
  172. package/dist/components/AiToolDebugger.js +0 -72
  173. package/dist/components/AiToolDebugger.js.map +0 -1
  174. package/dist/primitives/internal/Collapsible/index.cjs.map +0 -1
  175. package/dist/primitives/internal/Collapsible/index.js.map +0 -1
  176. package/dist/primitives/internal/Emoji.cjs +0 -32
  177. package/dist/primitives/internal/Emoji.cjs.map +0 -1
  178. package/dist/primitives/internal/Emoji.js +0 -30
  179. package/dist/primitives/internal/Emoji.js.map +0 -1
  180. package/dist/primitives/internal/Markdown.cjs.map +0 -1
  181. package/dist/primitives/internal/Markdown.js.map +0 -1
@@ -26,7 +26,7 @@
26
26
  --lb-transition-easing: cubic-bezier(0.4, 0, 0.2, 1);
27
27
  --lb-highlight-shadow: inset 0 0 0 1px rgb(0 0 0 / 10%);
28
28
  --lb-elevation-shadow: $lb-elevation-shadow;
29
- --lb-elevation-shadow-small: $lb-elevation-shadow-small;
29
+ --lb-elevation-shadow-moderate: $lb-elevation-shadow-moderate;
30
30
  --lb-tooltip-shadow: $lb-tooltip-shadow;
31
31
  --lb-accent-contrast: 8%;
32
32
  --lb-destructive-contrast: 8%;
@@ -284,6 +284,23 @@
284
284
  }
285
285
  }
286
286
 
287
+ &:where([data-variant="destructive"]) {
288
+ --lb-button-background: var(--lb-destructive);
289
+
290
+ color: var(--lb-destructive-foreground);
291
+
292
+ &:where(
293
+ :enabled:hover,
294
+ :enabled:focus-visible,
295
+ [aria-expanded="true"],
296
+ [aria-selected="true"]
297
+ ) {
298
+ --lb-button-background: var(--lb-destructive-secondary);
299
+
300
+ color: var(--lb-destructive-foreground);
301
+ }
302
+ }
303
+
287
304
  &:where([data-variant="outline"]) {
288
305
  box-shadow: inset 0 0 0 1px var(--lb-foreground-subtle);
289
306
  transition-property: background, color, opacity, box-shadow;
@@ -451,6 +468,278 @@
451
468
  opacity: 0.75;
452
469
  }
453
470
 
471
+ /*************************************
472
+ * Collapsible *
473
+ *************************************/
474
+
475
+ .lb-collapsible-trigger {
476
+ all: unset;
477
+ position: relative;
478
+ box-sizing: inherit;
479
+ user-select: none;
480
+ transition-timing-function: var(--lb-transition-easing);
481
+ transition-duration: var(--lb-transition-duration);
482
+ transition-property: color, background, opacity;
483
+ -webkit-tap-highlight-color: transparent;
484
+
485
+ &:where(:not([data-disabled])) {
486
+ cursor: pointer;
487
+ }
488
+ }
489
+
490
+ .lb-collapsible-chevron {
491
+ inline-size: calc(0.8 * var(--lb-icon-size));
492
+ block-size: calc(0.8 * var(--lb-icon-size));
493
+ margin-inline-start: -1px;
494
+ margin-block-start: 1px;
495
+ color: var(--lb-foreground-moderate);
496
+ }
497
+
498
+ @media (prefers-reduced-motion: no-preference) {
499
+ @supports (interpolate-size: allow-keywords) {
500
+ .lb-collapsible-content {
501
+ block-size: 0;
502
+ opacity: 0;
503
+ transition-duration: calc(3 * var(--lb-transition-duration));
504
+ transition-property: block-size, opacity, content-visibility;
505
+
506
+ /* overflow-block: clip; doesn't work as expected */
507
+ /* stylelint-disable-next-line plugin/use-logical-properties-and-values */
508
+ overflow-y: clip;
509
+
510
+ /* interpolate-size is a new-ish property */
511
+ /* stylelint-disable-next-line */
512
+ interpolate-size: allow-keywords;
513
+
514
+ /* transition-behavior is a new-ish property */
515
+ /* stylelint-disable-next-line */
516
+ transition-behavior: allow-discrete;
517
+
518
+ &:where([data-state="open"]) {
519
+ block-size: auto;
520
+ opacity: 1;
521
+
522
+ /* overflow-block: auto; doesn't work as expected */
523
+ /* stylelint-disable-next-line plugin/use-logical-properties-and-values */
524
+ overflow-y: auto;
525
+ }
526
+ }
527
+ }
528
+
529
+ .lb-collapsible-chevron {
530
+ transition-property: transform;
531
+
532
+ .lb-collapsible:where([data-state="open"]) :where(&) {
533
+ transform: rotate(90deg);
534
+ }
535
+ }
536
+ }
537
+
538
+ /* Fix default browser styles when `hidden="until-found"` isn't supported. */
539
+ .lb-collapsible-content:where([hidden]:not([hidden="until-found"])) {
540
+ display: none !important;
541
+ }
542
+
543
+ /*************************************
544
+ * Prose *
545
+ *************************************/
546
+
547
+ .lb-prose {
548
+ &,
549
+ * {
550
+ line-height: var(--lb-line-height);
551
+ }
552
+
553
+ :where(p) {
554
+ margin-block: 0.75em;
555
+ }
556
+
557
+ :where(p, li) {
558
+ text-wrap: pretty;
559
+ }
560
+
561
+ :where(h1, h2, h3, h4, h5, h6) {
562
+ margin-block-start: 1.5em;
563
+ margin-block-end: 0.375em;
564
+ font-weight: 600;
565
+ text-wrap: balance;
566
+ }
567
+
568
+ :where(h1) {
569
+ font-size: 1.75em;
570
+ line-height: calc(0.8 * var(--lb-line-height));
571
+ }
572
+
573
+ :where(h2) {
574
+ font-size: 1.5em;
575
+ line-height: calc(0.86 * var(--lb-line-height));
576
+ }
577
+
578
+ :where(h3) {
579
+ font-size: 1.25em;
580
+ line-height: calc(0.92 * var(--lb-line-height));
581
+ }
582
+
583
+ :where(h4) {
584
+ font-size: 1.125em;
585
+ line-height: calc(0.98 * var(--lb-line-height));
586
+ }
587
+
588
+ :where(h5) {
589
+ font-size: 1em;
590
+ }
591
+
592
+ :where(h6) {
593
+ font-size: 0.875em;
594
+ }
595
+
596
+ :where(hr) {
597
+ margin-block: 1.5em;
598
+ border: none;
599
+ border-block-start: 1px solid var(--lb-foreground-subtle);
600
+ }
601
+
602
+ :where(ol, ul) {
603
+ display: flex;
604
+ flex-direction: column;
605
+ gap: 0.25em;
606
+ margin-block: 0.75em;
607
+ padding-inline-start: 1.5em;
608
+ list-style-position: outside;
609
+
610
+ :where(ol, ul) {
611
+ margin-block: 0;
612
+ }
613
+ }
614
+
615
+ :where(ul) {
616
+ list-style-type: disc;
617
+ }
618
+
619
+ :where(ol) {
620
+ list-style-type: decimal;
621
+ }
622
+
623
+ :where(li) {
624
+ margin-block: 0;
625
+
626
+ > :where(ol, ul) {
627
+ margin-block-start: 0.25em;
628
+ }
629
+ }
630
+
631
+ :where(a) {
632
+ color: var(--lb-foreground);
633
+ outline: none;
634
+ font-weight: 500;
635
+ transition-property: color, text-decoration-color;
636
+ text-decoration-line: underline;
637
+ text-decoration-color: var(--lb-foreground-moderate);
638
+ text-underline-offset: 2px;
639
+
640
+ &:where([href]):where(:hover, :focus-visible) {
641
+ color: var(--lb-accent);
642
+ text-decoration-color: var(--lb-accent-moderate);
643
+ }
644
+ }
645
+
646
+ :where(strong) {
647
+ font-weight: 600;
648
+ }
649
+
650
+ :where(table) {
651
+ inline-size: 100%;
652
+ min-inline-size: 0;
653
+ margin-block: 1em;
654
+ border-collapse: collapse;
655
+ table-layout: auto;
656
+ word-break: break-word;
657
+ }
658
+
659
+ :where(thead) {
660
+ border-block-end: 2px solid var(--lb-foreground-subtle);
661
+
662
+ :where(th) {
663
+ vertical-align: bottom;
664
+ }
665
+ }
666
+
667
+ :where(tbody) {
668
+ :where(td) {
669
+ vertical-align: baseline;
670
+ }
671
+
672
+ :where(tr:not(:last-child)) {
673
+ border-block-end: 1px solid var(--lb-foreground-subtle);
674
+ }
675
+ }
676
+
677
+ :where(tfoot) {
678
+ border-block-start: 2px solid var(--lb-foreground-subtle);
679
+
680
+ :where(td) {
681
+ vertical-align: top;
682
+ }
683
+ }
684
+
685
+ :where(th, td) {
686
+ padding-inline: 0.75em;
687
+ padding-block: 0.5em;
688
+ text-align: start;
689
+
690
+ &:where(:first-child) {
691
+ padding-inline-start: 0;
692
+ }
693
+
694
+ &:where(:last-child) {
695
+ padding-inline-end: 0;
696
+ }
697
+ }
698
+
699
+ :where(.lb-code-block) {
700
+ margin-block: 1em;
701
+ }
702
+
703
+ :where(blockquote) {
704
+ position: relative;
705
+ margin-inline: 0;
706
+ margin-block: 0.75em;
707
+ padding: 0;
708
+ padding-inline-start: 1.25em;
709
+
710
+ &::after {
711
+ content: "";
712
+ position: absolute;
713
+ inset-inline-start: 0;
714
+ inset-block-start: 0;
715
+ inline-size: 4px;
716
+ block-size: 100%;
717
+ border-radius: calc(0.5 * var(--lb-radius));
718
+ background: var(--lb-foreground-subtle);
719
+ }
720
+
721
+ &:where(& + &) {
722
+ margin-block-start: 1em;
723
+ }
724
+
725
+ > :where(:first-child) {
726
+ margin-block-start: 0;
727
+ }
728
+
729
+ > :where(:last-child) {
730
+ margin-block-end: 0;
731
+ }
732
+ }
733
+
734
+ > :where(:first-child) {
735
+ margin-block-start: 0;
736
+ }
737
+
738
+ > :where(:last-child) {
739
+ margin-block-end: 0;
740
+ }
741
+ }
742
+
454
743
  /*************************************
455
744
  * Composer suggestions *
456
745
  *************************************/
@@ -510,6 +799,14 @@
510
799
  * Emoji *
511
800
  *************************************/
512
801
 
802
+ .lb-emoji {
803
+ display: inline-flex;
804
+ justify-content: center;
805
+ align-items: center;
806
+ inline-size: 1em;
807
+ white-space: nowrap;
808
+ }
809
+
513
810
  @include safari-only {
514
811
  .lb-emoji {
515
812
  transform: scale(0.825);
@@ -670,6 +967,7 @@
670
967
  --lb-background: #222;
671
968
  --lb-foreground: #fff;
672
969
  --lb-foreground-contrast: 10%;
970
+ --lb-dynamic-background: var(--lb-background);
673
971
 
674
972
  position: relative;
675
973
  display: flex;
@@ -1925,6 +2223,8 @@
1925
2223
  *************************************/
1926
2224
 
1927
2225
  .lb-elevation {
2226
+ --lb-dynamic-background: var(--lb-background);
2227
+
1928
2228
  position: relative;
1929
2229
  overflow: hidden;
1930
2230
  border-radius: var(--lb-radius);
@@ -1940,6 +2240,10 @@
1940
2240
  box-shadow: var(--lb-inset-shadow);
1941
2241
  pointer-events: none;
1942
2242
  }
2243
+
2244
+ &:where(.lb-elevation-moderate) {
2245
+ box-shadow: var(--lb-elevation-shadow-moderate);
2246
+ }
1943
2247
  }
1944
2248
 
1945
2249
  /*************************************
@@ -2049,9 +2353,56 @@
2049
2353
  }
2050
2354
  }
2051
2355
 
2356
+ /*************************************
2357
+ * Code block *
2358
+ *************************************/
2359
+
2360
+ .lb-code-block {
2361
+ min-inline-size: 0;
2362
+ border: 1px solid var(--lb-foreground-subtle);
2363
+ border-radius: var(--lb-radius);
2364
+
2365
+ :where(.lb-code-block-header) {
2366
+ display: flex;
2367
+ align-items: center;
2368
+ padding: calc(0.5 * var(--lb-spacing));
2369
+ }
2370
+
2371
+ :where(.lb-code-block-title) {
2372
+ margin-inline-start: calc(0.5 * var(--lb-spacing));
2373
+ color: var(--lb-foreground-tertiary);
2374
+ font-weight: 600;
2375
+ font-size: 0.675em;
2376
+ text-transform: uppercase;
2377
+ }
2378
+
2379
+ :where(.lb-code-block-header-actions) {
2380
+ margin-inline-start: auto;
2381
+ }
2382
+
2383
+ :where(.lb-code-block-content) {
2384
+ min-inline-size: 0;
2385
+ margin: 0;
2386
+ padding: 0 var(--lb-spacing) calc(0.875 * var(--lb-spacing));
2387
+ font-size: 85%;
2388
+ line-height: 1;
2389
+
2390
+ /* overflow-inline: auto; doesn't work as expected */
2391
+ /* stylelint-disable-next-line plugin/use-logical-properties-and-values */
2392
+ overflow-x: auto;
2393
+ }
2394
+ }
2395
+
2052
2396
  /*************************************
2053
2397
  * Chat Composer *
2054
2398
  *************************************/
2399
+
2400
+ .lb-ai-chat-composer {
2401
+ position: relative;
2402
+ inline-size: 100%;
2403
+ color: var(--lb-foreground);
2404
+ }
2405
+
2055
2406
  .lb-ai-chat-composer-form:where(
2056
2407
  :has(.lb-ai-chat-composer-editor:not(:focus-visible))
2057
2408
  ) {
@@ -2068,13 +2419,6 @@
2068
2419
  }
2069
2420
  }
2070
2421
 
2071
- .lb-ai-chat-composer-form {
2072
- position: relative;
2073
- background: var(--lb-dynamic-background);
2074
- color: var(--lb-foreground);
2075
- transition-property: background;
2076
- }
2077
-
2078
2422
  .lb-ai-chat-composer-editor {
2079
2423
  max-block-size: 15rem;
2080
2424
  padding: var(--lb-spacing) var(--lb-spacing) 0;
@@ -2144,180 +2488,24 @@
2144
2488
  .lb-ai-chat-message {
2145
2489
  display: flex;
2146
2490
  flex-direction: column;
2147
- gap: calc(0.75 * var(--lb-spacing));
2491
+ gap: var(--lb-spacing);
2148
2492
  color: var(--lb-foreground);
2149
2493
  }
2150
2494
 
2151
- .lb-ai-chat-message-content {
2152
- inline-size: 100%;
2153
- white-space: break-spaces;
2154
- }
2155
-
2156
2495
  .lb-ai-chat-user-message {
2157
2496
  :where(.lb-ai-chat-message-content) {
2497
+ min-block-size: calc(1lh + var(--lb-spacing));
2158
2498
  padding: calc(0.5 * var(--lb-spacing)) var(--lb-spacing);
2159
- border-radius: calc(3 * var(--lb-radius));
2499
+
2500
+ /**
2501
+ * Exactly half the height (line-height + padding) of a one line bubble,
2502
+ * so that it doesn't change when the text wraps and the bubble becomes taller.
2503
+ */
2504
+ border-radius: calc((1lh + var(--lb-spacing)) / 2);
2160
2505
  background: var(--lb-background-foreground-faint);
2161
2506
  color: var(--lb-foreground);
2162
- }
2163
- }
2164
-
2165
- .lb-ai-chat-message-text {
2166
- display: flex;
2167
- flex-direction: column;
2168
-
2169
- &,
2170
- * {
2171
2507
  line-height: var(--lb-line-height);
2172
2508
  }
2173
-
2174
- :where(p) {
2175
- margin-block: 0.25em;
2176
- }
2177
-
2178
- :where(h1, h2, h3, h4, h5, h6) {
2179
- margin-block: 0.5em;
2180
- font-weight: 600;
2181
- }
2182
-
2183
- :where(h1) {
2184
- font-size: 1.75em;
2185
- }
2186
-
2187
- :where(h2) {
2188
- font-size: 1.5em;
2189
- }
2190
-
2191
- :where(h3) {
2192
- font-size: 1.25em;
2193
- }
2194
-
2195
- :where(h4) {
2196
- font-size: 1.125em;
2197
- }
2198
-
2199
- :where(h5) {
2200
- font-size: 1em;
2201
- }
2202
-
2203
- :where(h6) {
2204
- font-size: 0.875em;
2205
- }
2206
-
2207
- :where(hr) {
2208
- margin-block: calc(0.75 * var(--lb-spacing));
2209
- border-block-start: 1px solid var(--lb-foreground-subtle);
2210
- }
2211
-
2212
- :where(blockquote) {
2213
- position: relative;
2214
- margin-block-start: calc(0.75 * var(--lb-spacing));
2215
- padding: calc(0.375 * var(--lb-spacing)) 0 calc(0.375 * var(--lb-spacing))
2216
- calc(1.5 * var(--lb-spacing));
2217
-
2218
- &::after {
2219
- content: "";
2220
- position: absolute;
2221
- inset-inline-start: 0;
2222
- inset-block-start: 0;
2223
- inline-size: 4px;
2224
- block-size: 100%;
2225
- border-radius: calc(0.5 * var(--lb-radius));
2226
- background: var(--lb-foreground-subtle);
2227
- }
2228
- }
2229
-
2230
- :where(ol, ul) {
2231
- margin-block: calc(0.75 * var(--lb-spacing));
2232
- padding-inline-start: calc(1.5 * var(--lb-spacing));
2233
- list-style-position: outside;
2234
- }
2235
-
2236
- :where(ul) {
2237
- list-style-type: disc;
2238
- }
2239
-
2240
- :where(ol) {
2241
- list-style-type: decimal;
2242
- }
2243
-
2244
- :where(li) {
2245
- margin-block: calc(0.25 * var(--lb-spacing));
2246
- }
2247
-
2248
- /**
2249
- * Merge adjacent inline code elements
2250
- */
2251
- :where(span:has(code) + span code) {
2252
- padding-inline-start: 0;
2253
- border-start-start-radius: 0;
2254
- border-end-start-radius: 0;
2255
- }
2256
-
2257
- :where(span:has(code):has(+ span code) code) {
2258
- padding-inline-end: 0;
2259
- border-start-end-radius: 0;
2260
- border-end-end-radius: 0;
2261
- }
2262
-
2263
- :where(a) {
2264
- color: var(--lb-foreground);
2265
- outline: none;
2266
- font-weight: 500;
2267
- transition-property: color, text-decoration-color;
2268
- text-decoration-line: underline;
2269
- text-decoration-color: var(--lb-foreground-moderate);
2270
- text-underline-offset: 2px;
2271
-
2272
- &:where([href]):where(:hover, :focus-visible) {
2273
- color: var(--lb-accent);
2274
- text-decoration-color: var(--lb-accent-moderate);
2275
- }
2276
- }
2277
-
2278
- :where(.lb-code-block) {
2279
- min-inline-size: 0;
2280
- margin-block: 0.25em;
2281
- border: 1px solid var(--lb-foreground-subtle);
2282
- border-radius: var(--lb-radius);
2283
-
2284
- :where(.lb-code-block-header) {
2285
- display: flex;
2286
- align-items: center;
2287
- padding: calc(0.5 * var(--lb-spacing));
2288
- }
2289
-
2290
- :where(.lb-code-block-title) {
2291
- margin-inline-start: calc(0.5 * var(--lb-spacing));
2292
- color: var(--lb-foreground-tertiary);
2293
- font-weight: 600;
2294
- font-size: 0.675em;
2295
- text-transform: uppercase;
2296
- }
2297
-
2298
- :where(.lb-code-block-header-actions) {
2299
- margin-inline-start: auto;
2300
- }
2301
-
2302
- :where(.lb-code-block-content) {
2303
- min-inline-size: 0;
2304
- padding: 0 var(--lb-spacing) calc(0.875 * var(--lb-spacing));
2305
- font-size: 85%;
2306
- line-height: 1;
2307
-
2308
- /* overflow-inline: auto; doesn't work as expected */
2309
- /* stylelint-disable-next-line plugin/use-logical-properties-and-values */
2310
- overflow-x: auto;
2311
- }
2312
- }
2313
-
2314
- :where(strong) {
2315
- font-weight: 600;
2316
- }
2317
- }
2318
-
2319
- .lb-ai-chat-message-tool {
2320
- margin-block: calc(0.25 * var(--lb-spacing));
2321
2509
  }
2322
2510
 
2323
2511
  .lb-ai-chat-message-deleted {
@@ -2326,110 +2514,67 @@
2326
2514
  inline-size: 100%;
2327
2515
  color: var(--lb-foreground-moderate);
2328
2516
  font-size: 0.875em;
2329
- text-wrap: balance;
2517
+ text-wrap: pretty;
2330
2518
  }
2331
2519
 
2332
2520
  .lb-ai-chat-message-error {
2333
- --lb-dynamic-background: var(--lb-background-destructive-subtle);
2334
-
2335
- position: relative;
2336
2521
  display: flex;
2337
2522
  gap: calc(0.5 * var(--lb-spacing));
2338
- align-items: center;
2523
+ align-items: flex-start;
2339
2524
  inline-size: 100%;
2340
- padding: calc(0.75 * var(--lb-spacing));
2341
- border-radius: var(--lb-radius);
2342
- background: var(--lb-dynamic-background);
2343
2525
  color: var(--lb-destructive);
2344
2526
  font-size: 0.875em;
2345
- text-wrap: balance;
2527
+ line-height: var(--lb-line-height);
2528
+ text-wrap: pretty;
2529
+ word-break: break-word;
2346
2530
 
2347
2531
  :where(.lb-icon-container) {
2532
+ block-size: 1lh;
2348
2533
  color: var(--lb-destructive-secondary);
2349
2534
  }
2350
- }
2351
2535
 
2352
- .lb-ai-chat-message-collapsible-trigger {
2353
- @include truncate;
2354
-
2355
- display: flex;
2356
- gap: calc(0.25 * var(--lb-spacing));
2357
- align-items: center;
2358
- cursor: pointer;
2359
- }
2360
-
2361
- .lb-ai-chat-message-collapsible-content {
2362
- display: flex;
2363
- flex-direction: column;
2364
- gap: calc(0.5 * var(--lb-spacing));
2365
- line-height: var(--lb-line-height);
2366
-
2367
- :where(& > *:first-child) {
2368
- margin-block-start: calc(0.5 * var(--lb-spacing));
2536
+ :where(code:not(pre > code)) {
2537
+ background: var(--lb-destructive-subtle);
2369
2538
  }
2370
2539
  }
2371
2540
 
2372
- .lb-ai-chat-message-collapsible-chevron {
2373
- inline-size: calc(0.8 * var(--lb-icon-size));
2374
- block-size: calc(0.8 * var(--lb-icon-size));
2375
- margin-inline-start: -1px;
2376
- margin-block-start: 1px;
2377
- }
2378
-
2379
- @media (prefers-reduced-motion: no-preference) {
2380
- @supports (interpolate-size: allow-keywords) {
2381
- .lb-ai-chat-message-collapsible-content {
2382
- block-size: 0;
2383
- opacity: 0;
2384
- transition-duration: calc(3 * var(--lb-transition-duration));
2385
- transition-property: block-size, opacity, content-visibility;
2386
- content-visibility: hidden;
2387
-
2388
- /* overflow-block: clip; doesn't work as expected */
2389
- /* stylelint-disable-next-line plugin/use-logical-properties-and-values */
2390
- overflow-y: clip;
2391
-
2392
- /* interpolate-size is a new-ish property */
2393
- /* stylelint-disable-next-line */
2394
- interpolate-size: allow-keywords;
2541
+ .lb-ai-chat-message-content {
2542
+ inline-size: 100%;
2543
+ white-space: break-spaces;
2395
2544
 
2396
- /* transition-behavior is a new-ish property */
2397
- /* stylelint-disable-next-line */
2398
- transition-behavior: allow-discrete;
2545
+ &:where(:empty) {
2546
+ display: contents;
2547
+ }
2399
2548
 
2400
- &:where([data-state="open"]) {
2401
- block-size: auto;
2402
- opacity: 1;
2403
- content-visibility: auto;
2549
+ > :where(.lb-ai-chat-message-text) {
2550
+ margin-block: var(--lb-spacing);
2551
+ }
2404
2552
 
2405
- /* overflow-block: auto; doesn't work as expected */
2406
- /* stylelint-disable-next-line plugin/use-logical-properties-and-values */
2407
- overflow-y: auto;
2408
- }
2409
- }
2553
+ > :where(.lb-ai-chat-message-tool-invocation) {
2554
+ margin-block: var(--lb-spacing);
2410
2555
  }
2411
2556
 
2412
- .lb-ai-chat-message-collapsible-chevron {
2413
- transition-property: transform;
2557
+ > :where(:first-child) {
2558
+ margin-block-start: 0;
2559
+ }
2414
2560
 
2415
- .lb-ai-chat-message-collapsible:where([data-state="open"]) :where(&) {
2416
- transform: rotate(90deg);
2417
- }
2561
+ > :where(:last-child) {
2562
+ margin-block-end: 0;
2418
2563
  }
2419
2564
  }
2420
2565
 
2421
2566
  .lb-ai-chat-messages {
2422
2567
  display: flex;
2423
2568
  flex-direction: column;
2424
- gap: calc(0.75 * var(--lb-spacing));
2569
+ gap: var(--lb-spacing);
2425
2570
  inline-size: 100%;
2426
2571
  max-inline-size: min(
2427
2572
  calc(var(--lb-ai-chat-container-width) - var(--lb-spacing)),
2428
2573
  calc(100% - 3 * var(--lb-spacing))
2429
2574
  );
2430
2575
  margin-inline: auto;
2431
- padding-block-start: var(--lb-spacing);
2432
- padding-block-end: calc(5 * var(--lb-spacing));
2576
+ padding-block-start: calc(1.5 * var(--lb-spacing));
2577
+ padding-block-end: calc(3 * var(--lb-spacing));
2433
2578
 
2434
2579
  :where(.lb-ai-chat-user-message) {
2435
2580
  max-inline-size: 80%;
@@ -2464,6 +2609,36 @@
2464
2609
  inset-block-end: 0;
2465
2610
  z-index: 1;
2466
2611
  margin-block-start: auto;
2612
+ }
2613
+
2614
+ :where(.lb-ai-chat-composer) {
2615
+ margin-inline: auto;
2616
+ }
2617
+ }
2618
+
2619
+ .lb-ai-chat:where(.lb-ai-chat\:layout-compact) {
2620
+ :where(.lb-ai-chat-footer) {
2621
+ background: var(--lb-dynamic-background);
2622
+
2623
+ &::after {
2624
+ content: "";
2625
+ position: absolute;
2626
+ inset: 0;
2627
+ border-block-start: 1px solid var(--lb-foreground-subtle);
2628
+ pointer-events: none;
2629
+ }
2630
+ }
2631
+
2632
+ :where(.lb-ai-chat-composer) {
2633
+ max-inline-size: min(
2634
+ 100%,
2635
+ calc(var(--lb-ai-chat-container-width) + var(--lb-spacing))
2636
+ );
2637
+ }
2638
+ }
2639
+
2640
+ .lb-ai-chat:where(.lb-ai-chat\:layout-inset) {
2641
+ :where(.lb-ai-chat-footer) {
2467
2642
  padding: var(--lb-spacing);
2468
2643
  padding-block-start: 0;
2469
2644
 
@@ -2483,13 +2658,15 @@
2483
2658
 
2484
2659
  :where(.lb-ai-chat-composer) {
2485
2660
  max-inline-size: var(--lb-ai-chat-container-width);
2486
- margin-inline: auto;
2487
2661
  border-radius: calc(2 * var(--lb-radius));
2488
- background: var(--lb-dynamic-background);
2489
- box-shadow: var(--lb-elevation-shadow-small);
2490
2662
  }
2491
2663
  }
2492
2664
 
2665
+ .lb-ai-chat-content {
2666
+ position: relative;
2667
+ flex: 1 0 auto;
2668
+ }
2669
+
2493
2670
  .lb-ai-chat-footer-actions {
2494
2671
  position: absolute;
2495
2672
  inset-inline: 0;
@@ -2500,11 +2677,6 @@
2500
2677
  transform: translateY(-100%);
2501
2678
  }
2502
2679
 
2503
- .lb-ai-chat-composer {
2504
- position: relative;
2505
- inline-size: 100%;
2506
- }
2507
-
2508
2680
  .lb-ai-chat-scroll-indicator {
2509
2681
  border-radius: $lb-radius-full;
2510
2682
  color: var(--lb-foreground-moderate);
@@ -2556,17 +2728,165 @@
2556
2728
  .lb-ai-chat-message-reasoning {
2557
2729
  inline-size: fit-content;
2558
2730
  max-inline-size: 100%;
2731
+ color: var(--lb-foreground-tertiary);
2732
+
2733
+ &:where(.lb-ai-chat-pending),
2734
+ :where(.lb-ai-chat-pending) {
2735
+ color: var(--lb-foreground);
2736
+ }
2559
2737
  }
2560
2738
 
2561
2739
  .lb-ai-chat-message-reasoning {
2562
- margin-block-end: calc(0.5 * var(--lb-spacing));
2740
+ margin-block-end: calc(0.75 * var(--lb-spacing));
2741
+
2742
+ :where(.lb-collapsible-trigger) {
2743
+ display: flex;
2744
+ gap: calc(0.25 * var(--lb-spacing));
2745
+ align-items: center;
2746
+
2747
+ &:where(:focus-visible) {
2748
+ color: var(--lb-accent);
2749
+
2750
+ :where(.lb-collapsible-chevron) {
2751
+ color: var(--lb-accent-moderate);
2752
+ }
2753
+ }
2754
+ }
2755
+
2756
+ :where(.lb-collapsible-content) {
2757
+ display: flex;
2758
+ flex-direction: column;
2759
+ gap: calc(0.5 * var(--lb-spacing));
2760
+ line-height: var(--lb-line-height);
2761
+
2762
+ :where(& > *:first-child) {
2763
+ margin-block-start: calc(0.5 * var(--lb-spacing));
2764
+ }
2765
+ }
2563
2766
 
2564
- :where(.lb-ai-chat-message-text) {
2767
+ :where(.lb-prose) {
2768
+ color: var(--lb-foreground);
2565
2769
  font-size: 0.875em;
2566
2770
  opacity: 0.75;
2567
2771
  }
2568
2772
  }
2569
2773
 
2774
+ .lb-ai-tool {
2775
+ position: relative;
2776
+ border-radius: var(--lb-radius);
2777
+ box-shadow: inset 0 0 0 1px var(--lb-foreground-subtle);
2778
+
2779
+ &::after {
2780
+ content: "";
2781
+ position: absolute;
2782
+ inset: 0;
2783
+ border-radius: inherit;
2784
+ pointer-events: none;
2785
+ transition-property: box-shadow;
2786
+ }
2787
+
2788
+ &:where(:has(.lb-ai-tool-header:focus-visible)) {
2789
+ z-index: 1;
2790
+
2791
+ &::after {
2792
+ box-shadow:
2793
+ var(--lb-dynamic-background) 0 0 0 2px,
2794
+ var(--lb-accent) 0 0 0 4px;
2795
+ }
2796
+ }
2797
+ }
2798
+
2799
+ .lb-ai-tool-header {
2800
+ display: flex;
2801
+ gap: calc(0.25 * var(--lb-spacing));
2802
+ align-items: center;
2803
+ inline-size: 100%;
2804
+ block-size: calc($lb-button-size + var(--lb-spacing));
2805
+ padding-inline: calc(0.5 * var(--lb-spacing));
2806
+ }
2807
+
2808
+ .lb-ai-tool-header-icon-container,
2809
+ .lb-ai-tool-icon {
2810
+ display: flex;
2811
+ flex: none;
2812
+ justify-content: center;
2813
+ align-items: center;
2814
+ inline-size: $lb-button-size;
2815
+ block-size: $lb-button-size;
2816
+ }
2817
+
2818
+ .lb-ai-tool-header-icon-container {
2819
+ color: var(--lb-foreground-moderate);
2820
+
2821
+ &:where(:has(.lb-ai-tool-icon)) {
2822
+ margin-inline-end: calc(0.25 * var(--lb-spacing));
2823
+ }
2824
+ }
2825
+
2826
+ .lb-ai-tool-icon {
2827
+ border-radius: calc(0.75 * var(--lb-radius));
2828
+ background: var(--lb-foreground-subtle);
2829
+ font-size: 0.875em;
2830
+ }
2831
+
2832
+ .lb-ai-tool-header-title {
2833
+ @include truncate;
2834
+
2835
+ color: var(--lb-foreground-secondary);
2836
+ font-size: 0.9375em;
2837
+
2838
+ &:where(:first-child) {
2839
+ margin-inline-start: calc(0.25 * var(--lb-spacing));
2840
+ }
2841
+ }
2842
+
2843
+ .lb-ai-tool-header-status {
2844
+ flex: none;
2845
+ margin-inline-start: auto;
2846
+ margin-inline-end: calc(0.25 * var(--lb-spacing));
2847
+ color: var(--lb-foreground-moderate);
2848
+ }
2849
+
2850
+ .lb-ai-tool:where([data-result="error"]) {
2851
+ box-shadow: inset 0 0 0 1px var(--lb-destructive-moderate);
2852
+
2853
+ &:where(:has(.lb-ai-tool-header:focus-visible)) {
2854
+ &::after {
2855
+ box-shadow:
2856
+ var(--lb-dynamic-background) 0 0 0 2px,
2857
+ var(--lb-destructive) 0 0 0 4px;
2858
+ }
2859
+ }
2860
+
2861
+ :where(.lb-ai-tool-header-status) {
2862
+ color: var(--lb-destructive);
2863
+ }
2864
+ }
2865
+
2866
+ .lb-ai-tool-content:where(:not(:empty)) {
2867
+ padding: 0 calc(0.75 * var(--lb-spacing)) calc(0.75 * var(--lb-spacing));
2868
+ }
2869
+
2870
+ .lb-ai-tool-inspector {
2871
+ display: flex;
2872
+ flex-direction: column;
2873
+ gap: calc(0.75 * var(--lb-spacing));
2874
+ }
2875
+
2876
+ .lb-ai-tool-confirmation-footer {
2877
+ display: flex;
2878
+ align-items: center;
2879
+ margin-block-start: calc(0.75 * var(--lb-spacing));
2880
+ }
2881
+
2882
+ .lb-ai-tool-confirmation-actions {
2883
+ display: flex;
2884
+ gap: calc(0.75 * var(--lb-spacing));
2885
+ justify-content: flex-end;
2886
+ align-items: center;
2887
+ margin-inline-start: auto;
2888
+ }
2889
+
2570
2890
  /*************************************
2571
2891
  * Animations *
2572
2892
  *************************************/