@gram-ai/elements 1.20.2 → 1.21.1
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/bin/cli.js +14 -12
- package/dist/components/Chat/stories/ConnectionConfiguration.stories.d.ts +2 -2
- package/dist/components/Chat/stories/ToolApproval.stories.d.ts +2 -0
- package/dist/components/ui/dialog.d.ts +1 -1
- package/dist/components/ui/tooltip.d.ts +3 -1
- package/dist/constants/tailwind.d.ts +1 -0
- package/dist/contexts/portal-container-context.d.ts +2 -0
- package/dist/contexts/portal-container.d.ts +7 -0
- package/dist/elements.cjs +1 -160
- package/dist/elements.cjs.map +1 -1
- package/dist/elements.css +1 -1
- package/dist/elements.js +11 -47215
- package/dist/elements.js.map +1 -1
- package/dist/hooks/usePortalContainer.d.ts +8 -0
- package/dist/hooks/useSession.d.ts +1 -2
- package/dist/index-B48xzOEm.cjs +169 -0
- package/dist/index-B48xzOEm.cjs.map +1 -0
- package/dist/index-C-iaUGd_.js +54687 -0
- package/dist/index-C-iaUGd_.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/lib/auth.d.ts +2 -2
- package/dist/lib/errorTracking.config.d.ts +16 -0
- package/dist/lib/errorTracking.d.ts +24 -0
- package/dist/lib/tools.d.ts +3 -2
- package/dist/profiler-WPgSewiM.js +278 -0
- package/dist/profiler-WPgSewiM.js.map +1 -0
- package/dist/profiler-j7uDglf5.cjs +2 -0
- package/dist/profiler-j7uDglf5.cjs.map +1 -0
- package/dist/startRecording-Cahc4WH4.cjs +3 -0
- package/dist/startRecording-Cahc4WH4.cjs.map +1 -0
- package/dist/startRecording-DpwlHYPJ.js +1212 -0
- package/dist/startRecording-DpwlHYPJ.js.map +1 -0
- package/dist/types/index.d.ts +45 -15
- package/package.json +16 -2
- package/src/components/Chat/index.tsx +31 -3
- package/src/components/Chat/stories/Composer.stories.tsx +0 -7
- package/src/components/Chat/stories/ConnectionConfiguration.stories.tsx +7 -14
- package/src/components/Chat/stories/CustomComponents.stories.tsx +0 -7
- package/src/components/Chat/stories/Density.stories.tsx +0 -7
- package/src/components/Chat/stories/ErrorBoundary.stories.tsx +4 -23
- package/src/components/Chat/stories/FrontendTools.stories.tsx +0 -7
- package/src/components/Chat/stories/Model.stories.tsx +0 -7
- package/src/components/Chat/stories/Plugins.stories.tsx +0 -7
- package/src/components/Chat/stories/Radius.stories.tsx +0 -7
- package/src/components/Chat/stories/ToolApproval.stories.tsx +51 -7
- package/src/components/Chat/stories/Tools.stories.tsx +0 -7
- package/src/components/Chat/stories/Variants.stories.tsx +5 -2
- package/src/components/Chat/stories/Welcome.stories.tsx +0 -8
- package/src/components/assistant-ui/assistant-sidecar.tsx +1 -4
- package/src/components/assistant-ui/attachment.tsx +1 -4
- package/src/components/assistant-ui/error-boundary.tsx +6 -0
- package/src/components/assistant-ui/thread-list.tsx +3 -1
- package/src/components/assistant-ui/thread.tsx +7 -8
- package/src/components/ui/dialog.tsx +10 -1
- package/src/components/ui/popover.tsx +10 -12
- package/src/components/ui/tooltip.tsx +7 -2
- package/src/constants/tailwind.ts +2 -0
- package/src/contexts/ElementsProvider.tsx +13 -1
- package/src/contexts/portal-container-context.ts +4 -0
- package/src/contexts/portal-container.tsx +20 -0
- package/src/global.css +129 -16
- package/src/hooks/useAuth.ts +6 -16
- package/src/hooks/usePortalContainer.ts +16 -0
- package/src/hooks/useSession.ts +1 -3
- package/src/index.ts +5 -0
- package/src/lib/api.test.ts +5 -5
- package/src/lib/auth.ts +4 -4
- package/src/lib/errorTracking.config.ts +16 -0
- package/src/lib/errorTracking.ts +104 -0
- package/src/lib/tools.ts +37 -8
- package/src/types/index.ts +48 -16
- package/src/vite-env.d.ts +3 -0
- package/dist/components/Chat/stories/ColorScheme.stories.d.ts +0 -8
- package/src/components/Chat/stories/ColorScheme.stories.tsx +0 -52
package/bin/cli.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { execSync } from 'node:child_process'
|
|
4
|
-
import { existsSync } from 'node:fs'
|
|
5
|
-
import { resolve } from 'node:path'
|
|
4
|
+
import { existsSync, readFileSync } from 'node:fs'
|
|
5
|
+
import { resolve, dirname } from 'node:path'
|
|
6
|
+
import { fileURLToPath } from 'node:url'
|
|
6
7
|
|
|
7
8
|
// Colors
|
|
8
9
|
const c = {
|
|
@@ -20,15 +21,14 @@ const c = {
|
|
|
20
21
|
white: '\x1b[37m',
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
'
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
'
|
|
30
|
-
|
|
31
|
-
]
|
|
24
|
+
// Read peer dependencies from package.json (excluding @types/* packages)
|
|
25
|
+
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
26
|
+
const packageJson = JSON.parse(
|
|
27
|
+
readFileSync(resolve(__dirname, '../package.json'), 'utf-8')
|
|
28
|
+
)
|
|
29
|
+
const PEER_DEPS = Object.keys(packageJson.peerDependencies || {}).filter(
|
|
30
|
+
(dep) => !dep.startsWith('@types/')
|
|
31
|
+
)
|
|
32
32
|
|
|
33
33
|
const PACKAGE_NAME = '@gram-ai/elements'
|
|
34
34
|
|
|
@@ -110,7 +110,9 @@ ${c.dim}Package manager:${c.reset} ${c.cyan}${pm}${c.reset}
|
|
|
110
110
|
`)
|
|
111
111
|
|
|
112
112
|
// Install everything in one command
|
|
113
|
-
console.log(
|
|
113
|
+
console.log(
|
|
114
|
+
`${c.yellow}○${c.reset} Installing ${c.cyan}@gram-ai/elements${c.reset} and peer dependencies...`
|
|
115
|
+
)
|
|
114
116
|
const allPackages = [...PEER_DEPS, PACKAGE_NAME]
|
|
115
117
|
const cmd = getInstallCommand(pm, allPackages)
|
|
116
118
|
if (!run(cmd)) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Chat } from '..';
|
|
2
1
|
import { Meta, StoryFn } from '@storybook/react-vite';
|
|
2
|
+
import { Chat } from '..';
|
|
3
3
|
declare const meta: Meta<typeof Chat>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryFn<typeof Chat>;
|
|
6
6
|
export declare const SystemPrompt: Story;
|
|
7
7
|
export declare const WithImplicitSessionAuth: Story;
|
|
8
8
|
export declare const WithExplicitSessionAuth: Story;
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const WithStaticSessionAuth: Story;
|
|
10
10
|
export declare const LanguageModel: Story;
|
|
@@ -4,5 +4,7 @@ declare const meta: Meta<typeof Chat>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryFn<typeof Chat>;
|
|
6
6
|
export declare const SingleTool: Story;
|
|
7
|
+
export declare const SingleToolWithFunction: Story;
|
|
7
8
|
export declare const MultipleGroupedTools: Story;
|
|
8
9
|
export declare const FrontendTool: Story;
|
|
10
|
+
export declare const FrontendToolWithFunction: Story;
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
3
3
|
declare function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
declare function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function DialogPortal({ container, ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
declare function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
declare function DialogContent({ className, children, showCloseButton, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
@@ -3,5 +3,7 @@ import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
|
3
3
|
declare function TooltipProvider({ delayDuration, ...props }: React.ComponentProps<typeof TooltipPrimitive.Provider>): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
declare function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
declare function TooltipContent({ className, sideOffset, children, ...props }: React.ComponentProps<typeof TooltipPrimitive.Content>
|
|
6
|
+
declare function TooltipContent({ className, sideOffset, children, container, ...props }: React.ComponentProps<typeof TooltipPrimitive.Content> & {
|
|
7
|
+
container?: HTMLElement | null;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
7
9
|
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ROOT_SELECTOR = "gram-elements";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { PortalContainerContext } from './portal-container-context';
|
|
3
|
+
export { PortalContainerContext };
|
|
4
|
+
export declare function PortalContainerProvider({ containerRef, children, }: {
|
|
5
|
+
containerRef: RefObject<HTMLElement | null>;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|