open-chat-studio-widget 0.4.2 → 0.4.3
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 +75 -72
- package/dist/cjs/{index-b700441a.js → index-bcb28089.js} +3 -1
- package/dist/cjs/index-bcb28089.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/open-chat-studio-widget.cjs.entry.js +50 -13
- package/dist/cjs/open-chat-studio-widget.cjs.entry.js.map +1 -1
- package/dist/cjs/open-chat-studio-widget.cjs.js +1 -1
- package/dist/collection/components/ocs-chat/ocs-chat.css +117 -92
- package/dist/collection/components/ocs-chat/ocs-chat.js +19 -11
- package/dist/collection/components/ocs-chat/ocs-chat.js.map +1 -1
- package/dist/collection/utils/utils.js +30 -0
- package/dist/collection/utils/utils.js.map +1 -0
- package/dist/components/open-chat-studio-widget.js +49 -12
- package/dist/components/open-chat-studio-widget.js.map +1 -1
- package/dist/esm/{index-b188b488.js → index-205c77bc.js} +3 -2
- package/dist/{open-chat-studio-widget/p-a0fbe1b4.js.map → esm/index-205c77bc.js.map} +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/open-chat-studio-widget.entry.js +50 -13
- package/dist/esm/open-chat-studio-widget.entry.js.map +1 -1
- package/dist/esm/open-chat-studio-widget.js +2 -2
- package/dist/open-chat-studio-widget/open-chat-studio-widget.esm.js +1 -1
- package/dist/open-chat-studio-widget/p-6c3059b7.entry.js +3 -0
- package/dist/open-chat-studio-widget/p-6c3059b7.entry.js.map +1 -0
- package/dist/open-chat-studio-widget/p-78d09c6b.js +3 -0
- package/dist/open-chat-studio-widget/p-78d09c6b.js.map +1 -0
- package/dist/types/components/ocs-chat/ocs-chat.d.ts +4 -3
- package/dist/types/utils/utils.d.ts +7 -0
- package/package.json +1 -1
- package/dist/cjs/index-b700441a.js.map +0 -1
- package/dist/esm/index-b188b488.js.map +0 -1
- package/dist/open-chat-studio-widget/p-a0fbe1b4.js +0 -3
- package/dist/open-chat-studio-widget/p-d47dbd2f.entry.js +0 -3
- package/dist/open-chat-studio-widget/p-d47dbd2f.entry.js.map +0 -1
|
@@ -503,7 +503,7 @@ video {
|
|
|
503
503
|
border-radius: 0.5rem;
|
|
504
504
|
text-align: left;
|
|
505
505
|
transition-duration: 200ms;
|
|
506
|
-
padding: var(--starter-question-padding, 0.
|
|
506
|
+
padding: var(--starter-question-padding, 0.75em);
|
|
507
507
|
background-color: var(--starter-question-bg-color);
|
|
508
508
|
border: 1px solid var(--starter-question-border-color);
|
|
509
509
|
color: var(--starter-question-text-color);
|
|
@@ -540,7 +540,7 @@ video {
|
|
|
540
540
|
display: flex;
|
|
541
541
|
align-items: center;
|
|
542
542
|
gap: 8px;
|
|
543
|
-
padding: var(--button-padding, 0.
|
|
543
|
+
padding: var(--button-padding, 0.75em);
|
|
544
544
|
color: var(--button-text-color, #111827);
|
|
545
545
|
}
|
|
546
546
|
.chat-btn-text:hover {
|
|
@@ -555,12 +555,12 @@ video {
|
|
|
555
555
|
flex-shrink: 0;
|
|
556
556
|
-o-object-fit: contain;
|
|
557
557
|
object-fit: contain;
|
|
558
|
-
width: var(--button-icon-width, 1.
|
|
559
|
-
height: var(--button-icon-height, 1.
|
|
558
|
+
width: var(--button-icon-width, 1.5em);
|
|
559
|
+
height: var(--button-icon-height, 1.5em);
|
|
560
560
|
}
|
|
561
561
|
/* Icon-only button */
|
|
562
562
|
.chat-btn-icon {
|
|
563
|
-
padding: var(--button-padding, 0.
|
|
563
|
+
padding: var(--button-padding, 0.75em);
|
|
564
564
|
width: 56px;
|
|
565
565
|
height: 56px;
|
|
566
566
|
}
|
|
@@ -576,7 +576,7 @@ video {
|
|
|
576
576
|
}
|
|
577
577
|
/* Error message styling */
|
|
578
578
|
.error-message {
|
|
579
|
-
padding: var(--error-message-padding, 0.
|
|
579
|
+
padding: var(--error-message-padding, 0.5em);
|
|
580
580
|
color: var(--error-text-color);
|
|
581
581
|
}
|
|
582
582
|
/* Chat window positioning classes */
|
|
@@ -588,7 +588,6 @@ video {
|
|
|
588
588
|
height: 100%;
|
|
589
589
|
max-height: 100%;
|
|
590
590
|
width: 100%;
|
|
591
|
-
max-width: 1024px;
|
|
592
591
|
flex-direction: column;
|
|
593
592
|
overflow: hidden;
|
|
594
593
|
border-radius: 0px;
|
|
@@ -601,12 +600,15 @@ video {
|
|
|
601
600
|
transition-duration: 200ms;
|
|
602
601
|
background-color: var(--chat-window-bg-color);
|
|
603
602
|
font-size: var(--chat-window-font-size);
|
|
603
|
+
max-width: var(--chat-window-fullscreen-width);
|
|
604
604
|
}
|
|
605
605
|
.chat-window-normal {
|
|
606
606
|
position: fixed;
|
|
607
607
|
display: flex;
|
|
608
|
-
height:
|
|
609
|
-
|
|
608
|
+
height: 100vh;
|
|
609
|
+
min-height: 300px;
|
|
610
|
+
width: 100vw;
|
|
611
|
+
min-width: 300px;
|
|
610
612
|
max-width: 1024px;
|
|
611
613
|
flex-direction: column;
|
|
612
614
|
overflow: hidden;
|
|
@@ -615,7 +617,8 @@ video {
|
|
|
615
617
|
@media (min-width: 640px) {
|
|
616
618
|
|
|
617
619
|
.chat-window-normal {
|
|
618
|
-
|
|
620
|
+
height: var(--chat-window-height);
|
|
621
|
+
width: var(--chat-window-width);
|
|
619
622
|
}
|
|
620
623
|
}
|
|
621
624
|
.chat-window-normal {
|
|
@@ -644,7 +647,7 @@ video {
|
|
|
644
647
|
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
|
|
645
648
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
646
649
|
transition-duration: 150ms;
|
|
647
|
-
padding: var(--header-padding, 0.
|
|
650
|
+
padding: var(--header-padding, 0.5em);
|
|
648
651
|
background-color: var(--header-bg-color);
|
|
649
652
|
border-bottom: 1px solid var(--header-border-color);
|
|
650
653
|
}
|
|
@@ -690,7 +693,7 @@ video {
|
|
|
690
693
|
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
|
|
691
694
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
692
695
|
transition-duration: 200ms;
|
|
693
|
-
padding: var(--button-padding-sm, 0.
|
|
696
|
+
padding: var(--button-padding-sm, 0.375em);
|
|
694
697
|
color: var(--header-button-text-color);
|
|
695
698
|
}
|
|
696
699
|
.header-button:hover {
|
|
@@ -750,7 +753,7 @@ video {
|
|
|
750
753
|
background-color: var(--scrollbar-thumb-hover-color);
|
|
751
754
|
}
|
|
752
755
|
.messages-container {
|
|
753
|
-
padding: var(--container-padding,
|
|
756
|
+
padding: var(--container-padding, 1em);
|
|
754
757
|
}
|
|
755
758
|
/* Message bubbles */
|
|
756
759
|
.message-row {
|
|
@@ -763,18 +766,9 @@ video {
|
|
|
763
766
|
justify-content: flex-start;
|
|
764
767
|
}
|
|
765
768
|
.message-bubble {
|
|
766
|
-
max-width: 20rem;
|
|
767
769
|
border-radius: 0.5rem;
|
|
770
|
+
padding: var(--message-padding-y, 0.5em) var(--message-padding-x, 1em);
|
|
768
771
|
}
|
|
769
|
-
@media (min-width: 1024px) {
|
|
770
|
-
|
|
771
|
-
.message-bubble {
|
|
772
|
-
max-width: 28rem;
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
.message-bubble {
|
|
776
|
-
padding: var(--message-padding-y, 0.5rem) var(--message-padding-x, 1rem);
|
|
777
|
-
}
|
|
778
772
|
.message-bubble-user {
|
|
779
773
|
background-color: var(--message-user-bg-color);
|
|
780
774
|
color: var(--message-user-text-color);
|
|
@@ -890,7 +884,7 @@ video {
|
|
|
890
884
|
margin-bottom: calc(0.5rem * var(--tw-space-y-reverse));
|
|
891
885
|
}
|
|
892
886
|
.starter-questions {
|
|
893
|
-
padding: var(--container-padding,
|
|
887
|
+
padding: var(--container-padding, 1em);
|
|
894
888
|
font-size: var(--chat-window-font-size);
|
|
895
889
|
}
|
|
896
890
|
.starter-question-row {
|
|
@@ -899,7 +893,7 @@ video {
|
|
|
899
893
|
}
|
|
900
894
|
/* Input area */
|
|
901
895
|
.input-area {
|
|
902
|
-
padding: var(--container-padding,
|
|
896
|
+
padding: var(--container-padding, 1em);
|
|
903
897
|
background-color: var(--input-bg-color);
|
|
904
898
|
border-top: 1px solid var(--input-border-color);
|
|
905
899
|
font-size: var(--chat-window-font-size);
|
|
@@ -920,7 +914,7 @@ video {
|
|
|
920
914
|
outline-color: #93c5fd;
|
|
921
915
|
}
|
|
922
916
|
.message-textarea {
|
|
923
|
-
padding: var(--input-textarea-padding-y, 0.
|
|
917
|
+
padding: var(--input-textarea-padding-y, 0.5em) var(--input-textarea-padding-x, 0.75em);
|
|
924
918
|
color: var(--input-text-color);
|
|
925
919
|
border: 1px solid var(--input-border-color);
|
|
926
920
|
}
|
|
@@ -933,7 +927,7 @@ video {
|
|
|
933
927
|
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
|
|
934
928
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
935
929
|
transition-duration: 200ms;
|
|
936
|
-
padding: var(--send-button-padding-y, 0.
|
|
930
|
+
padding: var(--send-button-padding-y, 0.5em) var(--send-button-padding-x, 1em);
|
|
937
931
|
font-size: var(--chat-window-font-size);
|
|
938
932
|
}
|
|
939
933
|
.send-button-enabled {
|
|
@@ -964,9 +958,6 @@ video {
|
|
|
964
958
|
width: 1.5rem;
|
|
965
959
|
height: 1.5rem;
|
|
966
960
|
}
|
|
967
|
-
.h-5\/6 {
|
|
968
|
-
height: 83.333333%;
|
|
969
|
-
}
|
|
970
961
|
.transform {
|
|
971
962
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
972
963
|
}
|
|
@@ -982,7 +973,7 @@ video {
|
|
|
982
973
|
/**
|
|
983
974
|
* Global Variables
|
|
984
975
|
* @prop --chat-z-index: Z-index for chat widget (50)
|
|
985
|
-
* @prop --container-padding: General container padding (
|
|
976
|
+
* @prop --container-padding: General container padding (1em)
|
|
986
977
|
*
|
|
987
978
|
* Button Variables
|
|
988
979
|
* @prop --button-background-color: Button background color (#ffffff)
|
|
@@ -991,18 +982,21 @@ video {
|
|
|
991
982
|
* @prop --button-text-color-hover: Button text color on hover (#1d4ed8)
|
|
992
983
|
* @prop --button-border-color: Button border color (#6b7280)
|
|
993
984
|
* @prop --button-border-color-hover: Button border color on hover (#374151)
|
|
994
|
-
* @prop --button-padding: Button padding (0.
|
|
995
|
-
* @prop --button-padding-sm: Small button padding (0.
|
|
996
|
-
* @prop --button-font-size: Button text font size (0.
|
|
997
|
-
* @prop --button-icon-width: Button icon width (1.
|
|
998
|
-
* @prop --button-icon-height: Button icon height (1.
|
|
985
|
+
* @prop --button-padding: Button padding (0.75em)
|
|
986
|
+
* @prop --button-padding-sm: Small button padding (0.375em)
|
|
987
|
+
* @prop --button-font-size: Button text font size (0.875em)
|
|
988
|
+
* @prop --button-icon-width: Button icon width (1.5em)
|
|
989
|
+
* @prop --button-icon-height: Button icon height (1.5em)
|
|
999
990
|
*
|
|
1000
991
|
* Chat Window Variables
|
|
992
|
+
* @prop --chat-window-height: Chat window height in pixels or percent (60%)
|
|
993
|
+
* @prop --chat-window-width: Chat window width in pixels or percent (25%)
|
|
994
|
+
* @prop --chat-window-fullscreen-width: Chat window fullscreen width in pixels or percent (80%)
|
|
1001
995
|
* @prop --chat-window-bg-color: Chat window background color (#ffffff)
|
|
1002
996
|
* @prop --chat-window-border-color: Chat window border color (#d1d5db)
|
|
1003
997
|
* @prop --chat-window-shadow-color: Chat window shadow color (rgba(0, 0, 0, 0.1))
|
|
1004
|
-
* @prop --chat-window-font-size: Default font size for text in the chat window (0.
|
|
1005
|
-
* @prop --chat-window-font-size-sm: Font size for small text in the chat window (0.
|
|
998
|
+
* @prop --chat-window-font-size: Default font size for text in the chat window (0.875em)
|
|
999
|
+
* @prop --chat-window-font-size-sm: Font size for small text in the chat window (0.75em)
|
|
1006
1000
|
*
|
|
1007
1001
|
* Header Variables
|
|
1008
1002
|
* @prop --header-bg-color: Header background color (transparent)
|
|
@@ -1010,7 +1004,7 @@ video {
|
|
|
1010
1004
|
* @prop --header-border-color: Header border color (#f3f4f6)
|
|
1011
1005
|
* @prop --header-button-text-color: Header button text color (#6b7280)
|
|
1012
1006
|
* @prop --header-button-bg-hover-color: Header button background on hover (#f3f4f6)
|
|
1013
|
-
* @prop --header-padding: Header padding (0.
|
|
1007
|
+
* @prop --header-padding: Header padding (0.5em)
|
|
1014
1008
|
*
|
|
1015
1009
|
* Starter Question Variables
|
|
1016
1010
|
* @prop --starter-question-bg-color: Starter question background color (transparent)
|
|
@@ -1018,7 +1012,7 @@ video {
|
|
|
1018
1012
|
* @prop --starter-question-text-color: Starter question text color (#3b82f6)
|
|
1019
1013
|
* @prop --starter-question-border-color: Starter question border color (#3b82f6)
|
|
1020
1014
|
* @prop --starter-question-border-hover-color: Starter question border on hover (#2563eb)
|
|
1021
|
-
* @prop --starter-question-padding: Starter question padding (0.
|
|
1015
|
+
* @prop --starter-question-padding: Starter question padding (0.75em)
|
|
1022
1016
|
*
|
|
1023
1017
|
* Message Bubble Variables
|
|
1024
1018
|
* @prop --message-user-bg-color: User message background color (#3b82f6)
|
|
@@ -1029,8 +1023,8 @@ video {
|
|
|
1029
1023
|
* @prop --message-system-text-color: System message text color (#4b5563)
|
|
1030
1024
|
* @prop --message-timestamp-color: User message timestamp color (rgba(255, 255, 255, 0.7))
|
|
1031
1025
|
* @prop --message-timestamp-assistant-color: Assistant message timestamp color (rgba(75, 85, 99, 0.7))
|
|
1032
|
-
* @prop --message-padding-x: Message horizontal padding (
|
|
1033
|
-
* @prop --message-padding-y: Message vertical padding (0.
|
|
1026
|
+
* @prop --message-padding-x: Message horizontal padding (1em)
|
|
1027
|
+
* @prop --message-padding-y: Message vertical padding (0.5em)
|
|
1034
1028
|
*
|
|
1035
1029
|
* Input Area Variables
|
|
1036
1030
|
* @prop --input-bg-color: Input area background color (transparent)
|
|
@@ -1038,8 +1032,8 @@ video {
|
|
|
1038
1032
|
* @prop --input-text-color: Input text color (#111827)
|
|
1039
1033
|
* @prop --input-placeholder-color: Input placeholder text color (#6b7280)
|
|
1040
1034
|
* @prop --input-outline-focus-color: Input field focus ring color (#3b82f6)
|
|
1041
|
-
* @prop --input-textarea-padding-x: Input textarea horizontal padding (0.
|
|
1042
|
-
* @prop --input-textarea-padding-y: Input textarea vertical padding (0.
|
|
1035
|
+
* @prop --input-textarea-padding-x: Input textarea horizontal padding (0.75em)
|
|
1036
|
+
* @prop --input-textarea-padding-y: Input textarea vertical padding (0.5em)
|
|
1043
1037
|
*
|
|
1044
1038
|
* Send Button Variables
|
|
1045
1039
|
* @prop --send-button-bg-color: Send button background color (#3b82f6)
|
|
@@ -1047,14 +1041,14 @@ video {
|
|
|
1047
1041
|
* @prop --send-button-text-color: Send button text color (#ffffff)
|
|
1048
1042
|
* @prop --send-button-bg-disabled-color: Send button background when disabled (#d1d5db)
|
|
1049
1043
|
* @prop --send-button-text-disabled-color: Send button text when disabled (#6b7280)
|
|
1050
|
-
* @prop --send-button-padding-x: Send button horizontal padding (
|
|
1051
|
-
* @prop --send-button-padding-y: Send button vertical padding (0.
|
|
1044
|
+
* @prop --send-button-padding-x: Send button horizontal padding (1em)
|
|
1045
|
+
* @prop --send-button-padding-y: Send button vertical padding (0.5em)
|
|
1052
1046
|
*
|
|
1053
1047
|
* Loading Variables
|
|
1054
1048
|
* @prop --loading-text-color: Loading text color (#6b7280)
|
|
1055
1049
|
* @prop --loading-spinner-track-color: Loading spinner track color (#e5e7eb)
|
|
1056
1050
|
* @prop --loading-spinner-fill-color: Loading spinner fill color (#3b82f6)
|
|
1057
|
-
* @prop --loading-spinner-size: Loading spinner size (1.
|
|
1051
|
+
* @prop --loading-spinner-size: Loading spinner size (1.25em)
|
|
1058
1052
|
*
|
|
1059
1053
|
* Typing Indicator Variables
|
|
1060
1054
|
* @prop --typing-progress-bg-color: Typing progress bar background color (#ade3ff)
|
|
@@ -1066,19 +1060,19 @@ video {
|
|
|
1066
1060
|
*
|
|
1067
1061
|
* Error Variables
|
|
1068
1062
|
* @prop --error-text-color: Error text color (#ef4444)
|
|
1069
|
-
* @prop --error-message-padding: Error message padding (0.
|
|
1063
|
+
* @prop --error-message-padding: Error message padding (0.5em)
|
|
1070
1064
|
*
|
|
1071
1065
|
* Markdown Code Variables
|
|
1072
|
-
* @prop --code-bg-user-color: Code background in user messages (
|
|
1073
|
-
* @prop --code-text-user-color: Code text color in user messages (
|
|
1074
|
-
* @prop --code-border-user-color: Code border in user messages (
|
|
1075
|
-
* @prop --code-bg-assistant-color: Code background in assistant messages (
|
|
1076
|
-
* @prop --code-text-assistant-color: Code text color in assistant messages (
|
|
1077
|
-
* @prop --code-border-assistant-color: Code border in assistant messages (
|
|
1066
|
+
* @prop --code-bg-user-color: Code background in user messages (--message-user-bg-color + 20% white)
|
|
1067
|
+
* @prop --code-text-user-color: Code text color in user messages (--message-user-text-color)
|
|
1068
|
+
* @prop --code-border-user-color: Code border in user messages (--message-user-bg-color + 20% black)
|
|
1069
|
+
* @prop --code-bg-assistant-color: Code background in assistant messages (--message-assistant-bg-color + 50% white)
|
|
1070
|
+
* @prop --code-text-assistant-color: Code text color in assistant messages (--message-assistant-text-color)
|
|
1071
|
+
* @prop --code-border-assistant-color: Code border in assistant messages (--message-assistant-bg-color + 10% black)
|
|
1078
1072
|
*/
|
|
1079
1073
|
/* Global variables */
|
|
1080
1074
|
--chat-z-index: 50;
|
|
1081
|
-
--container-padding:
|
|
1075
|
+
--container-padding: 1em;
|
|
1082
1076
|
|
|
1083
1077
|
/* Button variables */
|
|
1084
1078
|
--button-background-color: #ffffff;
|
|
@@ -1087,18 +1081,21 @@ video {
|
|
|
1087
1081
|
--button-text-color-hover: #1d4ed8;
|
|
1088
1082
|
--button-border-color: #6b7280;
|
|
1089
1083
|
--button-border-color-hover: #374151;
|
|
1090
|
-
--button-padding: 0.
|
|
1091
|
-
--button-padding-sm: 0.
|
|
1092
|
-
--button-font-size: 0.
|
|
1093
|
-
--button-icon-width: 1.
|
|
1094
|
-
--button-icon-height: 1.
|
|
1084
|
+
--button-padding: 0.75em;
|
|
1085
|
+
--button-padding-sm: 0.375em;
|
|
1086
|
+
--button-font-size: 0.875em; /* text-sm */
|
|
1087
|
+
--button-icon-width: 1.5em;
|
|
1088
|
+
--button-icon-height: 1.5em;
|
|
1095
1089
|
|
|
1096
1090
|
/* Chat window variables */
|
|
1091
|
+
--chat-window-height: 60%;
|
|
1092
|
+
--chat-window-width: 25%;
|
|
1093
|
+
--chat-window-fullscreen-width: 80%;
|
|
1097
1094
|
--chat-window-bg-color: #ffffff;
|
|
1098
1095
|
--chat-window-border-color: #d1d5db;
|
|
1099
1096
|
--chat-window-shadow-color: rgba(0, 0, 0, 0.1);
|
|
1100
|
-
--chat-window-font-size: 0.
|
|
1101
|
-
--chat-window-font-size-sm: 0.
|
|
1097
|
+
--chat-window-font-size: 0.875em; /* text-sm */
|
|
1098
|
+
--chat-window-font-size-sm: 0.75em; /* text-xs */
|
|
1102
1099
|
|
|
1103
1100
|
/* Header variables */
|
|
1104
1101
|
--header-bg-color: transparent;
|
|
@@ -1106,7 +1103,7 @@ video {
|
|
|
1106
1103
|
--header-border-color: #f3f4f6;
|
|
1107
1104
|
--header-button-text-color: #6b7280;
|
|
1108
1105
|
--header-button-bg-hover-color: #f3f4f6;
|
|
1109
|
-
--header-padding: 0.
|
|
1106
|
+
--header-padding: 0.5em;
|
|
1110
1107
|
|
|
1111
1108
|
/* Starter question variables */
|
|
1112
1109
|
--starter-question-bg-color: transparent;
|
|
@@ -1114,7 +1111,7 @@ video {
|
|
|
1114
1111
|
--starter-question-text-color: #3b82f6;
|
|
1115
1112
|
--starter-question-border-color: #3b82f6;
|
|
1116
1113
|
--starter-question-border-hover-color: #2563eb;
|
|
1117
|
-
--starter-question-padding: 0.
|
|
1114
|
+
--starter-question-padding: 0.75em;
|
|
1118
1115
|
|
|
1119
1116
|
/* Message bubble variables */
|
|
1120
1117
|
--message-user-bg-color: #3b82f6;
|
|
@@ -1125,8 +1122,8 @@ video {
|
|
|
1125
1122
|
--message-system-text-color: #4b5563;
|
|
1126
1123
|
--message-timestamp-color: rgba(255, 255, 255, 0.7);
|
|
1127
1124
|
--message-timestamp-assistant-color: rgba(75, 85, 99, 0.7);
|
|
1128
|
-
--message-padding-x:
|
|
1129
|
-
--message-padding-y: 0.
|
|
1125
|
+
--message-padding-x: 1em;
|
|
1126
|
+
--message-padding-y: 0.5em;
|
|
1130
1127
|
|
|
1131
1128
|
/* Input area variables */
|
|
1132
1129
|
--input-bg-color: transparent;
|
|
@@ -1134,8 +1131,8 @@ video {
|
|
|
1134
1131
|
--input-text-color: #111827;
|
|
1135
1132
|
--input-placeholder-color: #6b7280;
|
|
1136
1133
|
--input-outline-focus-color: #3b82f6;
|
|
1137
|
-
--input-textarea-padding-x: 0.
|
|
1138
|
-
--input-textarea-padding-y: 0.
|
|
1134
|
+
--input-textarea-padding-x: 0.75em;
|
|
1135
|
+
--input-textarea-padding-y: 0.5em;
|
|
1139
1136
|
|
|
1140
1137
|
/* Send button variables */
|
|
1141
1138
|
--send-button-bg-color: #3b82f6;
|
|
@@ -1143,14 +1140,14 @@ video {
|
|
|
1143
1140
|
--send-button-text-color: #ffffff;
|
|
1144
1141
|
--send-button-bg-disabled-color: #d1d5db;
|
|
1145
1142
|
--send-button-text-disabled-color: #6b7280;
|
|
1146
|
-
--send-button-padding-x:
|
|
1147
|
-
--send-button-padding-y: 0.
|
|
1143
|
+
--send-button-padding-x: 1em;
|
|
1144
|
+
--send-button-padding-y: 0.5em;
|
|
1148
1145
|
|
|
1149
1146
|
/* Loading variables */
|
|
1150
1147
|
--loading-text-color: #6b7280;
|
|
1151
1148
|
--loading-spinner-track-color: #e5e7eb;
|
|
1152
1149
|
--loading-spinner-fill-color: #3b82f6;
|
|
1153
|
-
--loading-spinner-size: 1.
|
|
1150
|
+
--loading-spinner-size: 1.25em;
|
|
1154
1151
|
|
|
1155
1152
|
/* Typing indicator variables */
|
|
1156
1153
|
--typing-progress-bg-color: #ade3ff;
|
|
@@ -1162,15 +1159,15 @@ video {
|
|
|
1162
1159
|
|
|
1163
1160
|
/* Error variables */
|
|
1164
1161
|
--error-text-color: #ef4444;
|
|
1165
|
-
--error-message-padding: 0.
|
|
1162
|
+
--error-message-padding: 0.5em;
|
|
1166
1163
|
|
|
1167
1164
|
/* Markdown code variables */
|
|
1168
|
-
--code-bg-user-color:
|
|
1169
|
-
--code-text-user-color:
|
|
1170
|
-
--code-border-user-color:
|
|
1171
|
-
--code-bg-assistant-color:
|
|
1172
|
-
--code-text-assistant-color:
|
|
1173
|
-
--code-border-assistant-color:
|
|
1165
|
+
--code-bg-user-color: color-mix(in srgb, var(--message-user-bg-color) 80%, white 20%);
|
|
1166
|
+
--code-text-user-color: var(--message-user-text-color);
|
|
1167
|
+
--code-border-user-color: color-mix(in srgb, var(--message-user-bg-color) 90%, black 10%);
|
|
1168
|
+
--code-bg-assistant-color: color-mix(in srgb, var(--message-assistant-bg-color) 50%, white 50%);
|
|
1169
|
+
--code-text-assistant-color: var(--message-assistant-text-color);
|
|
1170
|
+
--code-border-assistant-color: color-mix(in srgb, var(--message-assistant-bg-color) 90%, black 10%);;
|
|
1174
1171
|
|
|
1175
1172
|
display: block;
|
|
1176
1173
|
position: fixed;
|
|
@@ -1212,8 +1209,8 @@ textarea::-webkit-scrollbar-thumb:hover {
|
|
|
1212
1209
|
border-width: 2px;
|
|
1213
1210
|
border-color: var(--loading-spinner-track-color);
|
|
1214
1211
|
border-top-color: var(--loading-spinner-fill-color);
|
|
1215
|
-
width: var(--loading-spinner-size, 1.
|
|
1216
|
-
height: var(--loading-spinner-size, 1.
|
|
1212
|
+
width: var(--loading-spinner-size, 1.25em);
|
|
1213
|
+
height: var(--loading-spinner-size, 1.25em);
|
|
1217
1214
|
}
|
|
1218
1215
|
.overflow-y-auto::-webkit-scrollbar {
|
|
1219
1216
|
width: 0.375rem;
|
|
@@ -1884,11 +1881,49 @@ textarea::-webkit-scrollbar-thumb:hover {
|
|
|
1884
1881
|
--tw-prose-invert-th-borders: #4b5563;
|
|
1885
1882
|
--tw-prose-invert-td-borders: #374151;
|
|
1886
1883
|
max-width: none;
|
|
1884
|
+
font-size: var(--chat-window-font-size);
|
|
1885
|
+
--tw-prose-body: var(--message-assistant-text-color);
|
|
1886
|
+
--tw-prose-headings: var(--message-assistant-text-color);
|
|
1887
|
+
--tw-prose-lead: var(--message-assistant-text-color);
|
|
1888
|
+
--tw-prose-links: var(--message-assistant-text-color);
|
|
1889
|
+
--tw-prose-bold: var(--message-assistant-text-color);
|
|
1890
|
+
--tw-prose-counters: var(--message-assistant-text-color);
|
|
1891
|
+
--tw-prose-bullets: var(--message-assistant-text-color);
|
|
1892
|
+
--tw-prose-hr: var(--message-assistant-text-color);
|
|
1893
|
+
--tw-prose-quotes: var(--message-assistant-text-color);
|
|
1894
|
+
--tw-prose-quote-borders: var(--message-assistant-text-color);
|
|
1895
|
+
--tw-prose-captions: var(--message-assistant-text-color);
|
|
1896
|
+
--tw-prose-kbd: var(--message-assistant-text-color);
|
|
1897
|
+
--tw-prose-kbd-shadows: var(--message-assistant-text-color);
|
|
1898
|
+
--tw-prose-code: var(--code-text-assistant-color);
|
|
1899
|
+
--tw-prose-pre-code: var(--code-text-assistant-color);
|
|
1900
|
+
--tw-prose-pre-bg: var(--code-bg-assistant-color);
|
|
1901
|
+
--tw-prose-th-borders: var(--message-assistant-text-color);
|
|
1902
|
+
--tw-prose-td-borders: var(--message-assistant-text-color);
|
|
1903
|
+
|
|
1904
|
+
--tw-prose-invert-body: var(--message-user-text-color);
|
|
1905
|
+
--tw-prose-invert-headings: var(--message-user-text-color);
|
|
1906
|
+
--tw-prose-invert-lead: var(--message-user-text-color);
|
|
1907
|
+
--tw-prose-invert-links: var(--message-user-text-color);
|
|
1908
|
+
--tw-prose-invert-bold: var(--message-user-text-color);
|
|
1909
|
+
--tw-prose-invert-counters: var(--message-user-text-color);
|
|
1910
|
+
--tw-prose-invert-bullets: var(--message-user-text-color);
|
|
1911
|
+
--tw-prose-invert-hr: var(--message-user-text-color);
|
|
1912
|
+
--tw-prose-invert-quotes: var(--message-user-text-color);
|
|
1913
|
+
--tw-prose-invert-quote-borders: var(--message-user-text-color);
|
|
1914
|
+
--tw-prose-invert-captions: var(--message-user-text-color);
|
|
1915
|
+
--tw-prose-invert-kbd: var(--message-user-text-color);
|
|
1916
|
+
--tw-prose-invert-kbd-shadows: var(--message-user-text-color);
|
|
1917
|
+
--tw-prose-invert-code: var(--code-text-user-color);
|
|
1918
|
+
--tw-prose-invert-pre-code: var(--code-text-user-color);
|
|
1919
|
+
--tw-prose-invert-pre-bg: var(--code-bg-user-color);
|
|
1920
|
+
--tw-prose-invert-th-borders: var(--message-user-text-color);
|
|
1921
|
+
--tw-prose-invert-td-borders: var(--message-user-text-color);
|
|
1887
1922
|
}
|
|
1888
1923
|
/* override spacing */
|
|
1889
1924
|
.chat-markdown > * {
|
|
1890
|
-
margin-top: 0.
|
|
1891
|
-
margin-bottom: 0.
|
|
1925
|
+
margin-top: 0.1em;
|
|
1926
|
+
margin-bottom: 0.1em;
|
|
1892
1927
|
}
|
|
1893
1928
|
.message-bubble-user .chat-markdown {
|
|
1894
1929
|
--tw-prose-body: var(--tw-prose-invert-body);
|
|
@@ -1910,20 +1945,10 @@ textarea::-webkit-scrollbar-thumb:hover {
|
|
|
1910
1945
|
--tw-prose-th-borders: var(--tw-prose-invert-th-borders);
|
|
1911
1946
|
--tw-prose-td-borders: var(--tw-prose-invert-td-borders);
|
|
1912
1947
|
}
|
|
1913
|
-
.message-bubble-user .chat-markdown code {
|
|
1914
|
-
background-color: var(--code-bg-user-color);
|
|
1915
|
-
color: var(--code-text-user-color);
|
|
1916
|
-
}
|
|
1917
1948
|
.message-bubble-user .chat-markdown pre {
|
|
1918
|
-
background-color: var(--code-bg-user-color);
|
|
1919
1949
|
border: 1px solid var(--code-border-user-color);
|
|
1920
1950
|
}
|
|
1921
|
-
.message-bubble-assistant .chat-markdown code {
|
|
1922
|
-
background-color: var(--code-bg-assistant-color);
|
|
1923
|
-
color: var(--code-text-assistant-color);
|
|
1924
|
-
}
|
|
1925
1951
|
.message-bubble-assistant .chat-markdown pre {
|
|
1926
|
-
background-color: var(--code-bg-assistant-color);
|
|
1927
1952
|
border: 1px solid var(--code-border-assistant-color);
|
|
1928
1953
|
}
|
|
1929
1954
|
.loading:after {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
2
|
import { XMarkIcon, GripDotsVerticalIcon, PencilSquare, ArrowsPointingOutIcon, ArrowsPointingInIcon, } from "./heroicons";
|
|
3
3
|
import { renderMarkdownSync as renderMarkdownComplete } from "../../utils/markdown";
|
|
4
|
+
import { varToPixels } from "../../utils/utils";
|
|
4
5
|
export class OcsChat {
|
|
5
6
|
constructor() {
|
|
6
7
|
/**
|
|
@@ -47,6 +48,9 @@ export class OcsChat {
|
|
|
47
48
|
this.parsedWelcomeMessages = [];
|
|
48
49
|
this.parsedStarterQuestions = [];
|
|
49
50
|
this.isFullscreen = false;
|
|
51
|
+
this.chatWindowHeight = 600;
|
|
52
|
+
this.chatWindowWidth = 450;
|
|
53
|
+
this.chatWindowFullscreenWidth = 1024;
|
|
50
54
|
this.handleMouseDown = (event) => {
|
|
51
55
|
if (!this.isFullscreen && window.innerWidth < OcsChat.MOBILE_BREAKPOINT)
|
|
52
56
|
return;
|
|
@@ -121,6 +125,13 @@ export class OcsChat {
|
|
|
121
125
|
// Resume polling for existing session
|
|
122
126
|
this.startPolling();
|
|
123
127
|
}
|
|
128
|
+
const computedStyle = getComputedStyle(this.host);
|
|
129
|
+
const windowHeightVar = computedStyle.getPropertyValue('--chat-window-height');
|
|
130
|
+
const windowWidthVar = computedStyle.getPropertyValue('--chat-window-width');
|
|
131
|
+
const fullscreenWidthVar = computedStyle.getPropertyValue('--chat-window-fullscreen-width');
|
|
132
|
+
this.chatWindowHeight = varToPixels(windowHeightVar, window.innerHeight, this.chatWindowHeight);
|
|
133
|
+
this.chatWindowWidth = varToPixels(windowWidthVar, window.innerWidth, this.chatWindowWidth);
|
|
134
|
+
this.chatWindowFullscreenWidth = varToPixels(fullscreenWidthVar, window.innerWidth, this.chatWindowFullscreenWidth);
|
|
124
135
|
this.initializePosition();
|
|
125
136
|
window.addEventListener('resize', this.handleWindowResize);
|
|
126
137
|
}
|
|
@@ -416,7 +427,7 @@ export class OcsChat {
|
|
|
416
427
|
}
|
|
417
428
|
getFullscreenBounds() {
|
|
418
429
|
const windowWidth = window.innerWidth;
|
|
419
|
-
const actualChatWidth = Math.min(windowWidth,
|
|
430
|
+
const actualChatWidth = Math.min(windowWidth, this.chatWindowFullscreenWidth);
|
|
420
431
|
const centeredX = (windowWidth - actualChatWidth) / 2;
|
|
421
432
|
const maxOffset = (windowWidth - actualChatWidth) / 2;
|
|
422
433
|
return { windowWidth, actualChatWidth, centeredX, maxOffset };
|
|
@@ -439,8 +450,7 @@ export class OcsChat {
|
|
|
439
450
|
initializePosition() {
|
|
440
451
|
const windowWidth = window.innerWidth;
|
|
441
452
|
const windowHeight = window.innerHeight;
|
|
442
|
-
const chatWidth = windowWidth < OcsChat.MOBILE_BREAKPOINT ? windowWidth :
|
|
443
|
-
const chatHeight = windowHeight * OcsChat.CHAT_HEIGHT_EXPANDED_RATIO;
|
|
453
|
+
const chatWidth = windowWidth < OcsChat.MOBILE_BREAKPOINT ? windowWidth : this.chatWindowWidth;
|
|
444
454
|
const isMobile = windowWidth < OcsChat.MOBILE_BREAKPOINT;
|
|
445
455
|
if (isMobile) {
|
|
446
456
|
this.windowPosition = { x: 0, y: 0 };
|
|
@@ -450,19 +460,19 @@ export class OcsChat {
|
|
|
450
460
|
case 'left':
|
|
451
461
|
this.windowPosition = {
|
|
452
462
|
x: OcsChat.WINDOW_MARGIN,
|
|
453
|
-
y: windowHeight -
|
|
463
|
+
y: windowHeight - this.chatWindowHeight - OcsChat.WINDOW_MARGIN
|
|
454
464
|
};
|
|
455
465
|
break;
|
|
456
466
|
case 'right':
|
|
457
467
|
this.windowPosition = {
|
|
458
468
|
x: windowWidth - chatWidth - OcsChat.WINDOW_MARGIN,
|
|
459
|
-
y: windowHeight -
|
|
469
|
+
y: windowHeight - this.chatWindowHeight - OcsChat.WINDOW_MARGIN
|
|
460
470
|
};
|
|
461
471
|
break;
|
|
462
472
|
case 'center':
|
|
463
473
|
this.windowPosition = {
|
|
464
474
|
x: (windowWidth - chatWidth) / 2,
|
|
465
|
-
y: (windowHeight -
|
|
475
|
+
y: (windowHeight - this.chatWindowHeight) / 2
|
|
466
476
|
};
|
|
467
477
|
break;
|
|
468
478
|
}
|
|
@@ -513,8 +523,8 @@ export class OcsChat {
|
|
|
513
523
|
// Constrain chatbox to window
|
|
514
524
|
const windowWidth = window.innerWidth;
|
|
515
525
|
const windowHeight = window.innerHeight;
|
|
516
|
-
const chatWidth = windowWidth < OcsChat.MOBILE_BREAKPOINT ? windowWidth :
|
|
517
|
-
const chatHeight =
|
|
526
|
+
const chatWidth = windowWidth < OcsChat.MOBILE_BREAKPOINT ? windowWidth : this.chatWindowWidth;
|
|
527
|
+
const chatHeight = this.chatWindowRef.offsetHeight;
|
|
518
528
|
this.windowPosition = {
|
|
519
529
|
x: Math.max(0, Math.min(newX, windowWidth - chatWidth)),
|
|
520
530
|
y: Math.max(0, Math.min(newY, windowHeight - chatHeight))
|
|
@@ -998,15 +1008,13 @@ export class OcsChat {
|
|
|
998
1008
|
"isFullscreen": {}
|
|
999
1009
|
};
|
|
1000
1010
|
}
|
|
1011
|
+
static get elementRef() { return "host"; }
|
|
1001
1012
|
}
|
|
1002
1013
|
OcsChat.TASK_POLLING_MAX_ATTEMPTS = 30;
|
|
1003
1014
|
OcsChat.TASK_POLLING_INTERVAL_MS = 1000;
|
|
1004
1015
|
OcsChat.MESSAGE_POLLING_INTERVAL_MS = 30000;
|
|
1005
1016
|
OcsChat.SCROLL_DELAY_MS = 100;
|
|
1006
1017
|
OcsChat.FOCUS_DELAY_MS = 100;
|
|
1007
|
-
OcsChat.CHAT_WIDTH_DESKTOP = 450;
|
|
1008
|
-
OcsChat.CHAT_MAX_WIDTH = 1024;
|
|
1009
|
-
OcsChat.CHAT_HEIGHT_EXPANDED_RATIO = 0.83; // 83% of window height (h-5/6)
|
|
1010
1018
|
OcsChat.MOBILE_BREAKPOINT = 640;
|
|
1011
1019
|
OcsChat.WINDOW_MARGIN = 20;
|
|
1012
1020
|
OcsChat.LOCALSTORAGE_TEST_KEY = '__ocs_test__';
|