@duskmoon-dev/components 0.6.1 → 0.6.3

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.
@@ -38,7 +38,7 @@ var __chunks = (base, ids, nodes, entry) => {
38
38
  __chunkSeen ||= {};
39
39
  __preload(ids[entry], 1);
40
40
  };
41
- __chunks(import.meta.url,["75afjaj1","rd10x4gc","kg46s2vk"],[["./index.js",2],["../../../chunk-rd10x4gc.js",2],["../../../chunk-kg46s2vk.js"]],0);
41
+ __chunks(import.meta.url,["43jyfyzy","rd10x4gc","kg46s2vk"],[["./index.js",2],["../../../chunk-rd10x4gc.js",2],["../../../chunk-kg46s2vk.js"]],0);
42
42
 
43
43
  // src/components/chat/rich/RichChatComposer.tsx
44
44
  import { Component, Suspense, forwardRef as forwardRef5, lazy } from "react";
@@ -601,6 +601,7 @@ var ComposerShell = forwardRef(({
601
601
  composerId,
602
602
  compact = false,
603
603
  addMenu,
604
+ context,
604
605
  entries,
605
606
  renderAttachment,
606
607
  removeAttachment,
@@ -815,7 +816,7 @@ var ComposerShell = forwardRef(({
815
816
  return /* @__PURE__ */ jsxs3("div", {
816
817
  ...props,
817
818
  ref,
818
- className: cn("chat-composer", className),
819
+ className: cn("chat-composer", compact && "chat-composer-compact", className),
819
820
  style: compact ? {
820
821
  ...props.style,
821
822
  anchorName: props.style?.anchorName && props.style.anchorName !== "none" ? `${props.style.anchorName}, ${completionAnchor}` : completionAnchor
@@ -844,6 +845,7 @@ var ComposerShell = forwardRef(({
844
845
  }
845
846
  },
846
847
  children: [
848
+ context,
847
849
  entries.length > 0 ? /* @__PURE__ */ jsx3("ul", {
848
850
  role: "list",
849
851
  className: cn("chat-composer-attachments", thumbnails && "chat-composer-thumbnails"),
@@ -1852,6 +1854,16 @@ function snapshotComposerReceipt(input, submission) {
1852
1854
  throw new TypeError("Unsupported receipt fields");
1853
1855
  return value;
1854
1856
  }
1857
+ function createSubmissionId() {
1858
+ const webCrypto = globalThis.crypto;
1859
+ if (typeof webCrypto.randomUUID === "function")
1860
+ return webCrypto.randomUUID();
1861
+ const bytes = webCrypto.getRandomValues(new Uint8Array(16));
1862
+ bytes[6] = bytes[6] & 15 | 64;
1863
+ bytes[8] = bytes[8] & 63 | 128;
1864
+ const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
1865
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
1866
+ }
1855
1867
  function createComposerSessionController(initial, identity) {
1856
1868
  let context = initial;
1857
1869
  let disposed = false;
@@ -1974,7 +1986,7 @@ function createComposerSessionController(initial, identity) {
1974
1986
  const action = composerActionEligibility(context, intent);
1975
1987
  if (disposed || state.submitting || !action.allowed)
1976
1988
  return;
1977
- const clientSubmissionId = identity.nextSubmissionId?.() ?? crypto.randomUUID();
1989
+ const clientSubmissionId = identity.nextSubmissionId?.() ?? createSubmissionId();
1978
1990
  const common = {
1979
1991
  protocolVersion: 1,
1980
1992
  clientSubmissionId,
@@ -2982,6 +2994,7 @@ var SemanticComposer = forwardRef4(({
2982
2994
  allowAttachmentOnly = false,
2983
2995
  compact = false,
2984
2996
  addMenu,
2997
+ context: composerContext,
2985
2998
  onStop,
2986
2999
  label = "Message",
2987
3000
  attachLabel = "Attach files",
@@ -3180,6 +3193,7 @@ var SemanticComposer = forwardRef4(({
3180
3193
  composerId: id,
3181
3194
  compact,
3182
3195
  addMenu,
3196
+ context: composerContext,
3183
3197
  entries: (attachmentsCurrent ? attachments.entries : []).map((entry) => ({
3184
3198
  id: entry.entryId,
3185
3199
  name: entry.metadata.name,
@@ -1 +1 @@
1
- export declare const version = "0.6.1";
1
+ export declare const version = "0.6.3";