@tangle-network/ui 11.10.0 → 11.11.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/CHANGELOG.md +14 -0
- package/README.md +4 -1
- package/dist/active-sessions-store-Gt1R0rFG.js +262 -0
- package/dist/{active-sessions-store-CeOmXgv5.d.ts → active-sessions-store-nl70ZnMC.d.ts} +40 -41
- package/dist/artifact-pane-BL_DFWNl.d.ts +32 -0
- package/dist/artifact-pane-DMXT9a8U.js +70 -0
- package/dist/auth-DOETfnd9.js +154 -0
- package/dist/auth.d.ts +2 -74
- package/dist/auth.js +2 -16
- package/dist/branding-26d5ARIr.d.ts +14 -0
- package/dist/button-C87nEe2R.js +78 -0
- package/dist/button-yoIv77e2.d.ts +16 -0
- package/dist/chat-D4jAfEmj.js +667 -0
- package/dist/chat.d.ts +2 -201
- package/dist/chat.js +2 -31
- package/dist/code-block-B36KVUSN.js +165 -0
- package/dist/code-block-B9miUPht.d.ts +23 -0
- package/dist/diff-preview-BcK3nRXb.js +533 -0
- package/dist/document-editor-pane-BcoABlhn.d.ts +131 -0
- package/dist/document-editor-pane-BxlPjaTP.js +1287 -0
- package/dist/dropdown-menu-BpcLa5vF.js +101 -0
- package/dist/editor.d.ts +76 -78
- package/dist/editor.js +2 -34
- package/dist/file-format-BgXbr-Ib.js +160 -0
- package/dist/files-Bug33qCl.js +743 -0
- package/dist/files.d.ts +2 -243
- package/dist/files.js +3 -41
- package/dist/focus-BcE_SHqz.js +57 -0
- package/dist/format-DfcLWqMa.js +54 -0
- package/dist/hooks.d.ts +30 -37
- package/dist/hooks.js +111 -46
- package/dist/index-2UntyjBb.d.ts +52 -0
- package/dist/index-BgUHilZm.d.ts +108 -0
- package/dist/index-COgqsFAQ.d.ts +42 -0
- package/dist/index-CPDET_s1.d.ts +549 -0
- package/dist/index-CUhfHT_V.d.ts +204 -0
- package/dist/index-Cg6gYAqh.d.ts +73 -0
- package/dist/index-Cq-EJzqW.d.ts +16 -0
- package/dist/index-DhYmSaLF.d.ts +245 -0
- package/dist/index-DjKxO357.d.ts +128 -0
- package/dist/index.d.ts +26 -43
- package/dist/index.js +35 -472
- package/dist/markdown-BGqicV82.js +45 -0
- package/dist/markdown.d.ts +3 -18
- package/dist/markdown.js +3 -15
- package/dist/message-vhUI0c5G.d.ts +16 -0
- package/dist/nav.d.ts +6 -8
- package/dist/nav.js +29 -11
- package/dist/openui-artifact-renderer-D3E5bIAI.d.ts +114 -0
- package/dist/openui-artifact-renderer-DrU1AdVk.js +266 -0
- package/dist/openui.d.ts +2 -115
- package/dist/openui.js +2 -13
- package/dist/parts-5mhy9yJ3.d.ts +37 -0
- package/dist/primitives-Cb8GGVKr.js +1239 -0
- package/dist/primitives.d.ts +5 -525
- package/dist/primitives.js +9 -212
- package/dist/redaction-CGGB2ENG.js +74 -0
- package/dist/redaction.d.ts +2 -42
- package/dist/redaction.js +2 -7
- package/dist/run-OyWmIDqu.d.ts +41 -0
- package/dist/run-ZsIKPA6J.js +17 -0
- package/dist/run-group-BACLbCFl.js +410 -0
- package/dist/run.d.ts +3 -126
- package/dist/run.js +5 -40
- package/dist/sdk-hooks.d.ts +2 -285
- package/dist/sdk-hooks.js +3 -36
- package/dist/stores.d.ts +13 -14
- package/dist/stores.js +34 -76
- package/dist/table-Bss73DhB.js +146 -0
- package/dist/tabs-BVHR6NkO.js +40 -0
- package/dist/text-shimmer-BUUo6I-g.js +64 -0
- package/dist/tool-call-feed-BeB1_4pX.d.ts +47 -0
- package/dist/tool-call-feed-Djt2q11V.js +109 -0
- package/dist/tool-call-step-DNebqhmX.js +434 -0
- package/dist/tool-display-BAuAVa43.js +158 -0
- package/dist/{tool-display-z4JcDmMQ.d.ts → tool-display-DgmL5rIU.d.ts} +16 -16
- package/dist/tool-previews.d.ts +2 -48
- package/dist/tool-previews.js +2 -23
- package/dist/types.d.ts +6 -19
- package/dist/types.js +0 -1
- package/dist/use-auto-scroll-C5Pjeqon.js +153 -0
- package/dist/use-sse-stream-BVgO1QBN.js +884 -0
- package/dist/use-sse-stream-Dm6R5YWz.d.ts +282 -0
- package/dist/utils-Bl_CZ0Qp.js +37 -0
- package/dist/{chunk-RQHJBTEU.js → utils-C_uf36nf.js} +4 -6
- package/dist/utils.d.ts +2 -104
- package/dist/utils.js +6 -44
- package/package.json +39 -41
- package/src/lib/focus.ts +2 -1
- package/dist/artifact-pane-DpuWcAiF.d.ts +0 -33
- package/dist/button-CMQuQEW_.d.ts +0 -17
- package/dist/chunk-34A66VBG.js +0 -214
- package/dist/chunk-3OI2QKFD.js +0 -0
- package/dist/chunk-3XXBZL53.js +0 -174
- package/dist/chunk-42PAH5D2.js +0 -112
- package/dist/chunk-4CLN43XT.js +0 -45
- package/dist/chunk-55WHV7SS.js +0 -1604
- package/dist/chunk-565EATZZ.js +0 -156
- package/dist/chunk-5Z5ZYMOJ.js +0 -0
- package/dist/chunk-6BGQA4BQ.js +0 -0
- package/dist/chunk-BEBXZPHW.js +0 -299
- package/dist/chunk-C5WF4WMV.js +0 -734
- package/dist/chunk-HFL6R6IF.js +0 -37
- package/dist/chunk-HGML45QH.js +0 -104
- package/dist/chunk-HMAPIH7L.js +0 -595
- package/dist/chunk-K5XFRUS4.js +0 -1401
- package/dist/chunk-KFQGHD73.js +0 -198
- package/dist/chunk-L57WRIND.js +0 -59
- package/dist/chunk-LTEKI7YJ.js +0 -59
- package/dist/chunk-M3QZK62R.js +0 -233
- package/dist/chunk-ND3ZFXQK.js +0 -179
- package/dist/chunk-OEX7NZE3.js +0 -321
- package/dist/chunk-OL5GYLHV.js +0 -60
- package/dist/chunk-QGFYBNSO.js +0 -133
- package/dist/chunk-R7B3UWPF.js +0 -550
- package/dist/chunk-R7SUY4E3.js +0 -65
- package/dist/chunk-REJESC5U.js +0 -117
- package/dist/chunk-RQGKSCEZ.js +0 -0
- package/dist/chunk-SNLR2AEA.js +0 -40
- package/dist/chunk-WKWBTL2V.js +0 -15
- package/dist/chunk-X7CU776B.js +0 -1048
- package/dist/chunk-XU3HB5QL.js +0 -127
- package/dist/chunk-YTO5V6QS.js +0 -19
- package/dist/chunk-YU4E5J2N.js +0 -437
- package/dist/chunk-YZ6AK25N.js +0 -886
- package/dist/code-block-0kSpWMnf.d.ts +0 -25
- package/dist/document-editor-pane-IAEQn_Dl.d.ts +0 -128
- package/dist/document-editor-pane-QHDOBA43.js +0 -13
- package/dist/message-BHWbxBtT.d.ts +0 -15
- package/dist/parts-dj7AcUg0.d.ts +0 -36
- package/dist/run-PfLmDAox.d.ts +0 -41
- package/dist/tool-call-feed-D9iofJgW.d.ts +0 -46
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { t as cn } from "./utils-C_uf36nf.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Check, ChevronRight, Circle } from "lucide-react";
|
|
5
|
+
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
6
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
7
|
+
//#region src/primitives/avatar.tsx
|
|
8
|
+
const Avatar = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(AvatarPrimitive.Root, {
|
|
9
|
+
ref,
|
|
10
|
+
className: cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full", className),
|
|
11
|
+
...props
|
|
12
|
+
}));
|
|
13
|
+
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
14
|
+
const AvatarImage = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(AvatarPrimitive.Image, {
|
|
15
|
+
ref,
|
|
16
|
+
className: cn("aspect-square h-full w-full", className),
|
|
17
|
+
...props
|
|
18
|
+
}));
|
|
19
|
+
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
20
|
+
const AvatarFallback = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(AvatarPrimitive.Fallback, {
|
|
21
|
+
ref,
|
|
22
|
+
className: cn("flex h-full w-full items-center justify-center rounded-full bg-muted font-medium text-sm", className),
|
|
23
|
+
...props
|
|
24
|
+
}));
|
|
25
|
+
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/primitives/dropdown-menu.tsx
|
|
28
|
+
const DropdownMenu = DropdownMenuPrimitive.Root;
|
|
29
|
+
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
30
|
+
const DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
31
|
+
const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
32
|
+
const DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
33
|
+
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
34
|
+
const DropdownMenuSubTrigger = React.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs(DropdownMenuPrimitive.SubTrigger, {
|
|
35
|
+
ref,
|
|
36
|
+
className: cn("flex cursor-default select-none items-center rounded-md px-2 py-1.5 text-sm outline-none", "focus:bg-accent data-[state=open]:bg-muted/50", inset && "pl-8", className),
|
|
37
|
+
...props,
|
|
38
|
+
children: [children, /* @__PURE__ */ jsx(ChevronRight, { className: "ml-auto h-4 w-4" })]
|
|
39
|
+
}));
|
|
40
|
+
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
41
|
+
const DropdownMenuSubContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.SubContent, {
|
|
42
|
+
ref,
|
|
43
|
+
className: cn("z-50 min-w-[8rem] overflow-hidden rounded-xl border border-border bg-card p-1 text-foreground shadow-[var(--shadow-card)]", "data-[state=closed]:animate-out data-[state=open]:animate-in", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95", "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2", "data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className),
|
|
44
|
+
...props
|
|
45
|
+
}));
|
|
46
|
+
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
47
|
+
const DropdownMenuContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.Content, {
|
|
48
|
+
ref,
|
|
49
|
+
sideOffset,
|
|
50
|
+
className: cn("z-50 min-w-[8rem] overflow-hidden rounded-xl border border-border bg-card p-1 text-foreground shadow-[var(--shadow-card)]", "data-[state=closed]:animate-out data-[state=open]:animate-in", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95", "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2", "data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className),
|
|
51
|
+
...props
|
|
52
|
+
}) }));
|
|
53
|
+
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
54
|
+
const DropdownMenuItem = React.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Item, {
|
|
55
|
+
ref,
|
|
56
|
+
className: cn("relative flex cursor-pointer select-none items-center rounded-md px-2 py-1.5 text-sm outline-none transition-colors", "focus:bg-muted/50 focus:text-foreground", "data-[disabled]:pointer-events-none data-[disabled]:opacity-50", inset && "pl-8", className),
|
|
57
|
+
...props
|
|
58
|
+
}));
|
|
59
|
+
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
60
|
+
const DropdownMenuCheckboxItem = React.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs(DropdownMenuPrimitive.CheckboxItem, {
|
|
61
|
+
ref,
|
|
62
|
+
className: cn("relative flex cursor-pointer select-none items-center rounded-md py-1.5 pr-2 pl-8 text-sm outline-none transition-colors", "focus:bg-muted/50 focus:text-foreground", "data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className),
|
|
63
|
+
checked,
|
|
64
|
+
...props,
|
|
65
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
66
|
+
className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center",
|
|
67
|
+
children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) })
|
|
68
|
+
}), children]
|
|
69
|
+
}));
|
|
70
|
+
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
71
|
+
const DropdownMenuRadioItem = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DropdownMenuPrimitive.RadioItem, {
|
|
72
|
+
ref,
|
|
73
|
+
className: cn("relative flex cursor-pointer select-none items-center rounded-md py-1.5 pr-2 pl-8 text-sm outline-none transition-colors", "focus:bg-muted/50 focus:text-foreground", "data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className),
|
|
74
|
+
...props,
|
|
75
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
76
|
+
className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center",
|
|
77
|
+
children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Circle, { className: "h-2 w-2 fill-current" }) })
|
|
78
|
+
}), children]
|
|
79
|
+
}));
|
|
80
|
+
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
81
|
+
const DropdownMenuLabel = React.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Label, {
|
|
82
|
+
ref,
|
|
83
|
+
className: cn("px-2 py-1.5 font-semibold text-sm", inset && "pl-8", className),
|
|
84
|
+
...props
|
|
85
|
+
}));
|
|
86
|
+
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
87
|
+
const DropdownMenuSeparator = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Separator, {
|
|
88
|
+
ref,
|
|
89
|
+
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
90
|
+
...props
|
|
91
|
+
}));
|
|
92
|
+
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
93
|
+
const DropdownMenuShortcut = ({ className, ...props }) => {
|
|
94
|
+
return /* @__PURE__ */ jsx("span", {
|
|
95
|
+
className: cn("ml-auto text-xs tracking-widest opacity-60", className),
|
|
96
|
+
...props
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
100
|
+
//#endregion
|
|
101
|
+
export { AvatarFallback as _, DropdownMenuItem as a, DropdownMenuRadioGroup as c, DropdownMenuShortcut as d, DropdownMenuSub as f, Avatar as g, DropdownMenuTrigger as h, DropdownMenuGroup as i, DropdownMenuRadioItem as l, DropdownMenuSubTrigger as m, DropdownMenuCheckboxItem as n, DropdownMenuLabel as o, DropdownMenuSubContent as p, DropdownMenuContent as r, DropdownMenuPortal as s, DropdownMenu as t, DropdownMenuSeparator as u, AvatarImage as v };
|
package/dist/editor.d.ts
CHANGED
|
@@ -1,121 +1,119 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import { Editor } from
|
|
5
|
-
|
|
6
|
-
import 'react';
|
|
7
|
-
import './artifact-pane-DpuWcAiF.js';
|
|
8
|
-
import 'yjs';
|
|
9
|
-
|
|
1
|
+
import { a as DocumentEditorPaneProps, c as EditorContextValue, d as EditorTokenRefreshResult, f as EditorUser, i as DocumentEditorPaneCollaborationConfig, l as EditorProvider, n as DocumentEditorMode, o as Collaborator, p as useEditorContext, r as DocumentEditorPane, s as ConnectionState, t as DocumentEditorBackend, u as EditorProviderProps } from "./document-editor-pane-BcoABlhn.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { HocuspocusProvider } from "@hocuspocus/provider";
|
|
4
|
+
import { Editor } from "@tiptap/react";
|
|
5
|
+
//#region src/editor/editor-toolbar.d.ts
|
|
10
6
|
/**
|
|
11
7
|
* Editor toolbar component.
|
|
12
8
|
* Provides basic formatting controls.
|
|
13
9
|
*/
|
|
14
|
-
declare function EditorToolbar({ editor, className
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}):
|
|
18
|
-
|
|
10
|
+
export declare function EditorToolbar({ editor, className }: {
|
|
11
|
+
editor: Editor | null;
|
|
12
|
+
className?: string;
|
|
13
|
+
}): import("react").JSX.Element | null;
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/editor/tiptap-editor.d.ts
|
|
19
16
|
/**
|
|
20
17
|
* Props for TiptapEditor component.
|
|
21
18
|
*/
|
|
22
19
|
interface TiptapEditorProps {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
20
|
+
/** Initial content for new documents (markdown string) */
|
|
21
|
+
initialContent?: string;
|
|
22
|
+
/** Placeholder text when editor is empty */
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
/** Whether the editor is read-only */
|
|
25
|
+
readOnly?: boolean;
|
|
26
|
+
/** Whether to auto-focus on mount */
|
|
27
|
+
autoFocus?: boolean;
|
|
28
|
+
/** Custom className for the editor wrapper */
|
|
29
|
+
className?: string;
|
|
30
|
+
/** Custom className for the editor content area */
|
|
31
|
+
contentClassName?: string;
|
|
32
|
+
/** Callback when content changes */
|
|
33
|
+
onUpdate?: (editor: Editor) => void;
|
|
34
|
+
/** Callback when selection changes */
|
|
35
|
+
onSelectionUpdate?: (editor: Editor) => void;
|
|
36
|
+
/** Callback when editor is ready */
|
|
37
|
+
onReady?: (editor: Editor) => void;
|
|
41
38
|
}
|
|
42
39
|
/**
|
|
43
40
|
* TiptapEditor - Collaborative markdown editor with Y.js sync.
|
|
44
41
|
* Must be used within an EditorProvider. Loads its tiptap, Hocuspocus and
|
|
45
42
|
* yjs peers on first render.
|
|
46
43
|
*/
|
|
47
|
-
declare function TiptapEditor(props: TiptapEditorProps):
|
|
44
|
+
export declare function TiptapEditor(props: TiptapEditorProps): import("react").JSX.Element;
|
|
48
45
|
/**
|
|
49
46
|
* Collaborators list component.
|
|
50
47
|
* Shows active users in the document.
|
|
51
48
|
*/
|
|
52
|
-
declare function CollaboratorsList({ collaborators, className
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}):
|
|
56
|
-
|
|
49
|
+
export declare function CollaboratorsList({ collaborators, className }: {
|
|
50
|
+
collaborators: Collaborator[];
|
|
51
|
+
className?: string;
|
|
52
|
+
}): import("react").JSX.Element | null;
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/editor/use-editor.d.ts
|
|
57
55
|
/**
|
|
58
56
|
* Hook to get the current connection state and helpers.
|
|
59
57
|
*/
|
|
60
|
-
declare function useEditorConnection(): {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
58
|
+
export declare function useEditorConnection(): {
|
|
59
|
+
/** Current connection state string */
|
|
60
|
+
state: ConnectionState;
|
|
61
|
+
/** Whether connected to the server (connected or synced) */
|
|
62
|
+
isConnected: boolean;
|
|
63
|
+
/** Whether currently attempting to connect */
|
|
64
|
+
isConnecting: boolean;
|
|
65
|
+
/** Whether disconnected from the server */
|
|
66
|
+
isDisconnected: boolean;
|
|
67
|
+
/** Whether the document is synced with the server */
|
|
68
|
+
isSynced: boolean;
|
|
69
|
+
/** Connect to the collaboration server */
|
|
70
|
+
connect: () => void;
|
|
71
|
+
/** Disconnect from the collaboration server */
|
|
72
|
+
disconnect: () => void;
|
|
75
73
|
};
|
|
76
74
|
/**
|
|
77
75
|
* Hook to get the list of active collaborators.
|
|
78
76
|
*/
|
|
79
|
-
declare function useCollaborators(): {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
77
|
+
export declare function useCollaborators(): {
|
|
78
|
+
/** List of active collaborators (excluding self) */
|
|
79
|
+
collaborators: Collaborator[];
|
|
80
|
+
/** Number of other collaborators */
|
|
81
|
+
count: number;
|
|
82
|
+
/** Whether there are other collaborators present */
|
|
83
|
+
hasOthers: boolean;
|
|
86
84
|
};
|
|
87
85
|
/**
|
|
88
86
|
* Hook to track a specific collaborator's presence.
|
|
89
87
|
*/
|
|
90
|
-
declare function useCollaboratorPresence(userId: string): Collaborator | null;
|
|
88
|
+
export declare function useCollaboratorPresence(userId: string): Collaborator | null;
|
|
91
89
|
/**
|
|
92
90
|
* Hook to sync local state with the Y.Doc.
|
|
93
91
|
* Useful for persisting editor metadata.
|
|
94
92
|
*/
|
|
95
|
-
declare function useYjsState<T>(key: string, initialValue: T): [T, (value: T) => void];
|
|
93
|
+
export declare function useYjsState<T>(key: string, initialValue: T): [T, (value: T) => void];
|
|
96
94
|
/**
|
|
97
95
|
* Hook to track document changes.
|
|
98
96
|
* Returns true if there are unsaved changes since the last save.
|
|
99
97
|
*/
|
|
100
|
-
declare function useDocumentChanges(onSave?: () => Promise<void>): {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
98
|
+
export declare function useDocumentChanges(onSave?: () => Promise<void>): {
|
|
99
|
+
/** Whether there are unsaved changes */
|
|
100
|
+
isDirty: boolean;
|
|
101
|
+
/** Whether save is in progress */
|
|
102
|
+
isSaving: boolean;
|
|
103
|
+
/** When the document was last saved */
|
|
104
|
+
lastSaved: Date | null;
|
|
105
|
+
/** Save the document */
|
|
106
|
+
save: () => Promise<void>;
|
|
109
107
|
};
|
|
110
108
|
/**
|
|
111
109
|
* Hook to get awareness state for presence features.
|
|
112
110
|
* Provides lower-level access to the Hocuspocus awareness.
|
|
113
111
|
*/
|
|
114
|
-
declare function useAwareness(): {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
112
|
+
export declare function useAwareness(): {
|
|
113
|
+
localState: Record<string, unknown>;
|
|
114
|
+
setLocalState: (state: Record<string, unknown>) => void;
|
|
115
|
+
setLocalStateField: (field: string, value: unknown) => void;
|
|
116
|
+
awareness: HocuspocusProvider["awareness"] | undefined;
|
|
119
117
|
};
|
|
120
|
-
|
|
121
|
-
export { Collaborator,
|
|
118
|
+
//#endregion
|
|
119
|
+
export { type Collaborator, type ConnectionState, type DocumentEditorBackend, type DocumentEditorMode, DocumentEditorPane, type DocumentEditorPaneCollaborationConfig, type DocumentEditorPaneProps, type EditorContextValue, EditorProvider, type EditorProviderProps, type EditorTokenRefreshResult, type EditorUser, type TiptapEditorProps, useEditorContext };
|
package/dist/editor.js
CHANGED
|
@@ -1,34 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
DocumentEditorPane,
|
|
4
|
-
EditorProvider,
|
|
5
|
-
EditorToolbar,
|
|
6
|
-
TiptapEditor,
|
|
7
|
-
useAwareness,
|
|
8
|
-
useCollaboratorPresence,
|
|
9
|
-
useCollaborators,
|
|
10
|
-
useDocumentChanges,
|
|
11
|
-
useEditorConnection,
|
|
12
|
-
useEditorContext,
|
|
13
|
-
useYjsState
|
|
14
|
-
} from "./chunk-K5XFRUS4.js";
|
|
15
|
-
import "./chunk-R7SUY4E3.js";
|
|
16
|
-
import "./chunk-LTEKI7YJ.js";
|
|
17
|
-
import "./chunk-OL5GYLHV.js";
|
|
18
|
-
import "./chunk-3XXBZL53.js";
|
|
19
|
-
import "./chunk-WKWBTL2V.js";
|
|
20
|
-
import "./chunk-RQHJBTEU.js";
|
|
21
|
-
export {
|
|
22
|
-
CollaboratorsList,
|
|
23
|
-
DocumentEditorPane,
|
|
24
|
-
EditorProvider,
|
|
25
|
-
EditorToolbar,
|
|
26
|
-
TiptapEditor,
|
|
27
|
-
useAwareness,
|
|
28
|
-
useCollaboratorPresence,
|
|
29
|
-
useCollaborators,
|
|
30
|
-
useDocumentChanges,
|
|
31
|
-
useEditorConnection,
|
|
32
|
-
useEditorContext,
|
|
33
|
-
useYjsState
|
|
34
|
-
};
|
|
1
|
+
import { a as useCollaborators, c as useYjsState, d as EditorToolbar, f as EditorProvider, i as useCollaboratorPresence, l as CollaboratorsList, o as useDocumentChanges, p as useEditorContext, r as useAwareness, s as useEditorConnection, t as DocumentEditorPane, u as TiptapEditor } from "./document-editor-pane-BxlPjaTP.js";
|
|
2
|
+
export { CollaboratorsList, DocumentEditorPane, EditorProvider, EditorToolbar, TiptapEditor, useAwareness, useCollaboratorPresence, useCollaborators, useDocumentChanges, useEditorConnection, useEditorContext, useYjsState };
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
//#region src/files/file-format.ts
|
|
2
|
+
const IMAGE_EXTENSIONS = [
|
|
3
|
+
"png",
|
|
4
|
+
"jpg",
|
|
5
|
+
"jpeg",
|
|
6
|
+
"gif",
|
|
7
|
+
"svg",
|
|
8
|
+
"webp",
|
|
9
|
+
"avif"
|
|
10
|
+
];
|
|
11
|
+
const VIDEO_EXTENSIONS = [
|
|
12
|
+
"mp4",
|
|
13
|
+
"webm",
|
|
14
|
+
"mov"
|
|
15
|
+
];
|
|
16
|
+
const AUDIO_EXTENSIONS = [
|
|
17
|
+
"mp3",
|
|
18
|
+
"wav",
|
|
19
|
+
"ogg",
|
|
20
|
+
"m4a"
|
|
21
|
+
];
|
|
22
|
+
const SPREADSHEET_MIME_TYPES = ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.ms-excel"];
|
|
23
|
+
const EXTENSION_TO_SYNTAX_LANGUAGE = {
|
|
24
|
+
ts: "typescript",
|
|
25
|
+
tsx: "tsx",
|
|
26
|
+
js: "javascript",
|
|
27
|
+
jsx: "jsx",
|
|
28
|
+
mjs: "javascript",
|
|
29
|
+
cjs: "javascript",
|
|
30
|
+
rs: "rust",
|
|
31
|
+
py: "python",
|
|
32
|
+
go: "go",
|
|
33
|
+
rb: "ruby",
|
|
34
|
+
json: "json",
|
|
35
|
+
yaml: "yaml",
|
|
36
|
+
yml: "yaml",
|
|
37
|
+
toml: "toml",
|
|
38
|
+
md: "markdown",
|
|
39
|
+
markdown: "markdown",
|
|
40
|
+
css: "css",
|
|
41
|
+
scss: "scss",
|
|
42
|
+
html: "html",
|
|
43
|
+
sh: "bash",
|
|
44
|
+
bash: "bash",
|
|
45
|
+
zsh: "bash",
|
|
46
|
+
bashrc: "bash",
|
|
47
|
+
bash_logout: "bash",
|
|
48
|
+
profile: "bash",
|
|
49
|
+
sql: "sql",
|
|
50
|
+
sol: "solidity",
|
|
51
|
+
proto: "protobuf"
|
|
52
|
+
};
|
|
53
|
+
const NON_CODE_SYNTAX_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
54
|
+
"json",
|
|
55
|
+
"yaml",
|
|
56
|
+
"yml",
|
|
57
|
+
"md",
|
|
58
|
+
"markdown"
|
|
59
|
+
]);
|
|
60
|
+
const PLAIN_CODE_EXTENSIONS = ["env", "gitignore"];
|
|
61
|
+
const CODE_EXTENSIONS = /* @__PURE__ */ new Set([...Object.keys(EXTENSION_TO_SYNTAX_LANGUAGE).filter((ext) => !NON_CODE_SYNTAX_EXTENSIONS.has(ext)), ...PLAIN_CODE_EXTENSIONS]);
|
|
62
|
+
/**
|
|
63
|
+
* Lowercased trailing extension. Returns "" for a name with no extension
|
|
64
|
+
* ("README", "json" → ""), and the post-dot name for a dotfile (".bashrc" →
|
|
65
|
+
* "bashrc"). Directory components are ignored so dots in a directory name don't
|
|
66
|
+
* leak in ("my.config/file" → "").
|
|
67
|
+
*/
|
|
68
|
+
function fileExtension(filename) {
|
|
69
|
+
const base = filename.slice(filename.lastIndexOf("/") + 1);
|
|
70
|
+
const dot = base.lastIndexOf(".");
|
|
71
|
+
if (dot < 0) return "";
|
|
72
|
+
return base.slice(dot + 1).toLowerCase();
|
|
73
|
+
}
|
|
74
|
+
/** Bare MIME essence, lowercased with any `; charset=…` parameters stripped. */
|
|
75
|
+
function mimeEssence(mimeType) {
|
|
76
|
+
return mimeType?.split(";")[0]?.trim().toLowerCase() ?? "";
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Resolve a filename + optional MIME type to the renderer format. A specific,
|
|
80
|
+
* authoritative MIME type wins over the extension; otherwise the extension
|
|
81
|
+
* decides; a generic text/plain payload is the final fallback.
|
|
82
|
+
*/
|
|
83
|
+
function detectFileFormat(filename, mimeType) {
|
|
84
|
+
const ext = fileExtension(filename);
|
|
85
|
+
const mime = mimeEssence(mimeType);
|
|
86
|
+
if (mime === "application/pdf") return "pdf";
|
|
87
|
+
if (mime.startsWith("image/")) return "image";
|
|
88
|
+
if (mime.startsWith("video/")) return "video";
|
|
89
|
+
if (mime.startsWith("audio/")) return "audio";
|
|
90
|
+
if (mime === "text/markdown") return "markdown";
|
|
91
|
+
if (mime === "application/json") return "json";
|
|
92
|
+
if (mime === "text/csv" || mime === "application/csv") return "csv";
|
|
93
|
+
if (SPREADSHEET_MIME_TYPES.includes(mime)) return "spreadsheet";
|
|
94
|
+
if (mime === "application/yaml" || mime === "application/x-yaml" || mime === "text/yaml") return "yaml";
|
|
95
|
+
if (ext === "pdf") return "pdf";
|
|
96
|
+
if (IMAGE_EXTENSIONS.includes(ext)) return "image";
|
|
97
|
+
if (VIDEO_EXTENSIONS.includes(ext)) return "video";
|
|
98
|
+
if (AUDIO_EXTENSIONS.includes(ext)) return "audio";
|
|
99
|
+
if (ext === "csv") return "csv";
|
|
100
|
+
if (ext === "xlsx" || ext === "xls") return "spreadsheet";
|
|
101
|
+
if (CODE_EXTENSIONS.has(ext)) return "code";
|
|
102
|
+
if (ext === "json") return "json";
|
|
103
|
+
if (ext === "yaml" || ext === "yml") return "yaml";
|
|
104
|
+
if (ext === "md" || ext === "markdown") return "markdown";
|
|
105
|
+
if ([
|
|
106
|
+
"txt",
|
|
107
|
+
"log",
|
|
108
|
+
"text"
|
|
109
|
+
].includes(ext)) return "text";
|
|
110
|
+
if (mime === "text/plain") return "text";
|
|
111
|
+
return "unknown";
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* The preview renderer for a file, from its name and optional MIME type only.
|
|
115
|
+
* Same precedence as `detectFileFormat` (MIME outranks extension); a file that
|
|
116
|
+
* matches nothing is `binary`. Content is not an input: the preview renders a
|
|
117
|
+
* `binary` file's string content as text and offers a download otherwise.
|
|
118
|
+
*/
|
|
119
|
+
function resolveFilePreviewKind(filename, mimeType) {
|
|
120
|
+
const format = detectFileFormat(filename, mimeType);
|
|
121
|
+
return format === "unknown" ? "binary" : format;
|
|
122
|
+
}
|
|
123
|
+
/** Human-facing label for a detected format or preview kind. */
|
|
124
|
+
function getFormatLabel(format) {
|
|
125
|
+
switch (format) {
|
|
126
|
+
case "pdf": return "PDF";
|
|
127
|
+
case "image": return "Image";
|
|
128
|
+
case "video": return "Video";
|
|
129
|
+
case "audio": return "Audio";
|
|
130
|
+
case "csv": return "CSV";
|
|
131
|
+
case "spreadsheet": return "Spreadsheet";
|
|
132
|
+
case "code": return "Code";
|
|
133
|
+
case "json": return "JSON";
|
|
134
|
+
case "yaml": return "YAML";
|
|
135
|
+
case "markdown": return "Markdown";
|
|
136
|
+
case "text": return "Text";
|
|
137
|
+
default: return "File";
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Map a filename (or path) to a highlight.js language id for CodeBlock. Returns
|
|
142
|
+
* undefined when there is no confident mapping; CodeBlock then renders themed
|
|
143
|
+
* monospace and lets the highlighter auto-detect, so callers never need a
|
|
144
|
+
* bespoke language table.
|
|
145
|
+
*/
|
|
146
|
+
function getSyntaxLanguage(filename) {
|
|
147
|
+
return EXTENSION_TO_SYNTAX_LANGUAGE[fileExtension(filename)];
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Highlight language for a file already classified as a code-like format.
|
|
151
|
+
* `json`/`yaml` are their own highlight language even when detected purely from
|
|
152
|
+
* a MIME type on an extensionless file (where the extension can't reveal it);
|
|
153
|
+
* any other code format keys off the extension.
|
|
154
|
+
*/
|
|
155
|
+
function getCodeLanguage(filename, format) {
|
|
156
|
+
if (format === "json" || format === "yaml") return format;
|
|
157
|
+
return getSyntaxLanguage(filename);
|
|
158
|
+
}
|
|
159
|
+
//#endregion
|
|
160
|
+
export { getSyntaxLanguage as a, getFormatLabel as i, fileExtension as n, resolveFilePreviewKind as o, getCodeLanguage as r, detectFileFormat as t };
|