@smartimpact-it/modern-video-embed 2.0.5 → 2.0.7

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 (65) hide show
  1. package/README.md +322 -71
  2. package/dist/components/BaseVideoEmbed.d.ts +91 -0
  3. package/dist/components/BaseVideoEmbed.d.ts.map +1 -0
  4. package/dist/components/BaseVideoEmbed.js +275 -0
  5. package/dist/components/BaseVideoEmbed.js.map +1 -0
  6. package/dist/components/VideoEmbed.d.ts +68 -0
  7. package/dist/components/VideoEmbed.d.ts.map +1 -0
  8. package/dist/components/VideoEmbed.js +786 -0
  9. package/dist/components/VideoEmbed.js.map +1 -0
  10. package/dist/components/VimeoEmbed.d.ts +26 -36
  11. package/dist/components/VimeoEmbed.d.ts.map +1 -1
  12. package/dist/components/VimeoEmbed.js +231 -326
  13. package/dist/components/VimeoEmbed.js.map +1 -1
  14. package/dist/components/VimeoEmbed.min.js +1 -1
  15. package/dist/components/YouTubeEmbed.d.ts +108 -42
  16. package/dist/components/YouTubeEmbed.d.ts.map +1 -1
  17. package/dist/components/YouTubeEmbed.js +361 -375
  18. package/dist/components/YouTubeEmbed.js.map +1 -1
  19. package/dist/components/YouTubeEmbed.min.js +1 -1
  20. package/dist/css/components.css +285 -68
  21. package/dist/css/components.css.map +1 -1
  22. package/dist/css/components.min.css +1 -1
  23. package/dist/css/main.css +285 -68
  24. package/dist/css/main.css.map +1 -1
  25. package/dist/css/main.min.css +1 -1
  26. package/dist/index.d.ts +1 -0
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +1 -0
  29. package/dist/index.js.map +1 -1
  30. package/dist/index.min.js +1 -1
  31. package/dist/types/index.d.ts +1 -0
  32. package/dist/types/index.d.ts.map +1 -1
  33. package/dist/video-only.d.ts +7 -0
  34. package/dist/video-only.d.ts.map +1 -0
  35. package/dist/video-only.js +8 -0
  36. package/dist/video-only.js.map +1 -0
  37. package/dist/vimeo-only.d.ts +2 -2
  38. package/dist/vimeo-only.d.ts.map +1 -1
  39. package/dist/vimeo-only.js +2 -2
  40. package/dist/vimeo-only.js.map +1 -1
  41. package/dist/vimeo-only.min.js +1 -1
  42. package/dist/youtube-only.d.ts +2 -2
  43. package/dist/youtube-only.d.ts.map +1 -1
  44. package/dist/youtube-only.js +2 -2
  45. package/dist/youtube-only.js.map +1 -1
  46. package/dist/youtube-only.min.js +1 -1
  47. package/package.json +6 -5
  48. package/src/components/BaseVideoEmbed.ts +335 -0
  49. package/src/components/VideoEmbed.ts +870 -0
  50. package/src/components/VideoEmbed.ts.backup +1051 -0
  51. package/src/components/VimeoEmbed.ts +258 -395
  52. package/src/components/YouTubeEmbed.ts +378 -432
  53. package/src/index.ts +1 -0
  54. package/src/styles/_embed-base.scss +275 -0
  55. package/src/styles/_shared-functions.scss +56 -0
  56. package/src/styles/components.scss +4 -3
  57. package/src/styles/main.scss +7 -5
  58. package/src/styles/video-embed.scss +55 -0
  59. package/src/styles/vimeo-embed.scss +8 -248
  60. package/src/styles/youtube-embed.scss +8 -254
  61. package/src/types/index.ts +1 -0
  62. package/src/types/video-embed.d.ts +90 -0
  63. package/src/video-only.ts +9 -0
  64. package/src/vimeo-only.ts +2 -2
  65. package/src/youtube-only.ts +2 -2
package/dist/css/main.css CHANGED
@@ -11860,44 +11860,47 @@ textarea.form-control-lg {
11860
11860
  }
11861
11861
  }
11862
11862
  /**
11863
- * SVG encoding functions
11864
- */
11863
+ * YouTube Embed Component Styles
11864
+ * Uses shared base styles with YouTube-specific branding
11865
+ */
11866
+ /**
11867
+ * Base styles and mixins for all video embed components
11868
+ * Provides reusable CSS patterns to reduce duplication
11869
+ */
11870
+ /**
11871
+ * Shared SCSS functions for SVG encoding
11872
+ * Used by all video embed components
11873
+ */
11865
11874
  youtube-embed {
11866
- --video-aspect-ratio: 56.25%;
11867
- --poster-object-fit: cover;
11868
- --video-object-fit: contain;
11869
- --control-button-size: 70px;
11870
- --control-button-color: #ffffff;
11871
- --overlay-background-color: rgba(0, 0, 0, 0.5);
11875
+ --si-embed-video-aspect-ratio: 56.25%;
11876
+ --si-embed-aspect-width: 16;
11877
+ --si-embed-aspect-height: 9;
11878
+ --si-embed-poster-object-fit: cover;
11879
+ --si-embed-video-object-fit: contain;
11880
+ --si-embed-control-button-size: 70px;
11881
+ --si-embed-control-button-color: #ffffff;
11882
+ --si-embed-overlay-background-color: rgba(0, 0, 0, 0.5);
11872
11883
  display: block;
11873
11884
  position: relative;
11874
11885
  width: 100%;
11875
- padding-top: var(--video-aspect-ratio);
11886
+ padding-top: var(--si-embed-video-aspect-ratio);
11876
11887
  overflow: hidden;
11877
11888
  background-color: #000;
11878
11889
  }
11879
- youtube-embed iframe {
11880
- position: absolute;
11881
- top: 0;
11882
- left: 0;
11883
- width: 100%;
11884
- height: 100%;
11885
- border: none;
11886
- object-fit: var(--video-object-fit);
11887
- }
11890
+ youtube-embed .video-poster,
11888
11891
  youtube-embed .youtube-poster,
11889
- youtube-embed .video-poster {
11892
+ youtube-embed .vimeo-poster {
11890
11893
  position: absolute;
11891
11894
  top: 0;
11892
11895
  left: 0;
11893
11896
  width: 100%;
11894
11897
  height: 100%;
11895
- object-fit: var(--poster-object-fit);
11898
+ object-fit: var(--si-embed-poster-object-fit);
11896
11899
  display: block;
11897
11900
  cursor: pointer;
11898
11901
  }
11899
11902
  youtube-embed .button-overlay {
11900
- background: var(--overlay-background-color);
11903
+ background: var(--si-embed-overlay-background-color);
11901
11904
  cursor: pointer;
11902
11905
  display: flex;
11903
11906
  align-items: center;
@@ -11914,17 +11917,19 @@ youtube-embed .button-overlay {
11914
11917
  }
11915
11918
  youtube-embed.is-playing .button-overlay {
11916
11919
  opacity: 0;
11920
+ pointer-events: none;
11917
11921
  }
11918
11922
  youtube-embed.is-playing:hover .button-overlay {
11919
11923
  opacity: 1;
11924
+ pointer-events: auto;
11920
11925
  }
11921
11926
  youtube-embed .button-overlay .button {
11922
11927
  cursor: pointer;
11923
11928
  display: flex;
11924
11929
  align-items: center;
11925
11930
  justify-content: center;
11926
- height: var(--control-button-size);
11927
- width: var(--control-button-size);
11931
+ height: var(--si-embed-control-button-size);
11932
+ width: var(--si-embed-control-button-size);
11928
11933
  background-image: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%23ffffff%22%20d%3D%22M8%2C5.14V19.14L19%2C12.14L8%2C5.14Z%22%20%2F%3E%3C%2Fsvg%3E");
11929
11934
  background-size: cover;
11930
11935
  background-repeat: no-repeat;
@@ -11949,17 +11954,11 @@ youtube-embed.is-background iframe {
11949
11954
  top: 50%;
11950
11955
  left: 50%;
11951
11956
  transform: translate(-50%, -50%);
11952
- min-width: 100%;
11953
- min-height: 100%;
11957
+ aspect-ratio: var(--si-embed-aspect-width)/var(--si-embed-aspect-height);
11954
11958
  width: auto;
11955
11959
  height: auto;
11956
- }
11957
- @supports (aspect-ratio: 16/9) {
11958
- youtube-embed.is-background iframe {
11959
- aspect-ratio: 16/9;
11960
- }
11961
- }
11962
- youtube-embed.is-background iframe {
11960
+ min-width: 100%;
11961
+ min-height: 100%;
11963
11962
  pointer-events: none;
11964
11963
  }
11965
11964
  youtube-embed.is-background .button-overlay {
@@ -11973,7 +11972,7 @@ youtube-embed.has-background-controls .button-overlay {
11973
11972
  padding: 1rem;
11974
11973
  }
11975
11974
  youtube-embed.has-background-controls .button-overlay .button {
11976
- --control-button-size: 40px;
11975
+ --si-embed-control-button-size: 40px;
11977
11976
  opacity: 0.7;
11978
11977
  transition: opacity 0.2s ease;
11979
11978
  }
@@ -12005,7 +12004,7 @@ youtube-embed .youtube-error-message .error-content {
12005
12004
  max-width: 400px;
12006
12005
  }
12007
12006
  youtube-embed .youtube-error-message .error-content svg {
12008
- color: #ff4444;
12007
+ color: #ff0000;
12009
12008
  margin-bottom: 1rem;
12010
12009
  }
12011
12010
  youtube-embed .youtube-error-message .error-content .error-message {
@@ -12032,46 +12031,50 @@ youtube-embed .youtube-error-message .error-content .retry-button:focus {
12032
12031
  outline: 2px solid white;
12033
12032
  outline-offset: 2px;
12034
12033
  }
12034
+ youtube-embed iframe {
12035
+ position: absolute;
12036
+ top: 0;
12037
+ left: 0;
12038
+ width: 100%;
12039
+ height: 100%;
12040
+ border: none;
12041
+ object-fit: var(--si-embed-video-object-fit);
12042
+ }
12035
12043
 
12036
12044
  /**
12037
- * SVG encoding functions (shared with YouTube embed)
12038
- */
12045
+ * Vimeo Embed Component Styles
12046
+ * Uses shared base styles with Vimeo-specific branding
12047
+ */
12039
12048
  vimeo-embed {
12040
- --video-aspect-ratio: 56.25%;
12041
- --poster-object-fit: cover;
12042
- --video-object-fit: contain;
12043
- --control-button-size: 70px;
12044
- --control-button-color: #ffffff;
12045
- --overlay-background-color: rgba(0, 0, 0, 0.5);
12049
+ --si-embed-video-aspect-ratio: 56.25%;
12050
+ --si-embed-aspect-width: 16;
12051
+ --si-embed-aspect-height: 9;
12052
+ --si-embed-poster-object-fit: cover;
12053
+ --si-embed-video-object-fit: contain;
12054
+ --si-embed-control-button-size: 70px;
12055
+ --si-embed-control-button-color: #ffffff;
12056
+ --si-embed-overlay-background-color: rgba(0, 0, 0, 0.5);
12046
12057
  display: block;
12047
12058
  position: relative;
12048
12059
  width: 100%;
12049
- padding-top: var(--video-aspect-ratio);
12060
+ padding-top: var(--si-embed-video-aspect-ratio);
12050
12061
  overflow: hidden;
12051
12062
  background-color: #000;
12052
12063
  }
12053
- vimeo-embed iframe {
12064
+ vimeo-embed .video-poster,
12065
+ vimeo-embed .youtube-poster,
12066
+ vimeo-embed .vimeo-poster {
12054
12067
  position: absolute;
12055
12068
  top: 0;
12056
12069
  left: 0;
12057
12070
  width: 100%;
12058
12071
  height: 100%;
12059
- border: none;
12060
- object-fit: var(--video-object-fit);
12061
- }
12062
- vimeo-embed .vimeo-poster,
12063
- vimeo-embed .video-poster {
12064
- position: absolute;
12065
- top: 0;
12066
- left: 0;
12067
- width: 100%;
12068
- height: 100%;
12069
- object-fit: var(--poster-object-fit);
12072
+ object-fit: var(--si-embed-poster-object-fit);
12070
12073
  display: block;
12071
12074
  cursor: pointer;
12072
12075
  }
12073
12076
  vimeo-embed .button-overlay {
12074
- background: var(--overlay-background-color);
12077
+ background: var(--si-embed-overlay-background-color);
12075
12078
  cursor: pointer;
12076
12079
  display: flex;
12077
12080
  align-items: center;
@@ -12088,17 +12091,19 @@ vimeo-embed .button-overlay {
12088
12091
  }
12089
12092
  vimeo-embed.is-playing .button-overlay {
12090
12093
  opacity: 0;
12094
+ pointer-events: none;
12091
12095
  }
12092
12096
  vimeo-embed.is-playing:hover .button-overlay {
12093
12097
  opacity: 1;
12098
+ pointer-events: auto;
12094
12099
  }
12095
12100
  vimeo-embed .button-overlay .button {
12096
12101
  cursor: pointer;
12097
12102
  display: flex;
12098
12103
  align-items: center;
12099
12104
  justify-content: center;
12100
- height: var(--control-button-size);
12101
- width: var(--control-button-size);
12105
+ height: var(--si-embed-control-button-size);
12106
+ width: var(--si-embed-control-button-size);
12102
12107
  background-image: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%23ffffff%22%20d%3D%22M8%2C5.14V19.14L19%2C12.14L8%2C5.14Z%22%20%2F%3E%3C%2Fsvg%3E");
12103
12108
  background-size: cover;
12104
12109
  background-repeat: no-repeat;
@@ -12123,17 +12128,11 @@ vimeo-embed.is-background iframe {
12123
12128
  top: 50%;
12124
12129
  left: 50%;
12125
12130
  transform: translate(-50%, -50%);
12126
- min-width: 100%;
12127
- min-height: 100%;
12131
+ aspect-ratio: var(--si-embed-aspect-width)/var(--si-embed-aspect-height);
12128
12132
  width: auto;
12129
12133
  height: auto;
12130
- }
12131
- @supports (aspect-ratio: 16/9) {
12132
- vimeo-embed.is-background iframe {
12133
- aspect-ratio: 16/9;
12134
- }
12135
- }
12136
- vimeo-embed.is-background iframe {
12134
+ min-width: 100%;
12135
+ min-height: 100%;
12137
12136
  pointer-events: none;
12138
12137
  }
12139
12138
  vimeo-embed.is-background .button-overlay {
@@ -12147,7 +12146,7 @@ vimeo-embed.has-background-controls .button-overlay {
12147
12146
  padding: 1rem;
12148
12147
  }
12149
12148
  vimeo-embed.has-background-controls .button-overlay .button {
12150
- --control-button-size: 40px;
12149
+ --si-embed-control-button-size: 40px;
12151
12150
  opacity: 0.7;
12152
12151
  transition: opacity 0.2s ease;
12153
12152
  }
@@ -12206,5 +12205,223 @@ vimeo-embed .vimeo-error-message .error-content .retry-button:focus {
12206
12205
  outline: 2px solid white;
12207
12206
  outline-offset: 2px;
12208
12207
  }
12208
+ vimeo-embed iframe {
12209
+ position: absolute;
12210
+ top: 0;
12211
+ left: 0;
12212
+ width: 100%;
12213
+ height: 100%;
12214
+ border: none;
12215
+ object-fit: var(--si-embed-video-object-fit);
12216
+ }
12217
+
12218
+ /**
12219
+ * Video Embed Component Styles
12220
+ * Uses shared base styles with video-specific overrides
12221
+ */
12222
+ video-embed {
12223
+ --si-embed-video-aspect-ratio: 56.25%;
12224
+ --si-embed-aspect-width: 16;
12225
+ --si-embed-aspect-height: 9;
12226
+ --si-embed-poster-object-fit: cover;
12227
+ --si-embed-video-object-fit: contain;
12228
+ --si-embed-control-button-size: 70px;
12229
+ --si-embed-control-button-color: #ffffff;
12230
+ --si-embed-overlay-background-color: rgba(0, 0, 0, 0.5);
12231
+ display: block;
12232
+ position: relative;
12233
+ width: 100%;
12234
+ padding-top: var(--si-embed-video-aspect-ratio);
12235
+ overflow: hidden;
12236
+ background-color: #000;
12237
+ }
12238
+ video-embed .video-poster,
12239
+ video-embed .youtube-poster,
12240
+ video-embed .vimeo-poster {
12241
+ position: absolute;
12242
+ top: 0;
12243
+ left: 0;
12244
+ width: 100%;
12245
+ height: 100%;
12246
+ object-fit: var(--si-embed-poster-object-fit);
12247
+ display: block;
12248
+ cursor: pointer;
12249
+ }
12250
+ video-embed .button-overlay {
12251
+ background: var(--si-embed-overlay-background-color);
12252
+ cursor: pointer;
12253
+ display: flex;
12254
+ align-items: center;
12255
+ justify-content: center;
12256
+ position: absolute;
12257
+ left: 0;
12258
+ top: 0;
12259
+ right: 0;
12260
+ bottom: 0;
12261
+ height: 100%;
12262
+ width: 100%;
12263
+ transition: opacity 0.3s ease;
12264
+ z-index: 10;
12265
+ }
12266
+ video-embed.is-playing .button-overlay {
12267
+ opacity: 0;
12268
+ pointer-events: none;
12269
+ }
12270
+ video-embed.is-playing:hover .button-overlay {
12271
+ opacity: 1;
12272
+ pointer-events: auto;
12273
+ }
12274
+ video-embed .button-overlay .button {
12275
+ cursor: pointer;
12276
+ display: flex;
12277
+ align-items: center;
12278
+ justify-content: center;
12279
+ height: var(--si-embed-control-button-size);
12280
+ width: var(--si-embed-control-button-size);
12281
+ background-image: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%23ffffff%22%20d%3D%22M8%2C5.14V19.14L19%2C12.14L8%2C5.14Z%22%20%2F%3E%3C%2Fsvg%3E");
12282
+ background-size: cover;
12283
+ background-repeat: no-repeat;
12284
+ background-position: center;
12285
+ }
12286
+ video-embed.is-playing .button-overlay .button {
12287
+ background-image: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%23ffffff%22%20d%3D%22M14%2C19H18V5H14M6%2C19H10V5H6V19Z%22%20%2F%3E%3C%2Fsvg%3E");
12288
+ }
12289
+ video-embed.is-background {
12290
+ padding-top: 0;
12291
+ position: absolute;
12292
+ height: 100%;
12293
+ width: 100%;
12294
+ top: 0;
12295
+ left: 0;
12296
+ z-index: 0;
12297
+ overflow: hidden;
12298
+ background: #000;
12299
+ }
12300
+ video-embed.is-background video {
12301
+ position: absolute;
12302
+ top: 50%;
12303
+ left: 50%;
12304
+ transform: translate(-50%, -50%);
12305
+ width: 100%;
12306
+ height: calc(100% * var(--si-embed-aspect-height) / var(--si-embed-aspect-width));
12307
+ min-width: 100%;
12308
+ min-height: 100%;
12309
+ object-fit: cover;
12310
+ pointer-events: none;
12311
+ }
12312
+ video-embed.is-background video::-webkit-media-controls {
12313
+ display: none !important;
12314
+ }
12315
+ video-embed.is-background video::-webkit-media-controls-enclosure {
12316
+ display: none !important;
12317
+ }
12318
+ video-embed.is-background .button-overlay {
12319
+ display: none;
12320
+ }
12321
+ video-embed.has-background-controls .button-overlay {
12322
+ display: flex;
12323
+ background: none;
12324
+ justify-content: flex-end;
12325
+ align-items: flex-end;
12326
+ padding: 1rem;
12327
+ }
12328
+ video-embed.has-background-controls .button-overlay .button {
12329
+ --si-embed-control-button-size: 40px;
12330
+ opacity: 0.7;
12331
+ transition: opacity 0.2s ease;
12332
+ }
12333
+ video-embed.has-background-controls .button-overlay .button:hover {
12334
+ opacity: 1;
12335
+ }
12336
+ video-embed.has-background-controls.is-playing .button-overlay {
12337
+ opacity: 0;
12338
+ }
12339
+ video-embed.has-background-controls.is-playing .button-overlay:hover {
12340
+ opacity: 1;
12341
+ }
12342
+ video-embed .video-error-message {
12343
+ position: absolute;
12344
+ top: 0;
12345
+ left: 0;
12346
+ width: 100%;
12347
+ height: 100%;
12348
+ display: flex;
12349
+ align-items: center;
12350
+ justify-content: center;
12351
+ background: rgba(0, 0, 0, 0.9);
12352
+ color: white;
12353
+ z-index: 1000;
12354
+ }
12355
+ video-embed .video-error-message .error-content {
12356
+ text-align: center;
12357
+ padding: 2rem;
12358
+ max-width: 400px;
12359
+ }
12360
+ video-embed .video-error-message .error-content svg {
12361
+ color: #ff4444;
12362
+ margin-bottom: 1rem;
12363
+ }
12364
+ video-embed .video-error-message .error-content .error-message {
12365
+ margin: 1rem 0;
12366
+ font-size: 1rem;
12367
+ line-height: 1.5;
12368
+ }
12369
+ video-embed .video-error-message .error-content .retry-button {
12370
+ margin-top: 1rem;
12371
+ padding: 0.75rem 1.5rem;
12372
+ background: #ff4444;
12373
+ color: white;
12374
+ border: none;
12375
+ border-radius: 4px;
12376
+ cursor: pointer;
12377
+ font-size: 1rem;
12378
+ font-weight: 600;
12379
+ transition: background 0.2s ease;
12380
+ }
12381
+ video-embed .video-error-message .error-content .retry-button:hover {
12382
+ background: #cc0000;
12383
+ }
12384
+ video-embed .video-error-message .error-content .retry-button:focus {
12385
+ outline: 2px solid white;
12386
+ outline-offset: 2px;
12387
+ }
12388
+ video-embed video {
12389
+ position: absolute;
12390
+ top: 0;
12391
+ left: 0;
12392
+ width: 100%;
12393
+ height: 100%;
12394
+ border: none;
12395
+ object-fit: var(--si-embed-video-object-fit);
12396
+ }
12397
+ video-embed video::-webkit-media-controls {
12398
+ display: none !important;
12399
+ }
12400
+ video-embed video::-webkit-media-controls-enclosure {
12401
+ display: none !important;
12402
+ }
12403
+ video-embed[controls] video::-webkit-media-controls {
12404
+ display: flex !important;
12405
+ }
12406
+ video-embed[controls] video::-webkit-media-controls-enclosure {
12407
+ display: flex !important;
12408
+ }
12409
+ video-embed .video-poster {
12410
+ background-size: cover;
12411
+ background-position: center;
12412
+ background-repeat: no-repeat;
12413
+ }
12414
+ video-embed.is-fullscreen {
12415
+ padding-top: 0;
12416
+ position: fixed;
12417
+ top: 0;
12418
+ left: 0;
12419
+ width: 100vw;
12420
+ height: 100vh;
12421
+ z-index: 9999;
12422
+ }
12423
+ video-embed.is-fullscreen video {
12424
+ object-fit: contain;
12425
+ }
12209
12426
 
12210
12427
  /*# sourceMappingURL=main.css.map */