@dxos/react-ui-chat 0.8.4-main.03d5cd7b56

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.
Files changed (59) hide show
  1. package/LICENSE +8 -0
  2. package/README.md +1 -0
  3. package/dist/lib/browser/index.mjs +359 -0
  4. package/dist/lib/browser/index.mjs.map +7 -0
  5. package/dist/lib/browser/meta.json +1 -0
  6. package/dist/lib/browser/translations.mjs +14 -0
  7. package/dist/lib/browser/translations.mjs.map +7 -0
  8. package/dist/lib/node-esm/index.mjs +361 -0
  9. package/dist/lib/node-esm/index.mjs.map +7 -0
  10. package/dist/lib/node-esm/meta.json +1 -0
  11. package/dist/lib/node-esm/translations.mjs +16 -0
  12. package/dist/lib/node-esm/translations.mjs.map +7 -0
  13. package/dist/types/src/components/ChatDialog/ChatDialog.d.ts +50 -0
  14. package/dist/types/src/components/ChatDialog/ChatDialog.d.ts.map +1 -0
  15. package/dist/types/src/components/ChatDialog/ChatDialog.stories.d.ts +38 -0
  16. package/dist/types/src/components/ChatDialog/ChatDialog.stories.d.ts.map +1 -0
  17. package/dist/types/src/components/ChatDialog/index.d.ts +2 -0
  18. package/dist/types/src/components/ChatDialog/index.d.ts.map +1 -0
  19. package/dist/types/src/components/ChatEditor/ChatEditor.d.ts +20 -0
  20. package/dist/types/src/components/ChatEditor/ChatEditor.d.ts.map +1 -0
  21. package/dist/types/src/components/ChatEditor/ChatEditor.stories.d.ts +25 -0
  22. package/dist/types/src/components/ChatEditor/ChatEditor.stories.d.ts.map +1 -0
  23. package/dist/types/src/components/ChatEditor/index.d.ts +3 -0
  24. package/dist/types/src/components/ChatEditor/index.d.ts.map +1 -0
  25. package/dist/types/src/components/ChatEditor/references.d.ts +34 -0
  26. package/dist/types/src/components/ChatEditor/references.d.ts.map +1 -0
  27. package/dist/types/src/components/ChatStatus/ChatStatus.d.ts +40 -0
  28. package/dist/types/src/components/ChatStatus/ChatStatus.d.ts.map +1 -0
  29. package/dist/types/src/components/ChatStatus/ChatStatus.stories.d.ts +27 -0
  30. package/dist/types/src/components/ChatStatus/ChatStatus.stories.d.ts.map +1 -0
  31. package/dist/types/src/components/ChatStatus/format.d.ts +7 -0
  32. package/dist/types/src/components/ChatStatus/format.d.ts.map +1 -0
  33. package/dist/types/src/components/ChatStatus/format.test.d.ts +2 -0
  34. package/dist/types/src/components/ChatStatus/format.test.d.ts.map +1 -0
  35. package/dist/types/src/components/ChatStatus/index.d.ts +3 -0
  36. package/dist/types/src/components/ChatStatus/index.d.ts.map +1 -0
  37. package/dist/types/src/components/index.d.ts +4 -0
  38. package/dist/types/src/components/index.d.ts.map +1 -0
  39. package/dist/types/src/index.d.ts +2 -0
  40. package/dist/types/src/index.d.ts.map +1 -0
  41. package/dist/types/src/translations.d.ts +7 -0
  42. package/dist/types/src/translations.d.ts.map +1 -0
  43. package/dist/types/tsconfig.tsbuildinfo +1 -0
  44. package/package.json +84 -0
  45. package/src/components/ChatDialog/ChatDialog.stories.tsx +64 -0
  46. package/src/components/ChatDialog/ChatDialog.tsx +203 -0
  47. package/src/components/ChatDialog/index.ts +5 -0
  48. package/src/components/ChatEditor/ChatEditor.stories.tsx +97 -0
  49. package/src/components/ChatEditor/ChatEditor.tsx +59 -0
  50. package/src/components/ChatEditor/index.ts +7 -0
  51. package/src/components/ChatEditor/references.ts +181 -0
  52. package/src/components/ChatStatus/ChatStatus.stories.tsx +130 -0
  53. package/src/components/ChatStatus/ChatStatus.tsx +183 -0
  54. package/src/components/ChatStatus/format.test.ts +48 -0
  55. package/src/components/ChatStatus/format.ts +27 -0
  56. package/src/components/ChatStatus/index.ts +6 -0
  57. package/src/components/index.ts +7 -0
  58. package/src/index.ts +5 -0
  59. package/src/translations.ts +15 -0
@@ -0,0 +1,3 @@
1
+ export * from './references';
2
+ export * from './ChatEditor';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatEditor/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAE7B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { type Extension } from '@codemirror/state';
2
+ export type ReferenceData = {
3
+ uri: string;
4
+ label: string;
5
+ };
6
+ /**
7
+ * @deprecated
8
+ */
9
+ export interface ReferencesProvider {
10
+ getReferences({ query }: {
11
+ query: string;
12
+ }): Promise<ReferenceData[]>;
13
+ resolveReference({ uri }: {
14
+ uri: string;
15
+ }): Promise<ReferenceData | null>;
16
+ }
17
+ export type ReferencesOptions = {
18
+ provider: ReferencesProvider;
19
+ /**
20
+ * @default '@'
21
+ */
22
+ triggerCharacter?: string;
23
+ /**
24
+ * Prevent the autocomplete from closing when the user blurs the editor.
25
+ * @default false
26
+ */
27
+ debug?: boolean;
28
+ };
29
+ /**
30
+ * Lookup object references.
31
+ * @deprecated
32
+ */
33
+ export declare const references: ({ provider, triggerCharacter, debug }: ReferencesOptions) => Extension;
34
+ //# sourceMappingURL=references.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatEditor/references.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,mBAAmB,CAAC;AAe7D,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;GAEG;AAEH,MAAM,WAAW,kBAAkB;IACjC,aAAa,CAAC,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IACtE,gBAAgB,CAAC,EAAE,GAAG,EAAE,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;CAC3E;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,kBAAkB,CAAC;IAE7B;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;;GAGG;AAEH,eAAO,MAAM,UAAU,0CAAyD,iBAAiB,KAAG,SAyGnG,CAAC"}
@@ -0,0 +1,40 @@
1
+ import React, { type PropsWithChildren } from 'react';
2
+ import { type ThemedClassName } from '@dxos/react-ui';
3
+ type ChatStatusContextValue = {
4
+ /** Whole seconds elapsed since ChatStatus.Root mounted. Only advances while `running` is true. */
5
+ elapsed: number;
6
+ /** Whether the ChatStatus.Root tick is currently active. Toggled via the ChatStatusController. */
7
+ running: boolean;
8
+ };
9
+ declare const useChatStatusContext: (consumerName: string) => ChatStatusContextValue;
10
+ export { useChatStatusContext };
11
+ export type ChatStatusController = {
12
+ /** Resume the tick. No-op if already running. */
13
+ start: () => void;
14
+ /** Pause the tick. The reported `elapsed` freezes at its last value. */
15
+ stop: () => void;
16
+ };
17
+ export type RootProps = ThemedClassName<PropsWithChildren<{
18
+ /** Whether the tick starts running on mount. Defaults to `true`. */
19
+ defaultRunning?: boolean;
20
+ }>>;
21
+ export type IconProps = ThemedClassName<PropsWithChildren>;
22
+ export type StopwatchProps = ThemedClassName<{
23
+ /** Seconds to add to the context elapsed value before formatting. Defaults to 0. */
24
+ offset?: number;
25
+ }>;
26
+ export type SeparatorProps = ThemedClassName<unknown>;
27
+ export type TextProps = ThemedClassName<PropsWithChildren>;
28
+ export declare const ChatStatus: {
29
+ Root: React.ForwardRefExoticComponent<Omit<PropsWithChildren<{
30
+ /** Whether the tick starts running on mount. Defaults to `true`. */
31
+ defaultRunning?: boolean;
32
+ }>, "className"> & {
33
+ classNames?: import("@dxos/ui-types").ClassNameValue;
34
+ } & React.RefAttributes<ChatStatusController>>;
35
+ Icon: ({ classNames, children }: IconProps) => React.JSX.Element;
36
+ Stopwatch: ({ classNames, offset }: StopwatchProps) => React.JSX.Element;
37
+ Separator: ({ classNames }: SeparatorProps) => React.JSX.Element;
38
+ Text: ({ classNames, children }: TextProps) => React.JSX.Element;
39
+ };
40
+ //# sourceMappingURL=ChatStatus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatStatus.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatStatus/ChatStatus.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAkE,MAAM,OAAO,CAAC;AAEtH,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAWtD,KAAK,sBAAsB,GAAG;IAC5B,kGAAkG;IAClG,OAAO,EAAE,MAAM,CAAC;IAChB,kGAAkG;IAClG,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,QAAA,MAA2B,oBAAoB,kDAAuD,CAAC;AAEvG,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAMhC,MAAM,MAAM,oBAAoB,GAAG;IACjC,iDAAiD;IACjD,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,wEAAwE;IACxE,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB,CAAC;AAMF,MAAM,MAAM,SAAS,GAAG,eAAe,CACrC,iBAAiB,CAAC;IAChB,oEAAoE;IACpE,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC,CACH,CAAC;AAyDF,MAAM,MAAM,SAAS,GAAG,eAAe,CAAC,iBAAiB,CAAC,CAAC;AAqB3D,MAAM,MAAM,cAAc,GAAG,eAAe,CAAC;IAC3C,oFAAoF;IACpF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC,CAAC;AAoBH,MAAM,MAAM,cAAc,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;AAetD,MAAM,MAAM,SAAS,GAAG,eAAe,CAAC,iBAAiB,CAAC,CAAC;AAW3D,eAAO,MAAM,UAAU;;QAlInB,oEAAoE;yBACnD,OAAO;;;;qCAgEY,SAAS;wCA0BF,cAAc;gCAkB1B,cAAc;qCAeT,SAAS;CAYhD,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { type StoryObj } from '@storybook/react-vite';
2
+ import React from 'react';
3
+ import { type ChatStatusController } from './ChatStatus';
4
+ declare const meta: {
5
+ title: string;
6
+ component: React.ForwardRefExoticComponent<Omit<React.PropsWithChildren<{
7
+ defaultRunning?: boolean;
8
+ }>, "className"> & {
9
+ classNames?: import("@dxos/ui-types").ClassNameValue;
10
+ } & React.RefAttributes<ChatStatusController>>;
11
+ decorators: import("@storybook/react").Decorator[];
12
+ parameters: {
13
+ layout: string;
14
+ };
15
+ };
16
+ export default meta;
17
+ type Story = StoryObj<typeof meta>;
18
+ export declare const Default: Story;
19
+ export declare const WithMeta: Story;
20
+ export declare const WithCustomIcon: Story;
21
+ export declare const LongRunning: Story;
22
+ export declare const TextOnly: Story;
23
+ /**
24
+ * Demonstrates the imperative controller — start/stop the 1Hz tick from the outside.
25
+ */
26
+ export declare const Controller: Story;
27
+ //# sourceMappingURL=ChatStatus.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatStatus.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatStatus/ChatStatus.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAiB,MAAM,OAAO,CAAC;AAMtC,OAAO,EAAc,KAAK,oBAAoB,EAAwB,MAAM,cAAc,CAAC;AAE3F,QAAA,MAAM,IAAI;;;;;;;;;QAQN,MAAM;;CAE8B,CAAC;eAE1B,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAOrB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAWtB,CAAC;AAsBF,eAAO,MAAM,cAAc,EAAE,KAa5B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAWzB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAOtB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,KAkBxB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Formats elapsed milliseconds as a human-readable duration.
3
+ * Tiers: `Ns` (< 60s), `Nm Xs` (< 60m), `Nh Xm` (≥ 60m).
4
+ * Negative inputs clamp to `0s`.
5
+ */
6
+ export declare const formatElapsed: (ms: number) => string;
7
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatStatus/format.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,eAAO,MAAM,aAAa,OAAQ,MAAM,KAAG,MAa1C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=format.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.test.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatStatus/format.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export * from './ChatStatus';
2
+ export * from './format';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatStatus/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './ChatDialog';
2
+ export * from './ChatEditor';
3
+ export * from './ChatStatus';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './components';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare const translationKey = "@dxos/react-ui-chat";
2
+ export declare const translations: [{
3
+ readonly 'en-US': {
4
+ readonly "@dxos/react-ui-chat": {};
5
+ };
6
+ }];
7
+ //# sourceMappingURL=translations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,wBAAwB,CAAC;AAEpD,eAAO,MAAM,YAAY;;;;EAMM,CAAC"}