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