vime_view_components 0.1.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.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +35 -0
  4. data/Rakefile +12 -0
  5. data/lib/vime/component.rb +39 -0
  6. data/lib/vime/core/embed.rb +27 -0
  7. data/lib/vime/core/player.rb +53 -0
  8. data/lib/vime/core/playground.rb +29 -0
  9. data/lib/vime/providers/audio.rb +25 -0
  10. data/lib/vime/providers/dailymotion.rb +37 -0
  11. data/lib/vime/providers/dash.rb +39 -0
  12. data/lib/vime/providers/file.rb +37 -0
  13. data/lib/vime/providers/hls.rb +33 -0
  14. data/lib/vime/providers/video.rb +29 -0
  15. data/lib/vime/providers/vimeo.rb +31 -0
  16. data/lib/vime/providers/youtube.rb +27 -0
  17. data/lib/vime/ui/captions.rb +23 -0
  18. data/lib/vime/ui/click_to_play.rb +21 -0
  19. data/lib/vime/ui/controls/caption_control.rb +33 -0
  20. data/lib/vime/ui/controls/control.rb +35 -0
  21. data/lib/vime/ui/controls/control_group.rb +23 -0
  22. data/lib/vime/ui/controls/control_spacer.rb +15 -0
  23. data/lib/vime/ui/controls/controls.rb +43 -0
  24. data/lib/vime/ui/controls/default_controls.rb +29 -0
  25. data/lib/vime/ui/controls/fullscreen_control.rb +33 -0
  26. data/lib/vime/ui/controls/mute_control.rb +35 -0
  27. data/lib/vime/ui/controls/pip_control.rb +33 -0
  28. data/lib/vime/ui/controls/playback_control.rb +33 -0
  29. data/lib/vime/ui/controls/scrubber_control.rb +27 -0
  30. data/lib/vime/ui/controls/settings_control.rb +31 -0
  31. data/lib/vime/ui/controls/volume_control.rb +37 -0
  32. data/lib/vime/ui/dbl_click_fullscreen.rb +21 -0
  33. data/lib/vime/ui/default_ui.rb +37 -0
  34. data/lib/vime/ui/icon.rb +21 -0
  35. data/lib/vime/ui/icons.rb +21 -0
  36. data/lib/vime/ui/live_indicator.rb +13 -0
  37. data/lib/vime/ui/poster.rb +21 -0
  38. data/lib/vime/ui/scrim.rb +21 -0
  39. data/lib/vime/ui/settings/default_settings.rb +23 -0
  40. data/lib/vime/ui/settings/menu.rb +27 -0
  41. data/lib/vime/ui/settings/menu_item.rb +39 -0
  42. data/lib/vime/ui/settings/menu_radio.rb +31 -0
  43. data/lib/vime/ui/settings/menu_radio_group.rb +23 -0
  44. data/lib/vime/ui/settings/settings.rb +27 -0
  45. data/lib/vime/ui/settings/submenu.rb +29 -0
  46. data/lib/vime/ui/skeleton.rb +21 -0
  47. data/lib/vime/ui/slider.rb +31 -0
  48. data/lib/vime/ui/spinner.rb +13 -0
  49. data/lib/vime/ui/time/current_time.rb +23 -0
  50. data/lib/vime/ui/time/end_time.rb +23 -0
  51. data/lib/vime/ui/time/time.rb +27 -0
  52. data/lib/vime/ui/time/time_progress.rb +25 -0
  53. data/lib/vime/ui/tooltip.rb +27 -0
  54. data/lib/vime/ui/ui.rb +13 -0
  55. data/lib/vime_view_components.rb +68 -0
  56. data/lib/vime_view_components/version.rb +5 -0
  57. metadata +204 -0
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/providers/youtube
4
+
5
+ module Vime
6
+ module Providers
7
+ class Youtube < Component
8
+ option :cookies, type: Types::Bool, default: -> { false }
9
+ option :poster, type: Types::String, optional: true
10
+ option :show_fullscreen_control, type: Types::Bool, default: -> { true }
11
+ option :video_id, type: Types::String
12
+
13
+ def call
14
+ tag "vime-youtube", process_attrs(dom_attrs)
15
+ end
16
+
17
+ def dom_attrs
18
+ super.merge({
19
+ cookies: cookies,
20
+ poster: poster,
21
+ show_fullscreen_control: show_fullscreen_control,
22
+ video_id: video_id,
23
+ })
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/captions
4
+
5
+ module Vime
6
+ module Ui
7
+ class Captions < Component
8
+ option :controls_height, type: Types::Integer, default: -> { 0 }
9
+ option :hidden, type: Types::Bool, default: -> { false }
10
+
11
+ def call
12
+ tag "vime-captions", process_attrs(dom_attrs)
13
+ end
14
+
15
+ def dom_attrs
16
+ super.merge({
17
+ controls_height: controls_height,
18
+ hidden: hidden,
19
+ })
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/click-to-play
4
+
5
+ module Vime
6
+ module Ui
7
+ class ClickToPlay < Component
8
+ option :use_on_mobile, type: Types::Bool, default: -> { false }
9
+
10
+ def call
11
+ tag "vime-click-to-play", process_attrs(dom_attrs)
12
+ end
13
+
14
+ def dom_attrs
15
+ super.merge({
16
+ use_on_mobile: use_on_mobile,
17
+ })
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/controls/caption-control
4
+
5
+ module Vime
6
+ module Ui
7
+ module Controls
8
+ class CaptionControl < Component
9
+ option :hide_icon, type: Types::String, default: -> { "#vime-captions-off" }
10
+ option :hide_tooltip, type: Types::Bool, default: -> { false }
11
+ option :keys, type: Types::String, default: -> { "c" }
12
+ option :show_icon, type: Types::String, default: -> { "#vime-captions-on" }
13
+ option :tooltip_direction, type: Types::TooltipDirection, optional: true
14
+ option :tooltip_position, type: Types::TooltipPosition, default: -> { "top" }
15
+
16
+ def call
17
+ tag "vime-caption-control", process_attrs(dom_attrs)
18
+ end
19
+
20
+ def dom_attrs
21
+ super.merge({
22
+ hide_icon: hide_icon,
23
+ hide_tooltip: hide_tooltip,
24
+ keys: keys,
25
+ show_icon: show_icon,
26
+ tooltip_direction: tooltip_direction,
27
+ tooltip_position: tooltip_position,
28
+ })
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/controls/control
4
+
5
+ module Vime
6
+ module Ui
7
+ module Controls
8
+ class Control < Component
9
+ option :expanded, type: Types::Bool, optional: true
10
+ option :hidden, type: Types::Bool, default: -> { false }
11
+ option :identifier, type: Types::String, optional: true
12
+ option :keys, type: Types::String, optional: true
13
+ option :label, type: Types::String
14
+ option :menu, type: Types::String, optional: true
15
+ option :pressed, type: Types::Bool, optional: true
16
+
17
+ def call
18
+ content_tag "vime-control", content, process_attrs(dom_attrs)
19
+ end
20
+
21
+ def dom_attrs
22
+ super.merge({
23
+ expanded: expanded,
24
+ hidden: hidden,
25
+ identifier: identifier,
26
+ keys: keys,
27
+ label: label,
28
+ menu: menu,
29
+ pressed: pressed,
30
+ })
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/controls/control-group
4
+
5
+ module Vime
6
+ module Ui
7
+ module Controls
8
+ class ControlGroup < Component
9
+ option :space, type: Types::String.enum("both", "bottom", "none", "top"), default: -> { "none" }
10
+
11
+ def call
12
+ content_tag "vime-control-group", content, process_attrs(dom_attrs)
13
+ end
14
+
15
+ def dom_attrs
16
+ super.merge({
17
+ space: space,
18
+ })
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/controls/control-spacer
4
+
5
+ module Vime
6
+ module Ui
7
+ module Controls
8
+ class ControlSpacer < Component
9
+ def call
10
+ tag "vime-control-spacer", process_attrs(dom_attrs)
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/controls/controls
4
+
5
+ module Vime
6
+ module Ui
7
+ module Controls
8
+ class Controls < Component
9
+ option :active_duration, type: Types::Integer, default: -> { 2750 }
10
+ option :align, type: Types::String.enum("center", "end", "start"), default: -> { "center" }
11
+ option :direction, type: Types::String.enum("column", "row"), default: -> { "row" }
12
+ option :full_height, type: Types::Bool, default: -> { false }
13
+ option :full_width, type: Types::Bool, default: -> { false }
14
+ option :hidden, type: Types::Bool, default: -> { false }
15
+ option :hide_on_mouse_leave, type: Types::Bool, default: -> { false }
16
+ option :hide_when_paused, type: Types::Bool, default: -> { false }
17
+ option :justify, type: Types::String.enum("center", "end", "space-around", "space-between", "space-evenly", "start"), default: -> { "start" }
18
+ option :pin, type: Types::Pin, default: -> { "bottomLeft" }
19
+ option :wait_for_playback_start, type: Types::Bool, default: -> { false }
20
+
21
+ def call
22
+ content_tag "vime-controls", content, process_attrs(dom_attrs)
23
+ end
24
+
25
+ def dom_attrs
26
+ super.merge({
27
+ active_duration: active_duration,
28
+ align: align,
29
+ direction: direction,
30
+ full_height: full_height,
31
+ full_width: full_width,
32
+ hidden: hidden,
33
+ hide_on_mouse_leave: hide_on_mouse_leave,
34
+ hide_when_paused: hide_when_paused,
35
+ justify: justify,
36
+ pin: pin,
37
+ wait_for_playback_start: wait_for_playback_start
38
+ })
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/controls/default-controls
4
+
5
+ module Vime
6
+ module Ui
7
+ module Controls
8
+ class DefaultControls < Component
9
+ option :active_duration, type: Types::Integer, default: -> { 2750 }
10
+ option :hide_on_mouse_leave, type: Types::Bool, default: -> { false }
11
+ option :hide_when_paused, type: Types::Bool, default: -> { false }
12
+ option :wait_for_playback_start, type: Types::Bool, default: -> { false }
13
+
14
+ def call
15
+ tag "vime-default-controls", process_attrs(dom_attrs)
16
+ end
17
+
18
+ def dom_attrs
19
+ super.merge({
20
+ active_duration: active_duration,
21
+ hide_on_mouse_leave: hide_on_mouse_leave,
22
+ hide_when_paused: hide_when_paused,
23
+ wait_for_playback_start: wait_for_playback_start
24
+ })
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/controls/fullscreen-control
4
+
5
+ module Vime
6
+ module Ui
7
+ module Controls
8
+ class FullscreenControl < Component
9
+ option :enter_icon, type: Types::String, default: -> { "#vime-enter-fullscreen" }
10
+ option :exit_icon, type: Types::String, default: -> { "#vime-exit-fullscreen" }
11
+ option :hide_tooltip, type: Types::Bool, default: -> { false }
12
+ option :keys, type: Types::String, optional: true, default: -> { "f" }
13
+ option :tooltip_direction, type: Types::TooltipDirection, optional: true
14
+ option :tooltip_position, type: Types::TooltipPosition, default: -> { "top" }
15
+
16
+ def call
17
+ tag "vime-fullscreen-control", process_attrs(dom_attrs)
18
+ end
19
+
20
+ def dom_attrs
21
+ super.merge({
22
+ enter_icon: enter_icon,
23
+ exit_icon: exit_icon,
24
+ hide_tooltip: hide_tooltip,
25
+ keys: keys,
26
+ tooltip_direction: tooltip_direction,
27
+ tooltip_position: tooltip_position,
28
+ })
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/controls/mute-control
4
+
5
+ module Vime
6
+ module Ui
7
+ module Controls
8
+ class MuteControl < Component
9
+ option :hide_tooltip, type: Types::Bool, default: -> { false }
10
+ option :high_volume_icon, type: Types::String, default: -> { "#vime-volume-high" }
11
+ option :keys, type: Types::String.optional, default: -> { "m" }
12
+ option :low_volume_icon, type: Types::String, default: -> { "#vime-volume-low" }
13
+ option :muted_icon, type: Types::String, default: -> { "#vime-volume-mute" }
14
+ option :tooltip_direction, type: Types::TooltipDirection, optional: true
15
+ option :tooltip_position, type: Types::TooltipPosition, default: -> { "top" }
16
+
17
+ def call
18
+ tag "vime-mute-control", process_attrs(dom_attrs)
19
+ end
20
+
21
+ def dom_attrs
22
+ super.merge({
23
+ hide_tooltip: hide_tooltip,
24
+ high_volume_icon: high_volume_icon,
25
+ keys: keys,
26
+ low_volume_icon: low_volume_icon,
27
+ muted_icon: muted_icon,
28
+ tooltip_direction: tooltip_direction,
29
+ tooltip_position: tooltip_position,
30
+ })
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/controls/pip-control
4
+
5
+ module Vime
6
+ module Ui
7
+ module Controls
8
+ class PipControl < Component
9
+ option :enter_icon, type: Types::String, default: -> { "#vime-enter-pip" }
10
+ option :exit_icon, type: Types::String, default: -> { "#vime-exit-pip" }
11
+ option :hide_tooltip, type: Types::Bool, default: -> { false }
12
+ option :keys, type: Types::String, default: -> { "p" }
13
+ option :tooltip_direction, type: Types::TooltipDirection, optional: true
14
+ option :tooltip_position, type: Types::TooltipPosition, default: -> { "top" }
15
+
16
+ def call
17
+ tag "vime-pip-control", process_attrs(dom_attrs)
18
+ end
19
+
20
+ def dom_attrs
21
+ super.merge({
22
+ enter_icon: enter_icon,
23
+ exit_icon: exit_icon,
24
+ hide_tooltip: hide_tooltip,
25
+ keys: keys,
26
+ tooltip_direction: tooltip_direction,
27
+ tooltip_position: tooltip_position,
28
+ })
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/controls/playback-control
4
+
5
+ module Vime
6
+ module Ui
7
+ module Controls
8
+ class PlaybackControl < Component
9
+ option :hide_tooltip, type: Types::Bool, default: -> { false }
10
+ option :keys, type: Types::String.optional, default: -> { "k" }
11
+ option :play_icon, type: Types::String, default: -> { "#vime-play" }
12
+ option :pause_icon, type: Types::String, default: -> { "#vime-pause" }
13
+ option :tooltip_direction, type: Types::TooltipDirection, optional: true
14
+ option :tooltip_position, type: Types::TooltipPosition, default: -> { "top" }
15
+
16
+ def call
17
+ tag "vime-playback-control", process_attrs(dom_attrs)
18
+ end
19
+
20
+ def dom_attrs
21
+ super.merge({
22
+ hide_tooltip: hide_tooltip,
23
+ keys: keys,
24
+ pause_icon: pause_icon,
25
+ play_icon: play_icon,
26
+ tooltip_direction: tooltip_direction,
27
+ tooltip_position: tooltip_position,
28
+ })
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/controls/scrubber-control
4
+
5
+ module Vime
6
+ module Ui
7
+ module Controls
8
+ class ScrubberControl < Component
9
+ option :always_show_hours, type: Types::Bool, default: -> { false }
10
+ option :hide_tooltip, type: Types::Bool, default: -> { false }
11
+ option :no_keyboard, type: Types::Bool, default: -> { false }
12
+
13
+ def call
14
+ tag "vime-scrubber-control", process_attrs(dom_attrs)
15
+ end
16
+
17
+ def dom_attrs
18
+ super.merge({
19
+ always_show_hours: always_show_hours,
20
+ hide_tooltip: hide_tooltip,
21
+ no_keyboard: no_keyboard,
22
+ })
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @eee https://vimejs.com/components/ui/controls/settings-control
4
+
5
+ module Vime
6
+ module Ui
7
+ module Controls
8
+ class SettingsControl < Component
9
+ option :expanded, type: Types::Bool, default: -> { false }
10
+ option :icon, type: Types::String, default: -> { "#vime-settings" }
11
+ option :menu, type: Types::String, optional: true
12
+ option :tooltip_direction, type: Types::TooltipDirection, optional: true
13
+ option :tooltip_position, type: Types::TooltipPosition, default: -> { "top" }
14
+
15
+ def call
16
+ tag "vime-settings-control", process_attrs(dom_attrs)
17
+ end
18
+
19
+ def dom_attrs
20
+ super.merge({
21
+ expanded: expanded,
22
+ icon: icon,
23
+ menu: menu,
24
+ tooltip_direction: tooltip_direction,
25
+ tooltip_position: tooltip_position,
26
+ })
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end