@geekapps/silo-elements-nextjs 0.0.2 → 0.0.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.
@@ -0,0 +1,131 @@
1
+ import { UploadResult } from '@geekapps/silo-nextjs';
2
+
3
+ interface BaseUploaderProps {
4
+ /** Bucket to upload to */
5
+ bucket?: string;
6
+ /** Seconds until file expires (optional) */
7
+ expiresIn?: number;
8
+ /** Keep file private (default: true) */
9
+ private?: boolean;
10
+ /** Called when upload completes */
11
+ onUpload?: (result: UploadResult) => void;
12
+ /** Called when upload fails */
13
+ onError?: (error: Error) => void;
14
+ /** Custom className for the root element */
15
+ className?: string;
16
+ /** Custom styles */
17
+ style?: React.CSSProperties;
18
+ /** Disable the uploader */
19
+ disabled?: boolean;
20
+ /** Max file size in bytes */
21
+ maxSize?: number;
22
+ /** Custom label/content slot */
23
+ children?: React.ReactNode;
24
+ /** Override inner icon slot */
25
+ renderIcon?: () => React.ReactNode;
26
+ /** Override progress bar slot */
27
+ renderProgress?: (progress: number) => React.ReactNode;
28
+ /** Override success state slot */
29
+ renderSuccess?: (result: UploadResult) => React.ReactNode;
30
+ /** Override error state slot */
31
+ renderError?: (error: Error, retry: () => void) => React.ReactNode;
32
+ /** Theme tokens */
33
+ theme?: SiloTheme;
34
+ }
35
+ interface SiloTheme {
36
+ borderColor?: string;
37
+ borderColorActive?: string;
38
+ backgroundColor?: string;
39
+ backgroundColorHover?: string;
40
+ textColor?: string;
41
+ textColorMuted?: string;
42
+ accentColor?: string;
43
+ accentColorHover?: string;
44
+ errorColor?: string;
45
+ successColor?: string;
46
+ borderRadius?: string;
47
+ fontFamily?: string;
48
+ }
49
+ interface ImageUploaderProps extends BaseUploaderProps {
50
+ /** Allow cropping before upload */
51
+ allowCrop?: boolean;
52
+ /** Crop aspect ratio (e.g. 16/9) */
53
+ cropAspectRatio?: number;
54
+ /** Show preview after selection */
55
+ showPreview?: boolean;
56
+ /** Accept string (default: image/*) */
57
+ accept?: string;
58
+ }
59
+ interface VideoUploaderProps extends BaseUploaderProps {
60
+ /** Show video preview after selection */
61
+ showPreview?: boolean;
62
+ /** Accept string (default: video/*) */
63
+ accept?: string;
64
+ }
65
+ interface FileUploaderProps extends BaseUploaderProps {
66
+ /** Accepted MIME types or extensions */
67
+ accept?: string;
68
+ /** Allow multiple files */
69
+ multiple?: boolean;
70
+ }
71
+ interface MediaUploaderProps extends BaseUploaderProps {
72
+ /** Which tabs to show */
73
+ tabs?: Array<"image" | "video" | "file">;
74
+ /** Default active tab */
75
+ defaultTab?: "image" | "video" | "file";
76
+ imageProps?: Partial<ImageUploaderProps>;
77
+ videoProps?: Partial<VideoUploaderProps>;
78
+ fileProps?: Partial<FileUploaderProps>;
79
+ }
80
+ interface VideoPlayerProps {
81
+ /** HLS playlist URL or direct MP4 URL */
82
+ src: string;
83
+ /** Poster/thumbnail image URL */
84
+ poster?: string;
85
+ /** Signed URL for private streams */
86
+ token?: string;
87
+ /** Auto play */
88
+ autoPlay?: boolean;
89
+ /** Loop */
90
+ loop?: boolean;
91
+ /** Mute */
92
+ muted?: boolean;
93
+ /** Show native controls (default: true) */
94
+ controls?: boolean;
95
+ /** Custom controls slot — disables native controls */
96
+ renderControls?: (player: VideoPlayerControls) => React.ReactNode;
97
+ /** Custom className */
98
+ className?: string;
99
+ /** Custom styles */
100
+ style?: React.CSSProperties;
101
+ /** Subtitle tracks */
102
+ tracks?: Array<{
103
+ src: string;
104
+ label: string;
105
+ srcLang: string;
106
+ default?: boolean;
107
+ }>;
108
+ /** Theme */
109
+ theme?: SiloTheme;
110
+ /** Called when playback starts */
111
+ onPlay?: () => void;
112
+ /** Called when playback pauses */
113
+ onPause?: () => void;
114
+ /** Called on time update */
115
+ onTimeUpdate?: (currentTime: number, duration: number) => void;
116
+ }
117
+ interface VideoPlayerControls {
118
+ playing: boolean;
119
+ currentTime: number;
120
+ duration: number;
121
+ volume: number;
122
+ muted: boolean;
123
+ play: () => void;
124
+ pause: () => void;
125
+ seek: (time: number) => void;
126
+ setVolume: (vol: number) => void;
127
+ toggleMute: () => void;
128
+ requestFullscreen: () => void;
129
+ }
130
+
131
+ export type { BaseUploaderProps, FileUploaderProps, ImageUploaderProps, MediaUploaderProps, SiloTheme, VideoPlayerControls, VideoPlayerProps, VideoUploaderProps };
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=types.js.map
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"types.js"}
@@ -0,0 +1,4 @@
1
+ declare function formatBytes(bytes: number): string;
2
+ declare function getFileIcon(mimeType: string): string;
3
+
4
+ export { formatBytes, getFileIcon };
@@ -0,0 +1,22 @@
1
+ // src/utils/format.ts
2
+ function formatBytes(bytes) {
3
+ if (bytes < 1024) return `${bytes} B`;
4
+ if (bytes < 1024 ** 2) return `${(bytes / 1024).toFixed(1)} KB`;
5
+ if (bytes < 1024 ** 3) return `${(bytes / 1024 ** 2).toFixed(1)} MB`;
6
+ return `${(bytes / 1024 ** 3).toFixed(2)} GB`;
7
+ }
8
+ function getFileIcon(mimeType) {
9
+ if (mimeType.startsWith("image/")) return "\u{1F5BC}\uFE0F";
10
+ if (mimeType.startsWith("video/")) return "\u{1F3AC}";
11
+ if (mimeType.startsWith("audio/")) return "\u{1F3B5}";
12
+ if (mimeType === "application/pdf") return "\u{1F4C4}";
13
+ if (mimeType.includes("spreadsheet") || mimeType.includes("excel")) return "\u{1F4CA}";
14
+ if (mimeType.includes("presentation") || mimeType.includes("powerpoint")) return "\u{1F4D1}";
15
+ if (mimeType.includes("word") || mimeType.includes("document")) return "\u{1F4DD}";
16
+ if (mimeType.includes("zip") || mimeType.includes("tar") || mimeType.includes("gzip")) return "\u{1F4E6}";
17
+ return "\u{1F4CE}";
18
+ }
19
+
20
+ export { formatBytes, getFileIcon };
21
+ //# sourceMappingURL=format.js.map
22
+ //# sourceMappingURL=format.js.map
@@ -0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AK,QAAA,CAAS,QAAA,CAAS,KAAK,CAAA,IAAK,QAAA,CAAS,QAAA,CAAS,MAAM,CAAA,EAAG,OAAO,WAAA;AAC9F,EAAA,OAAO,WAAA;AACT","file":"format.js","sourcesContent":["export function formatBytes(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 ** 2) return `${(bytes / 1024).toFixed(1)} KB`;\n if (bytes < 1024 ** 3) return `${(bytes / 1024 ** 2).toFixed(1)} MB`;\n return `${(bytes / 1024 ** 3).toFixed(2)} GB`;\n}\n\nexport function getFileIcon(mimeType: string): string {\n if (mimeType.startsWith(\"image/\")) return \"🖼️\";\n if (mimeType.startsWith(\"video/\")) return \"🎬\";\n if (mimeType.startsWith(\"audio/\")) return \"🎵\";\n if (mimeType === \"application/pdf\") return \"📄\";\n if (mimeType.includes(\"spreadsheet\") || mimeType.includes(\"excel\")) return \"📊\";\n if (mimeType.includes(\"presentation\") || mimeType.includes(\"powerpoint\")) return \"📑\";\n if (mimeType.includes(\"word\") || mimeType.includes(\"document\")) return \"📝\";\n if (mimeType.includes(\"zip\") || mimeType.includes(\"tar\") || mimeType.includes(\"gzip\")) return \"📦\";\n return \"📎\";\n}\n"]}
@@ -0,0 +1,8 @@
1
+ import { SiloTheme } from '../types.js';
2
+ import '@geekapps/silo-nextjs';
3
+
4
+ declare const defaultTheme: Required<SiloTheme>;
5
+ declare function resolveTheme(theme?: SiloTheme): Required<SiloTheme>;
6
+ declare function themeToVars(theme: Required<SiloTheme>): Record<string, string>;
7
+
8
+ export { defaultTheme, resolveTheme, themeToVars };
@@ -0,0 +1,38 @@
1
+ // src/utils/theme.ts
2
+ var defaultTheme = {
3
+ borderColor: "#e2e8f0",
4
+ borderColorActive: "#6366f1",
5
+ backgroundColor: "#f8fafc",
6
+ backgroundColorHover: "#f1f5f9",
7
+ textColor: "#0f172a",
8
+ textColorMuted: "#64748b",
9
+ accentColor: "#6366f1",
10
+ accentColorHover: "#4f46e5",
11
+ errorColor: "#ef4444",
12
+ successColor: "#22c55e",
13
+ borderRadius: "12px",
14
+ fontFamily: "inherit"
15
+ };
16
+ function resolveTheme(theme) {
17
+ return { ...defaultTheme, ...theme };
18
+ }
19
+ function themeToVars(theme) {
20
+ return {
21
+ "--silo-border": theme.borderColor,
22
+ "--silo-border-active": theme.borderColorActive,
23
+ "--silo-bg": theme.backgroundColor,
24
+ "--silo-bg-hover": theme.backgroundColorHover,
25
+ "--silo-text": theme.textColor,
26
+ "--silo-text-muted": theme.textColorMuted,
27
+ "--silo-accent": theme.accentColor,
28
+ "--silo-accent-hover": theme.accentColorHover,
29
+ "--silo-error": theme.errorColor,
30
+ "--silo-success": theme.successColor,
31
+ "--silo-radius": theme.borderRadius,
32
+ "--silo-font": theme.fontFamily
33
+ };
34
+ }
35
+
36
+ export { defaultTheme, resolveTheme, themeToVars };
37
+ //# sourceMappingURL=theme.js.map
38
+ //# sourceMappingURL=theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/theme.ts"],"names":[],"mappings":";AAEO,IAAM,YAAA,GAAoC;AAAA,EAC/C,WAAA,EAAa,SAAA;AAAA,EACb,iBAAA,EAAmB,SAAA;AAAA,EACnB,eAAA,EAAiB,SAAA;AAAA,EACjB,oBAAA,EAAsB,SAAA;AAAA,EACtB,SAAA,EAAW,SAAA;AAAA,EACX,cAAA,EAAgB,SAAA;AAAA,EAChB,WAAA,EAAa,SAAA;AAAA,EACb,gBAAA,EAAkB,SAAA;AAAA,EAClB,UAAA,EAAY,SAAA;AAAA,EACZ,YAAA,EAAc,SAAA;AAAA,EACd,YAAA,EAAc,MAAA;AAAA,EACd,UAAA,EAAY;AACd;AAEO,SAAS,aAAa,KAAA,EAAwC;AACnE,EAAA,OAAO,EAAE,GAAG,YAAA,EAAc,GAAG,KAAA,EAAM;AACrC;AAEO,SAAS,YAAY,KAAA,EAAoD;AAC9E,EAAA,OAAO;AAAA,IACL,iBAAiB,KAAA,CAAM,WAAA;AAAA,IACvB,wBAAwB,KAAA,CAAM,iBAAA;AAAA,IAC9B,aAAa,KAAA,CAAM,eAAA;AAAA,IACnB,mBAAmB,KAAA,CAAM,oBAAA;AAAA,IACzB,eAAe,KAAA,CAAM,SAAA;AAAA,IACrB,qBAAqB,KAAA,CAAM,cAAA;AAAA,IAC3B,iBAAiB,KAAA,CAAM,WAAA;AAAA,IACvB,uBAAuB,KAAA,CAAM,gBAAA;AAAA,IAC7B,gBAAgB,KAAA,CAAM,UAAA;AAAA,IACtB,kBAAkB,KAAA,CAAM,YAAA;AAAA,IACxB,iBAAiB,KAAA,CAAM,YAAA;AAAA,IACvB,eAAe,KAAA,CAAM;AAAA,GACvB;AACF","file":"theme.js","sourcesContent":["import type { SiloTheme } from \"../types.js\";\n\nexport const defaultTheme: Required<SiloTheme> = {\n borderColor: \"#e2e8f0\",\n borderColorActive: \"#6366f1\",\n backgroundColor: \"#f8fafc\",\n backgroundColorHover: \"#f1f5f9\",\n textColor: \"#0f172a\",\n textColorMuted: \"#64748b\",\n accentColor: \"#6366f1\",\n accentColorHover: \"#4f46e5\",\n errorColor: \"#ef4444\",\n successColor: \"#22c55e\",\n borderRadius: \"12px\",\n fontFamily: \"inherit\",\n};\n\nexport function resolveTheme(theme?: SiloTheme): Required<SiloTheme> {\n return { ...defaultTheme, ...theme };\n}\n\nexport function themeToVars(theme: Required<SiloTheme>): Record<string, string> {\n return {\n \"--silo-border\": theme.borderColor,\n \"--silo-border-active\": theme.borderColorActive,\n \"--silo-bg\": theme.backgroundColor,\n \"--silo-bg-hover\": theme.backgroundColorHover,\n \"--silo-text\": theme.textColor,\n \"--silo-text-muted\": theme.textColorMuted,\n \"--silo-accent\": theme.accentColor,\n \"--silo-accent-hover\": theme.accentColorHover,\n \"--silo-error\": theme.errorColor,\n \"--silo-success\": theme.successColor,\n \"--silo-radius\": theme.borderRadius,\n \"--silo-font\": theme.fontFamily,\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geekapps/silo-elements-nextjs",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "Silo UI elements — beautiful, customizable upload components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",