comment-mode 0.1.3 → 0.1.4

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/index.d.mts CHANGED
@@ -3,6 +3,7 @@ import { SupabaseClient, User } from '@supabase/supabase-js';
3
3
 
4
4
  type CommentConfig = {
5
5
  projectSlug: string;
6
+ /** Identifies the surface (e.g. pathname or pathname+search for tabs). */
6
7
  surfaceId: string;
7
8
  /**
8
9
  * Optional override for the Comment Mode API base URL.
@@ -64,7 +65,16 @@ type ThreadAnchor = {
64
65
  type Thread = {
65
66
  id: string;
66
67
  anchor: ThreadAnchor;
68
+ /** CSS selector to resolve the anchored element within the surface. When set, pin is shown only when element exists and visible. */
69
+ anchorSelector?: string | null;
70
+ /** Where within the element the user clicked (0..1). Used with anchorSelector so the pin stays at the exact click spot. */
71
+ anchorRelative?: {
72
+ x: number;
73
+ y: number;
74
+ } | null;
67
75
  status: "open" | "resolved";
76
+ /** Avatar URL of the first comment author (for pin display). */
77
+ firstCommentAuthorAvatarUrl?: string | null;
68
78
  };
69
79
  type Comment = {
70
80
  id: string;
@@ -72,6 +82,7 @@ type Comment = {
72
82
  body: string;
73
83
  createdAt?: string;
74
84
  authorName?: string | null;
85
+ authorAvatarUrl?: string | null;
75
86
  };
76
87
 
77
88
  declare function useComments(): {
@@ -80,9 +91,9 @@ declare function useComments(): {
80
91
  commentsByThread: Record<string, Comment[]>;
81
92
  isLoading: boolean;
82
93
  error: Error | null;
83
- createThread: (anchor: ThreadAnchor, initialCommentBody?: string, initialAuthorName?: string | null) => Promise<Thread>;
94
+ createThread: (anchor: ThreadAnchor, initialCommentBody?: string, initialAuthorName?: string | null, anchorElement?: HTMLElement | null, initialAuthorAvatarUrl?: string | null) => Promise<Thread>;
84
95
  loadComments: (threadId: string) => Promise<void>;
85
- addComment: (threadId: string, body: string, authorName?: string | null) => Promise<Comment>;
96
+ addComment: (threadId: string, body: string, authorName?: string | null, authorAvatarUrl?: string | null) => Promise<Comment>;
86
97
  deleteThread: (threadId: string) => Promise<void>;
87
98
  };
88
99
 
@@ -94,6 +105,8 @@ type AuthContextValue = {
94
105
  isReady: boolean;
95
106
  /** Resolved from GitHub: full_name, or username if name not set. Read-only. */
96
107
  displayName: string;
108
+ /** GitHub avatar URL from user_metadata, if available. */
109
+ avatarUrl: string | null;
97
110
  signInWithEmail: (email: string) => Promise<void>;
98
111
  signInWithGitHub: () => Promise<void>;
99
112
  signOut: () => Promise<void>;
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import { SupabaseClient, User } from '@supabase/supabase-js';
3
3
 
4
4
  type CommentConfig = {
5
5
  projectSlug: string;
6
+ /** Identifies the surface (e.g. pathname or pathname+search for tabs). */
6
7
  surfaceId: string;
7
8
  /**
8
9
  * Optional override for the Comment Mode API base URL.
@@ -64,7 +65,16 @@ type ThreadAnchor = {
64
65
  type Thread = {
65
66
  id: string;
66
67
  anchor: ThreadAnchor;
68
+ /** CSS selector to resolve the anchored element within the surface. When set, pin is shown only when element exists and visible. */
69
+ anchorSelector?: string | null;
70
+ /** Where within the element the user clicked (0..1). Used with anchorSelector so the pin stays at the exact click spot. */
71
+ anchorRelative?: {
72
+ x: number;
73
+ y: number;
74
+ } | null;
67
75
  status: "open" | "resolved";
76
+ /** Avatar URL of the first comment author (for pin display). */
77
+ firstCommentAuthorAvatarUrl?: string | null;
68
78
  };
69
79
  type Comment = {
70
80
  id: string;
@@ -72,6 +82,7 @@ type Comment = {
72
82
  body: string;
73
83
  createdAt?: string;
74
84
  authorName?: string | null;
85
+ authorAvatarUrl?: string | null;
75
86
  };
76
87
 
77
88
  declare function useComments(): {
@@ -80,9 +91,9 @@ declare function useComments(): {
80
91
  commentsByThread: Record<string, Comment[]>;
81
92
  isLoading: boolean;
82
93
  error: Error | null;
83
- createThread: (anchor: ThreadAnchor, initialCommentBody?: string, initialAuthorName?: string | null) => Promise<Thread>;
94
+ createThread: (anchor: ThreadAnchor, initialCommentBody?: string, initialAuthorName?: string | null, anchorElement?: HTMLElement | null, initialAuthorAvatarUrl?: string | null) => Promise<Thread>;
84
95
  loadComments: (threadId: string) => Promise<void>;
85
- addComment: (threadId: string, body: string, authorName?: string | null) => Promise<Comment>;
96
+ addComment: (threadId: string, body: string, authorName?: string | null, authorAvatarUrl?: string | null) => Promise<Comment>;
86
97
  deleteThread: (threadId: string) => Promise<void>;
87
98
  };
88
99
 
@@ -94,6 +105,8 @@ type AuthContextValue = {
94
105
  isReady: boolean;
95
106
  /** Resolved from GitHub: full_name, or username if name not set. Read-only. */
96
107
  displayName: string;
108
+ /** GitHub avatar URL from user_metadata, if available. */
109
+ avatarUrl: string | null;
97
110
  signInWithEmail: (email: string) => Promise<void>;
98
111
  signInWithGitHub: () => Promise<void>;
99
112
  signOut: () => Promise<void>;