@appforgeapps/uiforge 0.1.0 → 0.5.0

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.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { default as default_2 } from 'react';
2
+ import { FC } from 'react';
2
3
  import { JSX } from 'react/jsx-runtime';
3
4
 
4
5
  /**
@@ -43,16 +44,22 @@ export declare interface ActivityEvent {
43
44
  children?: ActivityEvent[];
44
45
  }
45
46
 
47
+ /**
48
+ * Icon Maps - Icon lookup tables for easy access to icon components
49
+ *
50
+ * These maps are in a separate file to avoid React Fast Refresh issues
51
+ * when exporting both components and constants from the same file.
52
+ */
46
53
  export declare const ActivityIcons: {
47
- commit: default_2.FC<IconProps>;
48
- pr: default_2.FC<IconProps>;
49
- issue: default_2.FC<IconProps>;
50
- comment: default_2.FC<IconProps>;
51
- star: default_2.FC<IconProps>;
52
- fork: default_2.FC<IconProps>;
53
- merge: default_2.FC<IconProps>;
54
- release: default_2.FC<IconProps>;
55
- deploy: default_2.FC<IconProps>;
54
+ commit: FC<IconProps>;
55
+ pr: FC<IconProps>;
56
+ issue: FC<IconProps>;
57
+ comment: FC<IconProps>;
58
+ star: FC<IconProps>;
59
+ fork: FC<IconProps>;
60
+ merge: FC<IconProps>;
61
+ release: FC<IconProps>;
62
+ deploy: FC<IconProps>;
56
63
  };
57
64
 
58
65
  /**
@@ -94,11 +101,11 @@ export declare const BugIcon: default_2.FC<IconProps>;
94
101
  export declare const BuildIcon: default_2.FC<IconProps>;
95
102
 
96
103
  export declare const BusinessIcons: {
97
- chart: default_2.FC<IconProps>;
98
- meeting: default_2.FC<IconProps>;
99
- document: default_2.FC<IconProps>;
100
- calendar: default_2.FC<IconProps>;
101
- briefcase: default_2.FC<IconProps>;
104
+ chart: FC<IconProps>;
105
+ meeting: FC<IconProps>;
106
+ document: FC<IconProps>;
107
+ calendar: FC<IconProps>;
108
+ briefcase: FC<IconProps>;
102
109
  };
103
110
 
104
111
  /**
@@ -196,35 +203,83 @@ export declare const DeployIcon: default_2.FC<IconProps>;
196
203
 
197
204
  export declare const DeploymentIcon: default_2.FC<IconProps>;
198
205
 
206
+ /**
207
+ * Detect which video provider handles a given URL
208
+ * @param url - The video URL to analyze
209
+ * @returns The matching VideoProvider or null if not found
210
+ */
211
+ export declare function detectProvider(url: string): VideoProvider | null;
212
+
199
213
  export declare const DevProcessIcons: {
200
- gitbranch: default_2.FC<IconProps>;
201
- prdraft: default_2.FC<IconProps>;
202
- testing: default_2.FC<IconProps>;
203
- deployment: default_2.FC<IconProps>;
204
- review: default_2.FC<IconProps>;
205
- build: default_2.FC<IconProps>;
214
+ gitbranch: FC<IconProps>;
215
+ prdraft: FC<IconProps>;
216
+ testing: FC<IconProps>;
217
+ deployment: FC<IconProps>;
218
+ review: FC<IconProps>;
219
+ build: FC<IconProps>;
206
220
  };
207
221
 
208
222
  export declare const DocumentIcon: default_2.FC<IconProps>;
209
223
 
210
224
  export declare const DumbbellIcon: default_2.FC<IconProps>;
211
225
 
226
+ /**
227
+ * Options for video embedding
228
+ */
229
+ export declare interface EmbedOptions {
230
+ /**
231
+ * Enable autoplay (note: most browsers require muted=true for autoplay to work)
232
+ */
233
+ autoplay?: boolean;
234
+ /**
235
+ * Mute the video by default
236
+ */
237
+ muted?: boolean;
238
+ /**
239
+ * Loop the video
240
+ */
241
+ loop?: boolean;
242
+ /**
243
+ * Start time in seconds
244
+ */
245
+ startTime?: number;
246
+ /**
247
+ * Show video controls
248
+ */
249
+ controls?: boolean;
250
+ }
251
+
212
252
  /**
213
253
  * Export format options
214
254
  */
215
255
  export declare type ExportFormat = 'json' | 'html' | 'markdown';
216
256
 
257
+ /**
258
+ * Extract video ID from a URL using the appropriate provider
259
+ * @param url - The video URL to parse
260
+ * @returns Object containing the provider and video ID, or null if not found
261
+ */
262
+ export declare function extractVideoId(url: string): VideoIdExtractionResult | null;
263
+
217
264
  export declare const FitnessIcons: {
218
- dumbbell: default_2.FC<IconProps>;
219
- running: default_2.FC<IconProps>;
220
- heartrate: default_2.FC<IconProps>;
221
- strength: default_2.FC<IconProps>;
265
+ dumbbell: FC<IconProps>;
266
+ running: FC<IconProps>;
267
+ heartrate: FC<IconProps>;
268
+ strength: FC<IconProps>;
222
269
  };
223
270
 
224
271
  export declare const FoldIcon: default_2.FC<IconProps>;
225
272
 
226
273
  export declare const ForkIcon: default_2.FC<IconProps>;
227
274
 
275
+ /**
276
+ * Get embed URL from a video URL
277
+ * @param url - The video URL
278
+ * @param options - Embed options
279
+ * @returns The embed URL or null if not found
280
+ */
281
+ export declare function getEmbedUrlFromVideoUrl(url: string, options?: Parameters<VideoProvider['getEmbedUrl']>[1]): string | null;
282
+
228
283
  export declare const GitBranchIcon: default_2.FC<IconProps>;
229
284
 
230
285
  /**
@@ -321,6 +376,13 @@ export declare interface IconProps {
321
376
  color?: string;
322
377
  }
323
378
 
379
+ /**
380
+ * Check if a URL is from an adult content provider
381
+ * @param url - The video URL to check
382
+ * @returns true if the URL is from an adult content provider
383
+ */
384
+ export declare function isAdultContent(url: string): boolean;
385
+
324
386
  export declare const IssueIcon: default_2.FC<IconProps>;
325
387
 
326
388
  export declare const MeditationIcon: default_2.FC<IconProps>;
@@ -331,6 +393,11 @@ export declare const MergeIcon: default_2.FC<IconProps>;
331
393
 
332
394
  export declare const PlanetIcon: default_2.FC<IconProps>;
333
395
 
396
+ /**
397
+ * Map of provider names to provider objects for quick lookup
398
+ */
399
+ export declare const providersByName: Record<string, VideoProvider>;
400
+
334
401
  export declare const PullRequestDraftIcon: default_2.FC<IconProps>;
335
402
 
336
403
  export declare const PullRequestIcon: default_2.FC<IconProps>;
@@ -348,11 +415,11 @@ export declare const SatelliteIcon: default_2.FC<IconProps>;
348
415
  export declare const ServerIcon: default_2.FC<IconProps>;
349
416
 
350
417
  export declare const SpaceIcons: {
351
- rocket: default_2.FC<IconProps>;
352
- satellite: default_2.FC<IconProps>;
353
- alien: default_2.FC<IconProps>;
354
- planet: default_2.FC<IconProps>;
355
- telescope: default_2.FC<IconProps>;
418
+ rocket: FC<IconProps>;
419
+ satellite: FC<IconProps>;
420
+ alien: FC<IconProps>;
421
+ planet: FC<IconProps>;
422
+ telescope: FC<IconProps>;
356
423
  };
357
424
 
358
425
  export declare const StarIcon: default_2.FC<IconProps>;
@@ -362,12 +429,12 @@ export declare const StrengthIcon: default_2.FC<IconProps>;
362
429
  export declare const TaiChiIcon: default_2.FC<IconProps>;
363
430
 
364
431
  export declare const TechIcons: {
365
- server: default_2.FC<IconProps>;
366
- database: default_2.FC<IconProps>;
367
- cloud: default_2.FC<IconProps>;
368
- terminal: default_2.FC<IconProps>;
369
- bug: default_2.FC<IconProps>;
370
- code: default_2.FC<IconProps>;
432
+ server: FC<IconProps>;
433
+ database: FC<IconProps>;
434
+ cloud: FC<IconProps>;
435
+ terminal: FC<IconProps>;
436
+ bug: FC<IconProps>;
437
+ code: FC<IconProps>;
371
438
  };
372
439
 
373
440
  export declare const TelescopeIcon: default_2.FC<IconProps>;
@@ -722,24 +789,29 @@ export declare interface UIForgeGridProps<T = Record<string, unknown>> {
722
789
  }
723
790
 
724
791
  /**
725
- * UIForgeVideo - A video component with overlay that supports YouTube and Vimeo embeds
792
+ * UIForgeVideo - A universal video component that supports 30+ video platforms
726
793
  *
727
794
  * Features:
728
- * - Displays video title and optional description
729
- * - Supports YouTube and Vimeo video embeds
795
+ * - Auto-detects video provider from URL
796
+ * - Supports 30+ video platforms including YouTube, Vimeo, Twitch, and more
730
797
  * - Shows thumbnail with overlay icon before playing
731
- * - Emits event when video is clicked to play
798
+ * - Emits events for video interactions
732
799
  * - Lazy loads the video player on interaction
800
+ * - Adult content filtering (disabled by default)
801
+ * - Responsive design with configurable aspect ratios
733
802
  *
734
803
  * @example
735
804
  * ```tsx
805
+ * // Auto-detect from URL
806
+ * <UIForgeVideo url="https://www.youtube.com/watch?v=dQw4w9WgXcQ" />
807
+ *
808
+ * // With options
736
809
  * <UIForgeVideo
737
- * title="Introduction to React"
738
- * description="Learn React basics in this tutorial"
739
- * youtubeId="dQw4w9WgXcQ"
740
- * onPlay={(videoId, provider) => {
741
- * console.log(`Playing ${provider} video: ${videoId}`)
742
- * }}
810
+ * url="https://vimeo.com/123456789"
811
+ * autoplay={false}
812
+ * muted={true}
813
+ * aspectRatio="16:9"
814
+ * onPlay={(id, provider) => console.log(`Playing ${provider} video ${id}`)}
743
815
  * />
744
816
  * ```
745
817
  */
@@ -790,21 +862,56 @@ export declare interface UIForgeVideoPreviewProps {
790
862
  */
791
863
  export declare interface UIForgeVideoProps {
792
864
  /**
793
- * Video title
865
+ * Video title (optional when using url prop)
794
866
  */
795
- title: string;
867
+ title?: string;
796
868
  /**
797
869
  * Video description
798
870
  */
799
871
  description?: string;
872
+ /**
873
+ * Video URL from any supported platform
874
+ * The provider and video ID will be automatically detected
875
+ */
876
+ url?: string;
800
877
  /**
801
878
  * YouTube video ID (e.g., "dQw4w9WgXcQ" from https://www.youtube.com/watch?v=dQw4w9WgXcQ)
879
+ * @deprecated Use url prop instead
802
880
  */
803
881
  youtubeId?: string;
804
882
  /**
805
883
  * Vimeo video ID (e.g., "123456789" from https://vimeo.com/123456789)
884
+ * @deprecated Use url prop instead
806
885
  */
807
886
  vimeoId?: string;
887
+ /**
888
+ * Directly specify the provider name (e.g., "youtube", "vimeo")
889
+ */
890
+ provider?: string;
891
+ /**
892
+ * Video ID when using direct provider specification
893
+ */
894
+ videoId?: string;
895
+ /**
896
+ * Enable autoplay (note: most browsers require muted=true for autoplay to work)
897
+ */
898
+ autoplay?: boolean;
899
+ /**
900
+ * Mute the video by default
901
+ */
902
+ muted?: boolean;
903
+ /**
904
+ * Loop the video
905
+ */
906
+ loop?: boolean;
907
+ /**
908
+ * Start time in seconds
909
+ */
910
+ startTime?: number;
911
+ /**
912
+ * Show video controls (default: true)
913
+ */
914
+ controls?: boolean;
808
915
  /**
809
916
  * Custom thumbnail URL (optional, will use provider's default if not specified)
810
917
  */
@@ -812,34 +919,124 @@ export declare interface UIForgeVideoProps {
812
919
  /**
813
920
  * Callback fired when the video overlay is clicked and playback begins
814
921
  */
815
- onPlay?: (videoId: string, provider: 'youtube' | 'vimeo') => void;
922
+ onPlay?: (videoId: string, provider: string) => void;
923
+ /**
924
+ * Callback fired when video playback is paused
925
+ */
926
+ onPause?: (videoId: string, provider: string) => void;
927
+ /**
928
+ * Callback fired when video playback ends
929
+ */
930
+ onEnded?: (videoId: string, provider: string) => void;
931
+ /**
932
+ * Callback fired when an error occurs
933
+ */
934
+ onError?: (error: Error, provider: string) => void;
935
+ /**
936
+ * Callback fired when the video player is ready
937
+ */
938
+ onReady?: (videoId: string, provider: string) => void;
816
939
  /**
817
940
  * Custom className for styling
818
941
  */
819
942
  className?: string;
943
+ /**
944
+ * Aspect ratio of the video player (default: "16:9")
945
+ */
946
+ aspectRatio?: '16:9' | '4:3' | '1:1' | 'auto' | string;
947
+ /**
948
+ * Width of the video player
949
+ */
950
+ width?: string | number;
951
+ /**
952
+ * Height of the video player
953
+ */
954
+ height?: string | number;
820
955
  /**
821
956
  * Custom overlay icon (defaults to play icon)
822
957
  */
823
958
  overlayIcon?: default_2.ReactNode;
824
959
  /**
825
- * Aspect ratio of the video player (default: "16/9")
960
+ * Allow adult content to be embedded
961
+ * Default: false (must be explicitly enabled)
962
+ */
963
+ allowAdultContent?: boolean;
964
+ /**
965
+ * Fallback content when video cannot be loaded
826
966
  */
827
- aspectRatio?: string;
967
+ fallback?: default_2.ReactNode;
828
968
  }
829
969
 
830
970
  export declare const UIIcons: {
831
- unfold: default_2.FC<IconProps>;
832
- fold: default_2.FC<IconProps>;
833
- close: default_2.FC<IconProps>;
834
- check: default_2.FC<IconProps>;
971
+ unfold: FC<IconProps>;
972
+ fold: FC<IconProps>;
973
+ close: FC<IconProps>;
974
+ check: FC<IconProps>;
835
975
  };
836
976
 
837
977
  export declare const UnfoldIcon: default_2.FC<IconProps>;
838
978
 
979
+ /**
980
+ * Result of video ID extraction from a URL
981
+ */
982
+ declare interface VideoIdExtractionResult {
983
+ provider: VideoProvider;
984
+ videoId: string;
985
+ }
986
+
987
+ /**
988
+ * Video provider interface
989
+ */
990
+ export declare interface VideoProvider {
991
+ /**
992
+ * Internal provider name (lowercase, no spaces)
993
+ */
994
+ name: string;
995
+ /**
996
+ * Display name for the provider
997
+ */
998
+ displayName: string;
999
+ /**
1000
+ * Domains this provider handles
1001
+ */
1002
+ domains: string[];
1003
+ /**
1004
+ * Extract video ID from a URL
1005
+ */
1006
+ extractVideoId: (url: string) => string | null;
1007
+ /**
1008
+ * Generate embed URL for a video ID
1009
+ */
1010
+ getEmbedUrl: (videoId: string, options?: EmbedOptions) => string;
1011
+ /**
1012
+ * Whether the provider supports autoplay
1013
+ */
1014
+ supportsAutoplay?: boolean;
1015
+ /**
1016
+ * Whether the provider has a JavaScript API
1017
+ */
1018
+ supportsApi?: boolean;
1019
+ /**
1020
+ * Provider tier classification
1021
+ */
1022
+ tier: VideoProviderTier;
1023
+ }
1024
+
1025
+ /**
1026
+ * Array of all registered video providers
1027
+ * Ordered by tier and priority for matching
1028
+ */
1029
+ export declare const videoProviders: VideoProvider[];
1030
+
1031
+ /**
1032
+ * Video provider tier classification
1033
+ */
1034
+ export declare type VideoProviderTier = 'major' | 'professional' | 'cloud' | 'social' | 'adult';
1035
+
839
1036
  export declare const WellnessIcons: {
840
- taichi: default_2.FC<IconProps>;
841
- meditation: default_2.FC<IconProps>;
842
- yoga: default_2.FC<IconProps>;
1037
+ taichi: FC<IconProps>;
1038
+ meditation: FC<IconProps>;
1039
+ yoga: FC<IconProps>;
843
1040
  };
844
1041
 
845
1042
  export declare const YogaIcon: default_2.FC<IconProps>;