@tangle-network/sandbox-ui 0.3.7 → 0.3.11
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/active-sessions-store-CeOmXgv5.d.ts +85 -0
- package/dist/artifact-pane-Bh45Ssco.d.ts +24 -0
- package/dist/{chat-container-B34uj-J1.d.ts → chat-container-Dn1jWtWo.d.ts} +15 -3
- package/dist/chat.d.ts +16 -4
- package/dist/chat.js +2 -2
- package/dist/{chunk-PXRPYAMM.js → chunk-6H3EFUUC.js} +96 -74
- package/dist/{chunk-JF6E2DS5.js → chunk-6NYG2R7V.js} +171 -155
- package/dist/{chunk-WUR652Y3.js → chunk-72UEKFZ2.js} +113 -89
- package/dist/chunk-BOBXH6CH.js +10981 -0
- package/dist/{chunk-ZSNOGOUX.js → chunk-CREVWUCA.js} +541 -76
- package/dist/{chunk-5LV6DZZF.js → chunk-FOQTE67I.js} +278 -21
- package/dist/chunk-OEX7NZE3.js +321 -0
- package/dist/chunk-Q56BYXQF.js +61 -0
- package/dist/{chunk-PDV7W4NY.js → chunk-SULQQJPB.js} +1 -56
- package/dist/chunk-W4LM3QYZ.js +54 -0
- package/dist/document-editor-pane-AFBP2KFT.js +11 -0
- package/dist/document-editor-pane-Xnl8SmA7.d.ts +124 -0
- package/dist/editor.d.ts +7 -84
- package/dist/editor.js +18 -699
- package/dist/{expanded-tool-detail-BDi_h_dZ.d.ts → expanded-tool-detail-DM5M_T9h.d.ts} +10 -2
- package/dist/{file-tabs-CmaoDVBI.d.ts → file-tabs-BLfxfmAH.d.ts} +1 -22
- package/dist/files.d.ts +25 -3
- package/dist/files.js +2 -1
- package/dist/hooks.d.ts +3 -1
- package/dist/hooks.js +6 -1
- package/dist/index.d.ts +12 -6
- package/dist/index.js +21 -8
- package/dist/pages.js +4 -2
- package/dist/primitives.js +4 -2
- package/dist/run.d.ts +1 -1
- package/dist/run.js +1 -1
- package/dist/sdk-hooks.d.ts +32 -1
- package/dist/sdk-hooks.js +6 -1
- package/dist/stores.d.ts +1 -0
- package/dist/stores.js +60 -1
- package/dist/types.d.ts +2 -0
- package/dist/workspace.d.ts +84 -6
- package/dist/workspace.js +10 -4
- package/package.json +17 -6
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-RQHJBTEU.js";
|
|
4
|
+
|
|
5
|
+
// src/primitives/tabs.tsx
|
|
6
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
var Tabs = TabsPrimitive.Root;
|
|
10
|
+
var TabsList = React.forwardRef(({ className, variant = "default", ...props }, ref) => {
|
|
11
|
+
const variants = {
|
|
12
|
+
default: "inline-flex h-10 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
|
|
13
|
+
pills: "inline-flex items-center gap-2",
|
|
14
|
+
underline: "inline-flex items-center gap-4 border-b border-border"
|
|
15
|
+
};
|
|
16
|
+
return /* @__PURE__ */ jsx(
|
|
17
|
+
TabsPrimitive.List,
|
|
18
|
+
{
|
|
19
|
+
ref,
|
|
20
|
+
className: cn(variants[variant], className),
|
|
21
|
+
...props
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
26
|
+
var TabsTrigger = React.forwardRef(({ className, variant = "default", ...props }, ref) => {
|
|
27
|
+
const variants = {
|
|
28
|
+
default: "inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
|
|
29
|
+
pills: "inline-flex items-center justify-center whitespace-nowrap rounded-full px-4 py-2 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-primary data-[state=active]:text-primary-foreground data-[state=inactive]:text-muted-foreground data-[state=inactive]:hover:bg-muted",
|
|
30
|
+
underline: "inline-flex items-center justify-center whitespace-nowrap pb-3 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:text-foreground data-[state=inactive]:text-muted-foreground"
|
|
31
|
+
};
|
|
32
|
+
return /* @__PURE__ */ jsx(
|
|
33
|
+
TabsPrimitive.Trigger,
|
|
34
|
+
{
|
|
35
|
+
ref,
|
|
36
|
+
className: cn(variants[variant], className),
|
|
37
|
+
...props
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
});
|
|
41
|
+
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
42
|
+
var TabsContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
43
|
+
TabsPrimitive.Content,
|
|
44
|
+
{
|
|
45
|
+
ref,
|
|
46
|
+
className: cn(
|
|
47
|
+
"mt-4 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
48
|
+
"data-[state=active]:fade-in-0 data-[state=active]:slide-in-from-bottom-2 data-[state=active]:animate-in",
|
|
49
|
+
className
|
|
50
|
+
),
|
|
51
|
+
...props
|
|
52
|
+
}
|
|
53
|
+
));
|
|
54
|
+
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
55
|
+
|
|
56
|
+
export {
|
|
57
|
+
Tabs,
|
|
58
|
+
TabsList,
|
|
59
|
+
TabsTrigger,
|
|
60
|
+
TabsContent
|
|
61
|
+
};
|
|
@@ -110,57 +110,6 @@ var DialogDescription = React.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
110
110
|
));
|
|
111
111
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
112
112
|
|
|
113
|
-
// src/primitives/tabs.tsx
|
|
114
|
-
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
115
|
-
import * as React2 from "react";
|
|
116
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
117
|
-
var Tabs = TabsPrimitive.Root;
|
|
118
|
-
var TabsList = React2.forwardRef(({ className, variant = "default", ...props }, ref) => {
|
|
119
|
-
const variants = {
|
|
120
|
-
default: "inline-flex h-10 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
|
|
121
|
-
pills: "inline-flex items-center gap-2",
|
|
122
|
-
underline: "inline-flex items-center gap-4 border-b border-border"
|
|
123
|
-
};
|
|
124
|
-
return /* @__PURE__ */ jsx2(
|
|
125
|
-
TabsPrimitive.List,
|
|
126
|
-
{
|
|
127
|
-
ref,
|
|
128
|
-
className: cn(variants[variant], className),
|
|
129
|
-
...props
|
|
130
|
-
}
|
|
131
|
-
);
|
|
132
|
-
});
|
|
133
|
-
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
134
|
-
var TabsTrigger = React2.forwardRef(({ className, variant = "default", ...props }, ref) => {
|
|
135
|
-
const variants = {
|
|
136
|
-
default: "inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
|
|
137
|
-
pills: "inline-flex items-center justify-center whitespace-nowrap rounded-full px-4 py-2 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-primary data-[state=active]:text-primary-foreground data-[state=inactive]:text-muted-foreground data-[state=inactive]:hover:bg-muted",
|
|
138
|
-
underline: "inline-flex items-center justify-center whitespace-nowrap pb-3 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:text-foreground data-[state=inactive]:text-muted-foreground"
|
|
139
|
-
};
|
|
140
|
-
return /* @__PURE__ */ jsx2(
|
|
141
|
-
TabsPrimitive.Trigger,
|
|
142
|
-
{
|
|
143
|
-
ref,
|
|
144
|
-
className: cn(variants[variant], className),
|
|
145
|
-
...props
|
|
146
|
-
}
|
|
147
|
-
);
|
|
148
|
-
});
|
|
149
|
-
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
150
|
-
var TabsContent = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
|
|
151
|
-
TabsPrimitive.Content,
|
|
152
|
-
{
|
|
153
|
-
ref,
|
|
154
|
-
className: cn(
|
|
155
|
-
"mt-4 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
156
|
-
"data-[state=active]:fade-in-0 data-[state=active]:slide-in-from-bottom-2 data-[state=active]:animate-in",
|
|
157
|
-
className
|
|
158
|
-
),
|
|
159
|
-
...props
|
|
160
|
-
}
|
|
161
|
-
));
|
|
162
|
-
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
163
|
-
|
|
164
113
|
export {
|
|
165
114
|
Dialog,
|
|
166
115
|
DialogTrigger,
|
|
@@ -171,9 +120,5 @@ export {
|
|
|
171
120
|
DialogHeader,
|
|
172
121
|
DialogFooter,
|
|
173
122
|
DialogTitle,
|
|
174
|
-
DialogDescription
|
|
175
|
-
Tabs,
|
|
176
|
-
TabsList,
|
|
177
|
-
TabsTrigger,
|
|
178
|
-
TabsContent
|
|
123
|
+
DialogDescription
|
|
179
124
|
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-RQHJBTEU.js";
|
|
4
|
+
|
|
5
|
+
// src/workspace/artifact-pane.tsx
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
function ArtifactPane({
|
|
8
|
+
eyebrow,
|
|
9
|
+
title,
|
|
10
|
+
subtitle,
|
|
11
|
+
meta,
|
|
12
|
+
headerActions,
|
|
13
|
+
tabs,
|
|
14
|
+
toolbar,
|
|
15
|
+
footer,
|
|
16
|
+
emptyState,
|
|
17
|
+
children,
|
|
18
|
+
className,
|
|
19
|
+
contentClassName
|
|
20
|
+
}) {
|
|
21
|
+
const hasContent = children !== void 0 && children !== null;
|
|
22
|
+
return /* @__PURE__ */ jsxs(
|
|
23
|
+
"section",
|
|
24
|
+
{
|
|
25
|
+
className: cn(
|
|
26
|
+
"flex h-full min-h-0 flex-col overflow-hidden rounded-[var(--radius-xl)] bg-[linear-gradient(180deg,rgba(255,255,255,0.02),transparent_18%),var(--bg-dark)] text-[var(--text-primary)]",
|
|
27
|
+
className
|
|
28
|
+
),
|
|
29
|
+
children: [
|
|
30
|
+
/* @__PURE__ */ jsxs("header", { className: "border-b border-[var(--border-subtle)] bg-[radial-gradient(circle_at_top_left,rgba(98,114,243,0.12),transparent_34%),linear-gradient(180deg,rgba(255,255,255,0.04),transparent)]", children: [
|
|
31
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3 px-4 py-3", children: [
|
|
32
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
33
|
+
eyebrow && /* @__PURE__ */ jsx("div", { className: "mb-1 inline-flex max-w-full items-center rounded-full border border-[var(--border-accent)] bg-[var(--brand-cool)]/10 px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--brand-cool)]", children: eyebrow }),
|
|
34
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-0 text-[15px] font-semibold text-[var(--text-primary)]", children: title }),
|
|
35
|
+
(subtitle || meta) && /* @__PURE__ */ jsxs("div", { className: "mt-1 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs leading-relaxed text-[var(--text-muted)]", children: [
|
|
36
|
+
subtitle && /* @__PURE__ */ jsx("span", { className: "truncate", children: subtitle }),
|
|
37
|
+
meta && /* @__PURE__ */ jsx("span", { className: "flex items-center gap-2", children: meta })
|
|
38
|
+
] })
|
|
39
|
+
] }),
|
|
40
|
+
headerActions && /* @__PURE__ */ jsx("div", { className: "flex shrink-0 items-center gap-1.5", children: headerActions })
|
|
41
|
+
] }),
|
|
42
|
+
tabs,
|
|
43
|
+
toolbar && /* @__PURE__ */ jsx("div", { className: "border-t border-[var(--border-subtle)] px-3 py-2", children: toolbar })
|
|
44
|
+
] }),
|
|
45
|
+
/* @__PURE__ */ jsx("div", { className: cn("min-h-0 flex-1 overflow-auto", contentClassName), children: hasContent ? children : emptyState ? /* @__PURE__ */ jsx("div", { className: "flex h-full items-center justify-center p-6", children: emptyState }) : null }),
|
|
46
|
+
footer && /* @__PURE__ */ jsx("footer", { className: "shrink-0 border-t border-[var(--border-subtle)] bg-[var(--bg-card)] px-3 py-2", children: footer })
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export {
|
|
53
|
+
ArtifactPane
|
|
54
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { A as ArtifactPaneProps } from './artifact-pane-Bh45Ssco.js';
|
|
4
|
+
import { HocuspocusProvider } from '@hocuspocus/provider';
|
|
5
|
+
import * as Y from 'yjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Connection state for the Hocuspocus provider.
|
|
9
|
+
*/
|
|
10
|
+
type ConnectionState = "disconnected" | "connecting" | "connected" | "synced";
|
|
11
|
+
/**
|
|
12
|
+
* Collaborator information from awareness.
|
|
13
|
+
*/
|
|
14
|
+
interface Collaborator {
|
|
15
|
+
clientId: number;
|
|
16
|
+
user: {
|
|
17
|
+
name: string;
|
|
18
|
+
color: string;
|
|
19
|
+
userId?: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Editor context value exposed to children.
|
|
24
|
+
*/
|
|
25
|
+
interface EditorContextValue {
|
|
26
|
+
/** The Y.Doc instance for collaboration */
|
|
27
|
+
doc: Y.Doc;
|
|
28
|
+
/** The Hocuspocus provider instance */
|
|
29
|
+
provider: HocuspocusProvider | null;
|
|
30
|
+
/** Current connection state */
|
|
31
|
+
connectionState: ConnectionState;
|
|
32
|
+
/** List of active collaborators */
|
|
33
|
+
collaborators: Collaborator[];
|
|
34
|
+
/** Whether the document is synced with the server */
|
|
35
|
+
isSynced: boolean;
|
|
36
|
+
/** Connect to the collaboration server */
|
|
37
|
+
connect: () => void;
|
|
38
|
+
/** Disconnect from the collaboration server */
|
|
39
|
+
disconnect: () => void;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* User information for presence/awareness.
|
|
43
|
+
*/
|
|
44
|
+
interface EditorUser {
|
|
45
|
+
name: string;
|
|
46
|
+
color?: string;
|
|
47
|
+
userId?: string;
|
|
48
|
+
}
|
|
49
|
+
interface EditorTokenRefreshResult {
|
|
50
|
+
token: string;
|
|
51
|
+
expiresAt?: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Props for EditorProvider.
|
|
55
|
+
*/
|
|
56
|
+
interface EditorProviderProps {
|
|
57
|
+
/** WebSocket URL for the Hocuspocus server */
|
|
58
|
+
websocketUrl: string;
|
|
59
|
+
/** Document name (e.g., "doc:my-document") */
|
|
60
|
+
documentName: string;
|
|
61
|
+
/** JWT token for authentication */
|
|
62
|
+
token: string;
|
|
63
|
+
/** Unix timestamp (seconds) when the current token expires */
|
|
64
|
+
tokenExpiresAt?: number;
|
|
65
|
+
/** Current user information for awareness */
|
|
66
|
+
user: EditorUser;
|
|
67
|
+
/** Auto-connect on mount (default: true) */
|
|
68
|
+
autoConnect?: boolean;
|
|
69
|
+
/** Reconnect on disconnect (default: true) */
|
|
70
|
+
autoReconnect?: boolean;
|
|
71
|
+
/** Max reconnect attempts (default: 5) */
|
|
72
|
+
maxReconnectAttempts?: number;
|
|
73
|
+
/** Callback when connection state changes */
|
|
74
|
+
onConnectionChange?: (state: ConnectionState) => void;
|
|
75
|
+
/** Callback when sync completes */
|
|
76
|
+
onSync?: () => void;
|
|
77
|
+
/** Callback on authentication error */
|
|
78
|
+
onAuthError?: (error: Error) => void;
|
|
79
|
+
/** Optional token refresh callback used before reconnect/auth retry */
|
|
80
|
+
onRefreshToken?: () => Promise<EditorTokenRefreshResult | string>;
|
|
81
|
+
/** Children components */
|
|
82
|
+
children: ReactNode;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* EditorProvider wraps children with Hocuspocus collaboration context.
|
|
86
|
+
* Manages WebSocket connection, Y.Doc, and awareness state.
|
|
87
|
+
*/
|
|
88
|
+
declare function EditorProvider({ websocketUrl, documentName, token, tokenExpiresAt, user, autoConnect, autoReconnect, maxReconnectAttempts, onConnectionChange, onSync, onAuthError, onRefreshToken, children, }: EditorProviderProps): react_jsx_runtime.JSX.Element;
|
|
89
|
+
/**
|
|
90
|
+
* Hook to access the editor context.
|
|
91
|
+
* Must be used within an EditorProvider.
|
|
92
|
+
*/
|
|
93
|
+
declare function useEditorContext(): EditorContextValue;
|
|
94
|
+
|
|
95
|
+
type DocumentEditorMode = "preview" | "edit";
|
|
96
|
+
type DocumentEditorBackend = "local" | "collaborative";
|
|
97
|
+
interface DocumentEditorPaneCollaborationConfig extends Omit<EditorProviderProps, "children"> {
|
|
98
|
+
}
|
|
99
|
+
interface DocumentEditorPaneProps extends Omit<ArtifactPaneProps, "children" | "tabs" | "toolbar" | "emptyState"> {
|
|
100
|
+
tabs?: ArtifactPaneProps["tabs"];
|
|
101
|
+
toolbar?: ReactNode;
|
|
102
|
+
markdown?: string;
|
|
103
|
+
mode?: DocumentEditorMode;
|
|
104
|
+
defaultMode?: DocumentEditorMode;
|
|
105
|
+
onModeChange?: (mode: DocumentEditorMode) => void;
|
|
106
|
+
backend?: DocumentEditorBackend;
|
|
107
|
+
placeholder?: string;
|
|
108
|
+
autoFocus?: boolean;
|
|
109
|
+
readOnly?: boolean;
|
|
110
|
+
onChange?: (markdown: string) => void;
|
|
111
|
+
onSave?: (markdown: string) => Promise<void> | void;
|
|
112
|
+
saving?: boolean;
|
|
113
|
+
saveLabel?: string;
|
|
114
|
+
previewClassName?: string;
|
|
115
|
+
editorClassName?: string;
|
|
116
|
+
collaboration?: DocumentEditorPaneCollaborationConfig;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* DocumentEditorPane — reusable markdown document surface with preview/edit
|
|
120
|
+
* modes and optional collaborative editing backed by Yjs/Hocuspocus.
|
|
121
|
+
*/
|
|
122
|
+
declare function DocumentEditorPane({ eyebrow, title, subtitle, meta, headerActions, footer, className, contentClassName, tabs, toolbar, markdown, mode, defaultMode, onModeChange, backend, placeholder, autoFocus, readOnly, onChange, onSave, saving, saveLabel, previewClassName, editorClassName, collaboration, }: DocumentEditorPaneProps): react_jsx_runtime.JSX.Element;
|
|
123
|
+
|
|
124
|
+
export { type Collaborator as C, type DocumentEditorBackend as D, type EditorContextValue as E, type ConnectionState as a, type DocumentEditorMode as b, DocumentEditorPane as c, type DocumentEditorPaneCollaborationConfig as d, type DocumentEditorPaneProps as e, EditorProvider as f, type EditorProviderProps as g, type EditorTokenRefreshResult as h, type EditorUser as i, useEditorContext as u };
|
package/dist/editor.d.ts
CHANGED
|
@@ -1,88 +1,11 @@
|
|
|
1
|
+
import { C as Collaborator, a as ConnectionState } from './document-editor-pane-Xnl8SmA7.js';
|
|
2
|
+
export { D as DocumentEditorBackend, b as DocumentEditorMode, c as DocumentEditorPane, d as DocumentEditorPaneCollaborationConfig, e as DocumentEditorPaneProps, E as EditorContextValue, f as EditorProvider, g as EditorProviderProps, h as EditorTokenRefreshResult, i as EditorUser, u as useEditorContext } from './document-editor-pane-Xnl8SmA7.js';
|
|
1
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { HocuspocusProvider } from '@hocuspocus/provider';
|
|
3
|
-
import { ReactNode } from 'react';
|
|
4
|
-
import * as Y from 'yjs';
|
|
5
4
|
import { Editor } from '@tiptap/react';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
type ConnectionState = "disconnected" | "connecting" | "connected" | "synced";
|
|
11
|
-
/**
|
|
12
|
-
* Collaborator information from awareness.
|
|
13
|
-
*/
|
|
14
|
-
interface Collaborator {
|
|
15
|
-
clientId: number;
|
|
16
|
-
user: {
|
|
17
|
-
name: string;
|
|
18
|
-
color: string;
|
|
19
|
-
userId?: string;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Editor context value exposed to children.
|
|
24
|
-
*/
|
|
25
|
-
interface EditorContextValue {
|
|
26
|
-
/** The Y.Doc instance for collaboration */
|
|
27
|
-
doc: Y.Doc;
|
|
28
|
-
/** The Hocuspocus provider instance */
|
|
29
|
-
provider: HocuspocusProvider | null;
|
|
30
|
-
/** Current connection state */
|
|
31
|
-
connectionState: ConnectionState;
|
|
32
|
-
/** List of active collaborators */
|
|
33
|
-
collaborators: Collaborator[];
|
|
34
|
-
/** Whether the document is synced with the server */
|
|
35
|
-
isSynced: boolean;
|
|
36
|
-
/** Connect to the collaboration server */
|
|
37
|
-
connect: () => void;
|
|
38
|
-
/** Disconnect from the collaboration server */
|
|
39
|
-
disconnect: () => void;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* User information for presence/awareness.
|
|
43
|
-
*/
|
|
44
|
-
interface EditorUser {
|
|
45
|
-
name: string;
|
|
46
|
-
color?: string;
|
|
47
|
-
userId?: string;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Props for EditorProvider.
|
|
51
|
-
*/
|
|
52
|
-
interface EditorProviderProps {
|
|
53
|
-
/** WebSocket URL for the Hocuspocus server */
|
|
54
|
-
websocketUrl: string;
|
|
55
|
-
/** Document name (e.g., "doc:my-document") */
|
|
56
|
-
documentName: string;
|
|
57
|
-
/** JWT token for authentication */
|
|
58
|
-
token: string;
|
|
59
|
-
/** Current user information for awareness */
|
|
60
|
-
user: EditorUser;
|
|
61
|
-
/** Auto-connect on mount (default: true) */
|
|
62
|
-
autoConnect?: boolean;
|
|
63
|
-
/** Reconnect on disconnect (default: true) */
|
|
64
|
-
autoReconnect?: boolean;
|
|
65
|
-
/** Max reconnect attempts (default: 5) */
|
|
66
|
-
maxReconnectAttempts?: number;
|
|
67
|
-
/** Callback when connection state changes */
|
|
68
|
-
onConnectionChange?: (state: ConnectionState) => void;
|
|
69
|
-
/** Callback when sync completes */
|
|
70
|
-
onSync?: () => void;
|
|
71
|
-
/** Callback on authentication error */
|
|
72
|
-
onAuthError?: (error: Error) => void;
|
|
73
|
-
/** Children components */
|
|
74
|
-
children: ReactNode;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* EditorProvider wraps children with Hocuspocus collaboration context.
|
|
78
|
-
* Manages WebSocket connection, Y.Doc, and awareness state.
|
|
79
|
-
*/
|
|
80
|
-
declare function EditorProvider({ websocketUrl, documentName, token, user, autoConnect, autoReconnect, maxReconnectAttempts, onConnectionChange, onSync, onAuthError, children, }: EditorProviderProps): react_jsx_runtime.JSX.Element;
|
|
81
|
-
/**
|
|
82
|
-
* Hook to access the editor context.
|
|
83
|
-
* Must be used within an EditorProvider.
|
|
84
|
-
*/
|
|
85
|
-
declare function useEditorContext(): EditorContextValue;
|
|
5
|
+
import { HocuspocusProvider } from '@hocuspocus/provider';
|
|
6
|
+
import 'react';
|
|
7
|
+
import './artifact-pane-Bh45Ssco.js';
|
|
8
|
+
import 'yjs';
|
|
86
9
|
|
|
87
10
|
/**
|
|
88
11
|
* Props for TiptapEditor component.
|
|
@@ -193,4 +116,4 @@ declare function useAwareness(): {
|
|
|
193
116
|
awareness: HocuspocusProvider["awareness"] | undefined;
|
|
194
117
|
};
|
|
195
118
|
|
|
196
|
-
export {
|
|
119
|
+
export { Collaborator, CollaboratorsList, ConnectionState, EditorToolbar, TiptapEditor, type TiptapEditorProps, useAwareness, useCollaboratorPresence, useCollaborators, useDocumentChanges, useEditorConnection, useYjsState };
|