@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.
Files changed (132) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +4 -1
  3. package/dist/active-sessions-store-Gt1R0rFG.js +262 -0
  4. package/dist/{active-sessions-store-CeOmXgv5.d.ts → active-sessions-store-nl70ZnMC.d.ts} +40 -41
  5. package/dist/artifact-pane-BL_DFWNl.d.ts +32 -0
  6. package/dist/artifact-pane-DMXT9a8U.js +70 -0
  7. package/dist/auth-DOETfnd9.js +154 -0
  8. package/dist/auth.d.ts +2 -74
  9. package/dist/auth.js +2 -16
  10. package/dist/branding-26d5ARIr.d.ts +14 -0
  11. package/dist/button-C87nEe2R.js +78 -0
  12. package/dist/button-yoIv77e2.d.ts +16 -0
  13. package/dist/chat-D4jAfEmj.js +667 -0
  14. package/dist/chat.d.ts +2 -201
  15. package/dist/chat.js +2 -31
  16. package/dist/code-block-B36KVUSN.js +165 -0
  17. package/dist/code-block-B9miUPht.d.ts +23 -0
  18. package/dist/diff-preview-BcK3nRXb.js +533 -0
  19. package/dist/document-editor-pane-BcoABlhn.d.ts +131 -0
  20. package/dist/document-editor-pane-BxlPjaTP.js +1287 -0
  21. package/dist/dropdown-menu-BpcLa5vF.js +101 -0
  22. package/dist/editor.d.ts +76 -78
  23. package/dist/editor.js +2 -34
  24. package/dist/file-format-BgXbr-Ib.js +160 -0
  25. package/dist/files-Bug33qCl.js +743 -0
  26. package/dist/files.d.ts +2 -243
  27. package/dist/files.js +3 -41
  28. package/dist/focus-BcE_SHqz.js +57 -0
  29. package/dist/format-DfcLWqMa.js +54 -0
  30. package/dist/hooks.d.ts +30 -37
  31. package/dist/hooks.js +111 -46
  32. package/dist/index-2UntyjBb.d.ts +52 -0
  33. package/dist/index-BgUHilZm.d.ts +108 -0
  34. package/dist/index-COgqsFAQ.d.ts +42 -0
  35. package/dist/index-CPDET_s1.d.ts +549 -0
  36. package/dist/index-CUhfHT_V.d.ts +204 -0
  37. package/dist/index-Cg6gYAqh.d.ts +73 -0
  38. package/dist/index-Cq-EJzqW.d.ts +16 -0
  39. package/dist/index-DhYmSaLF.d.ts +245 -0
  40. package/dist/index-DjKxO357.d.ts +128 -0
  41. package/dist/index.d.ts +26 -43
  42. package/dist/index.js +35 -472
  43. package/dist/markdown-BGqicV82.js +45 -0
  44. package/dist/markdown.d.ts +3 -18
  45. package/dist/markdown.js +3 -15
  46. package/dist/message-vhUI0c5G.d.ts +16 -0
  47. package/dist/nav.d.ts +6 -8
  48. package/dist/nav.js +29 -11
  49. package/dist/openui-artifact-renderer-D3E5bIAI.d.ts +114 -0
  50. package/dist/openui-artifact-renderer-DrU1AdVk.js +266 -0
  51. package/dist/openui.d.ts +2 -115
  52. package/dist/openui.js +2 -13
  53. package/dist/parts-5mhy9yJ3.d.ts +37 -0
  54. package/dist/primitives-Cb8GGVKr.js +1239 -0
  55. package/dist/primitives.d.ts +5 -525
  56. package/dist/primitives.js +9 -212
  57. package/dist/redaction-CGGB2ENG.js +74 -0
  58. package/dist/redaction.d.ts +2 -42
  59. package/dist/redaction.js +2 -7
  60. package/dist/run-OyWmIDqu.d.ts +41 -0
  61. package/dist/run-ZsIKPA6J.js +17 -0
  62. package/dist/run-group-BACLbCFl.js +410 -0
  63. package/dist/run.d.ts +3 -126
  64. package/dist/run.js +5 -40
  65. package/dist/sdk-hooks.d.ts +2 -285
  66. package/dist/sdk-hooks.js +3 -36
  67. package/dist/stores.d.ts +13 -14
  68. package/dist/stores.js +34 -76
  69. package/dist/table-Bss73DhB.js +146 -0
  70. package/dist/tabs-BVHR6NkO.js +40 -0
  71. package/dist/text-shimmer-BUUo6I-g.js +64 -0
  72. package/dist/tool-call-feed-BeB1_4pX.d.ts +47 -0
  73. package/dist/tool-call-feed-Djt2q11V.js +109 -0
  74. package/dist/tool-call-step-DNebqhmX.js +434 -0
  75. package/dist/tool-display-BAuAVa43.js +158 -0
  76. package/dist/{tool-display-z4JcDmMQ.d.ts → tool-display-DgmL5rIU.d.ts} +16 -16
  77. package/dist/tool-previews.d.ts +2 -48
  78. package/dist/tool-previews.js +2 -23
  79. package/dist/types.d.ts +6 -19
  80. package/dist/types.js +0 -1
  81. package/dist/use-auto-scroll-C5Pjeqon.js +153 -0
  82. package/dist/use-sse-stream-BVgO1QBN.js +884 -0
  83. package/dist/use-sse-stream-Dm6R5YWz.d.ts +282 -0
  84. package/dist/utils-Bl_CZ0Qp.js +37 -0
  85. package/dist/{chunk-RQHJBTEU.js → utils-C_uf36nf.js} +4 -6
  86. package/dist/utils.d.ts +2 -104
  87. package/dist/utils.js +6 -44
  88. package/package.json +39 -41
  89. package/src/lib/focus.ts +2 -1
  90. package/dist/artifact-pane-DpuWcAiF.d.ts +0 -33
  91. package/dist/button-CMQuQEW_.d.ts +0 -17
  92. package/dist/chunk-34A66VBG.js +0 -214
  93. package/dist/chunk-3OI2QKFD.js +0 -0
  94. package/dist/chunk-3XXBZL53.js +0 -174
  95. package/dist/chunk-42PAH5D2.js +0 -112
  96. package/dist/chunk-4CLN43XT.js +0 -45
  97. package/dist/chunk-55WHV7SS.js +0 -1604
  98. package/dist/chunk-565EATZZ.js +0 -156
  99. package/dist/chunk-5Z5ZYMOJ.js +0 -0
  100. package/dist/chunk-6BGQA4BQ.js +0 -0
  101. package/dist/chunk-BEBXZPHW.js +0 -299
  102. package/dist/chunk-C5WF4WMV.js +0 -734
  103. package/dist/chunk-HFL6R6IF.js +0 -37
  104. package/dist/chunk-HGML45QH.js +0 -104
  105. package/dist/chunk-HMAPIH7L.js +0 -595
  106. package/dist/chunk-K5XFRUS4.js +0 -1401
  107. package/dist/chunk-KFQGHD73.js +0 -198
  108. package/dist/chunk-L57WRIND.js +0 -59
  109. package/dist/chunk-LTEKI7YJ.js +0 -59
  110. package/dist/chunk-M3QZK62R.js +0 -233
  111. package/dist/chunk-ND3ZFXQK.js +0 -179
  112. package/dist/chunk-OEX7NZE3.js +0 -321
  113. package/dist/chunk-OL5GYLHV.js +0 -60
  114. package/dist/chunk-QGFYBNSO.js +0 -133
  115. package/dist/chunk-R7B3UWPF.js +0 -550
  116. package/dist/chunk-R7SUY4E3.js +0 -65
  117. package/dist/chunk-REJESC5U.js +0 -117
  118. package/dist/chunk-RQGKSCEZ.js +0 -0
  119. package/dist/chunk-SNLR2AEA.js +0 -40
  120. package/dist/chunk-WKWBTL2V.js +0 -15
  121. package/dist/chunk-X7CU776B.js +0 -1048
  122. package/dist/chunk-XU3HB5QL.js +0 -127
  123. package/dist/chunk-YTO5V6QS.js +0 -19
  124. package/dist/chunk-YU4E5J2N.js +0 -437
  125. package/dist/chunk-YZ6AK25N.js +0 -886
  126. package/dist/code-block-0kSpWMnf.d.ts +0 -25
  127. package/dist/document-editor-pane-IAEQn_Dl.d.ts +0 -128
  128. package/dist/document-editor-pane-QHDOBA43.js +0 -13
  129. package/dist/message-BHWbxBtT.d.ts +0 -15
  130. package/dist/parts-dj7AcUg0.d.ts +0 -36
  131. package/dist/run-PfLmDAox.d.ts +0 -41
  132. 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 { C as Collaborator, a as ConnectionState } from './document-editor-pane-IAEQn_Dl.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-IAEQn_Dl.js';
3
- import * as react_jsx_runtime from 'react/jsx-runtime';
4
- import { Editor } from '@tiptap/react';
5
- import { HocuspocusProvider } from '@hocuspocus/provider';
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
- editor: Editor | null;
16
- className?: string;
17
- }): react_jsx_runtime.JSX.Element | null;
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
- /** Initial content for new documents (markdown string) */
24
- initialContent?: string;
25
- /** Placeholder text when editor is empty */
26
- placeholder?: string;
27
- /** Whether the editor is read-only */
28
- readOnly?: boolean;
29
- /** Whether to auto-focus on mount */
30
- autoFocus?: boolean;
31
- /** Custom className for the editor wrapper */
32
- className?: string;
33
- /** Custom className for the editor content area */
34
- contentClassName?: string;
35
- /** Callback when content changes */
36
- onUpdate?: (editor: Editor) => void;
37
- /** Callback when selection changes */
38
- onSelectionUpdate?: (editor: Editor) => void;
39
- /** Callback when editor is ready */
40
- onReady?: (editor: Editor) => void;
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): react_jsx_runtime.JSX.Element;
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
- collaborators: Collaborator[];
54
- className?: string;
55
- }): react_jsx_runtime.JSX.Element | null;
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
- /** Current connection state string */
62
- state: ConnectionState;
63
- /** Whether connected to the server (connected or synced) */
64
- isConnected: boolean;
65
- /** Whether currently attempting to connect */
66
- isConnecting: boolean;
67
- /** Whether disconnected from the server */
68
- isDisconnected: boolean;
69
- /** Whether the document is synced with the server */
70
- isSynced: boolean;
71
- /** Connect to the collaboration server */
72
- connect: () => void;
73
- /** Disconnect from the collaboration server */
74
- disconnect: () => void;
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
- /** List of active collaborators (excluding self) */
81
- collaborators: Collaborator[];
82
- /** Number of other collaborators */
83
- count: number;
84
- /** Whether there are other collaborators present */
85
- hasOthers: boolean;
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
- /** Whether there are unsaved changes */
102
- isDirty: boolean;
103
- /** Whether save is in progress */
104
- isSaving: boolean;
105
- /** When the document was last saved */
106
- lastSaved: Date | null;
107
- /** Save the document */
108
- save: () => Promise<void>;
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
- localState: Record<string, unknown>;
116
- setLocalState: (state: Record<string, unknown>) => void;
117
- setLocalStateField: (field: string, value: unknown) => void;
118
- awareness: HocuspocusProvider["awareness"] | undefined;
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, CollaboratorsList, ConnectionState, EditorToolbar, TiptapEditor, type TiptapEditorProps, useAwareness, useCollaboratorPresence, useCollaborators, useDocumentChanges, useEditorConnection, useYjsState };
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
- CollaboratorsList,
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 };