vime_view_components 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
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,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/controls/volume-control
4
+
5
+ module Vime
6
+ module Ui
7
+ module Controls
8
+ class VolumeControl < Component
9
+ option :hide_tooltip, type: Types::Bool, default: -> { false }
10
+ option :high_volume_icon, type: Types::String, default: -> { "#vime-volume-high" }
11
+ option :low_volume_icon, type: Types::String, default: -> { "#vime-volume-low" }
12
+ option :mute_keys, type: Types::String, default: -> { "m" }
13
+ option :muted_icon, type: Types::String, default: -> { "#vime-volume-mute" }
14
+ option :no_keyboard, type: Types::Bool, default: -> { false }
15
+ option :tooltip_direction, type: Types::TooltipDirection, optional: true
16
+ option :tooltip_position, type: Types::TooltipPosition, default: -> { "top" }
17
+
18
+ def call
19
+ tag "vime-volume-control", process_attrs(dom_attrs)
20
+ end
21
+
22
+ def dom_attrs
23
+ super.merge({
24
+ hide_tooltip: hide_tooltip,
25
+ high_volume_icon: high_volume_icon,
26
+ low_volume_icon: low_volume_icon,
27
+ mute_keys: mute_keys,
28
+ muted_icon: muted_icon,
29
+ no_keyboard: no_keyboard,
30
+ tooltip_direction: tooltip_direction,
31
+ tooltip_position: tooltip_position,
32
+ })
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/dbl-click-fullscreen
4
+
5
+ module Vime
6
+ module Ui
7
+ class DblClickFullscreen < Component
8
+ option :use_on_mobile, type: Types::Bool, default: -> { false }
9
+
10
+ def call
11
+ tag "vime-dbl-click-fullscreen", 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,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/default-ui
4
+
5
+ module Vime
6
+ module Ui
7
+ class DefaultUi < Component
8
+ option :no_captions, type: Types::Bool, default: -> { false }
9
+ option :no_click_to_play, type: Types::Bool, default: -> { false }
10
+ option :no_controls, type: Types::Bool, default: -> { false }
11
+ option :no_dbl_click_fullscreen, type: Types::Bool, default: -> { false }
12
+ option :no_icons, type: Types::Bool, default: -> { false }
13
+ option :no_poster, type: Types::Bool, default: -> { false }
14
+ option :no_settings, type: Types::Bool, default: -> { false }
15
+ option :no_skeleton, type: Types::Bool, default: -> { false }
16
+ option :no_spinner, type: Types::Bool, default: -> { false }
17
+
18
+ def call
19
+ content_tag "vime-default-ui", content, process_attrs(dom_attrs)
20
+ end
21
+
22
+ def dom_attrs
23
+ super.merge({
24
+ no_captions: no_captions,
25
+ no_click_to_play: no_click_to_play,
26
+ no_controls: no_controls,
27
+ no_dbl_click_fullscreen: no_dbl_click_fullscreen,
28
+ no_icons: no_icons,
29
+ no_poster: no_poster,
30
+ no_settings: no_settings,
31
+ no_skeleton: no_skeleton,
32
+ no_spinner: no_spinner,
33
+ })
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/icon
4
+
5
+ module Vime
6
+ module Ui
7
+ class Icon < Component
8
+ option :href, type: Types::String, optional: true
9
+
10
+ def call
11
+ content_tag "vime-icon", content, process_attrs(dom_attrs)
12
+ end
13
+
14
+ def dom_attrs
15
+ super.merge({
16
+ href: href,
17
+ })
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/icons
4
+
5
+ module Vime
6
+ module Ui
7
+ class Icons < Component
8
+ option :href, type: Types::String, optional: true
9
+
10
+ def call
11
+ tag "vime-icons", process_attrs(dom_attrs)
12
+ end
13
+
14
+ def dom_attrs
15
+ super.merge({
16
+ href: href,
17
+ })
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/live-indicator
4
+
5
+ module Vime
6
+ module Ui
7
+ class LiveIndicator < Component
8
+ def call
9
+ tag "vime-live-indicator", process_attrs(dom_attrs)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/poster
4
+
5
+ module Vime
6
+ module Ui
7
+ class Poster < Component
8
+ option :fit, type: Types::String.enum("contain", "cover", "fill", "none", "scale-down"), default: -> { "cover" }
9
+
10
+ def call
11
+ tag "vime-poster", process_attrs(dom_attrs)
12
+ end
13
+
14
+ def dom_attrs
15
+ super.merge({
16
+ fit: fit
17
+ })
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/scrim
4
+
5
+ module Vime
6
+ module Ui
7
+ class Scrim < Component
8
+ option :gradient, type: Types::String.enum("down", "up").optional, optional: true
9
+
10
+ def call
11
+ content_tag "vime-scrim", content, process_attrs(dom_attrs)
12
+ end
13
+
14
+ def dom_attrs
15
+ super.merge({
16
+ gradient: gradient,
17
+ })
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/settings/default-settings
4
+
5
+ module Vime
6
+ module Ui
7
+ module Settings
8
+ class DefaultSettings < Component
9
+ option :pin, type: Types::Pin, default: -> { "bottomRight" }
10
+
11
+ def call
12
+ tag "vime-default-settings", process_attrs(dom_attrs)
13
+ end
14
+
15
+ def dom_attrs
16
+ super.merge({
17
+ pin: pin,
18
+ })
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/settings/menu
4
+
5
+ module Vime
6
+ module Ui
7
+ module Settings
8
+ class Menu < Component
9
+ option :active, type: Types::Bool, default: -> { false }
10
+ option :controller, type: Types::String
11
+ option :identifier, type: Types::String
12
+
13
+ def call
14
+ content_tag "vime-menu", content, process_attrs(dom_attrs)
15
+ end
16
+
17
+ def dom_attrs
18
+ super.merge({
19
+ active: active,
20
+ controller: controller,
21
+ identifier: identifier,
22
+ })
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/settings/menu-item
4
+
5
+ module Vime
6
+ module Ui
7
+ module Settings
8
+ class MenuItem < Component
9
+ option :badge, type: Types::String, optional: true
10
+ option :checked, type: Types::Bool, optional: true
11
+ option :checked_icon, type: Types::String, default: -> { "#vime-checkmark" }
12
+ option :expanded, type: Types::Bool, optional: true
13
+ option :hidden, type: Types::Bool, default: -> { false }
14
+ option :hint, type: Types::String, optional: true
15
+ option :identifier, type: Types::String, optional: true
16
+ option :label, type: Types::String
17
+ option :menu, type: Types::String, optional: true
18
+
19
+ def call
20
+ tag "vime-menu-item", process_attrs(dom_attrs)
21
+ end
22
+
23
+ def dom_attrs
24
+ super.merge({
25
+ badge: badge,
26
+ checked: checked,
27
+ checked_icon: checked_icon,
28
+ expanded: expanded,
29
+ hidden: hidden,
30
+ hint: hint,
31
+ identifier: identifier,
32
+ label: label,
33
+ menu: menu,
34
+ })
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/settings/menu-radio
4
+
5
+ module Vime
6
+ module Ui
7
+ module Settings
8
+ class MenuRadio < Component
9
+ option :badge, type: Types::String, optional: true
10
+ option :checked, type: Types::Bool, default: -> { false }
11
+ option :checked_icon, type: Types::String, default: -> { "#vime-checkmark" }
12
+ option :label, type: Types::String
13
+ option :value, type: Types::String
14
+
15
+ def call
16
+ tag "vime-menu-radio", process_attrs(dom_attrs)
17
+ end
18
+
19
+ def dom_attrs
20
+ super.merge({
21
+ badge: badge,
22
+ checked: checked,
23
+ checked_icon: checked_icon,
24
+ label: label,
25
+ value: value,
26
+ })
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/settings/menu-radio-group
4
+
5
+ module Vime
6
+ module Ui
7
+ module Settings
8
+ class MenuRadioGroup < Component
9
+ option :value, type: Types::String, optional: true
10
+
11
+ def call
12
+ content_tag "vime-menu-radio-group", content, process_attrs(dom_attrs)
13
+ end
14
+
15
+ def dom_attrs
16
+ super.merge({
17
+ value: value,
18
+ })
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/settings/settings
4
+
5
+ module Vime
6
+ module Ui
7
+ module Settings
8
+ class Settings < Component
9
+ option :active, type: Types::Bool, default: -> { false }
10
+ option :controls_height, type: Types::Integer, default: -> { 0 }
11
+ option :pin, type: Types::Pin, default: -> { "bottomRight" }
12
+
13
+ def call
14
+ content_tag "vime-settings", content, process_attrs(dom_attrs)
15
+ end
16
+
17
+ def dom_attrs
18
+ super.merge({
19
+ active: active,
20
+ controls_height: controls_height,
21
+ pin: pin,
22
+ })
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/settings/submenu
4
+
5
+ module Vime
6
+ module Ui
7
+ module Settings
8
+ class Submenu < Component
9
+ option :active, type: Types::Bool, default: -> { false }
10
+ option :hidden, type: Types::Bool, default: -> { false }
11
+ option :hint, type: Types::String, optional: true
12
+ option :label, type: Types::String
13
+
14
+ def call
15
+ content_tag "vime-submenu", content, process_attrs(dom_attrs)
16
+ end
17
+
18
+ def dom_attrs
19
+ super.merge({
20
+ active: active,
21
+ hidden: hidden,
22
+ hint: hint,
23
+ label: label,
24
+ })
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/skeleton
4
+
5
+ module Vime
6
+ module Ui
7
+ class Skeleton < Component
8
+ option :effect, type: Types::String.enum("none", "sheen"), default: -> { "sheen" }
9
+
10
+ def call
11
+ tag "vime-skeleton", process_attrs(dom_attrs)
12
+ end
13
+
14
+ def dom_attrs
15
+ super.merge({
16
+ effect: effect
17
+ })
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://vimejs.com/components/ui/slider
4
+
5
+ module Vime
6
+ module Ui
7
+ class Slider < Component
8
+ option :label, type: Types::String, optional: true
9
+ option :max, type: Types::Integer, default: -> { 10 }
10
+ option :min, type: Types::Integer, default: -> { 0 }
11
+ option :step, type: Types::Integer, default: -> { 1 }
12
+ option :value, type: Types::Integer, default: -> { 5 }
13
+ option :value_text, type: Types::String, optional: true
14
+
15
+ def call
16
+ tag "vime-slider", process_attrs(dom_attrs)
17
+ end
18
+
19
+ def dom_attrs
20
+ super.merge({
21
+ label: label,
22
+ max: max,
23
+ min: min,
24
+ step: step,
25
+ value: value,
26
+ value_text: value_text,
27
+ })
28
+ end
29
+ end
30
+ end
31
+ end