@inkeep/agents-ui 0.14.13 → 0.14.15

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.d.cts CHANGED
@@ -1225,17 +1225,7 @@ export declare const dataAttr: (guard: boolean | undefined) => Booleanish;
1225
1225
 
1226
1226
  declare type DataParts = {
1227
1227
  operation: {
1228
- type:
1229
- | 'error'
1230
- | 'agent_initializing'
1231
- | 'completion'
1232
- | 'agent_generate'
1233
- | 'agent_reasoning'
1234
- | 'tool_execution'
1235
- | 'transfer'
1236
- | 'delegation_sent'
1237
- | 'delegation_returned'
1238
- | 'artifact_saved'
1228
+ type: OperationType
1239
1229
  ctx: Record<string, unknown>
1240
1230
  message?: string
1241
1231
  label?: string
@@ -3851,6 +3841,19 @@ export declare const ModalProvider: React.FC<{
3851
3841
 
3852
3842
  declare type OnLoadingStatusChange = AvatarPrimitive.AvatarImageProps['onLoadingStatusChange'];
3853
3843
 
3844
+ declare type OperationType =
3845
+ | 'error'
3846
+ | 'agent_initializing'
3847
+ | 'completion'
3848
+ | 'agent_generate'
3849
+ | 'agent_reasoning'
3850
+ | 'tool_call'
3851
+ | 'tool_result'
3852
+ | 'transfer'
3853
+ | 'delegation_sent'
3854
+ | 'delegation_returned'
3855
+ | 'artifact_saved'
3856
+
3854
3857
  declare const Overlay: React_2.ForwardRefExoticComponent<DialogOverlayProps & React_2.RefAttributes<HTMLDivElement>>;
3855
3858
 
3856
3859
  export declare interface PolymorphicProps {
package/dist/index.d.ts CHANGED
@@ -1225,17 +1225,7 @@ export declare const dataAttr: (guard: boolean | undefined) => Booleanish;
1225
1225
 
1226
1226
  declare type DataParts = {
1227
1227
  operation: {
1228
- type:
1229
- | 'error'
1230
- | 'agent_initializing'
1231
- | 'completion'
1232
- | 'agent_generate'
1233
- | 'agent_reasoning'
1234
- | 'tool_execution'
1235
- | 'transfer'
1236
- | 'delegation_sent'
1237
- | 'delegation_returned'
1238
- | 'artifact_saved'
1228
+ type: OperationType
1239
1229
  ctx: Record<string, unknown>
1240
1230
  message?: string
1241
1231
  label?: string
@@ -3851,6 +3841,19 @@ export declare const ModalProvider: React.FC<{
3851
3841
 
3852
3842
  declare type OnLoadingStatusChange = AvatarPrimitive.AvatarImageProps['onLoadingStatusChange'];
3853
3843
 
3844
+ declare type OperationType =
3845
+ | 'error'
3846
+ | 'agent_initializing'
3847
+ | 'completion'
3848
+ | 'agent_generate'
3849
+ | 'agent_reasoning'
3850
+ | 'tool_call'
3851
+ | 'tool_result'
3852
+ | 'transfer'
3853
+ | 'delegation_sent'
3854
+ | 'delegation_returned'
3855
+ | 'artifact_saved'
3856
+
3854
3857
  declare const Overlay: React_2.ForwardRefExoticComponent<DialogOverlayProps & React_2.RefAttributes<HTMLDivElement>>;
3855
3858
 
3856
3859
  export declare interface PolymorphicProps {
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),T=require("react"),m=require("@radix-ui/primitive"),P=require("@radix-ui/react-compose-refs"),H=require("@radix-ui/react-context"),R=require("@radix-ui/react-id"),W=require("@radix-ui/react-use-controllable-state"),z=require("@radix-ui/react-dismissable-layer"),B=require("@zag-js/focus-trap"),K=require("@radix-ui/react-portal"),_=require("@radix-ui/react-presence"),f=require("@radix-ui/react-primitive"),U=require("@radix-ui/react-focus-guards"),V=require("react-remove-scroll"),Y=require("aria-hidden"),Z=require("@radix-ui/react-slot");function J(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const s=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(r,o,s.get?s:{enumerable:!0,get:()=>e[o]})}}return r.default=e,Object.freeze(r)}const c=J(T),x="Dialog",[N,Q]=H.createContextScope(x),[X,l]=N(x),O=e=>{const{__scopeDialog:r,children:o,open:s,defaultOpen:n,onOpenChange:t,modal:a=!0}=e,u=c.useRef(null),p=c.useRef(null),[g=!1,D]=W.useControllableState({prop:s,defaultProp:n??!1,onChange:t});return i.jsx(X,{scope:r,triggerRef:u,contentRef:p,contentId:R.useId(),titleId:R.useId(),descriptionId:R.useId(),open:g,onOpenChange:D,onOpenToggle:c.useCallback(()=>D(G=>!G),[D]),modal:a,children:o})};O.displayName=x;const M="DialogTrigger",S=c.forwardRef((e,r)=>{const{__scopeDialog:o,...s}=e,n=l(M,o),t=P.useComposedRefs(r,n.triggerRef);return i.jsx(f.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":j(n.open),...s,ref:t,onClick:m.composeEventHandlers(e.onClick,n.onOpenToggle)})});S.displayName=M;const v="DialogPortal",[$,q]=N(v,{forceMount:void 0}),y=e=>{const{__scopeDialog:r,forceMount:o,children:s,container:n}=e,t=l(v,r);return i.jsx($,{scope:r,forceMount:o,children:c.Children.map(s,a=>i.jsx(_.Presence,{present:o||t.open,children:i.jsx(K.Portal,{asChild:!0,container:n,children:a})}))})};y.displayName=v;const C="DialogOverlay",E=c.forwardRef((e,r)=>{const o=q(C,e.__scopeDialog),{forceMount:s=o.forceMount,...n}=e,t=l(C,e.__scopeDialog);return t.modal?i.jsx(_.Presence,{present:s||t.open,children:i.jsx(ee,{...n,ref:r})}):null});E.displayName=C;const ee=c.forwardRef((e,r)=>{const{__scopeDialog:o,...s}=e,n=l(C,o);return i.jsx(V.RemoveScroll,{as:Z.Slot,allowPinchZoom:!0,shards:[n.contentRef],gapMode:"padding",removeScrollBar:!0,children:i.jsx(f.Primitive.div,{"data-state":j(n.open),...s,ref:r,style:{pointerEvents:"auto",...s.style}})})}),d="DialogContent",h=c.forwardRef((e,r)=>{const o=q(d,e.__scopeDialog),{forceMount:s=o.forceMount,...n}=e,t=l(d,e.__scopeDialog);return i.jsx(_.Presence,{present:s||t.open,children:t.modal?i.jsx(te,{...n,ref:r}):i.jsx(oe,{...n,ref:r})})});h.displayName=d;const te=c.forwardRef((e,r)=>{const o=l(d,e.__scopeDialog),s=c.useRef(null),n=P.useComposedRefs(r,o.contentRef,s);return c.useEffect(()=>{const t=s.current;if(t){const a=document.querySelectorAll("[data-ikp-component]");return Y.hideOthers([t,...Array.from(a)])}},[]),i.jsx(A,{...e,ref:n,trapFocus:o.open,disableOutsidePointerEvents:!0,onPointerDownOutside:m.composeEventHandlers(e.onPointerDownOutside,t=>{const a=t.detail.originalEvent,u=a.button===0&&a.ctrlKey===!0;(a.button===2||u)&&t.preventDefault(),t.target.closest("[data-ikp-component]")&&t.preventDefault()}),onFocusOutside:m.composeEventHandlers(e.onFocusOutside,t=>t.preventDefault())})}),oe=c.forwardRef((e,r)=>{const o=l(d,e.__scopeDialog),s=c.useRef(!1),n=c.useRef(!1);return i.jsx(A,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(s.current=!0,t.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const a=t.target;o.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type==="focusin"&&n.current&&t.preventDefault()}})}),A=c.forwardRef((e,r)=>{const{__scopeDialog:o,trapFocus:s,onOpenAutoFocus:n,onCloseAutoFocus:t,...a}=e,u=l(d,o),p=c.useRef(null),g=P.useComposedRefs(r,p);return U.useFocusGuards(),T.useEffect(()=>{if(s)return B.trapFocus(p.current,{preventScroll:!0,onActivate:n,onDeactivate:t,initialFocus:!1})},[]),i.jsx(z.DismissableLayer,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":j(u.open),...a,ref:g,onDismiss:()=>u.onOpenChange(!1)})}),w="DialogTitle",I=c.forwardRef((e,r)=>{const{__scopeDialog:o,...s}=e,n=l(w,o);return i.jsx(f.Primitive.h2,{id:n.titleId,...s,ref:r})});I.displayName=w;const k="DialogDescription",F=c.forwardRef((e,r)=>{const{__scopeDialog:o,...s}=e,n=l(k,o);return i.jsx(f.Primitive.p,{id:n.descriptionId,...s,ref:r})});F.displayName=k;const L="DialogClose",b=c.forwardRef((e,r)=>{const{__scopeDialog:o,...s}=e,n=l(L,o);return i.jsx(f.Primitive.button,{type:"button",...s,ref:r,onClick:m.composeEventHandlers(e.onClick,()=>n.onOpenChange(!1))})});b.displayName=L;function j(e){return e?"open":"closed"}const ne=O,re=y,se=E,ce=h,ie=I,ae=b;exports.Close=ae;exports.Content=ce;exports.Dialog=O;exports.DialogClose=b;exports.DialogContent=h;exports.DialogDescription=F;exports.DialogOverlay=E;exports.DialogPortal=y;exports.DialogTitle=I;exports.DialogTrigger=S;exports.Overlay=se;exports.Portal=re;exports.Root=ne;exports.Title=ie;exports.createDialogScope=Q;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),P=require("react"),m=require("@radix-ui/primitive"),O=require("@radix-ui/react-compose-refs"),H=require("@radix-ui/react-context"),R=require("@radix-ui/react-id"),W=require("@radix-ui/react-use-controllable-state"),z=require("@radix-ui/react-dismissable-layer"),B=require("@zag-js/focus-trap"),K=require("@radix-ui/react-portal"),_=require("@radix-ui/react-presence"),g=require("@radix-ui/react-primitive"),U=require("@radix-ui/react-focus-guards"),V=require("aria-hidden"),Y=require("@zag-js/remove-scroll"),$=require("./shadow/context.cjs");function J(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const s=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(n,o,s.get?s:{enumerable:!0,get:()=>e[o]})}}return n.default=e,Object.freeze(n)}const c=J(P),x="Dialog",[w,Q]=H.createContextScope(x),[X,l]=w(x),y=e=>{const{__scopeDialog:n,children:o,open:s,defaultOpen:r,onOpenChange:t,modal:a=!0}=e,u=c.useRef(null),f=c.useRef(null),[D=!1,d]=W.useControllableState({prop:s,defaultProp:r??!1,onChange:t});return i.jsx(X,{scope:n,triggerRef:u,contentRef:f,contentId:R.useId(),titleId:R.useId(),descriptionId:R.useId(),open:D,onOpenChange:d,onOpenToggle:c.useCallback(()=>d(N=>!N),[d]),modal:a,children:o})};y.displayName=x;const M="DialogTrigger",q=c.forwardRef((e,n)=>{const{__scopeDialog:o,...s}=e,r=l(M,o),t=O.useComposedRefs(n,r.triggerRef);return i.jsx(g.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":T(r.open),...s,ref:t,onClick:m.composeEventHandlers(e.onClick,r.onOpenToggle)})});q.displayName=M;const v="DialogPortal",[Z,S]=w(v,{forceMount:void 0}),E=e=>{const{__scopeDialog:n,forceMount:o,children:s,container:r}=e,t=l(v,n);return i.jsx(Z,{scope:n,forceMount:o,children:c.Children.map(s,a=>i.jsx(_.Presence,{present:o||t.open,children:i.jsx(K.Portal,{asChild:!0,container:r,children:a})}))})};E.displayName=v;const C="DialogOverlay",I=c.forwardRef((e,n)=>{const o=S(C,e.__scopeDialog),{forceMount:s=o.forceMount,...r}=e,t=l(C,e.__scopeDialog);return t.modal?i.jsx(_.Presence,{present:s||t.open,children:i.jsx(ee,{...r,ref:n})}):null});I.displayName=C;const ee=c.forwardRef((e,n)=>{const{__scopeDialog:o,...s}=e,r=l(C,o),t=$.useShadow();return P.useEffect(()=>{t&&Y.preventBodyScroll(t?.rootElement?.ownerDocument)},[t]),i.jsx(g.Primitive.div,{"data-state":T(r.open),...s,ref:n,style:{pointerEvents:"auto",...s.style}})}),p="DialogContent",h=c.forwardRef((e,n)=>{const o=S(p,e.__scopeDialog),{forceMount:s=o.forceMount,...r}=e,t=l(p,e.__scopeDialog);return i.jsx(_.Presence,{present:s||t.open,children:t.modal?i.jsx(te,{...r,ref:n}):i.jsx(oe,{...r,ref:n})})});h.displayName=p;const te=c.forwardRef((e,n)=>{const o=l(p,e.__scopeDialog),s=c.useRef(null),r=O.useComposedRefs(n,o.contentRef,s);return c.useEffect(()=>{const t=s.current;if(t){const a=document.querySelectorAll("[data-ikp-component]");return V.hideOthers([t,...Array.from(a)])}},[]),i.jsx(k,{...e,ref:r,trapFocus:o.open,disableOutsidePointerEvents:!0,onPointerDownOutside:m.composeEventHandlers(e.onPointerDownOutside,t=>{const a=t.detail.originalEvent,u=a.button===0&&a.ctrlKey===!0;(a.button===2||u)&&t.preventDefault(),t.target.closest("[data-ikp-component]")&&t.preventDefault()}),onFocusOutside:m.composeEventHandlers(e.onFocusOutside,t=>t.preventDefault())})}),oe=c.forwardRef((e,n)=>{const o=l(p,e.__scopeDialog),s=c.useRef(!1),r=c.useRef(!1);return i.jsx(k,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(s.current=!0,t.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const a=t.target;o.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type==="focusin"&&r.current&&t.preventDefault()}})}),k=c.forwardRef((e,n)=>{const{__scopeDialog:o,trapFocus:s,onOpenAutoFocus:r,onCloseAutoFocus:t,...a}=e,u=l(p,o),f=c.useRef(null),D=O.useComposedRefs(n,f);return U.useFocusGuards(),P.useEffect(()=>{if(s)return B.trapFocus(f.current,{preventScroll:!0,onActivate:r,onDeactivate:t,initialFocus:!1,allowOutsideClick:d=>!!d.target.closest("[data-ikp-component]")})},[]),i.jsx(z.DismissableLayer,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":T(u.open),...a,ref:D,onDismiss:()=>u.onOpenChange(!1)})}),A="DialogTitle",b=c.forwardRef((e,n)=>{const{__scopeDialog:o,...s}=e,r=l(A,o);return i.jsx(g.Primitive.h2,{id:r.titleId,...s,ref:n})});b.displayName=A;const F="DialogDescription",L=c.forwardRef((e,n)=>{const{__scopeDialog:o,...s}=e,r=l(F,o);return i.jsx(g.Primitive.p,{id:r.descriptionId,...s,ref:n})});L.displayName=F;const G="DialogClose",j=c.forwardRef((e,n)=>{const{__scopeDialog:o,...s}=e,r=l(G,o);return i.jsx(g.Primitive.button,{type:"button",...s,ref:n,onClick:m.composeEventHandlers(e.onClick,()=>r.onOpenChange(!1))})});j.displayName=G;function T(e){return e?"open":"closed"}const ne=y,re=E,se=I,ce=h,ie=b,ae=j;exports.Close=ae;exports.Content=ce;exports.Dialog=y;exports.DialogClose=j;exports.DialogContent=h;exports.DialogDescription=L;exports.DialogOverlay=I;exports.DialogPortal=E;exports.DialogTitle=b;exports.DialogTrigger=q;exports.Overlay=se;exports.Portal=re;exports.Root=ne;exports.Title=ie;exports.createDialogScope=Q;
@@ -1,167 +1,165 @@
1
1
  "use client";
2
2
  import { jsx as c } from "react/jsx-runtime";
3
3
  import * as i from "react";
4
- import { useEffect as G } from "react";
4
+ import { useEffect as I } from "react";
5
5
  import { composeEventHandlers as D } from "@radix-ui/primitive";
6
6
  import { useComposedRefs as _ } from "@radix-ui/react-compose-refs";
7
7
  import { createContextScope as W } from "@radix-ui/react-context";
8
- import { useId as C } from "@radix-ui/react-id";
8
+ import { useId as R } from "@radix-ui/react-id";
9
9
  import { useControllableState as $ } from "@radix-ui/react-use-controllable-state";
10
10
  import { DismissableLayer as j } from "@radix-ui/react-dismissable-layer";
11
11
  import { trapFocus as q } from "@zag-js/focus-trap";
12
12
  import { Portal as B } from "@radix-ui/react-portal";
13
13
  import { Presence as O } from "@radix-ui/react-presence";
14
- import { Primitive as d } from "@radix-ui/react-primitive";
14
+ import { Primitive as g } from "@radix-ui/react-primitive";
15
15
  import { useFocusGuards as H } from "@radix-ui/react-focus-guards";
16
- import { RemoveScroll as K } from "react-remove-scroll";
17
- import { hideOthers as V } from "aria-hidden";
18
- import { Slot as Y } from "@radix-ui/react-slot";
19
- const P = "Dialog", [E, Co] = W(P), [Z, l] = E(P), I = (o) => {
20
- const { __scopeDialog: n, children: r, open: s, defaultOpen: e, onOpenChange: t, modal: a = !0 } = o, p = i.useRef(null), u = i.useRef(null), [g = !1, m] = $({
16
+ import { hideOthers as K } from "aria-hidden";
17
+ import { preventBodyScroll as V } from "@zag-js/remove-scroll";
18
+ import { useShadow as Y } from "./shadow/context.js";
19
+ const P = "Dialog", [v, Ct] = W(P), [z, l] = v(P), x = (t) => {
20
+ const { __scopeDialog: n, children: r, open: s, defaultOpen: e, onOpenChange: o, modal: a = !0 } = t, p = i.useRef(null), d = i.useRef(null), [m = !1, f] = $({
21
21
  prop: s,
22
22
  defaultProp: e ?? !1,
23
- onChange: t
23
+ onChange: o
24
24
  });
25
25
  return /* @__PURE__ */ c(
26
- Z,
26
+ z,
27
27
  {
28
28
  scope: n,
29
29
  triggerRef: p,
30
- contentRef: u,
31
- contentId: C(),
32
- titleId: C(),
33
- descriptionId: C(),
34
- open: g,
35
- onOpenChange: m,
36
- onOpenToggle: i.useCallback(() => m((L) => !L), [m]),
30
+ contentRef: d,
31
+ contentId: R(),
32
+ titleId: R(),
33
+ descriptionId: R(),
34
+ open: m,
35
+ onOpenChange: f,
36
+ onOpenToggle: i.useCallback(() => f((E) => !E), [f]),
37
37
  modal: a,
38
38
  children: r
39
39
  }
40
40
  );
41
41
  };
42
- I.displayName = P;
43
- const v = "DialogTrigger", z = i.forwardRef(
44
- (o, n) => {
45
- const { __scopeDialog: r, ...s } = o, e = l(v, r), t = _(n, e.triggerRef);
42
+ x.displayName = P;
43
+ const N = "DialogTrigger", J = i.forwardRef(
44
+ (t, n) => {
45
+ const { __scopeDialog: r, ...s } = t, e = l(N, r), o = _(n, e.triggerRef);
46
46
  return /* @__PURE__ */ c(
47
- d.button,
47
+ g.button,
48
48
  {
49
49
  type: "button",
50
50
  "aria-haspopup": "dialog",
51
51
  "aria-expanded": e.open,
52
52
  "aria-controls": e.contentId,
53
- "data-state": y(e.open),
53
+ "data-state": h(e.open),
54
54
  ...s,
55
- ref: t,
56
- onClick: D(o.onClick, e.onOpenToggle)
55
+ ref: o,
56
+ onClick: D(t.onClick, e.onOpenToggle)
57
57
  }
58
58
  );
59
59
  }
60
60
  );
61
- z.displayName = v;
62
- const h = "DialogPortal", [J, x] = E(h, {
61
+ J.displayName = N;
62
+ const y = "DialogPortal", [Q, w] = v(y, {
63
63
  forceMount: void 0
64
- }), N = (o) => {
65
- const { __scopeDialog: n, forceMount: r, children: s, container: e } = o, t = l(h, n);
66
- return /* @__PURE__ */ c(J, { scope: n, forceMount: r, children: i.Children.map(s, (a) => /* @__PURE__ */ c(O, { present: r || t.open, children: /* @__PURE__ */ c(B, { asChild: !0, container: e, children: a }) })) });
64
+ }), T = (t) => {
65
+ const { __scopeDialog: n, forceMount: r, children: s, container: e } = t, o = l(y, n);
66
+ return /* @__PURE__ */ c(Q, { scope: n, forceMount: r, children: i.Children.map(s, (a) => /* @__PURE__ */ c(O, { present: r || o.open, children: /* @__PURE__ */ c(B, { asChild: !0, container: e, children: a }) })) });
67
67
  };
68
- N.displayName = h;
69
- const R = "DialogOverlay", M = i.forwardRef(
70
- (o, n) => {
71
- const r = x(R, o.__scopeDialog), { forceMount: s = r.forceMount, ...e } = o, t = l(R, o.__scopeDialog);
72
- return t.modal ? /* @__PURE__ */ c(O, { present: s || t.open, children: /* @__PURE__ */ c(Q, { ...e, ref: n }) }) : null;
68
+ T.displayName = y;
69
+ const C = "DialogOverlay", A = i.forwardRef(
70
+ (t, n) => {
71
+ const r = w(C, t.__scopeDialog), { forceMount: s = r.forceMount, ...e } = t, o = l(C, t.__scopeDialog);
72
+ return o.modal ? /* @__PURE__ */ c(O, { present: s || o.open, children: /* @__PURE__ */ c(U, { ...e, ref: n }) }) : null;
73
73
  }
74
74
  );
75
- M.displayName = R;
76
- const Q = i.forwardRef(
77
- (o, n) => {
78
- const { __scopeDialog: r, ...s } = o, e = l(R, r);
79
- return (
80
- // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
81
- // ie. when `Overlay` and `Content` are siblings
82
- /* @__PURE__ */ c(
83
- K,
84
- {
85
- as: Y,
86
- allowPinchZoom: !0,
87
- shards: [e.contentRef],
88
- gapMode: "padding",
89
- removeScrollBar: !0,
90
- children: /* @__PURE__ */ c(
91
- d.div,
92
- {
93
- "data-state": y(e.open),
94
- ...s,
95
- ref: n,
96
- style: { pointerEvents: "auto", ...s.style }
97
- }
98
- )
99
- }
100
- )
75
+ A.displayName = C;
76
+ const U = i.forwardRef(
77
+ (t, n) => {
78
+ const { __scopeDialog: r, ...s } = t, e = l(C, r), o = Y();
79
+ return I(() => {
80
+ o && V(o?.rootElement?.ownerDocument);
81
+ }, [o]), // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
82
+ // ie. when `Overlay` and `Content` are siblings
83
+ // <RemoveScroll
84
+ // as={Slot}
85
+ // allowPinchZoom
86
+ // shards={[context.contentRef]}
87
+ // gapMode="padding"
88
+ // removeScrollBar={true}
89
+ // >
90
+ /* @__PURE__ */ c(
91
+ g.div,
92
+ {
93
+ "data-state": h(e.open),
94
+ ...s,
95
+ ref: n,
96
+ style: { pointerEvents: "auto", ...s.style }
97
+ }
101
98
  );
102
99
  }
103
- ), f = "DialogContent", T = i.forwardRef(
104
- (o, n) => {
105
- const r = x(f, o.__scopeDialog), { forceMount: s = r.forceMount, ...e } = o, t = l(f, o.__scopeDialog);
106
- return /* @__PURE__ */ c(O, { present: s || t.open, children: t.modal ? /* @__PURE__ */ c(U, { ...e, ref: n }) : /* @__PURE__ */ c(X, { ...e, ref: n }) });
100
+ ), u = "DialogContent", M = i.forwardRef(
101
+ (t, n) => {
102
+ const r = w(u, t.__scopeDialog), { forceMount: s = r.forceMount, ...e } = t, o = l(u, t.__scopeDialog);
103
+ return /* @__PURE__ */ c(O, { present: s || o.open, children: o.modal ? /* @__PURE__ */ c(X, { ...e, ref: n }) : /* @__PURE__ */ c(Z, { ...e, ref: n }) });
107
104
  }
108
105
  );
109
- T.displayName = f;
110
- const U = i.forwardRef(
111
- (o, n) => {
112
- const r = l(f, o.__scopeDialog), s = i.useRef(null), e = _(n, r.contentRef, s);
106
+ M.displayName = u;
107
+ const X = i.forwardRef(
108
+ (t, n) => {
109
+ const r = l(u, t.__scopeDialog), s = i.useRef(null), e = _(n, r.contentRef, s);
113
110
  return i.useEffect(() => {
114
- const t = s.current;
115
- if (t) {
111
+ const o = s.current;
112
+ if (o) {
116
113
  const a = document.querySelectorAll("[data-ikp-component]");
117
- return V([t, ...Array.from(a)]);
114
+ return K([o, ...Array.from(a)]);
118
115
  }
119
116
  }, []), /* @__PURE__ */ c(
120
- A,
117
+ b,
121
118
  {
122
- ...o,
119
+ ...t,
123
120
  ref: e,
124
121
  trapFocus: r.open,
125
122
  disableOutsidePointerEvents: !0,
126
- onPointerDownOutside: D(o.onPointerDownOutside, (t) => {
127
- const a = t.detail.originalEvent, p = a.button === 0 && a.ctrlKey === !0;
128
- (a.button === 2 || p) && t.preventDefault(), t.target.closest("[data-ikp-component]") && t.preventDefault();
123
+ onPointerDownOutside: D(t.onPointerDownOutside, (o) => {
124
+ const a = o.detail.originalEvent, p = a.button === 0 && a.ctrlKey === !0;
125
+ (a.button === 2 || p) && o.preventDefault(), o.target.closest("[data-ikp-component]") && o.preventDefault();
129
126
  }),
130
127
  onFocusOutside: D(
131
- o.onFocusOutside,
132
- (t) => t.preventDefault()
128
+ t.onFocusOutside,
129
+ (o) => o.preventDefault()
133
130
  )
134
131
  }
135
132
  );
136
133
  }
137
- ), X = i.forwardRef(
138
- (o, n) => {
139
- const r = l(f, o.__scopeDialog), s = i.useRef(!1), e = i.useRef(!1);
134
+ ), Z = i.forwardRef(
135
+ (t, n) => {
136
+ const r = l(u, t.__scopeDialog), s = i.useRef(!1), e = i.useRef(!1);
140
137
  return /* @__PURE__ */ c(
141
- A,
138
+ b,
142
139
  {
143
- ...o,
140
+ ...t,
144
141
  ref: n,
145
142
  trapFocus: !1,
146
143
  disableOutsidePointerEvents: !1,
147
- onInteractOutside: (t) => {
148
- o.onInteractOutside?.(t), t.defaultPrevented || (s.current = !0, t.detail.originalEvent.type === "pointerdown" && (e.current = !0));
149
- const a = t.target;
150
- r.triggerRef.current?.contains(a) && t.preventDefault(), t.detail.originalEvent.type === "focusin" && e.current && t.preventDefault();
144
+ onInteractOutside: (o) => {
145
+ t.onInteractOutside?.(o), o.defaultPrevented || (s.current = !0, o.detail.originalEvent.type === "pointerdown" && (e.current = !0));
146
+ const a = o.target;
147
+ r.triggerRef.current?.contains(a) && o.preventDefault(), o.detail.originalEvent.type === "focusin" && e.current && o.preventDefault();
151
148
  }
152
149
  }
153
150
  );
154
151
  }
155
- ), A = i.forwardRef(
156
- (o, n) => {
157
- const { __scopeDialog: r, trapFocus: s, onOpenAutoFocus: e, onCloseAutoFocus: t, ...a } = o, p = l(f, r), u = i.useRef(null), g = _(n, u);
158
- return H(), G(() => {
152
+ ), b = i.forwardRef(
153
+ (t, n) => {
154
+ const { __scopeDialog: r, trapFocus: s, onOpenAutoFocus: e, onCloseAutoFocus: o, ...a } = t, p = l(u, r), d = i.useRef(null), m = _(n, d);
155
+ return H(), I(() => {
159
156
  if (s)
160
- return q(u.current, {
157
+ return q(d.current, {
161
158
  preventScroll: !0,
162
159
  onActivate: e,
163
- onDeactivate: t,
164
- initialFocus: !1
160
+ onDeactivate: o,
161
+ initialFocus: !1,
162
+ allowOutsideClick: (f) => !!f.target.closest("[data-ikp-component]")
165
163
  });
166
164
  }, []), /* @__PURE__ */ c(
167
165
  j,
@@ -170,60 +168,60 @@ const U = i.forwardRef(
170
168
  id: p.contentId,
171
169
  "aria-describedby": p.descriptionId,
172
170
  "aria-labelledby": p.titleId,
173
- "data-state": y(p.open),
171
+ "data-state": h(p.open),
174
172
  ...a,
175
- ref: g,
173
+ ref: m,
176
174
  onDismiss: () => p.onOpenChange(!1)
177
175
  }
178
176
  );
179
177
  }
180
- ), b = "DialogTitle", w = i.forwardRef(
181
- (o, n) => {
182
- const { __scopeDialog: r, ...s } = o, e = l(b, r);
183
- return /* @__PURE__ */ c(d.h2, { id: e.titleId, ...s, ref: n });
178
+ ), k = "DialogTitle", F = i.forwardRef(
179
+ (t, n) => {
180
+ const { __scopeDialog: r, ...s } = t, e = l(k, r);
181
+ return /* @__PURE__ */ c(g.h2, { id: e.titleId, ...s, ref: n });
184
182
  }
185
183
  );
186
- w.displayName = b;
187
- const k = "DialogDescription", oo = i.forwardRef(
188
- (o, n) => {
189
- const { __scopeDialog: r, ...s } = o, e = l(k, r);
190
- return /* @__PURE__ */ c(d.p, { id: e.descriptionId, ...s, ref: n });
184
+ F.displayName = k;
185
+ const S = "DialogDescription", tt = i.forwardRef(
186
+ (t, n) => {
187
+ const { __scopeDialog: r, ...s } = t, e = l(S, r);
188
+ return /* @__PURE__ */ c(g.p, { id: e.descriptionId, ...s, ref: n });
191
189
  }
192
190
  );
193
- oo.displayName = k;
194
- const F = "DialogClose", S = i.forwardRef(
195
- (o, n) => {
196
- const { __scopeDialog: r, ...s } = o, e = l(F, r);
191
+ tt.displayName = S;
192
+ const L = "DialogClose", G = i.forwardRef(
193
+ (t, n) => {
194
+ const { __scopeDialog: r, ...s } = t, e = l(L, r);
197
195
  return /* @__PURE__ */ c(
198
- d.button,
196
+ g.button,
199
197
  {
200
198
  type: "button",
201
199
  ...s,
202
200
  ref: n,
203
- onClick: D(o.onClick, () => e.onOpenChange(!1))
201
+ onClick: D(t.onClick, () => e.onOpenChange(!1))
204
202
  }
205
203
  );
206
204
  }
207
205
  );
208
- S.displayName = F;
209
- function y(o) {
210
- return o ? "open" : "closed";
206
+ G.displayName = L;
207
+ function h(t) {
208
+ return t ? "open" : "closed";
211
209
  }
212
- const _o = I, Oo = N, Po = M, ho = T, yo = w, Eo = S;
210
+ const Rt = x, _t = T, Ot = A, Pt = M, yt = F, ht = G;
213
211
  export {
214
- Eo as Close,
215
- ho as Content,
216
- I as Dialog,
217
- S as DialogClose,
218
- T as DialogContent,
219
- oo as DialogDescription,
220
- M as DialogOverlay,
221
- N as DialogPortal,
222
- w as DialogTitle,
223
- z as DialogTrigger,
224
- Po as Overlay,
225
- Oo as Portal,
226
- _o as Root,
227
- yo as Title,
228
- Co as createDialogScope
212
+ ht as Close,
213
+ Pt as Content,
214
+ x as Dialog,
215
+ G as DialogClose,
216
+ M as DialogContent,
217
+ tt as DialogDescription,
218
+ A as DialogOverlay,
219
+ T as DialogPortal,
220
+ F as DialogTitle,
221
+ J as DialogTrigger,
222
+ Ot as Overlay,
223
+ _t as Portal,
224
+ Rt as Root,
225
+ yt as Title,
226
+ Ct as createDialogScope
229
227
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),b=require("./use-inkeep-chat.cjs"),E=require("../../../types/message.cjs");function L(i,p,g){const[l,R]=n.useState([]),[h,A]=n.useState(new Map),[d,D]=n.useState(Date.now()),[P,y]=n.useState(!1),S=n.useRef(0),x=n.useRef(0),w=n.useRef([]),f=n.useRef(h);f.current=h;const C=n.useCallback(()=>{const t=[];let e="",o=[],c=!1;i.length>S.current&&(D(Date.now()),S.current=i.length),x.current=0;const m=new Map,u=(s=!1)=>{if(o.length>0){const r=`group-${x.current++}`,a=f.current.get(r);a?m.set(r,{...a,isCompleted:s}):m.set(r,{isCompleted:s}),t.push({type:"summary-group",summaries:[...o],groupKey:r}),o=[]}};for(const s of i)if(s.type==="text")u(!0),e+=s.text||"";else if(s.type==="data-summary")e.trim()&&(t.push({type:"text",text:e}),e=""),o.push(s.data);else if(s.type==="data-operation"){e.trim()&&(t.push({type:"text",text:e}),e="");const r=s.data;if(r?.type)switch(r.type){case"completion":u(!0);break;case"error":{u(!0);const a=r.message||"Unknown error";console.warn("Data operation error:",a),g(new Error(a)),c||(t.push({type:"text",text:b.DEFAULT_ERROR_MESSAGE}),c=!0);break}default:{const{type:a,label:v}=r;o.push({type:a,label:v});break}}}else if(s.type==="data-artifact")if(s.data?.type?.toLowerCase()===E.CITATION_ARTIFACT_TYPE){const r=s.data,a=r.artifactSummary||{title:r.name};e+=` ^${a?.title||r.name}^`}else e.trim()&&(t.push({type:"text",text:e}),e=""),t.push(s);else s.type==="data-component"&&(e.trim()&&(t.push({type:"text",text:e}),e=""),u(!0),t.push(s));return u(!p),e.trim()&&t.push({type:"text",text:e}),{processed:t,newTimings:m}},[i,p,g]);n.useEffect(()=>{if(w.current===i)return;w.current=i;const{processed:t,newTimings:e}=C();R(t),(e.size!==f.current.size||Array.from(e.entries()).some(([c,m])=>{const u=f.current.get(c);return!u||u.isCompleted!==m.isCompleted}))&&A(e)},[C,i]);const T=n.useCallback(()=>{const t=Date.now()-d,e=Array.from(f.current.values()).some(c=>!c.isCompleted),o=t>1e3&&!e;y(o)},[d]);n.useEffect(()=>{if(!p){y(!1);return}if(!(l.length>0)){y(!1);return}const e=setInterval(T,200);return()=>clearInterval(e)},[p,T,l.length]);const k=n.useMemo(()=>!(l.length>0),[l.length]);return{processedParts:l,summaryTimings:h,shouldShowInitialLoading:k,shouldShowStreamDelayLoading:P}}exports.useStreamProcessor=L;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),v=require("./use-inkeep-chat.cjs"),E=require("../../../types/message.cjs");function L(u,p,g){const[l,R]=n.useState([]),[h,A]=n.useState(new Map),[d,k]=n.useState(Date.now()),[D,y]=n.useState(!1),S=n.useRef(0),x=n.useRef(0),w=n.useRef([]),f=n.useRef(h);f.current=h;const C=n.useCallback(()=>{const t=[];let e="",o=[],c=!1;u.length>S.current&&(k(Date.now()),S.current=u.length),x.current=0;const m=new Map,i=(s=!1)=>{if(o.length>0){const r=`group-${x.current++}`,a=f.current.get(r);a?m.set(r,{...a,isCompleted:s}):m.set(r,{isCompleted:s}),t.push({type:"summary-group",summaries:[...o],groupKey:r}),o=[]}};for(const s of u)if(s.type==="text")i(!0),e+=s.text||"";else if(s.type==="data-summary")e.trim()&&(t.push({type:"text",text:e}),e=""),o.push(s.data);else if(s.type==="data-operation"){e.trim()&&(t.push({type:"text",text:e}),e="");const r=s.data;if(r?.type)switch(r.type){case"agent_initializing":break;case"completion":i(!0);break;case"error":{i(!0);const a=r.message||"Unknown error";console.warn("Data operation error:",a),g(new Error(a)),c||(t.push({type:"text",text:v.DEFAULT_ERROR_MESSAGE}),c=!0);break}default:{const{type:a,label:b}=r;o.push({type:a,label:b});break}}}else if(s.type==="data-artifact")if(s.data?.type?.toLowerCase()===E.CITATION_ARTIFACT_TYPE){const r=s.data,a=r.artifactSummary||{title:r.name};e+=` ^${a?.title||r.name}^`}else e.trim()&&(t.push({type:"text",text:e}),e=""),t.push(s);else s.type==="data-component"&&(e.trim()&&(t.push({type:"text",text:e}),e=""),i(!0),t.push(s));return i(!p),e.trim()&&t.push({type:"text",text:e}),{processed:t,newTimings:m}},[u,p,g]);n.useEffect(()=>{if(w.current===u)return;w.current=u;const{processed:t,newTimings:e}=C();R(t),(e.size!==f.current.size||Array.from(e.entries()).some(([c,m])=>{const i=f.current.get(c);return!i||i.isCompleted!==m.isCompleted}))&&A(e)},[C,u]);const T=n.useCallback(()=>{const t=Date.now()-d,e=Array.from(f.current.values()).some(c=>!c.isCompleted),o=t>1e3&&!e;y(o)},[d]);n.useEffect(()=>{if(!p){y(!1);return}if(!(l.length>0)){y(!1);return}const e=setInterval(T,200);return()=>clearInterval(e)},[p,T,l.length]);const P=n.useMemo(()=>!(l.length>0),[l.length]);return{processedParts:l,summaryTimings:h,shouldShowInitialLoading:P,shouldShowStreamDelayLoading:D}}exports.useStreamProcessor=L;
@@ -1,51 +1,53 @@
1
1
  "use client";
2
- import { useState as p, useRef as h, useCallback as D, useEffect as R, useMemo as M } from "react";
3
- import { DEFAULT_ERROR_MESSAGE as b } from "./use-inkeep-chat.js";
2
+ import { useState as p, useRef as h, useCallback as D, useEffect as R, useMemo as I } from "react";
3
+ import { DEFAULT_ERROR_MESSAGE as M } from "./use-inkeep-chat.js";
4
4
  import { CITATION_ARTIFACT_TYPE as _ } from "../../../types/message.js";
5
- function z(i, f, d) {
6
- const [u, v] = p([]), [y, L] = p(/* @__PURE__ */ new Map()), [x, P] = p(Date.now()), [k, g] = p(!1), w = h(0), C = h(0), S = h([]), m = h(y);
7
- m.current = y;
5
+ function O(i, f, d) {
6
+ const [u, k] = p([]), [y, v] = p(/* @__PURE__ */ new Map()), [x, L] = p(Date.now()), [P, g] = p(!1), w = h(0), C = h(0), S = h([]), l = h(y);
7
+ l.current = y;
8
8
  const T = D(() => {
9
9
  const e = [];
10
- let t = "", o = [], c = !1;
11
- i.length > w.current && (P(Date.now()), w.current = i.length), C.current = 0;
12
- const l = /* @__PURE__ */ new Map(), a = (r = !1) => {
13
- if (o.length > 0) {
14
- const s = `group-${C.current++}`, n = m.current.get(s);
15
- n ? l.set(s, {
10
+ let t = "", a = [], c = !1;
11
+ i.length > w.current && (L(Date.now()), w.current = i.length), C.current = 0;
12
+ const m = /* @__PURE__ */ new Map(), o = (r = !1) => {
13
+ if (a.length > 0) {
14
+ const s = `group-${C.current++}`, n = l.current.get(s);
15
+ n ? m.set(s, {
16
16
  ...n,
17
17
  isCompleted: r
18
- }) : l.set(s, {
18
+ }) : m.set(s, {
19
19
  isCompleted: r
20
20
  }), e.push({
21
21
  type: "summary-group",
22
- summaries: [...o],
22
+ summaries: [...a],
23
23
  groupKey: s
24
- }), o = [];
24
+ }), a = [];
25
25
  }
26
26
  };
27
27
  for (const r of i)
28
28
  if (r.type === "text")
29
- a(!0), t += r.text || "";
29
+ o(!0), t += r.text || "";
30
30
  else if (r.type === "data-summary")
31
- t.trim() && (e.push({ type: "text", text: t }), t = ""), o.push(r.data);
31
+ t.trim() && (e.push({ type: "text", text: t }), t = ""), a.push(r.data);
32
32
  else if (r.type === "data-operation") {
33
33
  t.trim() && (e.push({ type: "text", text: t }), t = "");
34
34
  const s = r.data;
35
35
  if (s?.type)
36
36
  switch (s.type) {
37
+ case "agent_initializing":
38
+ break;
37
39
  case "completion":
38
- a(!0);
40
+ o(!0);
39
41
  break;
40
42
  case "error": {
41
- a(!0);
43
+ o(!0);
42
44
  const n = s.message || "Unknown error";
43
- console.warn("Data operation error:", n), d(new Error(n)), c || (e.push({ type: "text", text: b }), c = !0);
45
+ console.warn("Data operation error:", n), d(new Error(n)), c || (e.push({ type: "text", text: M }), c = !0);
44
46
  break;
45
47
  }
46
48
  default: {
47
- const { type: n, label: I } = s;
48
- o.push({ type: n, label: I });
49
+ const { type: n, label: b } = s;
50
+ a.push({ type: n, label: b });
49
51
  break;
50
52
  }
51
53
  }
@@ -57,24 +59,24 @@ function z(i, f, d) {
57
59
  t += ` ^${n?.title || s.name}^`;
58
60
  } else
59
61
  t.trim() && (e.push({ type: "text", text: t }), t = ""), e.push(r);
60
- else r.type === "data-component" && (t.trim() && (e.push({ type: "text", text: t }), t = ""), a(!0), e.push(r));
61
- return a(!f), t.trim() && e.push({ type: "text", text: t }), { processed: e, newTimings: l };
62
+ else r.type === "data-component" && (t.trim() && (e.push({ type: "text", text: t }), t = ""), o(!0), e.push(r));
63
+ return o(!f), t.trim() && e.push({ type: "text", text: t }), { processed: e, newTimings: m };
62
64
  }, [i, f, d]);
63
65
  R(() => {
64
66
  if (S.current === i)
65
67
  return;
66
68
  S.current = i;
67
69
  const { processed: e, newTimings: t } = T();
68
- v(e), (t.size !== m.current.size || Array.from(t.entries()).some(([c, l]) => {
69
- const a = m.current.get(c);
70
- return !a || a.isCompleted !== l.isCompleted;
71
- })) && L(t);
70
+ k(e), (t.size !== l.current.size || Array.from(t.entries()).some(([c, m]) => {
71
+ const o = l.current.get(c);
72
+ return !o || o.isCompleted !== m.isCompleted;
73
+ })) && v(t);
72
74
  }, [T, i]);
73
75
  const A = D(() => {
74
- const e = Date.now() - x, t = Array.from(m.current.values()).some(
76
+ const e = Date.now() - x, t = Array.from(l.current.values()).some(
75
77
  (c) => !c.isCompleted
76
- ), o = e > 1e3 && !t;
77
- g(o);
78
+ ), a = e > 1e3 && !t;
79
+ g(a);
78
80
  }, [x]);
79
81
  R(() => {
80
82
  if (!f) {
@@ -88,14 +90,14 @@ function z(i, f, d) {
88
90
  const t = setInterval(A, 200);
89
91
  return () => clearInterval(t);
90
92
  }, [f, A, u.length]);
91
- const E = M(() => !(u.length > 0), [u.length]);
93
+ const E = I(() => !(u.length > 0), [u.length]);
92
94
  return {
93
95
  processedParts: u,
94
96
  summaryTimings: y,
95
97
  shouldShowInitialLoading: E,
96
- shouldShowStreamDelayLoading: k
98
+ shouldShowStreamDelayLoading: P
97
99
  };
98
100
  }
99
101
  export {
100
- z as useStreamProcessor
102
+ O as useStreamProcessor
101
103
  };