@nuralyui/video 0.0.2 → 0.0.5

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.
@@ -4,270 +4,181 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { LitElement, html, css } from "lit";
7
+ import { html, LitElement } from "lit";
8
8
  import { customElement, property, state } from "lit/decorators.js";
9
- let HyVideoPlayer = class HyVideoPlayer extends LitElement {
9
+ import { classMap } from "lit/directives/class-map.js";
10
+ import { styleMap } from "lit/directives/style-map.js";
11
+ import { NuralyUIBaseMixin } from "../../shared/base-mixin.js";
12
+ import styles from "./video.style.js";
13
+ let NrVideoElement = class NrVideoElement extends NuralyUIBaseMixin(LitElement) {
10
14
  constructor() {
11
15
  super(...arguments);
12
16
  this.width = 'auto';
13
17
  this.height = 'auto';
14
- this.fallback = null;
18
+ this.autoplay = false;
19
+ this.loop = false;
20
+ this.muted = false;
21
+ this.controls = true;
22
+ this.preload = "metadata" /* VideoPreload.Metadata */;
15
23
  this.previewable = false;
16
- this.isFullscreen = false;
24
+ this.block = false;
25
+ this.showPreview = false;
17
26
  this.hasError = false;
18
- // Updated fallback with a broken video icon
19
- this.defaultFallBack = `data:image/svg+xml;base64,${btoa(`
20
- <svg width="240" height="180" viewBox="0 0 240 180" fill="none" xmlns="http://www.w3.org/2000/svg">
21
- <rect width="240" height="180" fill="#F3F4F6"/>
22
- <path fill-rule="evenodd" clip-rule="evenodd" d="M120 82C109.507 82 101 90.5066 101 101C101 111.493 109.507 120 120 120C130.493 120 139 111.493 139 101C139 90.5066 130.493 82 120 82ZM105 101C105 92.7157 111.716 86 120 86C128.284 86 135 92.7157 135 101C135 109.284 128.284 116 120 116C111.716 116 105 109.284 105 101Z" fill="#9CA3AF"/>
23
- <path d="M120 90V96" stroke="#9CA3AF" stroke-width="4" stroke-linecap="round"/>
24
- <path d="M120 106V112" stroke="#9CA3AF" stroke-width="4" stroke-linecap="round"/>
25
- <path d="M106.343 87.3431L110.686 91.6863" stroke="#9CA3AF" stroke-width="4" stroke-linecap="round"/>
26
- <path d="M129.314 110.314L133.657 114.657" stroke="#9CA3AF" stroke-width="4" stroke-linecap="round"/>
27
- <path d="M95 101H101" stroke="#9CA3AF" stroke-width="4" stroke-linecap="round"/>
28
- <path d="M139 101H145" stroke="#9CA3AF" stroke-width="4" stroke-linecap="round"/>
29
- <path d="M106.343 114.657L110.686 110.314" stroke="#9CA3AF" stroke-width="4" stroke-linecap="round"/>
30
- <path d="M129.314 91.6863L133.657 87.3431" stroke="#9CA3AF" stroke-width="4" stroke-linecap="round"/>
31
- <rect x="70" y="60" width="100" height="4" rx="2" fill="#9CA3AF"/>
32
- <path d="M82 45C82 43.3431 83.3431 42 85 42H155C156.657 42 158 43.3431 158 45V60H82V45Z" fill="#9CA3AF"/>
33
- <rect x="70" y="138" width="100" height="4" rx="2" fill="#9CA3AF"/>
34
- <path d="M89 60H151C152.657 60 154 61.3431 154 63V138H86C84.3431 138 83 136.657 83 135V66C83 62.6863 85.6863 60 89 60Z" fill="#E5E7EB"/>
35
- <path d="M188 69L168 89M168 69L188 89" stroke="#9CA3AF" stroke-width="4" stroke-linecap="round"/>
36
- </svg>
37
- `)}`;
27
+ this.defaultFallback = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQwIiBoZWlnaHQ9IjE4MCIgdmlld0JveD0iMCAwIDI0MCAxODAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHJlY3Qgd2lkdGg9IjI0MCIgaGVpZ2h0PSIxODAiIGZpbGw9IiNGM0Y0RjYiLz48cGF0aCBkPSJNMTg4IDY5TDE2OCA4OU0xNjggNjlMMTg4IDg5IiBzdHJva2U9IiM5Q0EzQUYiIHN0cm9rZS13aWR0aD0iNCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+PC9zdmc+';
38
28
  }
39
- render() {
40
- return html `
41
- <div class="video-container" style="width:${this.width}; height:${this.height};">
42
- ${this.hasError ? html `
43
- <div class="fallback-container">
44
- <img
45
- class="fallback-image"
46
- src=${this.fallback || this.defaultFallBack}
47
- alt="Video failed to load"
48
- />
49
- <p class="error-message">This video cannot be played.</p>
50
- </div>
51
- ` : html `
52
- <video
53
- class="video-element"
54
- src="${this.src}"
55
- controls
56
- @error=${this._handleError}
57
- ></video>
58
-
59
- ${this.previewable ? html `
60
- <button class="preview-button" @click=${this._openFullscreen}>
61
- <svg width="14" height="14" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
62
- <path d="M5.5 1H1.5C1.22386 1 1 1.22386 1 1.5V5.5C1 5.77614 1.22386 6 1.5 6C1.77614 6 2 5.77614 2 5.5V2H5.5C5.77614 2 6 1.77614 6 1.5C6 1.22386 5.77614 1 5.5 1Z" fill="currentColor"/>
63
- <path d="M14.5 1H10.5C10.2239 1 10 1.22386 10 1.5C10 1.77614 10.2239 2 10.5 2H14V5.5C14 5.77614 14.2239 6 14.5 6C14.7761 6 15 5.77614 15 5.5V1.5C15 1.22386 14.7761 1 14.5 1Z" fill="currentColor"/>
64
- <path d="M5.5 14H2V10.5C2 10.2239 1.77614 10 1.5 10C1.22386 10 1 10.2239 1 10.5V14.5C1 14.7761 1.22386 15 1.5 15H5.5C5.77614 15 6 14.7761 6 14.5C6 14.2239 5.77614 14 5.5 14Z" fill="currentColor"/>
65
- <path d="M14.5 10C14.2239 10 14 10.2239 14 10.5V14H10.5C10.2239 14 10 14.2239 10 14.5C10 14.7761 10.2239 15 10.5 15H14.5C14.7761 15 15 14.7761 15 14.5V10.5C15 10.2239 14.7761 10 14.5 10Z" fill="currentColor"/>
66
- </svg>
67
- Fullscreen
68
- </button>
69
- ` : ''}
70
- `}
71
- </div>
72
-
73
- ${this.isFullscreen ? html `
74
- <div class="fullscreen-overlay">
75
- <div class="fullscreen-header">
76
- <button class="close-button" @click=${this._closeFullscreen}>
77
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
78
- <path d="M12.5 3.5L3.5 12.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
79
- <path d="M12.5 12.5L3.5 3.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
80
- </svg>
81
- </button>
82
- </div>
83
- <div class="fullscreen-content">
84
- ${this.hasError ? html `
85
- <div class="fallback-container" style="max-width: 100%; max-height: calc(100vh - 64px);">
86
- <img
87
- class="fallback-image"
88
- src=${this.fallback || this.defaultFallBack}
89
- alt="Video failed to load"
90
- />
91
- <p class="error-message">This video cannot be played.</p>
92
- </div>
93
- ` : html `
94
- <video
95
- class="video-element"
96
- src="${this.src}"
97
- controls
98
- @error=${this._handleError}
99
- style="max-width: 100%; max-height: calc(100vh - 64px);"
100
- ></video>
101
- `}
102
- </div>
103
- </div>
104
- ` : ''}
105
- `;
106
- }
107
- _handleError(e) {
108
- console.error('Video loading error:', e);
29
+ handleError() {
109
30
  this.hasError = true;
110
- this.dispatchEvent(new CustomEvent('onError', {
31
+ this.dispatchEvent(new CustomEvent('nr-video-error', {
111
32
  bubbles: true,
112
33
  composed: true,
113
- detail: {
114
- error: `Error loading video: Format not supported or file cannot be loaded`
115
- }
34
+ detail: { error: `Error loading video: ${this.src}`, src: this.src }
116
35
  }));
117
36
  }
118
- _openFullscreen() {
119
- this.isFullscreen = true;
120
- document.body.style.overflow = 'hidden';
121
- }
122
- _closeFullscreen() {
123
- this.isFullscreen = false;
124
- document.body.style.overflow = '';
125
- }
126
- disconnectedCallback() {
127
- super.disconnectedCallback();
128
- if (this.isFullscreen) {
129
- document.body.style.overflow = '';
130
- }
131
- }
132
- };
133
- HyVideoPlayer.styles = css `
134
- :host {
135
- display: block;
136
- }
137
-
138
- .video-container {
139
- position: relative;
140
- overflow: hidden;
141
- min-height: 100px;
142
- background-color: black;
143
- }
144
-
145
- .video-element {
146
- width: 100%;
147
- height: 100%;
148
- display: block;
149
- }
150
-
151
- .fallback-container {
152
- width: 100%;
153
- height: 100%;
154
- display: flex;
155
- flex-direction: column;
156
- align-items: center;
157
- justify-content: center;
158
- background-color: #F3F4F6;
159
- padding: 20px;
160
- box-sizing: border-box;
161
- }
162
-
163
- .fallback-image {
164
- max-width: 240px;
165
- width: 100%;
166
- height: auto;
167
- margin-bottom: 16px;
168
- }
169
-
170
- .error-message {
171
- font-family: system-ui, -apple-system, sans-serif;
172
- color: #6B7280;
173
- font-size: 14px;
174
- text-align: center;
175
- max-width: 300px;
176
- margin: 0;
177
- }
178
-
179
- .preview-button {
180
- position: absolute;
181
- top: 10px;
182
- right: 10px;
183
- background-color: rgba(255, 255, 255, 0.8);
184
- border: 1px solid #ccc;
185
- border-radius: 4px;
186
- padding: 5px 10px;
187
- cursor: pointer;
188
- display: flex;
189
- align-items: center;
190
- font-family: system-ui, -apple-system, sans-serif;
191
- font-size: 12px;
192
- z-index: 10;
193
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
194
- }
195
-
196
- .preview-button:hover {
197
- background-color: rgba(255, 255, 255, 1);
198
- }
199
-
200
- .preview-button svg {
201
- margin-right: 4px;
37
+ handlePlay() {
38
+ this.dispatchEvent(new CustomEvent('nr-video-play', {
39
+ bubbles: true,
40
+ composed: true,
41
+ detail: { src: this.src }
42
+ }));
202
43
  }
203
-
204
- .fullscreen-overlay {
205
- position: fixed;
206
- top: 0;
207
- left: 0;
208
- width: 100vw;
209
- height: 100vh;
210
- background-color: black;
211
- z-index: 9999;
212
- display: flex;
213
- flex-direction: column;
44
+ handlePause() {
45
+ this.dispatchEvent(new CustomEvent('nr-video-pause', {
46
+ bubbles: true,
47
+ composed: true,
48
+ detail: { src: this.src }
49
+ }));
214
50
  }
215
-
216
- .fullscreen-header {
217
- display: flex;
218
- justify-content: flex-end;
219
- padding: 16px;
220
- background-color: rgba(0, 0, 0, 0.4);
51
+ handleEnded() {
52
+ this.dispatchEvent(new CustomEvent('nr-video-ended', {
53
+ bubbles: true,
54
+ composed: true,
55
+ detail: { src: this.src }
56
+ }));
221
57
  }
222
-
223
- .close-button {
224
- background-color: white;
225
- border: none;
226
- border-radius: 4px;
227
- padding: 8px;
228
- cursor: pointer;
229
- display: flex;
230
- align-items: center;
231
- justify-content: center;
232
- width: 32px;
233
- height: 32px;
234
- box-shadow: 0 2px 4px rgba(0,0,0,0.2);
58
+ showPreviewModal() {
59
+ if (this.previewable && !this.hasError) {
60
+ this.showPreview = true;
61
+ this.dispatchEvent(new CustomEvent('nr-video-preview-open', {
62
+ bubbles: true,
63
+ composed: true,
64
+ detail: { src: this.src }
65
+ }));
66
+ }
235
67
  }
236
-
237
- .close-button:hover {
238
- background-color: #f0f0f0;
68
+ closePreviewModal() {
69
+ this.showPreview = false;
70
+ this.dispatchEvent(new CustomEvent('nr-video-preview-close', {
71
+ bubbles: true,
72
+ composed: true,
73
+ detail: { src: this.src }
74
+ }));
239
75
  }
240
-
241
- .fullscreen-content {
242
- flex: 1;
243
- display: flex;
244
- align-items: center;
245
- justify-content: center;
76
+ render() {
77
+ const containerClasses = {
78
+ 'video-container': true,
79
+ 'video--error': this.hasError
80
+ };
81
+ const videoStyles = {
82
+ width: typeof this.width === 'number' ? `${this.width}px` : this.width,
83
+ height: typeof this.height === 'number' ? `${this.height}px` : this.height,
84
+ };
85
+ if (this.hasError) {
86
+ return html `
87
+ <div class=${classMap(containerClasses)}>
88
+ <div class="error-message">
89
+ <img class="error-icon" src=${this.defaultFallback} alt="Video error" />
90
+ <p>Unable to load video</p>
91
+ </div>
92
+ </div>
93
+ `;
94
+ }
95
+ return html `
96
+ <div class=${classMap(containerClasses)}>
97
+ <video
98
+ style=${styleMap(videoStyles)}
99
+ ?autoplay=${this.autoplay}
100
+ ?loop=${this.loop}
101
+ ?muted=${this.muted}
102
+ ?controls=${this.controls}
103
+ preload=${this.preload}
104
+ poster=${this.poster || ''}
105
+ @error=${this.handleError}
106
+ @play=${this.handlePlay}
107
+ @pause=${this.handlePause}
108
+ @ended=${this.handleEnded}
109
+ >
110
+ <source src=${this.src} />
111
+ Your browser does not support the video tag.
112
+ </video>
113
+ ${this.previewable ? html `
114
+ <button class="preview-button" @click=${this.showPreviewModal}>
115
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
116
+ <path d="M5.5 5.5A.5.5 0 0 1 6 6v3a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm2.5 0a.5.5 0 0 1 .5.5v3a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm3 .5a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0V6z"/>
117
+ <path d="M2 1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H2zM1 2a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2z"/>
118
+ </svg>
119
+ Fullscreen
120
+ </button>
121
+ ` : ''}
122
+ ${this.showPreview ? html `
123
+ <div class="preview-modal" @click=${this.closePreviewModal}>
124
+ <button class="preview-close" @click=${this.closePreviewModal} aria-label="Close preview">×</button>
125
+ <video
126
+ ?autoplay=${true}
127
+ ?loop=${this.loop}
128
+ ?muted=${this.muted}
129
+ controls
130
+ poster=${this.poster || ''}
131
+ >
132
+ <source src=${this.src} />
133
+ </video>
134
+ </div>
135
+ ` : ''}
136
+ </div>
137
+ `;
246
138
  }
247
- `;
139
+ };
140
+ NrVideoElement.styles = styles;
141
+ __decorate([
142
+ property({ type: String })
143
+ ], NrVideoElement.prototype, "src", void 0);
248
144
  __decorate([
249
- property()
250
- ], HyVideoPlayer.prototype, "src", void 0);
145
+ property({ type: String })
146
+ ], NrVideoElement.prototype, "poster", void 0);
251
147
  __decorate([
252
- property()
253
- ], HyVideoPlayer.prototype, "width", void 0);
148
+ property({ type: String })
149
+ ], NrVideoElement.prototype, "width", void 0);
254
150
  __decorate([
255
- property()
256
- ], HyVideoPlayer.prototype, "height", void 0);
151
+ property({ type: String })
152
+ ], NrVideoElement.prototype, "height", void 0);
257
153
  __decorate([
258
- property({ type: Object })
259
- ], HyVideoPlayer.prototype, "fallback", void 0);
154
+ property({ type: Boolean })
155
+ ], NrVideoElement.prototype, "autoplay", void 0);
156
+ __decorate([
157
+ property({ type: Boolean })
158
+ ], NrVideoElement.prototype, "loop", void 0);
260
159
  __decorate([
261
160
  property({ type: Boolean })
262
- ], HyVideoPlayer.prototype, "previewable", void 0);
161
+ ], NrVideoElement.prototype, "muted", void 0);
162
+ __decorate([
163
+ property({ type: Boolean })
164
+ ], NrVideoElement.prototype, "controls", void 0);
165
+ __decorate([
166
+ property({ type: String })
167
+ ], NrVideoElement.prototype, "preload", void 0);
168
+ __decorate([
169
+ property({ type: Boolean })
170
+ ], NrVideoElement.prototype, "previewable", void 0);
171
+ __decorate([
172
+ property({ type: Boolean, reflect: true })
173
+ ], NrVideoElement.prototype, "block", void 0);
263
174
  __decorate([
264
175
  state()
265
- ], HyVideoPlayer.prototype, "isFullscreen", void 0);
176
+ ], NrVideoElement.prototype, "showPreview", void 0);
266
177
  __decorate([
267
178
  state()
268
- ], HyVideoPlayer.prototype, "hasError", void 0);
269
- HyVideoPlayer = __decorate([
270
- customElement('hy-video-player')
271
- ], HyVideoPlayer);
272
- export { HyVideoPlayer };
179
+ ], NrVideoElement.prototype, "hasError", void 0);
180
+ NrVideoElement = __decorate([
181
+ customElement('nr-video')
182
+ ], NrVideoElement);
183
+ export { NrVideoElement };
273
184
  //# sourceMappingURL=video.component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"video.component.js","sourceRoot":"","sources":["../../../src/components/video/video.component.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM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ACqB;AAG7B;IADC,KAAK,EAAE;+CACiB;AApBd,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CAgQzB;SAhQY,aAAa","sourcesContent":["import { LitElement, html, css } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\n\n@customElement('hy-video-player')\nexport class HyVideoPlayer extends LitElement {\n @property()\n src!: string;\n\n @property()\n width = 'auto';\n\n @property()\n height = 'auto';\n\n @property({ type: Object })\n fallback = null;\n\n @property({ type: Boolean })\n previewable = false;\n\n @state()\n private isFullscreen = false;\n\n @state()\n private hasError = false;\n\n // Updated fallback with a broken video icon\n defaultFallBack = `data:image/svg+xml;base64,${btoa(`\n <svg width=\"240\" height=\"180\" viewBox=\"0 0 240 180\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect width=\"240\" height=\"180\" fill=\"#F3F4F6\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M120 82C109.507 82 101 90.5066 101 101C101 111.493 109.507 120 120 120C130.493 120 139 111.493 139 101C139 90.5066 130.493 82 120 82ZM105 101C105 92.7157 111.716 86 120 86C128.284 86 135 92.7157 135 101C135 109.284 128.284 116 120 116C111.716 116 105 109.284 105 101Z\" fill=\"#9CA3AF\"/>\n <path d=\"M120 90V96\" stroke=\"#9CA3AF\" stroke-width=\"4\" stroke-linecap=\"round\"/>\n <path d=\"M120 106V112\" stroke=\"#9CA3AF\" stroke-width=\"4\" stroke-linecap=\"round\"/>\n <path d=\"M106.343 87.3431L110.686 91.6863\" stroke=\"#9CA3AF\" stroke-width=\"4\" stroke-linecap=\"round\"/>\n <path d=\"M129.314 110.314L133.657 114.657\" stroke=\"#9CA3AF\" stroke-width=\"4\" stroke-linecap=\"round\"/>\n <path d=\"M95 101H101\" stroke=\"#9CA3AF\" stroke-width=\"4\" stroke-linecap=\"round\"/>\n <path d=\"M139 101H145\" stroke=\"#9CA3AF\" stroke-width=\"4\" stroke-linecap=\"round\"/>\n <path d=\"M106.343 114.657L110.686 110.314\" stroke=\"#9CA3AF\" stroke-width=\"4\" stroke-linecap=\"round\"/>\n <path d=\"M129.314 91.6863L133.657 87.3431\" stroke=\"#9CA3AF\" stroke-width=\"4\" stroke-linecap=\"round\"/>\n <rect x=\"70\" y=\"60\" width=\"100\" height=\"4\" rx=\"2\" fill=\"#9CA3AF\"/>\n <path d=\"M82 45C82 43.3431 83.3431 42 85 42H155C156.657 42 158 43.3431 158 45V60H82V45Z\" fill=\"#9CA3AF\"/>\n <rect x=\"70\" y=\"138\" width=\"100\" height=\"4\" rx=\"2\" fill=\"#9CA3AF\"/>\n <path d=\"M89 60H151C152.657 60 154 61.3431 154 63V138H86C84.3431 138 83 136.657 83 135V66C83 62.6863 85.6863 60 89 60Z\" fill=\"#E5E7EB\"/>\n <path d=\"M188 69L168 89M168 69L188 89\" stroke=\"#9CA3AF\" stroke-width=\"4\" stroke-linecap=\"round\"/>\n </svg>\n `)}`;\n\n static override styles = css`\n :host {\n display: block;\n }\n \n .video-container {\n position: relative;\n overflow: hidden;\n min-height: 100px;\n background-color: black;\n }\n \n .video-element {\n width: 100%;\n height: 100%;\n display: block;\n }\n\n .fallback-container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n background-color: #F3F4F6;\n padding: 20px;\n box-sizing: border-box;\n }\n\n .fallback-image {\n max-width: 240px;\n width: 100%;\n height: auto;\n margin-bottom: 16px;\n }\n\n .error-message {\n font-family: system-ui, -apple-system, sans-serif;\n color: #6B7280;\n font-size: 14px;\n text-align: center;\n max-width: 300px;\n margin: 0;\n }\n \n .preview-button {\n position: absolute;\n top: 10px;\n right: 10px;\n background-color: rgba(255, 255, 255, 0.8);\n border: 1px solid #ccc;\n border-radius: 4px;\n padding: 5px 10px;\n cursor: pointer;\n display: flex;\n align-items: center;\n font-family: system-ui, -apple-system, sans-serif;\n font-size: 12px;\n z-index: 10;\n box-shadow: 0 2px 4px rgba(0,0,0,0.1);\n }\n \n .preview-button:hover {\n background-color: rgba(255, 255, 255, 1);\n }\n\n .preview-button svg {\n margin-right: 4px;\n }\n \n .fullscreen-overlay {\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background-color: black;\n z-index: 9999;\n display: flex;\n flex-direction: column;\n }\n \n .fullscreen-header {\n display: flex;\n justify-content: flex-end;\n padding: 16px;\n background-color: rgba(0, 0, 0, 0.4);\n }\n \n .close-button {\n background-color: white;\n border: none;\n border-radius: 4px;\n padding: 8px;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 32px;\n height: 32px;\n box-shadow: 0 2px 4px rgba(0,0,0,0.2);\n }\n\n .close-button:hover {\n background-color: #f0f0f0;\n }\n \n .fullscreen-content {\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n `;\n\n override render() {\n return html`\n <div class=\"video-container\" style=\"width:${this.width}; height:${this.height};\">\n ${this.hasError ? html`\n <div class=\"fallback-container\">\n <img\n class=\"fallback-image\"\n src=${this.fallback || this.defaultFallBack}\n alt=\"Video failed to load\"\n />\n <p class=\"error-message\">This video cannot be played.</p>\n </div>\n ` : html`\n <video\n class=\"video-element\"\n src=\"${this.src}\"\n controls\n @error=${this._handleError}\n ></video>\n \n ${this.previewable ? html`\n <button class=\"preview-button\" @click=${this._openFullscreen}>\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M5.5 1H1.5C1.22386 1 1 1.22386 1 1.5V5.5C1 5.77614 1.22386 6 1.5 6C1.77614 6 2 5.77614 2 5.5V2H5.5C5.77614 2 6 1.77614 6 1.5C6 1.22386 5.77614 1 5.5 1Z\" fill=\"currentColor\"/>\n <path d=\"M14.5 1H10.5C10.2239 1 10 1.22386 10 1.5C10 1.77614 10.2239 2 10.5 2H14V5.5C14 5.77614 14.2239 6 14.5 6C14.7761 6 15 5.77614 15 5.5V1.5C15 1.22386 14.7761 1 14.5 1Z\" fill=\"currentColor\"/>\n <path d=\"M5.5 14H2V10.5C2 10.2239 1.77614 10 1.5 10C1.22386 10 1 10.2239 1 10.5V14.5C1 14.7761 1.22386 15 1.5 15H5.5C5.77614 15 6 14.7761 6 14.5C6 14.2239 5.77614 14 5.5 14Z\" fill=\"currentColor\"/>\n <path d=\"M14.5 10C14.2239 10 14 10.2239 14 10.5V14H10.5C10.2239 14 10 14.2239 10 14.5C10 14.7761 10.2239 15 10.5 15H14.5C14.7761 15 15 14.7761 15 14.5V10.5C15 10.2239 14.7761 10 14.5 10Z\" fill=\"currentColor\"/>\n </svg>\n Fullscreen\n </button>\n ` : ''}\n `}\n </div>\n \n ${this.isFullscreen ? html`\n <div class=\"fullscreen-overlay\">\n <div class=\"fullscreen-header\">\n <button class=\"close-button\" @click=${this._closeFullscreen}>\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M12.5 3.5L3.5 12.5\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n <path d=\"M12.5 12.5L3.5 3.5\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n </div>\n <div class=\"fullscreen-content\">\n ${this.hasError ? html`\n <div class=\"fallback-container\" style=\"max-width: 100%; max-height: calc(100vh - 64px);\">\n <img\n class=\"fallback-image\"\n src=${this.fallback || this.defaultFallBack}\n alt=\"Video failed to load\"\n />\n <p class=\"error-message\">This video cannot be played.</p>\n </div>\n ` : html`\n <video\n class=\"video-element\"\n src=\"${this.src}\"\n controls\n @error=${this._handleError}\n style=\"max-width: 100%; max-height: calc(100vh - 64px);\"\n ></video>\n `}\n </div>\n </div>\n ` : ''}\n `;\n }\n\n _handleError(e: Event) {\n console.error('Video loading error:', e);\n this.hasError = true;\n this.dispatchEvent(new CustomEvent('onError', {\n bubbles: true,\n composed: true,\n detail: {\n error: `Error loading video: Format not supported or file cannot be loaded`\n }\n }));\n }\n\n _openFullscreen() {\n this.isFullscreen = true;\n document.body.style.overflow = 'hidden';\n }\n\n _closeFullscreen() {\n this.isFullscreen = false;\n document.body.style.overflow = '';\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n if (this.isFullscreen) {\n document.body.style.overflow = '';\n }\n }\n}"]}
1
+ {"version":3,"file":"video.component.js","sourceRoot":"","sources":["../../../src/components/video/video.component.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,MAAM,MAAM,kBAAkB,CAAC;AAItC,IAAa,cAAc,GAA3B,MAAa,cAAe,SAAQ,iBAAiB,CAAC,UAAU,CAAC;IAAjE;;QAUE,UAAK,GAAG,MAAM,CAAC;QAGf,WAAM,GAAG,MAAM,CAAC;QAGhB,aAAQ,GAAG,KAAK,CAAC;QAGjB,SAAI,GAAG,KAAK,CAAC;QAGb,UAAK,GAAG,KAAK,CAAC;QAGd,aAAQ,GAAG,IAAI,CAAC;QAGhB,YAAO,0CAAuC;QAG9C,gBAAW,GAAG,KAAK,CAAC;QAGpB,UAAK,GAAG,KAAK,CAAC;QAGN,gBAAW,GAAG,KAAK,CAAC;QAGpB,aAAQ,GAAG,KAAK,CAAC;QAER,oBAAe,GAAG,wWAAwW,CAAC;IAyH9Y,CAAC;IAvHS,WAAW;QACjB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,gBAAgB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DACiB;AAxCd,cAAc;IAD1B,aAAa,CAAC,UAAU,CAAC;GACb,cAAc,CAmK1B;SAnKY,cAAc","sourcesContent":["import { html, LitElement } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { styleMap } from \"lit/directives/style-map.js\";\nimport { NuralyUIBaseMixin } from \"../../shared/base-mixin.js\";\nimport styles from \"./video.style.js\";\nimport { VideoPreload } from \"./video.types.js\";\n\n@customElement('nr-video')\nexport class NrVideoElement extends NuralyUIBaseMixin(LitElement) {\n static override styles = styles;\n\n @property({ type: String })\n src!: string;\n\n @property({ type: String })\n poster?: string;\n\n @property({ type: String })\n width = 'auto';\n\n @property({ type: String })\n height = 'auto';\n\n @property({ type: Boolean })\n autoplay = false;\n\n @property({ type: Boolean })\n loop = false;\n\n @property({ type: Boolean })\n muted = false;\n\n @property({ type: Boolean })\n controls = true;\n\n @property({ type: String })\n preload: VideoPreload = VideoPreload.Metadata;\n\n @property({ type: Boolean })\n previewable = false;\n\n @property({ type: Boolean, reflect: true })\n block = false;\n\n @state()\n private showPreview = false;\n\n @state()\n private hasError = false;\n\n private readonly defaultFallback = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQwIiBoZWlnaHQ9IjE4MCIgdmlld0JveD0iMCAwIDI0MCAxODAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHJlY3Qgd2lkdGg9IjI0MCIgaGVpZ2h0PSIxODAiIGZpbGw9IiNGM0Y0RjYiLz48cGF0aCBkPSJNMTg4IDY5TDE2OCA4OU0xNjggNjlMMTg4IDg5IiBzdHJva2U9IiM5Q0EzQUYiIHN0cm9rZS13aWR0aD0iNCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+PC9zdmc+';\n\n private handleError() {\n this.hasError = true;\n this.dispatchEvent(new CustomEvent('nr-video-error', {\n bubbles: true,\n composed: true,\n detail: { error: `Error loading video: ${this.src}`, src: this.src }\n }));\n }\n\n private handlePlay() {\n this.dispatchEvent(new CustomEvent('nr-video-play', {\n bubbles: true,\n composed: true,\n detail: { src: this.src }\n }));\n }\n\n private handlePause() {\n this.dispatchEvent(new CustomEvent('nr-video-pause', {\n bubbles: true,\n composed: true,\n detail: { src: this.src }\n }));\n }\n\n private handleEnded() {\n this.dispatchEvent(new CustomEvent('nr-video-ended', {\n bubbles: true,\n composed: true,\n detail: { src: this.src }\n }));\n }\n\n private showPreviewModal() {\n if (this.previewable && !this.hasError) {\n this.showPreview = true;\n this.dispatchEvent(new CustomEvent('nr-video-preview-open', {\n bubbles: true,\n composed: true,\n detail: { src: this.src }\n }));\n }\n }\n\n private closePreviewModal() {\n this.showPreview = false;\n this.dispatchEvent(new CustomEvent('nr-video-preview-close', {\n bubbles: true,\n composed: true,\n detail: { src: this.src }\n }));\n }\n\n override render() {\n const containerClasses = {\n 'video-container': true,\n 'video--error': this.hasError\n };\n\n const videoStyles: Record<string, string> = {\n width: typeof this.width === 'number' ? `${this.width}px` : this.width,\n height: typeof this.height === 'number' ? `${this.height}px` : this.height,\n };\n\n if (this.hasError) {\n return html`\n <div class=${classMap(containerClasses)}>\n <div class=\"error-message\">\n <img class=\"error-icon\" src=${this.defaultFallback} alt=\"Video error\" />\n <p>Unable to load video</p>\n </div>\n </div>\n `;\n }\n\n return html`\n <div class=${classMap(containerClasses)}>\n <video\n style=${styleMap(videoStyles)}\n ?autoplay=${this.autoplay}\n ?loop=${this.loop}\n ?muted=${this.muted}\n ?controls=${this.controls}\n preload=${this.preload}\n poster=${this.poster || ''}\n @error=${this.handleError}\n @play=${this.handlePlay}\n @pause=${this.handlePause}\n @ended=${this.handleEnded}\n >\n <source src=${this.src} />\n Your browser does not support the video tag.\n </video>\n ${this.previewable ? html`\n <button class=\"preview-button\" @click=${this.showPreviewModal}>\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\">\n <path d=\"M5.5 5.5A.5.5 0 0 1 6 6v3a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm2.5 0a.5.5 0 0 1 .5.5v3a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm3 .5a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0V6z\"/>\n <path d=\"M2 1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H2zM1 2a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2z\"/>\n </svg>\n Fullscreen\n </button>\n ` : ''}\n ${this.showPreview ? html`\n <div class=\"preview-modal\" @click=${this.closePreviewModal}>\n <button class=\"preview-close\" @click=${this.closePreviewModal} aria-label=\"Close preview\">×</button>\n <video\n ?autoplay=${true}\n ?loop=${this.loop}\n ?muted=${this.muted}\n controls\n poster=${this.poster || ''}\n >\n <source src=${this.src} />\n </video>\n </div>\n ` : ''}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nr-video': NrVideoElement;\n }\n}\n"]}
@@ -0,0 +1,3 @@
1
+ declare const _default: import("lit").CSSResult;
2
+ export default _default;
3
+ //# sourceMappingURL=video.style.d.ts.map
package/video.style.js ADDED
@@ -0,0 +1,124 @@
1
+ import { css } from "lit";
2
+ export default css `
3
+ :host {
4
+ display: inline-block;
5
+ box-sizing: border-box;
6
+ }
7
+
8
+ :host([block]) {
9
+ display: block;
10
+ }
11
+
12
+ .video-container {
13
+ position: relative;
14
+ width: 100%;
15
+ height: 100%;
16
+ background-color: var(--nuraly-video-bg, #000);
17
+ }
18
+
19
+ video {
20
+ display: block;
21
+ width: 100%;
22
+ height: 100%;
23
+ border-radius: var(--nuraly-video-border-radius, 4px);
24
+ }
25
+
26
+ .video--error {
27
+ display: flex;
28
+ align-items: center;
29
+ justify-content: center;
30
+ min-height: 200px;
31
+ background-color: var(--nuraly-video-error-bg, #f5f5f5);
32
+ color: var(--nuraly-video-error-color, #999);
33
+ }
34
+
35
+ .error-message {
36
+ text-align: center;
37
+ padding: 20px;
38
+ }
39
+
40
+ .error-icon {
41
+ width: 64px;
42
+ height: 64px;
43
+ margin: 0 auto 16px;
44
+ opacity: 0.5;
45
+ }
46
+
47
+ /* Preview/Fullscreen Modal */
48
+ .preview-modal {
49
+ position: fixed;
50
+ top: 0;
51
+ left: 0;
52
+ right: 0;
53
+ bottom: 0;
54
+ display: flex;
55
+ align-items: center;
56
+ justify-content: center;
57
+ background-color: var(--nuraly-video-preview-bg, rgba(0, 0, 0, 0.95));
58
+ z-index: var(--nuraly-video-preview-zindex, 1000);
59
+ animation: fadeIn 0.3s ease;
60
+ }
61
+
62
+ .preview-modal video {
63
+ max-width: 90%;
64
+ max-height: 90%;
65
+ border-radius: var(--nuraly-video-preview-border-radius, 4px);
66
+ }
67
+
68
+ .preview-close {
69
+ position: absolute;
70
+ top: 20px;
71
+ right: 20px;
72
+ width: 40px;
73
+ height: 40px;
74
+ background: var(--nuraly-video-preview-close-bg, rgba(255, 255, 255, 0.2));
75
+ border: none;
76
+ border-radius: 50%;
77
+ color: var(--nuraly-video-preview-close-color, white);
78
+ font-size: 24px;
79
+ line-height: 1;
80
+ cursor: pointer;
81
+ transition: background-color 0.3s ease;
82
+ display: flex;
83
+ align-items: center;
84
+ justify-content: center;
85
+ outline: none;
86
+ }
87
+
88
+ .preview-close:hover {
89
+ background: var(--nuraly-video-preview-close-hover-bg, rgba(255, 255, 255, 0.3));
90
+ }
91
+
92
+ .preview-button {
93
+ position: absolute;
94
+ top: 10px;
95
+ right: 10px;
96
+ background-color: var(--nuraly-video-fullscreen-btn-bg, rgba(0, 0, 0, 0.5));
97
+ border: none;
98
+ border-radius: 4px;
99
+ padding: 8px 12px;
100
+ cursor: pointer;
101
+ color: var(--nuraly-video-fullscreen-btn-color, white);
102
+ font-size: 12px;
103
+ display: flex;
104
+ align-items: center;
105
+ gap: 4px;
106
+ transition: background-color 0.3s ease;
107
+ z-index: 10;
108
+ }
109
+
110
+ .preview-button:hover {
111
+ background-color: var(--nuraly-video-fullscreen-btn-hover-bg, rgba(0, 0, 0, 0.7));
112
+ }
113
+
114
+ /* Animations */
115
+ @keyframes fadeIn {
116
+ from {
117
+ opacity: 0;
118
+ }
119
+ to {
120
+ opacity: 1;
121
+ }
122
+ }
123
+ `;
124
+ //# sourceMappingURL=video.style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video.style.js","sourceRoot":"","sources":["../../../src/components/video/video.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,eAAe,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyHjB,CAAC","sourcesContent":["import { css } from \"lit\";\n\nexport default css`\n :host {\n display: inline-block;\n box-sizing: border-box;\n }\n\n :host([block]) {\n display: block;\n }\n\n .video-container {\n position: relative;\n width: 100%;\n height: 100%;\n background-color: var(--nuraly-video-bg, #000);\n }\n\n video {\n display: block;\n width: 100%;\n height: 100%;\n border-radius: var(--nuraly-video-border-radius, 4px);\n }\n\n .video--error {\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 200px;\n background-color: var(--nuraly-video-error-bg, #f5f5f5);\n color: var(--nuraly-video-error-color, #999);\n }\n\n .error-message {\n text-align: center;\n padding: 20px;\n }\n\n .error-icon {\n width: 64px;\n height: 64px;\n margin: 0 auto 16px;\n opacity: 0.5;\n }\n\n /* Preview/Fullscreen Modal */\n .preview-modal {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: var(--nuraly-video-preview-bg, rgba(0, 0, 0, 0.95));\n z-index: var(--nuraly-video-preview-zindex, 1000);\n animation: fadeIn 0.3s ease;\n }\n\n .preview-modal video {\n max-width: 90%;\n max-height: 90%;\n border-radius: var(--nuraly-video-preview-border-radius, 4px);\n }\n\n .preview-close {\n position: absolute;\n top: 20px;\n right: 20px;\n width: 40px;\n height: 40px;\n background: var(--nuraly-video-preview-close-bg, rgba(255, 255, 255, 0.2));\n border: none;\n border-radius: 50%;\n color: var(--nuraly-video-preview-close-color, white);\n font-size: 24px;\n line-height: 1;\n cursor: pointer;\n transition: background-color 0.3s ease;\n display: flex;\n align-items: center;\n justify-content: center;\n outline: none;\n }\n\n .preview-close:hover {\n background: var(--nuraly-video-preview-close-hover-bg, rgba(255, 255, 255, 0.3));\n }\n\n .preview-button {\n position: absolute;\n top: 10px;\n right: 10px;\n background-color: var(--nuraly-video-fullscreen-btn-bg, rgba(0, 0, 0, 0.5));\n border: none;\n border-radius: 4px;\n padding: 8px 12px;\n cursor: pointer;\n color: var(--nuraly-video-fullscreen-btn-color, white);\n font-size: 12px;\n display: flex;\n align-items: center;\n gap: 4px;\n transition: background-color 0.3s ease;\n z-index: 10;\n }\n\n .preview-button:hover {\n background-color: var(--nuraly-video-fullscreen-btn-hover-bg, rgba(0, 0, 0, 0.7));\n }\n\n /* Animations */\n @keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n`;\n"]}