@promptbook/components 0.101.0-10 → 0.101.0-11
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/esm/index.es.js +50 -4
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +50 -4
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -21,7 +21,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
21
21
|
* @generated
|
|
22
22
|
* @see https://github.com/webgptorg/promptbook
|
|
23
23
|
*/
|
|
24
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.101.0-
|
|
24
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.101.0-11';
|
|
25
25
|
/**
|
|
26
26
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
27
27
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -4127,6 +4127,49 @@ const LOADING_INTERACTIVE_IMAGE = 'Loading...';
|
|
|
4127
4127
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
4128
4128
|
*/
|
|
4129
4129
|
|
|
4130
|
+
// Critical inline styles to prevent layout shift during CSS module loading
|
|
4131
|
+
const CRITICAL_STYLES = {
|
|
4132
|
+
chat: {
|
|
4133
|
+
width: '100%',
|
|
4134
|
+
height: '100%',
|
|
4135
|
+
display: 'flex',
|
|
4136
|
+
flexDirection: 'column',
|
|
4137
|
+
},
|
|
4138
|
+
chatMainFlow: {
|
|
4139
|
+
width: '100%',
|
|
4140
|
+
height: '100%',
|
|
4141
|
+
maxWidth: '100vw',
|
|
4142
|
+
display: 'grid',
|
|
4143
|
+
gridTemplate: `
|
|
4144
|
+
'header' min-content
|
|
4145
|
+
'messages' 1fr
|
|
4146
|
+
'input' min-content
|
|
4147
|
+
/ 1fr`,
|
|
4148
|
+
},
|
|
4149
|
+
chatMessages: {
|
|
4150
|
+
gridArea: 'messages',
|
|
4151
|
+
width: '100%',
|
|
4152
|
+
height: '100%',
|
|
4153
|
+
padding: '24px 20px 16px',
|
|
4154
|
+
overflowY: 'auto',
|
|
4155
|
+
overflowX: 'hidden',
|
|
4156
|
+
},
|
|
4157
|
+
chatInput: {
|
|
4158
|
+
gridArea: 'input',
|
|
4159
|
+
width: '100%',
|
|
4160
|
+
padding: '20px',
|
|
4161
|
+
display: 'flex',
|
|
4162
|
+
alignItems: 'center',
|
|
4163
|
+
gap: '12px',
|
|
4164
|
+
},
|
|
4165
|
+
chatBar: {
|
|
4166
|
+
gridArea: 'header',
|
|
4167
|
+
width: '100%',
|
|
4168
|
+
padding: '16px 20px',
|
|
4169
|
+
textAlign: 'center',
|
|
4170
|
+
},
|
|
4171
|
+
};
|
|
4172
|
+
// <- TODO: [💩] !!!! "[✨🦬] Fix `<Chat/>` loading"
|
|
4130
4173
|
/**
|
|
4131
4174
|
* Renders a chat with messages and input for new messages
|
|
4132
4175
|
*
|
|
@@ -4307,7 +4350,10 @@ function Chat(props) {
|
|
|
4307
4350
|
return { ...message, content: humanizeAiText(message.content) };
|
|
4308
4351
|
});
|
|
4309
4352
|
}, [messages, isAiTextHumanized]);
|
|
4310
|
-
return (jsxs(Fragment, { children: [ratingConfirmation && jsx("div", { className: styles$1.ratingConfirmation, children: ratingConfirmation }), jsx("div", { className: classNames(className, styles$1.Chat, useChatCssClassName('Chat')), style
|
|
4353
|
+
return (jsxs(Fragment, { children: [ratingConfirmation && jsx("div", { className: styles$1.ratingConfirmation, children: ratingConfirmation }), jsx("div", { className: classNames(className, styles$1.Chat, useChatCssClassName('Chat')), style: {
|
|
4354
|
+
...CRITICAL_STYLES.chat,
|
|
4355
|
+
...style,
|
|
4356
|
+
}, children: jsxs("div", { className: classNames(className, styles$1.chatMainFlow, useChatCssClassName('chatMainFlow')), style: CRITICAL_STYLES.chatMainFlow, children: [children && (jsx("div", { className: classNames(styles$1.chatBar, chatBarCssClassName), style: CRITICAL_STYLES.chatBar, children: children })), !isAutoScrolling && (jsx("div", { className: styles$1.scrollToBottomContainer, children: jsx("button", { "data-button-type": "custom", className: classNames(styles$1.scrollToBottom, scrollToBottomCssClassName), onClick: () => {
|
|
4311
4357
|
const chatMessagesElement = chatMessagesRef.current;
|
|
4312
4358
|
if (chatMessagesElement === null) {
|
|
4313
4359
|
return;
|
|
@@ -4329,7 +4375,7 @@ function Chat(props) {
|
|
|
4329
4375
|
return;
|
|
4330
4376
|
}
|
|
4331
4377
|
onReset();
|
|
4332
|
-
}, children: [jsx(ResetIcon, {}), jsx("span", { className: styles$1.resetButtonText, children: "New chat" })] })), onUseTemplate && (jsxs("button", { className: classNames(styles$1.useTemplateButton), onClick: onUseTemplate, children: [jsx("span", { className: styles$1.resetButtonText, children: "Use this template" }), jsx(TemplateIcon, { size: 16 })] }))] }), jsx("div", { className: classNames(styles$1.chatMessages, useChatCssClassName('chatMessages')), ref: (chatMessagesElement) => {
|
|
4378
|
+
}, children: [jsx(ResetIcon, {}), jsx("span", { className: styles$1.resetButtonText, children: "New chat" })] })), onUseTemplate && (jsxs("button", { className: classNames(styles$1.useTemplateButton), onClick: onUseTemplate, children: [jsx("span", { className: styles$1.resetButtonText, children: "Use this template" }), jsx(TemplateIcon, { size: 16 })] }))] }), jsx("div", { className: classNames(styles$1.chatMessages, useChatCssClassName('chatMessages')), style: CRITICAL_STYLES.chatMessages, ref: (chatMessagesElement) => {
|
|
4333
4379
|
chatMessagesRef.current = chatMessagesElement;
|
|
4334
4380
|
if (chatMessagesElement === null) {
|
|
4335
4381
|
return;
|
|
@@ -4402,7 +4448,7 @@ function Chat(props) {
|
|
|
4402
4448
|
: '#666',
|
|
4403
4449
|
transition: 'color 0.2s',
|
|
4404
4450
|
}, children: "\u2B50" })) }))] })] }, i));
|
|
4405
|
-
}) }), onMessage && (jsxs("div", { className: classNames(styles$1.chatInput, useChatCssClassName('chatInput')), children: [jsx("textarea", { ref: (element) => {
|
|
4451
|
+
}) }), onMessage && (jsxs("div", { className: classNames(styles$1.chatInput, useChatCssClassName('chatInput')), style: CRITICAL_STYLES.chatInput, children: [jsx("textarea", { ref: (element) => {
|
|
4406
4452
|
textareaRef.current = element;
|
|
4407
4453
|
}, style: {
|
|
4408
4454
|
height: Math.max(countLines(((_b = textareaRef.current) === null || _b === void 0 ? void 0 : _b.value) || defaultMessage || ''), (((_c = textareaRef.current) === null || _c === void 0 ? void 0 : _c.value) || defaultMessage || '').split('\n').length, 3) *
|