@cloudnest/redxplyr 1.0.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/.editorconfig +10 -0
- package/.gitpod.yml +6 -0
- package/.node-version +1 -0
- package/.prettierrc +7 -0
- package/.stickler.yml +5 -0
- package/.stylelintrc.json +26 -0
- package/CHANGELOG.md +16 -0
- package/CONTRIBUTING.md +34 -0
- package/CONTROLS.md +49 -0
- package/Dockerfile +32 -0
- package/LICENSE.md +22 -0
- package/README.md +194 -0
- package/cspell.json +48 -0
- package/dist/redxplyr.css +1 -0
- package/dist/redxplyr.js +8801 -0
- package/dist/redxplyr.min.js +2 -0
- package/dist/redxplyr.min.js.map +1 -0
- package/dist/redxplyr.min.mjs +1 -0
- package/dist/redxplyr.min.mjs.map +1 -0
- package/dist/redxplyr.mjs +8793 -0
- package/dist/redxplyr.polyfilled.js +9294 -0
- package/dist/redxplyr.polyfilled.min.js +2 -0
- package/dist/redxplyr.polyfilled.min.js.map +1 -0
- package/dist/redxplyr.polyfilled.min.mjs +1 -0
- package/dist/redxplyr.polyfilled.min.mjs.map +1 -0
- package/dist/redxplyr.polyfilled.mjs +9286 -0
- package/dist/redxplyr.svg +1 -0
- package/eslint.config.mjs +39 -0
- package/gulpfile.js +8 -0
- package/package.json +114 -0
- package/pnpm-workspace.yaml +8 -0
- package/src/js/captions.js +411 -0
- package/src/js/config/defaults.js +459 -0
- package/src/js/config/states.js +10 -0
- package/src/js/config/types.js +34 -0
- package/src/js/console.js +28 -0
- package/src/js/controls.js +1870 -0
- package/src/js/fullscreen.js +305 -0
- package/src/js/html5.js +148 -0
- package/src/js/listeners.js +854 -0
- package/src/js/media.js +61 -0
- package/src/js/plugins/ads.js +647 -0
- package/src/js/plugins/preview-thumbnails.js +706 -0
- package/src/js/plugins/vimeo.js +443 -0
- package/src/js/plugins/youtube.js +451 -0
- package/src/js/plyr.d.ts +729 -0
- package/src/js/plyr.js +1291 -0
- package/src/js/plyr.polyfilled.js +13 -0
- package/src/js/source.js +155 -0
- package/src/js/storage.js +70 -0
- package/src/js/support.js +100 -0
- package/src/js/ui.js +297 -0
- package/src/js/utils/animation.js +33 -0
- package/src/js/utils/arrays.js +23 -0
- package/src/js/utils/browser.js +21 -0
- package/src/js/utils/elements.js +263 -0
- package/src/js/utils/events.js +116 -0
- package/src/js/utils/fetch.js +45 -0
- package/src/js/utils/i18n.js +47 -0
- package/src/js/utils/is.js +81 -0
- package/src/js/utils/load-image.js +19 -0
- package/src/js/utils/load-script.js +14 -0
- package/src/js/utils/load-sprite.js +77 -0
- package/src/js/utils/numbers.js +17 -0
- package/src/js/utils/objects.js +43 -0
- package/src/js/utils/promise.js +14 -0
- package/src/js/utils/strings.js +80 -0
- package/src/js/utils/style.js +148 -0
- package/src/js/utils/time.js +36 -0
- package/src/js/utils/urls.js +40 -0
- package/src/sass/base.scss +69 -0
- package/src/sass/components/badges.scss +12 -0
- package/src/sass/components/captions.scss +58 -0
- package/src/sass/components/control.scss +52 -0
- package/src/sass/components/controls.scss +65 -0
- package/src/sass/components/menus.scss +205 -0
- package/src/sass/components/poster.scss +27 -0
- package/src/sass/components/progress.scss +107 -0
- package/src/sass/components/sliders.scss +99 -0
- package/src/sass/components/times.scss +20 -0
- package/src/sass/components/tooltips.scss +91 -0
- package/src/sass/components/volume.scss +18 -0
- package/src/sass/lib/animation.scss +31 -0
- package/src/sass/lib/css-vars.scss +103 -0
- package/src/sass/lib/functions.scss +3 -0
- package/src/sass/lib/mixins.scss +82 -0
- package/src/sass/plugins/ads.scss +53 -0
- package/src/sass/plugins/preview-thumbnails/index.scss +121 -0
- package/src/sass/plugins/preview-thumbnails/settings.scss +17 -0
- package/src/sass/plyr.scss +46 -0
- package/src/sass/settings/badges.scss +7 -0
- package/src/sass/settings/breakpoints.scss +9 -0
- package/src/sass/settings/captions.scss +10 -0
- package/src/sass/settings/colors.scss +18 -0
- package/src/sass/settings/controls.scss +30 -0
- package/src/sass/settings/cosmetics.scss +5 -0
- package/src/sass/settings/helpers.scss +7 -0
- package/src/sass/settings/menus.scss +13 -0
- package/src/sass/settings/progress.scss +18 -0
- package/src/sass/settings/sliders.scss +39 -0
- package/src/sass/settings/tooltips.scss +11 -0
- package/src/sass/settings/type.scss +16 -0
- package/src/sass/states/fullscreen.scss +15 -0
- package/src/sass/types/audio.scss +61 -0
- package/src/sass/types/video.scss +170 -0
- package/src/sass/utils/animation.scss +7 -0
- package/src/sass/utils/hidden.scss +28 -0
- package/src/sprite/plyr-airplay.svg +8 -0
- package/src/sprite/plyr-captions-off.svg +7 -0
- package/src/sprite/plyr-captions-on.svg +7 -0
- package/src/sprite/plyr-download.svg +8 -0
- package/src/sprite/plyr-enter-fullscreen.svg +4 -0
- package/src/sprite/plyr-exit-fullscreen.svg +4 -0
- package/src/sprite/plyr-fast-forward.svg +3 -0
- package/src/sprite/plyr-logo-vimeo.svg +6 -0
- package/src/sprite/plyr-logo-youtube.svg +6 -0
- package/src/sprite/plyr-muted.svg +8 -0
- package/src/sprite/plyr-pause.svg +8 -0
- package/src/sprite/plyr-pip.svg +6 -0
- package/src/sprite/plyr-play.svg +5 -0
- package/src/sprite/plyr-restart.svg +5 -0
- package/src/sprite/plyr-rewind.svg +3 -0
- package/src/sprite/plyr-settings.svg +5 -0
- package/src/sprite/plyr-volume.svg +11 -0
- package/tasks/build.js +226 -0
- package/tasks/deploy.js +216 -0
- package/tasks/utils/publish.js +34 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
// --------------------------------------------------------------
|
|
2
|
+
// Video styles
|
|
3
|
+
// --------------------------------------------------------------
|
|
4
|
+
|
|
5
|
+
@use 'sass:math';
|
|
6
|
+
|
|
7
|
+
// Container
|
|
8
|
+
.plyr--video {
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
|
|
11
|
+
&.plyr--menu-open {
|
|
12
|
+
overflow: visible;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.plyr__video-wrapper {
|
|
17
|
+
background: var(--plyr-video-background, $plyr-video-background);
|
|
18
|
+
border-radius: inherit;
|
|
19
|
+
height: 100%;
|
|
20
|
+
margin: auto;
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
position: relative;
|
|
23
|
+
width: 100%;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Default to 16:9 ratio but this is set by JavaScript based on config
|
|
27
|
+
$embed-padding: (math.div(100, 16) * 9);
|
|
28
|
+
|
|
29
|
+
.plyr__video-embed,
|
|
30
|
+
.plyr__video-wrapper--fixed-ratio {
|
|
31
|
+
@supports not (aspect-ratio: 16 / 9) {
|
|
32
|
+
height: 0;
|
|
33
|
+
padding-bottom: to-percentage($embed-padding);
|
|
34
|
+
position: relative;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
aspect-ratio: 16 / 9;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.plyr__video-embed iframe,
|
|
41
|
+
.plyr__video-wrapper--fixed-ratio video {
|
|
42
|
+
border: 0;
|
|
43
|
+
height: 100%;
|
|
44
|
+
left: 0;
|
|
45
|
+
position: absolute;
|
|
46
|
+
top: 0;
|
|
47
|
+
width: 100%;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// For Vimeo, if the full custom UI is supported
|
|
51
|
+
.plyr--full-ui .plyr__video-embed > .plyr__video-embed__container {
|
|
52
|
+
$height: 240;
|
|
53
|
+
$offset: to-percentage(math.div($height - $embed-padding, math.div($height, 50)));
|
|
54
|
+
|
|
55
|
+
padding-bottom: to-percentage($height);
|
|
56
|
+
position: relative;
|
|
57
|
+
transform: translateY(-$offset);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Controls container
|
|
61
|
+
.plyr--video .plyr__controls {
|
|
62
|
+
background: $plyr-video-controls-background;
|
|
63
|
+
border-bottom-left-radius: inherit;
|
|
64
|
+
border-bottom-right-radius: inherit;
|
|
65
|
+
bottom: 0;
|
|
66
|
+
color: $plyr-video-control-color;
|
|
67
|
+
left: 0;
|
|
68
|
+
padding: calc(#{$plyr-control-spacing} / 2);
|
|
69
|
+
padding-top: calc(#{$plyr-control-spacing} * 2);
|
|
70
|
+
position: absolute;
|
|
71
|
+
right: 0;
|
|
72
|
+
transition:
|
|
73
|
+
opacity 0.4s ease-in-out,
|
|
74
|
+
transform 0.4s ease-in-out;
|
|
75
|
+
z-index: 3;
|
|
76
|
+
|
|
77
|
+
@media (min-width: $plyr-bp-sm) {
|
|
78
|
+
padding: $plyr-control-spacing;
|
|
79
|
+
padding-top: calc(#{$plyr-control-spacing} * 3.5);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Hide controls
|
|
84
|
+
.plyr--video.plyr--hide-controls .plyr__controls {
|
|
85
|
+
opacity: 0;
|
|
86
|
+
pointer-events: none;
|
|
87
|
+
transform: translateY(100%);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Control elements
|
|
91
|
+
.plyr--video .plyr__control {
|
|
92
|
+
&:focus-visible,
|
|
93
|
+
&:hover,
|
|
94
|
+
&[aria-expanded='true'] {
|
|
95
|
+
background: $plyr-video-control-background-hover;
|
|
96
|
+
color: $plyr-video-control-color-hover;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Large play button (video only)
|
|
101
|
+
.plyr__control--overlaid {
|
|
102
|
+
background: $plyr-video-control-background-hover;
|
|
103
|
+
border: 0;
|
|
104
|
+
border-radius: 100%;
|
|
105
|
+
color: $plyr-video-control-color;
|
|
106
|
+
display: none;
|
|
107
|
+
left: 50%;
|
|
108
|
+
opacity: 0.9;
|
|
109
|
+
padding: calc(#{$plyr-control-spacing} * 1.5);
|
|
110
|
+
position: absolute;
|
|
111
|
+
top: 50%;
|
|
112
|
+
transform: translate(-50%, -50%);
|
|
113
|
+
transition: 0.3s;
|
|
114
|
+
z-index: 2;
|
|
115
|
+
|
|
116
|
+
// Offset icon to make the play button look right
|
|
117
|
+
svg {
|
|
118
|
+
left: 2px;
|
|
119
|
+
position: relative;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&:hover,
|
|
123
|
+
&:focus {
|
|
124
|
+
opacity: 1;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.plyr--playing .plyr__control--overlaid {
|
|
129
|
+
opacity: 0;
|
|
130
|
+
visibility: hidden;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.plyr--full-ui.plyr--video .plyr__control--overlaid {
|
|
134
|
+
display: block;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Video range inputs
|
|
138
|
+
.plyr--full-ui.plyr--video input[type='range'] {
|
|
139
|
+
&::-webkit-slider-runnable-track {
|
|
140
|
+
background-color: $plyr-video-range-track-background;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&::-moz-range-track {
|
|
144
|
+
background-color: $plyr-video-range-track-background;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
&::-ms-track {
|
|
148
|
+
background-color: $plyr-video-range-track-background;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Pressed styles
|
|
152
|
+
&:active {
|
|
153
|
+
&::-webkit-slider-thumb {
|
|
154
|
+
@include plyr-range-thumb-active($plyr-video-range-thumb-active-shadow-color);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
&::-moz-range-thumb {
|
|
158
|
+
@include plyr-range-thumb-active($plyr-video-range-thumb-active-shadow-color);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
&::-ms-thumb {
|
|
162
|
+
@include plyr-range-thumb-active($plyr-video-range-thumb-active-shadow-color);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Progress
|
|
168
|
+
.plyr--video .plyr__progress__buffer {
|
|
169
|
+
color: $plyr-video-progress-buffered-background;
|
|
170
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// --------------------------------------------------------------
|
|
2
|
+
// Hiding content nicely
|
|
3
|
+
// --------------------------------------------------------------
|
|
4
|
+
|
|
5
|
+
// Screen reader only elements
|
|
6
|
+
.plyr__sr-only {
|
|
7
|
+
clip: rect(1px, 1px, 1px, 1px);
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
|
|
10
|
+
// !important is not always needed
|
|
11
|
+
@if $plyr-sr-only-important {
|
|
12
|
+
border: 0 !important;
|
|
13
|
+
height: 1px !important;
|
|
14
|
+
padding: 0 !important;
|
|
15
|
+
position: absolute !important;
|
|
16
|
+
width: 1px !important;
|
|
17
|
+
} @else {
|
|
18
|
+
border: 0;
|
|
19
|
+
height: 1px;
|
|
20
|
+
padding: 0;
|
|
21
|
+
position: absolute;
|
|
22
|
+
width: 1px;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.plyr [hidden] {
|
|
27
|
+
display: none !important;
|
|
28
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg width="18px" height="18px" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g>
|
|
3
|
+
<path
|
|
4
|
+
d="M16,1 L2,1 C1.447,1 1,1.447 1,2 L1,12 C1,12.553 1.447,13 2,13 L5,13 L5,11 L3,11 L3,3 L15,3 L15,11 L13,11 L13,13 L16,13 C16.553,13 17,12.553 17,12 L17,2 C17,1.447 16.553,1 16,1 L16,1 Z"
|
|
5
|
+
/>
|
|
6
|
+
<polygon points="4 17 14 17 9 11" />
|
|
7
|
+
</g>
|
|
8
|
+
</svg>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<svg width="18px" height="18px" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g fill-rule="evenodd" fill-opacity="0.5">
|
|
3
|
+
<path
|
|
4
|
+
d="M1,1 C0.4,1 0,1.4 0,2 L0,13 C0,13.6 0.4,14 1,14 L5.6,14 L8.3,16.7 C8.5,16.9 8.7,17 9,17 C9.3,17 9.5,16.9 9.7,16.7 L12.4,14 L17,14 C17.6,14 18,13.6 18,13 L18,2 C18,1.4 17.6,1 17,1 L1,1 Z M5.52,11.15 C7.51,11.15 8.53,9.83 8.8,8.74 L7.51,8.35 C7.32,9.01 6.73,9.8 5.52,9.8 C4.38,9.8 3.32,8.97 3.32,7.46 C3.32,5.85 4.44,5.09 5.5,5.09 C6.73,5.09 7.28,5.84 7.45,6.52 L8.75,6.11 C8.47,4.96 7.46,3.76 5.5,3.76 C3.6,3.76 1.89,5.2 1.89,7.46 C1.89,9.72 3.54,11.15 5.52,11.15 Z M13.09,11.15 C15.08,11.15 16.1,9.83 16.37,8.74 L15.08,8.35 C14.89,9.01 14.3,9.8 13.09,9.8 C11.95,9.8 10.89,8.97 10.89,7.46 C10.89,5.85 12.01,5.09 13.07,5.09 C14.3,5.09 14.85,5.84 15.02,6.52 L16.32,6.11 C16.04,4.96 15.03,3.76 13.07,3.76 C11.17,3.76 9.46,5.2 9.46,7.46 C9.46,9.72 11.11,11.15 13.09,11.15 Z"
|
|
5
|
+
/>
|
|
6
|
+
</g>
|
|
7
|
+
</svg>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<svg width="18px" height="18px" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g fill-rule="evenodd">
|
|
3
|
+
<path
|
|
4
|
+
d="M1,1 C0.4,1 0,1.4 0,2 L0,13 C0,13.6 0.4,14 1,14 L5.6,14 L8.3,16.7 C8.5,16.9 8.7,17 9,17 C9.3,17 9.5,16.9 9.7,16.7 L12.4,14 L17,14 C17.6,14 18,13.6 18,13 L18,2 C18,1.4 17.6,1 17,1 L1,1 Z M5.52,11.15 C7.51,11.15 8.53,9.83 8.8,8.74 L7.51,8.35 C7.32,9.01 6.73,9.8 5.52,9.8 C4.38,9.8 3.32,8.97 3.32,7.46 C3.32,5.85 4.44,5.09 5.5,5.09 C6.73,5.09 7.28,5.84 7.45,6.52 L8.75,6.11 C8.47,4.96 7.46,3.76 5.5,3.76 C3.6,3.76 1.89,5.2 1.89,7.46 C1.89,9.72 3.54,11.15 5.52,11.15 Z M13.09,11.15 C15.08,11.15 16.1,9.83 16.37,8.74 L15.08,8.35 C14.89,9.01 14.3,9.8 13.09,9.8 C11.95,9.8 10.89,8.97 10.89,7.46 C10.89,5.85 12.01,5.09 13.07,5.09 C14.3,5.09 14.85,5.84 15.02,6.52 L16.32,6.11 C16.04,4.96 15.03,3.76 13.07,3.76 C11.17,3.76 9.46,5.2 9.46,7.46 C9.46,9.72 11.11,11.15 13.09,11.15 Z"
|
|
5
|
+
/>
|
|
6
|
+
</g>
|
|
7
|
+
</svg>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg width="18px" height="18px" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g transform="translate(2 1)">
|
|
3
|
+
<path
|
|
4
|
+
d="M7,12 C7.3,12 7.5,11.9 7.7,11.7 L13.4,6 L12,4.6 L8,8.6 L8,0 L6,0 L6,8.6 L2,4.6 L0.6,6 L6.3,11.7 C6.5,11.9 6.7,12 7,12 Z"
|
|
5
|
+
/>
|
|
6
|
+
<rect width="14" height="2" y="14" />
|
|
7
|
+
</g>
|
|
8
|
+
</svg>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
|
|
2
|
+
<path
|
|
3
|
+
d="M16,3.3 C15.9,4.9 14.8,7 12.7,9.7 C10.5,12.5 8.7,13.9 7.2,13.9 C6.3,13.9 5.5,13 4.8,11.3 C4,8.9 3.4,4 2,4 C1.9,4 1.5,4.3 0.8,4.8 L0,3.8 C0.8,3.1 3.5,0.4 4.7,0.3 C5.9,0.2 6.7,1 7,2.8 C7.3,4.8 7.8,8.9 8.8,8.9 C9.7,8.9 11.3,5.5 11.4,4.9 C11.5,4 11.1,3 9.1,3.8 C9.9,1.2 11.4,-8.8817842e-16 13.6,-8.8817842e-16 C15.3,0.1 16.1,1.2 16,3.3 Z"
|
|
4
|
+
transform="translate(1 2)"
|
|
5
|
+
/>
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
|
|
2
|
+
<path
|
|
3
|
+
d="M15.8,2.8 C15.6,1.5 15,0.6 13.6,0.4 C11.4,0 8,0 8,0 C8,0 4.6,0 2.4,0.4 C1,0.6 0.3,1.5 0.2,2.8 C0,4.1 0,6 0,6 C0,6 0,7.9 0.2,9.2 C0.4,10.5 1,11.4 2.4,11.6 C4.6,12 8,12 8,12 C8,12 11.4,12 13.6,11.6 C15,11.3 15.6,10.5 15.8,9.2 C16,7.9 16,6 16,6 C16,6 16,4.1 15.8,2.8 Z M6,9 L6,3 L11,6 L6,9 Z"
|
|
4
|
+
transform="translate(1 3)"
|
|
5
|
+
/>
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg width="18px" height="18px" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<polygon
|
|
3
|
+
points="12.4 12.5 14.5 10.4 16.6 12.5 18 11.1 15.9 9 18 6.9 16.6 5.5 14.5 7.6 12.4 5.5 11 6.9 13.1 9 11 11.1"
|
|
4
|
+
/>
|
|
5
|
+
<path
|
|
6
|
+
d="M3.78571429,6.00820648 L0.714285714,6.00820648 C0.285714286,6.00820648 0,6.30901277 0,6.76022222 L0,11.2723167 C0,11.7235261 0.285714286,12.0243324 0.714285714,12.0243324 L3.78571429,12.0243324 L7.85714286,15.8819922 C8.35714286,16.1827985 9,15.8819922 9,15.2803796 L9,2.75215925 C9,2.15054666 8.35714286,1.77453879 7.85714286,2.15054666 L3.78571429,6.00820648 Z"
|
|
7
|
+
/>
|
|
8
|
+
</svg>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg width="18px" height="18px" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path
|
|
3
|
+
d="M6,1 L3,1 C2.4,1 2,1.4 2,2 L2,16 C2,16.6 2.4,17 3,17 L6,17 C6.6,17 7,16.6 7,16 L7,2 C7,1.4 6.6,1 6,1 L6,1 Z"
|
|
4
|
+
/>
|
|
5
|
+
<path
|
|
6
|
+
d="M12,1 C11.4,1 11,1.4 11,2 L11,16 C11,16.6 11.4,17 12,17 L15,17 C15.6,17 16,16.6 16,16 L16,2 C16,1.4 15.6,1 15,1 L12,1 Z"
|
|
7
|
+
/>
|
|
8
|
+
</svg>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg width="18px" height="18px" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<polygon points="13.293 3.293 7.022 9.564 8.436 10.978 14.707 4.707 17 7 17 1 11 1" />
|
|
3
|
+
<path
|
|
4
|
+
d="M13,15 L3,15 L3,5 L8,5 L8,3 L2,3 C1.448,3 1,3.448 1,4 L1,16 C1,16.552 1.448,17 2,17 L14,17 C14.552,17 15,16.552 15,16 L15,10 L13,10 L13,15 L13,15 Z"
|
|
5
|
+
/>
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="18px" height="18px" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path
|
|
3
|
+
d="M15.5615866,8.10002147 L3.87056367,0.225209313 C3.05219207,-0.33727727 2,0.225209313 2,1.12518784 L2,16.8748122 C2,17.7747907 3.05219207,18.3372773 3.87056367,17.7747907 L15.5615866,9.89997853 C16.1461378,9.44998927 16.1461378,8.55001073 15.5615866,8.10002147 L15.5615866,8.10002147 Z"
|
|
4
|
+
/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="18px" height="18px" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path
|
|
3
|
+
d="M9.7,1.2 L10.4,7.6 L12.5,5.5 C14.4,7.4 14.4,10.6 12.5,12.5 C11.6,13.5 10.3,14 9,14 C7.7,14 6.4,13.5 5.5,12.5 C3.6,10.6 3.6,7.4 5.5,5.5 C6.1,4.9 6.9,4.4 7.8,4.2 L7.2,2.3 C6,2.6 4.9,3.2 4,4.1 C1.3,6.8 1.3,11.2 4,14 C5.3,15.3 7.1,16 8.9,16 C10.8,16 12.5,15.3 13.8,14 C16.5,11.3 16.5,6.9 13.8,4.1 L16,1.9 L9.7,1.2 L9.7,1.2 Z"
|
|
4
|
+
/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="18px" height="18px" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path
|
|
3
|
+
d="M16.135,7.784 C14.832,7.458 14.214,5.966 14.905,4.815 C15.227,4.279 15.13,3.817 14.811,3.499 L14.501,3.189 C14.183,2.871 13.721,2.774 13.185,3.095 C12.033,3.786 10.541,3.168 10.216,1.865 C10.065,1.258 9.669,1 9.219,1 L8.781,1 C8.331,1 7.936,1.258 7.784,1.865 C7.458,3.168 5.966,3.786 4.815,3.095 C4.279,2.773 3.816,2.87 3.498,3.188 L3.188,3.498 C2.87,3.816 2.773,4.279 3.095,4.815 C3.786,5.967 3.168,7.459 1.865,7.784 C1.26,7.935 1,8.33 1,8.781 L1,9.219 C1,9.669 1.258,10.064 1.865,10.216 C3.168,10.542 3.786,12.034 3.095,13.185 C2.773,13.721 2.87,14.183 3.189,14.501 L3.499,14.811 C3.818,15.13 4.281,15.226 4.815,14.905 C5.967,14.214 7.459,14.832 7.784,16.135 C7.935,16.742 8.331,17 8.781,17 L9.219,17 C9.669,17 10.064,16.742 10.216,16.135 C10.542,14.832 12.034,14.214 13.185,14.905 C13.72,15.226 14.182,15.13 14.501,14.811 L14.811,14.501 C15.129,14.183 15.226,13.72 14.905,13.185 C14.214,12.033 14.832,10.541 16.135,10.216 C16.742,10.065 17,9.669 17,9.219 L17,8.781 C17,8.33 16.74,7.935 16.135,7.784 L16.135,7.784 Z M9,12 C7.343,12 6,10.657 6,9 C6,7.343 7.343,6 9,6 C10.657,6 12,7.343 12,9 C12,10.657 10.657,12 9,12 L9,12 Z"
|
|
4
|
+
/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<svg width="18px" height="18px" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path
|
|
3
|
+
d="M15.5999996,3.3 C15.1999996,2.9 14.5999996,2.9 14.1999996,3.3 C13.7999996,3.7 13.7999996,4.3 14.1999996,4.7 C15.3999996,5.9 15.9999996,7.4 15.9999996,9 C15.9999996,10.6 15.3999996,12.1 14.1999996,13.3 C13.7999996,13.7 13.7999996,14.3 14.1999996,14.7 C14.3999996,14.9 14.6999996,15 14.8999996,15 C15.1999996,15 15.3999996,14.9 15.5999996,14.7 C17.0999996,13.2 17.9999996,11.2 17.9999996,9 C17.9999996,6.8 17.0999996,4.8 15.5999996,3.3 L15.5999996,3.3 Z"
|
|
4
|
+
/>
|
|
5
|
+
<path
|
|
6
|
+
d="M11.2819745,5.28197449 C10.9060085,5.65794047 10.9060085,6.22188944 11.2819745,6.59785542 C12.0171538,7.33303477 12.2772954,8.05605449 12.2772954,9.00000021 C12.2772954,9.93588462 11.851678,10.9172014 11.2819745,11.4869049 C10.9060085,11.8628709 10.9060085,12.4268199 11.2819745,12.8027859 C11.4271642,12.9479755 11.9176724,13.0649528 12.2998149,12.9592565 C12.4124479,12.9281035 12.5156669,12.8776063 12.5978555,12.8027859 C13.773371,11.732654 14.1311161,10.1597914 14.1312523,9.00000021 C14.1312723,8.8299555 14.1286311,8.66015647 14.119665,8.4897429 C14.0674781,7.49784946 13.8010171,6.48513613 12.5978554,5.28197449 C12.2218894,4.9060085 11.6579405,4.9060085 11.2819745,5.28197449 Z"
|
|
7
|
+
/>
|
|
8
|
+
<path
|
|
9
|
+
d="M3.78571429,6.00820648 L0.714285714,6.00820648 C0.285714286,6.00820648 0,6.30901277 0,6.76022222 L0,11.2723167 C0,11.7235261 0.285714286,12.0243324 0.714285714,12.0243324 L3.78571429,12.0243324 L7.85714286,15.8819922 C8.35714286,16.1827985 9,15.8819922 9,15.2803796 L9,2.75215925 C9,2.15054666 8.35714286,1.77453879 7.85714286,2.15054666 L3.78571429,6.00820648 Z"
|
|
10
|
+
/>
|
|
11
|
+
</svg>
|
package/tasks/build.js
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import path, { join } from 'node:path';
|
|
3
|
+
import babel from '@rollup/plugin-babel';
|
|
4
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
5
|
+
import resolve from '@rollup/plugin-node-resolve';
|
|
6
|
+
import autoprefixer from 'autoprefixer';
|
|
7
|
+
import browserSync from 'browser-sync';
|
|
8
|
+
import cssnano from 'cssnano';
|
|
9
|
+
import { deleteAsync } from 'del';
|
|
10
|
+
import gulp from 'gulp';
|
|
11
|
+
import rollup from 'gulp-better-rollup';
|
|
12
|
+
import filter from 'gulp-filter';
|
|
13
|
+
import header from 'gulp-header';
|
|
14
|
+
import gulpIf from 'gulp-if';
|
|
15
|
+
import imagemin from 'gulp-imagemin';
|
|
16
|
+
import plumber from 'gulp-plumber';
|
|
17
|
+
import postcss from 'gulp-postcss';
|
|
18
|
+
import rename from 'gulp-rename';
|
|
19
|
+
import sass from 'gulp-sass';
|
|
20
|
+
import size from 'gulp-size';
|
|
21
|
+
import sourcemaps from 'gulp-sourcemaps';
|
|
22
|
+
import svgstore from 'gulp-svgstore';
|
|
23
|
+
import terser from 'gulp-terser';
|
|
24
|
+
import imageminSvgo from 'imagemin-svgo';
|
|
25
|
+
import customprops from 'postcss-custom-properties';
|
|
26
|
+
import * as dartSass from 'sass';
|
|
27
|
+
|
|
28
|
+
const jobs = JSON.parse(readFileSync(join(path.resolve(), 'build.json'), 'utf-8'));
|
|
29
|
+
|
|
30
|
+
const bs = browserSync.create();
|
|
31
|
+
const sassCompiler = sass(dartSass);
|
|
32
|
+
const minSuffix = '.min';
|
|
33
|
+
const cdnChannel = 'v1';
|
|
34
|
+
|
|
35
|
+
// Paths
|
|
36
|
+
const root = path.resolve();
|
|
37
|
+
const paths = {
|
|
38
|
+
plyr: {
|
|
39
|
+
src: {
|
|
40
|
+
sass: path.join(root, 'src/sass/**/*.scss'),
|
|
41
|
+
js: path.join(root, 'src/js/**/*.js'),
|
|
42
|
+
sprite: path.join(root, 'src/sprite/*.svg'),
|
|
43
|
+
},
|
|
44
|
+
output: path.join(root, 'dist/'),
|
|
45
|
+
},
|
|
46
|
+
demo: {
|
|
47
|
+
src: {
|
|
48
|
+
sass: path.join(root, 'demo/src/sass/**/*.scss'),
|
|
49
|
+
js: path.join(root, 'demo/src/js/**/*.js'),
|
|
50
|
+
},
|
|
51
|
+
output: path.join(root, 'demo/dist/'),
|
|
52
|
+
root: path.join(root, 'demo/'),
|
|
53
|
+
version: path.join(root, `demo/${cdnChannel}/`),
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// Task lists
|
|
58
|
+
const tasks = {
|
|
59
|
+
css: [],
|
|
60
|
+
js: [],
|
|
61
|
+
sprite: [],
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// Size plugin options
|
|
65
|
+
const sizeOptions = { showFiles: true, gzip: true };
|
|
66
|
+
|
|
67
|
+
// Clean task
|
|
68
|
+
export async function clean() {
|
|
69
|
+
const dirs = [paths.plyr.output, paths.demo.output].map(dir => path.join(dir, '**/*'));
|
|
70
|
+
dirs.push(path.join(paths.demo.version, 'redxplyr*'));
|
|
71
|
+
dirs.push(`!${path.join(paths.plyr.output, '**/*.mp4')}`);
|
|
72
|
+
return await deleteAsync(dirs);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// JavaScript tasks
|
|
76
|
+
Object.entries(jobs.js).forEach(([filename, entry]) => {
|
|
77
|
+
const { dist, formats, namespace, polyfill, src } = entry;
|
|
78
|
+
const basename = path.parse(filename).name;
|
|
79
|
+
|
|
80
|
+
formats.forEach((format) => {
|
|
81
|
+
const name = `js:${filename}:${format}`;
|
|
82
|
+
const extension = format === 'es' ? 'mjs' : 'js';
|
|
83
|
+
tasks.js.push(name);
|
|
84
|
+
|
|
85
|
+
gulp.task(name, () =>
|
|
86
|
+
gulp
|
|
87
|
+
.src(src)
|
|
88
|
+
.pipe(plumber())
|
|
89
|
+
.pipe(sourcemaps.init())
|
|
90
|
+
.pipe(
|
|
91
|
+
rollup(
|
|
92
|
+
{
|
|
93
|
+
plugins: [
|
|
94
|
+
resolve(),
|
|
95
|
+
commonjs(),
|
|
96
|
+
babel({
|
|
97
|
+
babelHelpers: 'bundled',
|
|
98
|
+
presets: [
|
|
99
|
+
[
|
|
100
|
+
'@babel/env',
|
|
101
|
+
{
|
|
102
|
+
useBuiltIns: polyfill ? 'usage' : false,
|
|
103
|
+
corejs: polyfill ? 3 : undefined,
|
|
104
|
+
bugfixes: true,
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
],
|
|
108
|
+
plugins: [
|
|
109
|
+
'@babel/plugin-proposal-class-properties',
|
|
110
|
+
'@babel/plugin-transform-nullish-coalescing-operator',
|
|
111
|
+
'@babel/plugin-proposal-optional-chaining',
|
|
112
|
+
],
|
|
113
|
+
babelrc: false,
|
|
114
|
+
exclude: [/\/core-js\//],
|
|
115
|
+
}),
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: namespace,
|
|
120
|
+
format,
|
|
121
|
+
},
|
|
122
|
+
),
|
|
123
|
+
)
|
|
124
|
+
.pipe(gulpIf(() => extension !== 'mjs', header('typeof navigator === "object" && ')))
|
|
125
|
+
.pipe(rename({ basename, extname: `.${extension}` }))
|
|
126
|
+
.pipe(gulp.dest(dist))
|
|
127
|
+
.pipe(filter(`**/*.${extension}`))
|
|
128
|
+
.pipe(terser())
|
|
129
|
+
.pipe(rename({ suffix: minSuffix }))
|
|
130
|
+
.pipe(size(sizeOptions))
|
|
131
|
+
.pipe(sourcemaps.write(''))
|
|
132
|
+
.pipe(gulp.dest(dist)));
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
// CSS tasks
|
|
137
|
+
Object.entries(jobs.css).forEach(([filename, entry]) => {
|
|
138
|
+
const { dist, src } = entry;
|
|
139
|
+
const basename = path.parse(filename).name;
|
|
140
|
+
const name = `css:${filename}`;
|
|
141
|
+
tasks.css.push(name);
|
|
142
|
+
|
|
143
|
+
gulp.task(name, () =>
|
|
144
|
+
gulp
|
|
145
|
+
.src(src)
|
|
146
|
+
.pipe(plumber())
|
|
147
|
+
.pipe(sassCompiler())
|
|
148
|
+
.pipe(
|
|
149
|
+
postcss([
|
|
150
|
+
customprops(),
|
|
151
|
+
autoprefixer(),
|
|
152
|
+
cssnano({ preset: 'default' }),
|
|
153
|
+
]),
|
|
154
|
+
)
|
|
155
|
+
.pipe(rename({ basename, extname: '.css' }))
|
|
156
|
+
.pipe(size(sizeOptions))
|
|
157
|
+
.pipe(gulp.dest(dist)));
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
// SVG Sprite tasks
|
|
161
|
+
Object.entries(jobs.sprite).forEach(([filename, entry]) => {
|
|
162
|
+
const { dist, src } = entry;
|
|
163
|
+
const name = `sprite:${filename}`;
|
|
164
|
+
tasks.sprite.push(name);
|
|
165
|
+
|
|
166
|
+
gulp.task(name, () =>
|
|
167
|
+
gulp
|
|
168
|
+
.src(src)
|
|
169
|
+
.pipe(plumber())
|
|
170
|
+
.pipe(
|
|
171
|
+
imagemin([
|
|
172
|
+
imageminSvgo({
|
|
173
|
+
plugins: [
|
|
174
|
+
{
|
|
175
|
+
name: 'preset-default',
|
|
176
|
+
params: {
|
|
177
|
+
overrides: {
|
|
178
|
+
removeViewBox: false, // Keep viewBox attribute
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
}),
|
|
184
|
+
]),
|
|
185
|
+
)
|
|
186
|
+
.pipe(svgstore())
|
|
187
|
+
.pipe(rename({ basename: path.parse(filename).name }))
|
|
188
|
+
.pipe(size(sizeOptions))
|
|
189
|
+
.pipe(gulp.dest(dist)));
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
// Build tasks
|
|
193
|
+
export const js = gulp.parallel(...tasks.js);
|
|
194
|
+
export const css = gulp.parallel(...tasks.css);
|
|
195
|
+
export const sprites = gulp.parallel(...tasks.sprite);
|
|
196
|
+
|
|
197
|
+
export function versionAssets() {
|
|
198
|
+
return gulp.src(path.join(paths.plyr.output, 'redxplyr*'), { allowEmpty: true }).pipe(gulp.dest(paths.demo.version));
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Watch task
|
|
202
|
+
export function watch() {
|
|
203
|
+
gulp.watch(paths.plyr.src.js, gulp.series(js, versionAssets));
|
|
204
|
+
gulp.watch(paths.plyr.src.sass, gulp.series(css, versionAssets));
|
|
205
|
+
gulp.watch(paths.plyr.src.sprite, gulp.series(sprites, versionAssets));
|
|
206
|
+
gulp.watch(paths.demo.src.js, js);
|
|
207
|
+
gulp.watch(paths.demo.src.sass, css);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// Serve task
|
|
211
|
+
export function serve() {
|
|
212
|
+
return bs.init({
|
|
213
|
+
server: {
|
|
214
|
+
baseDir: paths.demo.root,
|
|
215
|
+
},
|
|
216
|
+
notify: false,
|
|
217
|
+
watch: true,
|
|
218
|
+
ghostMode: false,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Build distribution
|
|
223
|
+
export const build = gulp.series(clean, gulp.parallel(js, css, sprites), versionAssets);
|
|
224
|
+
|
|
225
|
+
// Default task
|
|
226
|
+
export default gulp.series(build, gulp.parallel(serve, watch));
|