version-pill-react 1.0.0 → 1.1.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/dist/index.d.mts CHANGED
@@ -1,15 +1,32 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
 
3
3
  interface Version {
4
- id: string;
5
4
  version: string;
6
5
  type: "major" | "minor" | "patch";
7
6
  title: string;
8
- description?: string;
9
- emoji?: string;
7
+ description?: string | null;
8
+ emoji?: string | null;
10
9
  features?: string[];
11
- releaseDate: number;
12
- isActive: boolean;
10
+ date: string | number;
11
+ tasks?: {
12
+ title: string;
13
+ type: string;
14
+ }[];
15
+ }
16
+ interface ProjectInfo {
17
+ name: string;
18
+ slug: string;
19
+ icon?: string | null;
20
+ currentVersion?: string | null;
21
+ }
22
+ interface ChangelogAPIResponse {
23
+ project: ProjectInfo;
24
+ changelog: Version[];
25
+ }
26
+ interface BadgeAPIResponse {
27
+ version: string | null;
28
+ name: string;
29
+ slug: string;
13
30
  }
14
31
  interface VersionPillConfig {
15
32
  /** Your project slug from Version Pill dashboard */
@@ -17,6 +34,8 @@ interface VersionPillConfig {
17
34
  /** Version Pill API base URL (default: https://versionpill.com) */
18
35
  baseUrl?: string;
19
36
  }
37
+ type BadgeStyle = "dot" | "pill" | "minimal" | "glass" | "gradient";
38
+ type BadgeSize = "sm" | "md" | "lg";
20
39
  interface VersionPillProps extends VersionPillConfig {
21
40
  /** Position of the pill */
22
41
  position?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | "inline";
@@ -24,12 +43,18 @@ interface VersionPillProps extends VersionPillConfig {
24
43
  className?: string;
25
44
  /** Theme */
26
45
  theme?: "light" | "dark" | "auto";
46
+ /** Badge style variant */
47
+ style?: BadgeStyle;
48
+ /** Badge size */
49
+ size?: BadgeSize;
27
50
  /** Show "Powered by Version Pill" branding */
28
51
  showBranding?: boolean;
29
- /** Accent color (hex) */
30
- accentColor?: string;
52
+ /** Accent color */
53
+ accent?: "green" | "blue" | "purple" | "orange" | "neutral";
31
54
  /** Callback when a new version is detected */
32
55
  onNewVersion?: (version: Version) => void;
56
+ /** Callback when badge is clicked */
57
+ onClick?: () => void;
33
58
  }
34
59
  interface ChangelogProps extends VersionPillConfig {
35
60
  /** Max height in pixels */
@@ -47,8 +72,61 @@ interface RoadmapProps extends VersionPillConfig {
47
72
  /** Custom class name */
48
73
  className?: string;
49
74
  }
50
- declare function VersionPill({ projectId, baseUrl, position, className, theme, showBranding, accentColor, onNewVersion, }: VersionPillProps): react_jsx_runtime.JSX.Element | null;
75
+ declare function VersionPill({ projectId, baseUrl, position, className, theme, style, size, showBranding, accent, onNewVersion, onClick, }: VersionPillProps): react_jsx_runtime.JSX.Element | null;
76
+ interface VersionBadgeProps {
77
+ /** Your project slug from Version Pill dashboard */
78
+ projectId: string;
79
+ /** Version Pill API base URL (default: https://versionpill.com) */
80
+ baseUrl?: string;
81
+ /** Theme */
82
+ theme?: "light" | "dark" | "auto";
83
+ /** Badge style variant */
84
+ style?: BadgeStyle;
85
+ /** Badge size */
86
+ size?: BadgeSize;
87
+ /** Accent color */
88
+ accent?: "green" | "blue" | "purple" | "orange" | "neutral";
89
+ /** Custom class name */
90
+ className?: string;
91
+ /** Link to changelog (if provided, badge becomes a link) */
92
+ href?: string;
93
+ }
94
+ declare function VersionBadge({ projectId, baseUrl, theme, style, size, accent, className, href, }: VersionBadgeProps): react_jsx_runtime.JSX.Element | null;
51
95
  declare function Changelog({ projectId, baseUrl, maxHeight, theme, className, }: ChangelogProps): react_jsx_runtime.JSX.Element;
52
96
  declare function Roadmap({ projectId, baseUrl, maxHeight, theme, className, }: RoadmapProps): react_jsx_runtime.JSX.Element;
97
+ interface UseVersionOptions {
98
+ /** Your project slug from Version Pill dashboard */
99
+ projectId: string;
100
+ /** Version Pill API base URL (default: https://versionpill.com) */
101
+ baseUrl?: string;
102
+ /** Refetch interval in ms (0 = no refetch) */
103
+ refetchInterval?: number;
104
+ }
105
+ interface UseVersionResult {
106
+ /** Current version string (e.g., "1.2.3") */
107
+ version: string | null;
108
+ /** Project name */
109
+ name: string | null;
110
+ /** Project slug */
111
+ slug: string | null;
112
+ /** Loading state */
113
+ loading: boolean;
114
+ /** Error message if fetch failed */
115
+ error: string | null;
116
+ /** Manually refetch the version */
117
+ refetch: () => Promise<void>;
118
+ }
119
+ /**
120
+ * Hook to fetch the current version for a project.
121
+ * Use this when you need the version data without the UI components.
122
+ *
123
+ * @example
124
+ * ```tsx
125
+ * const { version, loading } = useVersion({ projectId: "my-app" });
126
+ * if (loading) return <Skeleton />;
127
+ * return <span>v{version}</span>;
128
+ * ```
129
+ */
130
+ declare function useVersion({ projectId, baseUrl, refetchInterval, }: UseVersionOptions): UseVersionResult;
53
131
 
54
- export { Changelog, type ChangelogProps, Roadmap, type RoadmapProps, type Version, VersionPill, type VersionPillConfig, type VersionPillProps, VersionPill as default };
132
+ export { type BadgeAPIResponse, type BadgeSize, type BadgeStyle, Changelog, type ChangelogAPIResponse, type ChangelogProps, type ProjectInfo, Roadmap, type RoadmapProps, type UseVersionOptions, type UseVersionResult, type Version, VersionBadge, type VersionBadgeProps, VersionPill, type VersionPillConfig, type VersionPillProps, VersionPill as default, useVersion };
package/dist/index.d.ts CHANGED
@@ -1,15 +1,32 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
 
3
3
  interface Version {
4
- id: string;
5
4
  version: string;
6
5
  type: "major" | "minor" | "patch";
7
6
  title: string;
8
- description?: string;
9
- emoji?: string;
7
+ description?: string | null;
8
+ emoji?: string | null;
10
9
  features?: string[];
11
- releaseDate: number;
12
- isActive: boolean;
10
+ date: string | number;
11
+ tasks?: {
12
+ title: string;
13
+ type: string;
14
+ }[];
15
+ }
16
+ interface ProjectInfo {
17
+ name: string;
18
+ slug: string;
19
+ icon?: string | null;
20
+ currentVersion?: string | null;
21
+ }
22
+ interface ChangelogAPIResponse {
23
+ project: ProjectInfo;
24
+ changelog: Version[];
25
+ }
26
+ interface BadgeAPIResponse {
27
+ version: string | null;
28
+ name: string;
29
+ slug: string;
13
30
  }
14
31
  interface VersionPillConfig {
15
32
  /** Your project slug from Version Pill dashboard */
@@ -17,6 +34,8 @@ interface VersionPillConfig {
17
34
  /** Version Pill API base URL (default: https://versionpill.com) */
18
35
  baseUrl?: string;
19
36
  }
37
+ type BadgeStyle = "dot" | "pill" | "minimal" | "glass" | "gradient";
38
+ type BadgeSize = "sm" | "md" | "lg";
20
39
  interface VersionPillProps extends VersionPillConfig {
21
40
  /** Position of the pill */
22
41
  position?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | "inline";
@@ -24,12 +43,18 @@ interface VersionPillProps extends VersionPillConfig {
24
43
  className?: string;
25
44
  /** Theme */
26
45
  theme?: "light" | "dark" | "auto";
46
+ /** Badge style variant */
47
+ style?: BadgeStyle;
48
+ /** Badge size */
49
+ size?: BadgeSize;
27
50
  /** Show "Powered by Version Pill" branding */
28
51
  showBranding?: boolean;
29
- /** Accent color (hex) */
30
- accentColor?: string;
52
+ /** Accent color */
53
+ accent?: "green" | "blue" | "purple" | "orange" | "neutral";
31
54
  /** Callback when a new version is detected */
32
55
  onNewVersion?: (version: Version) => void;
56
+ /** Callback when badge is clicked */
57
+ onClick?: () => void;
33
58
  }
34
59
  interface ChangelogProps extends VersionPillConfig {
35
60
  /** Max height in pixels */
@@ -47,8 +72,61 @@ interface RoadmapProps extends VersionPillConfig {
47
72
  /** Custom class name */
48
73
  className?: string;
49
74
  }
50
- declare function VersionPill({ projectId, baseUrl, position, className, theme, showBranding, accentColor, onNewVersion, }: VersionPillProps): react_jsx_runtime.JSX.Element | null;
75
+ declare function VersionPill({ projectId, baseUrl, position, className, theme, style, size, showBranding, accent, onNewVersion, onClick, }: VersionPillProps): react_jsx_runtime.JSX.Element | null;
76
+ interface VersionBadgeProps {
77
+ /** Your project slug from Version Pill dashboard */
78
+ projectId: string;
79
+ /** Version Pill API base URL (default: https://versionpill.com) */
80
+ baseUrl?: string;
81
+ /** Theme */
82
+ theme?: "light" | "dark" | "auto";
83
+ /** Badge style variant */
84
+ style?: BadgeStyle;
85
+ /** Badge size */
86
+ size?: BadgeSize;
87
+ /** Accent color */
88
+ accent?: "green" | "blue" | "purple" | "orange" | "neutral";
89
+ /** Custom class name */
90
+ className?: string;
91
+ /** Link to changelog (if provided, badge becomes a link) */
92
+ href?: string;
93
+ }
94
+ declare function VersionBadge({ projectId, baseUrl, theme, style, size, accent, className, href, }: VersionBadgeProps): react_jsx_runtime.JSX.Element | null;
51
95
  declare function Changelog({ projectId, baseUrl, maxHeight, theme, className, }: ChangelogProps): react_jsx_runtime.JSX.Element;
52
96
  declare function Roadmap({ projectId, baseUrl, maxHeight, theme, className, }: RoadmapProps): react_jsx_runtime.JSX.Element;
97
+ interface UseVersionOptions {
98
+ /** Your project slug from Version Pill dashboard */
99
+ projectId: string;
100
+ /** Version Pill API base URL (default: https://versionpill.com) */
101
+ baseUrl?: string;
102
+ /** Refetch interval in ms (0 = no refetch) */
103
+ refetchInterval?: number;
104
+ }
105
+ interface UseVersionResult {
106
+ /** Current version string (e.g., "1.2.3") */
107
+ version: string | null;
108
+ /** Project name */
109
+ name: string | null;
110
+ /** Project slug */
111
+ slug: string | null;
112
+ /** Loading state */
113
+ loading: boolean;
114
+ /** Error message if fetch failed */
115
+ error: string | null;
116
+ /** Manually refetch the version */
117
+ refetch: () => Promise<void>;
118
+ }
119
+ /**
120
+ * Hook to fetch the current version for a project.
121
+ * Use this when you need the version data without the UI components.
122
+ *
123
+ * @example
124
+ * ```tsx
125
+ * const { version, loading } = useVersion({ projectId: "my-app" });
126
+ * if (loading) return <Skeleton />;
127
+ * return <span>v{version}</span>;
128
+ * ```
129
+ */
130
+ declare function useVersion({ projectId, baseUrl, refetchInterval, }: UseVersionOptions): UseVersionResult;
53
131
 
54
- export { Changelog, type ChangelogProps, Roadmap, type RoadmapProps, type Version, VersionPill, type VersionPillConfig, type VersionPillProps, VersionPill as default };
132
+ export { type BadgeAPIResponse, type BadgeSize, type BadgeStyle, Changelog, type ChangelogAPIResponse, type ChangelogProps, type ProjectInfo, Roadmap, type RoadmapProps, type UseVersionOptions, type UseVersionResult, type Version, VersionBadge, type VersionBadgeProps, VersionPill, type VersionPillConfig, type VersionPillProps, VersionPill as default, useVersion };