@apteva/apteva-kit 0.1.94 → 0.1.96

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/dist/index.js CHANGED
@@ -768,8 +768,10 @@ var WIDGET_DEFINITIONS = {
768
768
  }
769
769
  };
770
770
  var ALL_WIDGET_TYPES = Object.keys(WIDGET_DEFINITIONS);
771
+ var DISABLED_WIDGETS = ["flow"];
772
+ var DEFAULT_WIDGET_TYPES = ALL_WIDGET_TYPES.filter((t) => !DISABLED_WIDGETS.includes(t));
771
773
  function generateWidgetContext(enabledWidgets) {
772
- const widgets = enabledWidgets || ALL_WIDGET_TYPES;
774
+ const widgets = enabledWidgets || DEFAULT_WIDGET_TYPES;
773
775
  let context = `
774
776
  ## UI Widgets
775
777
  SYNTAX: @ui:type[{json}] - MUST use SQUARE BRACKETS [] around the JSON object.
@@ -789,7 +791,7 @@ Per-item "metadata" is sent as payload on action click.
789
791
  return context;
790
792
  }
791
793
  function generateCompactWidgetContext(enabledWidgets) {
792
- const widgets = enabledWidgets || ALL_WIDGET_TYPES;
794
+ const widgets = enabledWidgets || DEFAULT_WIDGET_TYPES;
793
795
  return `
794
796
  Widgets: @ui:type[{json}] - MUST use square brackets []. Example: @ui:list[{"items": [...]}]. Types: ${widgets.join(", ")}. Per-item "metadata" is sent as action payload.
795
797
  `;
@@ -2271,12 +2273,14 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
2271
2273
  const handleChange = (e) => {
2272
2274
  setText(e.target.value);
2273
2275
  e.target.style.height = "auto";
2274
- e.target.style.height = `${e.target.scrollHeight}px`;
2276
+ const scrollHeight = e.target.scrollHeight;
2277
+ e.target.style.height = `${scrollHeight}px`;
2275
2278
  const hasNewline = e.target.value.includes("\n");
2276
- const textLength = e.target.value.length;
2277
- if (!isMultiLine && (hasNewline || textLength > 50)) {
2279
+ const singleLineHeight = 36;
2280
+ const isOverflowing = scrollHeight > singleLineHeight;
2281
+ if (!isMultiLine && (hasNewline || isOverflowing)) {
2278
2282
  setIsMultiLine(true);
2279
- } else if (isMultiLine && !hasNewline && textLength < 30) {
2283
+ } else if (isMultiLine && !hasNewline && !isOverflowing && e.target.value.length < 20) {
2280
2284
  setIsMultiLine(false);
2281
2285
  }
2282
2286
  };
@@ -2358,7 +2362,7 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
2358
2362
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
2359
2363
  "div",
2360
2364
  {
2361
- className: "apteva-composer relative border-2 border-neutral-300 dark:border-neutral-700 bg-white dark:bg-neutral-900 transition-all duration-300 px-3 py-2 grid gap-x-3 gap-y-2",
2365
+ className: "apteva-composer",
2362
2366
  style: {
2363
2367
  gridTemplateColumns: "auto 1fr auto",
2364
2368
  gridTemplateAreas: isMultiLine ? '"textarea textarea textarea" "plus . send"' : '"plus textarea send"',
@@ -2438,9 +2442,9 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
2438
2442
  "button",
2439
2443
  {
2440
2444
  onClick: onStop,
2441
- className: "apteva-composer-stop-btn !w-8 !h-8 !p-0 !m-0 !rounded-lg !flex !items-center !justify-center !font-bold !transition-all !flex-shrink-0 !border !border-solid !border-red-400 dark:!border-red-500 !bg-red-50 dark:!bg-red-900/30 !text-red-600 dark:!text-red-400 hover:!bg-red-100 dark:hover:!bg-red-900/50 !outline-none !shadow-none",
2445
+ className: "apteva-composer-stop-btn",
2442
2446
  title: "Stop generation",
2443
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "!text-red-600 dark:!text-red-400", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "rect", { x: "2", y: "2", width: "10", height: "10", rx: "1", fill: "currentColor" }) })
2447
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "rect", { x: "2", y: "2", width: "10", height: "10", rx: "1", fill: "currentColor" }) })
2444
2448
  }
2445
2449
  ) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2446
2450
  "button",
@@ -2744,9 +2748,9 @@ function CommandComposer({
2744
2748
  "button",
2745
2749
  {
2746
2750
  onClick: onStop,
2747
- className: "apteva-composer-stop-btn !w-8 !h-8 !p-0 !m-0 !rounded-lg !flex !items-center !justify-center !transition-all !border !border-solid !border-red-400 dark:!border-red-500 !bg-red-50 dark:!bg-red-900/30 !text-red-600 dark:!text-red-400 hover:!bg-red-100 dark:hover:!bg-red-900/50 !outline-none !shadow-none",
2751
+ className: "apteva-composer-stop-btn",
2748
2752
  title: "Stop generation",
2749
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "!text-red-600 dark:!text-red-400", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "rect", { x: "2", y: "2", width: "10", height: "10", rx: "1", fill: "currentColor" }) })
2753
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "rect", { x: "2", y: "2", width: "10", height: "10", rx: "1", fill: "currentColor" }) })
2750
2754
  }
2751
2755
  ),
2752
2756
  (state === "success" || state === "error") && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,