@helpai/elements 0.59.3 → 0.59.5

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/web-component.mjs CHANGED
@@ -1010,9 +1010,7 @@ var DEFAULT_ATTACHMENTS = {
1010
1010
  accept: "*/*"
1011
1011
  };
1012
1012
  var DEFAULT_FEATURES = {
1013
- files: true,
1014
- voice: "local",
1015
- disableHumanInLoop: false
1013
+ voice: "local"
1016
1014
  };
1017
1015
  var DEFAULT_FORMS = { list: [], byTrigger: {} };
1018
1016
  var DEFAULT_TRACKING = {
@@ -1087,12 +1085,11 @@ function resolveOptions(rawOpts) {
1087
1085
  showReasoning: behavior.showReasoning ?? false,
1088
1086
  showToolCalls: behavior.showToolCalls ?? false,
1089
1087
  showSources: behavior.showSources ?? false,
1090
- scrollFade: behavior.scrollFade ?? true,
1091
1088
  enableMessageFeedback: !(behavior.disableMessageFeedback ?? false),
1092
1089
  features: {
1093
- files: opts.features?.files ?? DEFAULT_FEATURES.files,
1094
1090
  voice: opts.features?.voice ?? DEFAULT_FEATURES.voice,
1095
- disableHumanInLoop: opts.features?.disableHumanInLoop ?? false,
1091
+ fileUpload: !(opts.features?.disableFileUpload ?? false),
1092
+ humanInLoop: !(opts.features?.disableHumanInLoop ?? false),
1096
1093
  tools: opts.features?.tools
1097
1094
  },
1098
1095
  forms: resolveForms(opts.forms, locale),
@@ -1206,9 +1203,9 @@ function resolveModules(overrides) {
1206
1203
  if (m.layout === "home") {
1207
1204
  resolved.brandName = m.brandName;
1208
1205
  resolved.greetingText = m.greetingText;
1209
- resolved.hideGreeting = m.hideGreeting ?? false;
1210
- resolved.hideSearchBar = m.hideSearchBar ?? false;
1211
- resolved.hideRecentConversations = m.hideRecentConversations ?? false;
1206
+ resolved.showGreeting = !(m.hideGreeting ?? false);
1207
+ resolved.showSearchBar = !(m.hideSearchBar ?? false);
1208
+ resolved.showRecentConversations = !(m.hideRecentConversations ?? false);
1212
1209
  if (m.userAvatars && m.userAvatars.length > 0) resolved.userAvatars = m.userAvatars;
1213
1210
  if (m.status) resolved.status = m.status;
1214
1211
  resolved.contentBlockTitle = m.contentBlockTitle;
@@ -1417,7 +1414,6 @@ var BEHAVIOR_ATTRS = [
1417
1414
  ["show-reasoning", "showReasoning", boolAttr],
1418
1415
  ["show-tool-calls", "showToolCalls", boolAttr],
1419
1416
  ["show-sources", "showSources", boolAttr],
1420
- ["scroll-fade", "scrollFade", boolAttr],
1421
1417
  ["disable-message-feedback", "disableMessageFeedback", boolAttr]
1422
1418
  ];
1423
1419
  var I18N_ATTRS = [["locale", "locale"]];
@@ -1430,7 +1426,7 @@ var LAUNCHER_ATTRS = [
1430
1426
  ["launcher-hidden", "hidden", boolAttr]
1431
1427
  ];
1432
1428
  var FEATURE_ATTRS = [
1433
- ["features-files", "files", boolAttr],
1429
+ ["features-disable-file-upload", "disableFileUpload", boolAttr],
1434
1430
  ["features-voice", "voice", (v) => v],
1435
1431
  ["features-tools", "tools", csv]
1436
1432
  ];
@@ -1933,7 +1929,7 @@ function createAuth(opts) {
1933
1929
  }
1934
1930
 
1935
1931
  // src/core/version.ts
1936
- var ELEMENTS_VERSION = true ? "0.59.3" : "0.0.0-dev";
1932
+ var ELEMENTS_VERSION = true ? "0.59.5" : "0.0.0-dev";
1937
1933
  var ELEMENTS_VERSION_PARAM = "_ev";
1938
1934
 
1939
1935
  // src/stream/types.ts
@@ -4459,7 +4455,7 @@ function Composer({ options, transport, feedback, bus, isStreaming, onSend, onSt
4459
4455
  const [voiceOn, setVoiceOn] = useState2(false);
4460
4456
  const taRef = useRef2(null);
4461
4457
  const fileRef = useRef2(null);
4462
- const filesEnabled = options.features.files;
4458
+ const fileUploadEnabled = options.features.fileUpload;
4463
4459
  const voiceMode = options.features.voice;
4464
4460
  const [voice, setVoice] = useState2(
4465
4461
  () => createVoice(voiceMode, options.locale, (blob, type) => transport.transcribe(blob, type))
@@ -4484,7 +4480,9 @@ function Composer({ options, transport, feedback, bus, isStreaming, onSend, onSt
4484
4480
  return;
4485
4481
  }
4486
4482
  el.style.height = "auto";
4487
- el.style.height = `${Math.min(Math.max(el.scrollHeight, 40), 160)}px`;
4483
+ const halfLine = parseFloat(getComputedStyle(el).fontSize) * 0.7;
4484
+ const measured = Math.min(el.scrollHeight, 160);
4485
+ el.style.height = `${measured < 40 + halfLine ? 40 : measured}px`;
4488
4486
  }, [text]);
4489
4487
  const attsRef = useRef2(atts);
4490
4488
  attsRef.current = atts;
@@ -4516,7 +4514,7 @@ function Composer({ options, transport, feedback, bus, isStreaming, onSend, onSt
4516
4514
  "input, textarea, [contenteditable]:not([contenteditable='false'])"
4517
4515
  );
4518
4516
  if (editable && editable !== ta) return;
4519
- if (filesEnabled) {
4517
+ if (fileUploadEnabled) {
4520
4518
  const result = ingest(data.items, attsRef.current, options.attachments);
4521
4519
  if (result.accepted.length > 0) {
4522
4520
  e.preventDefault();
@@ -4535,7 +4533,7 @@ function Composer({ options, transport, feedback, bus, isStreaming, onSend, onSt
4535
4533
  };
4536
4534
  panel.addEventListener("paste", onPaste);
4537
4535
  return () => panel.removeEventListener("paste", onPaste);
4538
- }, [filesEnabled, options.attachments, p7]);
4536
+ }, [fileUploadEnabled, options.attachments, p7]);
4539
4537
  const send = () => {
4540
4538
  const trimmed = text.trim();
4541
4539
  if (!trimmed && atts.length === 0) return;
@@ -4605,7 +4603,7 @@ function Composer({ options, transport, feedback, bus, isStreaming, onSend, onSt
4605
4603
  atts.length > 0 ? /* @__PURE__ */ jsx6("div", { class: `${p7}-attachments`, children: atts.map((a) => /* @__PURE__ */ jsx6(AttachmentChip, { attachment: a, onRemove: () => removeAtt(a.id) }, a.id)) }) : null,
4606
4604
  /* @__PURE__ */ jsxs5("div", { class: `${p7}-composer-row`, children: [
4607
4605
  /* @__PURE__ */ jsxs5("div", { class: `${p7}-composer-actions`, children: [
4608
- filesEnabled ? /* @__PURE__ */ jsx6(
4606
+ fileUploadEnabled ? /* @__PURE__ */ jsx6(
4609
4607
  "button",
4610
4608
  {
4611
4609
  type: "button",
@@ -6362,7 +6360,6 @@ function MessageList({
6362
6360
  showReasoning,
6363
6361
  showToolCalls,
6364
6362
  showSources,
6365
- scrollFade,
6366
6363
  enableMessageFeedback,
6367
6364
  onFeedback,
6368
6365
  loading,
@@ -6383,7 +6380,6 @@ function MessageList({
6383
6380
  const inInteractionGrace = () => interactingRef.current || performance.now() - interactionEndedAtRef.current < INTERACTION_GRACE_MS;
6384
6381
  const autoPinAtRef = useRef5(0);
6385
6382
  const syncFade = (el) => {
6386
- if (!scrollFade) return;
6387
6383
  const overflowing = el.scrollHeight - el.clientHeight > 1;
6388
6384
  el.dataset.fadeTop = overflowing && el.scrollTop > 1 ? "true" : "false";
6389
6385
  el.dataset.fadeBottom = overflowing && el.scrollHeight - el.scrollTop - el.clientHeight > 1 ? "true" : "false";
@@ -6629,21 +6625,11 @@ function MessageList({
6629
6625
  rows.push(markerRow(marker));
6630
6626
  }
6631
6627
  return /* @__PURE__ */ jsxs16("div", { class: `${p18}-list-wrap`, children: [
6632
- /* @__PURE__ */ jsxs16(
6633
- "div",
6634
- {
6635
- ref,
6636
- class: `${p18}-list${scrollFade ? ` ${p18}-list--fade` : ""}`,
6637
- role: "log",
6638
- "aria-live": "polite",
6639
- "aria-relevant": "additions text",
6640
- children: [
6641
- loading && messages.value.length === 0 ? /* @__PURE__ */ jsx20("div", { class: `${p18}-list-loading`, role: "status", children: strings.conversationLoading }) : null,
6642
- rows,
6643
- form && !inlineForm ? /* @__PURE__ */ jsx20(FormGate, { form: form.form, strings, onSubmit: form.onSubmit, onSkip: form.onSkip }) : null
6644
- ]
6645
- }
6646
- ),
6628
+ /* @__PURE__ */ jsxs16("div", { ref, class: `${p18}-list ${p18}-list--fade`, role: "log", "aria-live": "polite", "aria-relevant": "additions text", children: [
6629
+ loading && messages.value.length === 0 ? /* @__PURE__ */ jsx20("div", { class: `${p18}-list-loading`, role: "status", children: strings.conversationLoading }) : null,
6630
+ rows,
6631
+ form && !inlineForm ? /* @__PURE__ */ jsx20(FormGate, { form: form.form, strings, onSubmit: form.onSubmit, onSkip: form.onSkip }) : null
6632
+ ] }),
6647
6633
  showJump ? /* @__PURE__ */ jsx20(
6648
6634
  "button",
6649
6635
  {
@@ -7012,7 +6998,6 @@ function PanelContent(props2) {
7012
6998
  showReasoning: options.showReasoning,
7013
6999
  showToolCalls: options.showToolCalls,
7014
7000
  showSources: options.showSources,
7015
- scrollFade: options.scrollFade,
7016
7001
  enableMessageFeedback: options.enableMessageFeedback,
7017
7002
  onFeedback: onMessageFeedback,
7018
7003
  loading: loadingMessages,
@@ -7559,13 +7544,13 @@ function HomeRoot(props2) {
7559
7544
  const [content, setContent] = useState12([]);
7560
7545
  const tagsKey = config.contentTags?.join(",");
7561
7546
  useEffect11(() => {
7562
- if (config.hideRecentConversations) return;
7547
+ if (config.showRecentConversations === false) return;
7563
7548
  let cancelled = false;
7564
7549
  transport.listConversations({ limit: 1 }).then((res) => !cancelled && setRecent(res.conversations?.[0] ?? null)).catch((err) => !cancelled && log13.warn("listConversations (home) failed", { err }));
7565
7550
  return () => {
7566
7551
  cancelled = true;
7567
7552
  };
7568
- }, [transport, config.hideRecentConversations]);
7553
+ }, [transport, config.showRecentConversations]);
7569
7554
  useEffect11(() => {
7570
7555
  if (!config.contentTags?.length) return;
7571
7556
  let cancelled = false;
@@ -7593,13 +7578,13 @@ function HomeRoot(props2) {
7593
7578
  /* @__PURE__ */ jsx32(HeaderActions, { panelProps, variant: "plain" })
7594
7579
  ] })
7595
7580
  ] }),
7596
- !config.hideGreeting ? /* @__PURE__ */ jsxs26(Fragment7, { children: [
7581
+ config.showGreeting !== false ? /* @__PURE__ */ jsxs26(Fragment7, { children: [
7597
7582
  /* @__PURE__ */ jsx32("h1", { class: `${p28}-home-greeting`, "data-testid": TID.homeGreeting, children: greeting.title }),
7598
7583
  greeting.subtitle ? /* @__PURE__ */ jsx32("p", { class: `${p28}-home-lead`, children: greeting.subtitle }) : null
7599
7584
  ] }) : null
7600
7585
  ] }),
7601
7586
  /* @__PURE__ */ jsxs26("div", { class: `${p28}-home-cards`, children: [
7602
- !config.hideSearchBar ? /* @__PURE__ */ jsx32(
7587
+ config.showSearchBar !== false ? /* @__PURE__ */ jsx32(
7603
7588
  HomeSearchButton,
7604
7589
  {
7605
7590
  placeholder: strings.homeSearchPlaceholder,
@@ -8752,12 +8737,12 @@ function App({ options, hostElement, bus }) {
8752
8737
  );
8753
8738
  const toolInteraction = useMemo3(
8754
8739
  () => ({
8755
- humanInLoop: !options.features.disableHumanInLoop,
8740
+ humanInLoop: options.features.humanInLoop,
8756
8741
  onResult: handleToolResult,
8757
8742
  onDecision: handleToolDecision,
8758
8743
  onEdit: handleToolEdit
8759
8744
  }),
8760
- [options.features.disableHumanInLoop, handleToolResult, handleToolDecision, handleToolEdit]
8745
+ [options.features.humanInLoop, handleToolResult, handleToolDecision, handleToolEdit]
8761
8746
  );
8762
8747
  const userMessageCount = () => messagesSig.value.reduce((n, m) => n + (m.role === "user" ? 1 : 0), 0);
8763
8748
  const effectiveForms = options.forms.list.length > 0 ? options.forms : remoteForms ?? options.forms;