@assistant-ui/react 0.10.5 → 0.10.6

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.
@@ -7,6 +7,7 @@ type MessageIfFilters = {
7
7
  hasBranches: boolean | undefined;
8
8
  copied: boolean | undefined;
9
9
  lastOrHover: boolean | undefined;
10
+ last: boolean | undefined;
10
11
  speaking: boolean | undefined;
11
12
  hasAttachments: boolean | undefined;
12
13
  hasContent: boolean | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"MessageIf.d.ts","sourceRoot":"","sources":["../../../src/primitives/message/MessageIf.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAKnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGvE,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B,SAAS,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,WAAW,EAAE,OAAO,GAAG,SAAS,CAAC;IACjC,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,WAAW,EAAE,OAAO,GAAG,SAAS,CAAC;IACjC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,cAAc,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,UAAU,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC,iBAAiB,EAAE,UAAU,GAAG,UAAU,GAAG,IAAI,GAAG,SAAS,CAAC;CAC/D,CAAC;AACF,KAAK,iBAAiB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;AA4D7D,yBAAiB,kBAAkB,CAAC;IAClC,KAAY,KAAK,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;CAC1D;AAED,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAM3D,CAAC"}
1
+ {"version":3,"file":"MessageIf.d.ts","sourceRoot":"","sources":["../../../src/primitives/message/MessageIf.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAKnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGvE,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B,SAAS,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,WAAW,EAAE,OAAO,GAAG,SAAS,CAAC;IACjC,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,WAAW,EAAE,OAAO,GAAG,SAAS,CAAC;IACjC,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,cAAc,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,UAAU,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC,iBAAiB,EAAE,UAAU,GAAG,UAAU,GAAG,IAAI,GAAG,SAAS,CAAC;CAC/D,CAAC;AACF,KAAK,iBAAiB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;AA6D7D,yBAAiB,kBAAkB,CAAC;IAClC,KAAY,KAAK,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;CAC1D;AAED,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAM3D,CAAC"}
@@ -25,6 +25,7 @@ var useMessageIf = (props) => {
25
25
  if (props.assistant && role !== "assistant") return false;
26
26
  if (props.system && role !== "system") return false;
27
27
  if (props.lastOrHover === true && !isHovering && !isLast) return false;
28
+ if (props.last === true && !isLast) return false;
28
29
  if (props.copied === true && !isCopied) return false;
29
30
  if (props.copied === false && isCopied) return false;
30
31
  if (props.speaking === true && speech == null) return false;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/primitives/message/MessageIf.tsx"],"sourcesContent":["\"use client\";\n\nimport type { FC, PropsWithChildren } from \"react\";\nimport {\n useMessageRuntime,\n useMessageUtilsStore,\n} from \"../../context/react/MessageContext\";\nimport type { RequireAtLeastOne } from \"../../utils/RequireAtLeastOne\";\nimport { useCombinedStore } from \"../../utils/combined/useCombinedStore\";\n\ntype MessageIfFilters = {\n user: boolean | undefined;\n assistant: boolean | undefined;\n system: boolean | undefined;\n hasBranches: boolean | undefined;\n copied: boolean | undefined;\n lastOrHover: boolean | undefined;\n speaking: boolean | undefined;\n hasAttachments: boolean | undefined;\n hasContent: boolean | undefined;\n submittedFeedback: \"positive\" | \"negative\" | null | undefined;\n};\ntype UseMessageIfProps = RequireAtLeastOne<MessageIfFilters>;\n\nconst useMessageIf = (props: UseMessageIfProps) => {\n const messageRuntime = useMessageRuntime();\n const messageUtilsStore = useMessageUtilsStore();\n\n return useCombinedStore(\n [messageRuntime, messageUtilsStore],\n (\n {\n role,\n attachments,\n content,\n branchCount,\n isLast,\n speech,\n submittedFeedback,\n },\n { isCopied, isHovering },\n ) => {\n if (props.hasBranches === true && branchCount < 2) return false;\n\n if (props.user && role !== \"user\") return false;\n if (props.assistant && role !== \"assistant\") return false;\n if (props.system && role !== \"system\") return false;\n\n if (props.lastOrHover === true && !isHovering && !isLast) return false;\n\n if (props.copied === true && !isCopied) return false;\n if (props.copied === false && isCopied) return false;\n\n if (props.speaking === true && speech == null) return false;\n if (props.speaking === false && speech != null) return false;\n\n if (\n props.hasAttachments === true &&\n (role !== \"user\" || !attachments.length)\n )\n return false;\n if (\n props.hasAttachments === false &&\n role === \"user\" &&\n !!attachments.length\n )\n return false;\n\n if (props.hasContent === true && content.length === 0) return false;\n if (props.hasContent === false && content.length > 0) return false;\n\n if (\n props.submittedFeedback !== undefined &&\n (submittedFeedback?.type ?? null) !== props.submittedFeedback\n )\n return false;\n\n return true;\n },\n );\n};\n\nexport namespace MessagePrimitiveIf {\n export type Props = PropsWithChildren<UseMessageIfProps>;\n}\n\nexport const MessagePrimitiveIf: FC<MessagePrimitiveIf.Props> = ({\n children,\n ...query\n}) => {\n const result = useMessageIf(query);\n return result ? children : null;\n};\n\nMessagePrimitiveIf.displayName = \"MessagePrimitive.If\";\n"],"mappings":";;;AAGA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP,SAAS,wBAAwB;AAgBjC,IAAM,eAAe,CAAC,UAA6B;AACjD,QAAM,iBAAiB,kBAAkB;AACzC,QAAM,oBAAoB,qBAAqB;AAE/C,SAAO;AAAA,IACL,CAAC,gBAAgB,iBAAiB;AAAA,IAClC,CACE;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,GACA,EAAE,UAAU,WAAW,MACpB;AACH,UAAI,MAAM,gBAAgB,QAAQ,cAAc,EAAG,QAAO;AAE1D,UAAI,MAAM,QAAQ,SAAS,OAAQ,QAAO;AAC1C,UAAI,MAAM,aAAa,SAAS,YAAa,QAAO;AACpD,UAAI,MAAM,UAAU,SAAS,SAAU,QAAO;AAE9C,UAAI,MAAM,gBAAgB,QAAQ,CAAC,cAAc,CAAC,OAAQ,QAAO;AAEjE,UAAI,MAAM,WAAW,QAAQ,CAAC,SAAU,QAAO;AAC/C,UAAI,MAAM,WAAW,SAAS,SAAU,QAAO;AAE/C,UAAI,MAAM,aAAa,QAAQ,UAAU,KAAM,QAAO;AACtD,UAAI,MAAM,aAAa,SAAS,UAAU,KAAM,QAAO;AAEvD,UACE,MAAM,mBAAmB,SACxB,SAAS,UAAU,CAAC,YAAY;AAEjC,eAAO;AACT,UACE,MAAM,mBAAmB,SACzB,SAAS,UACT,CAAC,CAAC,YAAY;AAEd,eAAO;AAET,UAAI,MAAM,eAAe,QAAQ,QAAQ,WAAW,EAAG,QAAO;AAC9D,UAAI,MAAM,eAAe,SAAS,QAAQ,SAAS,EAAG,QAAO;AAE7D,UACE,MAAM,sBAAsB,WAC3B,mBAAmB,QAAQ,UAAU,MAAM;AAE5C,eAAO;AAET,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAMO,IAAM,qBAAmD,CAAC;AAAA,EAC/D;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,SAAS,aAAa,KAAK;AACjC,SAAO,SAAS,WAAW;AAC7B;AAEA,mBAAmB,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/primitives/message/MessageIf.tsx"],"sourcesContent":["\"use client\";\n\nimport type { FC, PropsWithChildren } from \"react\";\nimport {\n useMessageRuntime,\n useMessageUtilsStore,\n} from \"../../context/react/MessageContext\";\nimport type { RequireAtLeastOne } from \"../../utils/RequireAtLeastOne\";\nimport { useCombinedStore } from \"../../utils/combined/useCombinedStore\";\n\ntype MessageIfFilters = {\n user: boolean | undefined;\n assistant: boolean | undefined;\n system: boolean | undefined;\n hasBranches: boolean | undefined;\n copied: boolean | undefined;\n lastOrHover: boolean | undefined;\n last: boolean | undefined;\n speaking: boolean | undefined;\n hasAttachments: boolean | undefined;\n hasContent: boolean | undefined;\n submittedFeedback: \"positive\" | \"negative\" | null | undefined;\n};\ntype UseMessageIfProps = RequireAtLeastOne<MessageIfFilters>;\n\nconst useMessageIf = (props: UseMessageIfProps) => {\n const messageRuntime = useMessageRuntime();\n const messageUtilsStore = useMessageUtilsStore();\n\n return useCombinedStore(\n [messageRuntime, messageUtilsStore],\n (\n {\n role,\n attachments,\n content,\n branchCount,\n isLast,\n speech,\n submittedFeedback,\n },\n { isCopied, isHovering },\n ) => {\n if (props.hasBranches === true && branchCount < 2) return false;\n\n if (props.user && role !== \"user\") return false;\n if (props.assistant && role !== \"assistant\") return false;\n if (props.system && role !== \"system\") return false;\n\n if (props.lastOrHover === true && !isHovering && !isLast) return false;\n if (props.last === true && !isLast) return false;\n\n if (props.copied === true && !isCopied) return false;\n if (props.copied === false && isCopied) return false;\n\n if (props.speaking === true && speech == null) return false;\n if (props.speaking === false && speech != null) return false;\n\n if (\n props.hasAttachments === true &&\n (role !== \"user\" || !attachments.length)\n )\n return false;\n if (\n props.hasAttachments === false &&\n role === \"user\" &&\n !!attachments.length\n )\n return false;\n\n if (props.hasContent === true && content.length === 0) return false;\n if (props.hasContent === false && content.length > 0) return false;\n\n if (\n props.submittedFeedback !== undefined &&\n (submittedFeedback?.type ?? null) !== props.submittedFeedback\n )\n return false;\n\n return true;\n },\n );\n};\n\nexport namespace MessagePrimitiveIf {\n export type Props = PropsWithChildren<UseMessageIfProps>;\n}\n\nexport const MessagePrimitiveIf: FC<MessagePrimitiveIf.Props> = ({\n children,\n ...query\n}) => {\n const result = useMessageIf(query);\n return result ? children : null;\n};\n\nMessagePrimitiveIf.displayName = \"MessagePrimitive.If\";\n"],"mappings":";;;AAGA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP,SAAS,wBAAwB;AAiBjC,IAAM,eAAe,CAAC,UAA6B;AACjD,QAAM,iBAAiB,kBAAkB;AACzC,QAAM,oBAAoB,qBAAqB;AAE/C,SAAO;AAAA,IACL,CAAC,gBAAgB,iBAAiB;AAAA,IAClC,CACE;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,GACA,EAAE,UAAU,WAAW,MACpB;AACH,UAAI,MAAM,gBAAgB,QAAQ,cAAc,EAAG,QAAO;AAE1D,UAAI,MAAM,QAAQ,SAAS,OAAQ,QAAO;AAC1C,UAAI,MAAM,aAAa,SAAS,YAAa,QAAO;AACpD,UAAI,MAAM,UAAU,SAAS,SAAU,QAAO;AAE9C,UAAI,MAAM,gBAAgB,QAAQ,CAAC,cAAc,CAAC,OAAQ,QAAO;AACjE,UAAI,MAAM,SAAS,QAAQ,CAAC,OAAQ,QAAO;AAE3C,UAAI,MAAM,WAAW,QAAQ,CAAC,SAAU,QAAO;AAC/C,UAAI,MAAM,WAAW,SAAS,SAAU,QAAO;AAE/C,UAAI,MAAM,aAAa,QAAQ,UAAU,KAAM,QAAO;AACtD,UAAI,MAAM,aAAa,SAAS,UAAU,KAAM,QAAO;AAEvD,UACE,MAAM,mBAAmB,SACxB,SAAS,UAAU,CAAC,YAAY;AAEjC,eAAO;AACT,UACE,MAAM,mBAAmB,SACzB,SAAS,UACT,CAAC,CAAC,YAAY;AAEd,eAAO;AAET,UAAI,MAAM,eAAe,QAAQ,QAAQ,WAAW,EAAG,QAAO;AAC9D,UAAI,MAAM,eAAe,SAAS,QAAQ,SAAS,EAAG,QAAO;AAE7D,UACE,MAAM,sBAAsB,WAC3B,mBAAmB,QAAQ,UAAU,MAAM;AAE5C,eAAO;AAET,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAMO,IAAM,qBAAmD,CAAC;AAAA,EAC/D;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,SAAS,aAAa,KAAK;AACjC,SAAO,SAAS,WAAW;AAC7B;AAEA,mBAAmB,cAAc;","names":[]}
package/package.json CHANGED
@@ -28,7 +28,7 @@
28
28
  "conversational-ui",
29
29
  "conversational-ai"
30
30
  ],
31
- "version": "0.10.5",
31
+ "version": "0.10.6",
32
32
  "license": "MIT",
33
33
  "type": "module",
34
34
  "exports": {
@@ -15,6 +15,7 @@ type MessageIfFilters = {
15
15
  hasBranches: boolean | undefined;
16
16
  copied: boolean | undefined;
17
17
  lastOrHover: boolean | undefined;
18
+ last: boolean | undefined;
18
19
  speaking: boolean | undefined;
19
20
  hasAttachments: boolean | undefined;
20
21
  hasContent: boolean | undefined;
@@ -47,6 +48,7 @@ const useMessageIf = (props: UseMessageIfProps) => {
47
48
  if (props.system && role !== "system") return false;
48
49
 
49
50
  if (props.lastOrHover === true && !isHovering && !isLast) return false;
51
+ if (props.last === true && !isLast) return false;
50
52
 
51
53
  if (props.copied === true && !isCopied) return false;
52
54
  if (props.copied === false && isCopied) return false;