@videojs/html 0.1.0-preview.2 → 0.1.0-preview.3
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/README.md +2 -2
- package/dist/{icons-YlVTDFdV.js → icons-eJws_3Te.js} +55 -7
- package/dist/icons-eJws_3Te.js.map +1 -0
- package/dist/icons.d.ts +2 -2
- package/dist/icons.js +2 -2
- package/dist/{index-BtSCzZKn.d.ts → index-AcYRyuAY.d.ts} +18 -4
- package/dist/index-AcYRyuAY.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/media-preview-time-display-C7jpAct6.js +44 -0
- package/dist/media-preview-time-display-C7jpAct6.js.map +1 -0
- package/dist/{media-skin-CbuyuCb-.d.ts → media-skin-D44BfH6y.d.ts} +3 -29
- package/dist/media-skin-D44BfH6y.d.ts.map +1 -0
- package/dist/{media-skin-BlXPC9wG.js → media-skin-DR8zj-LV.js} +124 -258
- package/dist/media-skin-DR8zj-LV.js.map +1 -0
- package/dist/skins/frosted.d.ts +12 -0
- package/dist/skins/frosted.d.ts.map +1 -0
- package/dist/skins/frosted.js +118 -0
- package/dist/skins/frosted.js.map +1 -0
- package/dist/skins/minimal.d.ts +12 -0
- package/dist/skins/minimal.d.ts.map +1 -0
- package/dist/skins/minimal.js +123 -0
- package/dist/skins/minimal.js.map +1 -0
- package/package.json +12 -7
- package/dist/icons-YlVTDFdV.js.map +0 -1
- package/dist/index-BtSCzZKn.d.ts.map +0 -1
- package/dist/media-skin-BlXPC9wG.js.map +0 -1
- package/dist/media-skin-CbuyuCb-.d.ts.map +0 -1
- package/dist/skins/default.d.ts +0 -12
- package/dist/skins/default.d.ts.map +0 -1
- package/dist/skins/default.js +0 -424
- package/dist/skins/default.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createMediaStore, currentTimeDisplayStateDefinition, durationDisplayStateDefinition, fullscreenButtonStateDefinition, muteButtonStateDefinition, playButtonStateDefinition, timeSliderStateDefinition, volumeSliderStateDefinition } from "@videojs/core/store";
|
|
2
2
|
import { formatDisplayTime, uniqueId } from "@videojs/utils";
|
|
3
3
|
import { ConsumerMixin, ProviderMixin } from "@open-wc/context-protocol";
|
|
4
|
-
import {
|
|
4
|
+
import { contains, getDocument, getDocumentOrShadowRoot, namedNodeMapToObject, safePolygon, setAttributes } from "@videojs/utils/dom";
|
|
5
5
|
import { arrow, autoUpdate, computePosition, flip, offset, shift } from "@floating-ui/dom";
|
|
6
6
|
import { TimeSlider, VolumeSlider } from "@videojs/core";
|
|
7
7
|
|
|
@@ -311,37 +311,44 @@ if (!globalThis.customElements.get("media-play-button")) globalThis.customElemen
|
|
|
311
311
|
|
|
312
312
|
//#endregion
|
|
313
313
|
//#region src/components/media-popover.ts
|
|
314
|
-
var
|
|
314
|
+
var Popover = class extends HTMLElement {
|
|
315
315
|
#open = false;
|
|
316
|
+
#transitionStatus = "initial";
|
|
316
317
|
#hoverTimeout = null;
|
|
317
318
|
#cleanup = null;
|
|
318
|
-
#transitionStatus = "initial";
|
|
319
319
|
#abortController = null;
|
|
320
|
+
#floatingContext = null;
|
|
320
321
|
connectedCallback() {
|
|
321
|
-
this.#updateVisibility();
|
|
322
322
|
this.#abortController ??= new AbortController();
|
|
323
323
|
const { signal } = this.#abortController;
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
324
|
+
const trigger = this.#triggerElement;
|
|
325
|
+
if (trigger) {
|
|
326
|
+
if (globalThis.matchMedia?.("(hover: hover)")?.matches) {
|
|
327
|
+
trigger.addEventListener("pointerenter", this, { signal });
|
|
328
|
+
trigger.addEventListener("pointerleave", this, { signal });
|
|
329
|
+
}
|
|
330
|
+
trigger.addEventListener("focusin", this, { signal });
|
|
331
|
+
trigger.addEventListener("focusout", this, { signal });
|
|
332
|
+
}
|
|
333
|
+
this.addEventListener("pointerenter", this, { signal });
|
|
327
334
|
this.addEventListener("focusout", this, { signal });
|
|
328
|
-
getDocument(this).documentElement.addEventListener("mouseleave", this, { signal });
|
|
329
335
|
}
|
|
330
336
|
disconnectedCallback() {
|
|
331
337
|
this.#clearHoverTimeout();
|
|
332
338
|
this.#cleanup?.();
|
|
333
|
-
this.#transitionStatus = "unmounted";
|
|
334
|
-
this.#updateVisibility();
|
|
335
339
|
this.#abortController?.abort();
|
|
336
340
|
this.#abortController = null;
|
|
337
341
|
}
|
|
338
342
|
handleEvent(event) {
|
|
339
343
|
switch (event.type) {
|
|
340
|
-
case "
|
|
341
|
-
this.#
|
|
344
|
+
case "pointerenter":
|
|
345
|
+
this.#handlePointerEnter(event);
|
|
342
346
|
break;
|
|
343
|
-
case "
|
|
344
|
-
this.#
|
|
347
|
+
case "pointerleave":
|
|
348
|
+
this.#handlePointerLeave(event);
|
|
349
|
+
break;
|
|
350
|
+
case "pointermove":
|
|
351
|
+
this.#handlePointerMove(event);
|
|
345
352
|
break;
|
|
346
353
|
case "focusin":
|
|
347
354
|
this.#handleFocusIn(event);
|
|
@@ -356,7 +363,9 @@ var MediaPopoverRoot = class extends HTMLElement {
|
|
|
356
363
|
return [
|
|
357
364
|
"open-on-hover",
|
|
358
365
|
"delay",
|
|
359
|
-
"close-delay"
|
|
366
|
+
"close-delay",
|
|
367
|
+
"side",
|
|
368
|
+
"side-offset"
|
|
360
369
|
];
|
|
361
370
|
}
|
|
362
371
|
get openOnHover() {
|
|
@@ -368,265 +377,120 @@ var MediaPopoverRoot = class extends HTMLElement {
|
|
|
368
377
|
get closeDelay() {
|
|
369
378
|
return Number.parseInt(this.getAttribute("close-delay") ?? "0", 10);
|
|
370
379
|
}
|
|
371
|
-
get
|
|
372
|
-
return this.
|
|
373
|
-
}
|
|
374
|
-
get #portalElement() {
|
|
375
|
-
return this.querySelector("media-popover-portal");
|
|
380
|
+
get side() {
|
|
381
|
+
return this.getAttribute("side");
|
|
376
382
|
}
|
|
377
|
-
get
|
|
378
|
-
return this
|
|
383
|
+
get sideOffset() {
|
|
384
|
+
return Number.parseInt(this.getAttribute("side-offset") ?? "0", 10);
|
|
379
385
|
}
|
|
380
|
-
get #
|
|
381
|
-
return this
|
|
386
|
+
get #triggerElement() {
|
|
387
|
+
return getDocumentOrShadowRoot(this)?.querySelector(`[popovertarget="${this.id}"]`);
|
|
382
388
|
}
|
|
383
|
-
setOpen(open) {
|
|
389
|
+
#setOpen(open) {
|
|
384
390
|
if (this.#open === open) return;
|
|
385
391
|
this.#open = open;
|
|
386
392
|
if (open) {
|
|
387
393
|
this.#setupFloating();
|
|
388
|
-
this.#portalElement?.renderGuards();
|
|
389
|
-
} else {
|
|
390
|
-
this.#portalElement?.removeGuards();
|
|
391
|
-
this.#cleanup?.();
|
|
392
|
-
this.#cleanup = null;
|
|
393
|
-
}
|
|
394
|
-
if (open) {
|
|
395
394
|
this.#transitionStatus = "initial";
|
|
395
|
+
this.#updateVisibility();
|
|
396
|
+
this.showPopover();
|
|
396
397
|
requestAnimationFrame(() => {
|
|
397
398
|
this.#transitionStatus = "open";
|
|
398
399
|
this.#updateVisibility();
|
|
399
400
|
});
|
|
400
|
-
} else
|
|
401
|
-
|
|
401
|
+
} else {
|
|
402
|
+
this.#transitionStatus = "close";
|
|
403
|
+
this.#updateVisibility();
|
|
404
|
+
const transitions = this.getAnimations().filter((anim) => anim instanceof CSSTransition);
|
|
405
|
+
if (transitions.length > 0) Promise.all(transitions.map((t) => t.finished)).then(() => this.hidePopover()).catch(() => this.hidePopover());
|
|
406
|
+
else this.hidePopover();
|
|
407
|
+
}
|
|
402
408
|
}
|
|
403
409
|
#updateVisibility() {
|
|
404
|
-
this.style
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
this.#popupElement.toggleAttribute("data-starting-style", this.#transitionStatus === "initial");
|
|
409
|
-
this.#popupElement.toggleAttribute("data-open", this.#transitionStatus === "initial" || this.#transitionStatus === "open");
|
|
410
|
-
this.#popupElement.toggleAttribute("data-ending-style", this.#transitionStatus === "close" || this.#transitionStatus === "unmounted");
|
|
411
|
-
this.#popupElement.toggleAttribute("data-closed", this.#transitionStatus === "close" || this.#transitionStatus === "unmounted");
|
|
412
|
-
this.#abortController ??= new AbortController();
|
|
413
|
-
const { signal } = this.#abortController;
|
|
414
|
-
this.#popupElement.addEventListener("mouseleave", this, { signal });
|
|
415
|
-
}
|
|
416
|
-
const triggerElement = this.#triggerElement?.firstElementChild;
|
|
417
|
-
if (triggerElement) {
|
|
418
|
-
triggerElement.setAttribute("aria-expanded", this.#open.toString());
|
|
419
|
-
triggerElement.toggleAttribute("data-popup-open", this.#open);
|
|
420
|
-
if (this.#popupElement?.id) triggerElement.setAttribute("aria-controls", this.#popupElement?.id);
|
|
421
|
-
}
|
|
410
|
+
this.toggleAttribute("data-starting-style", this.#transitionStatus === "initial");
|
|
411
|
+
this.toggleAttribute("data-open", this.#transitionStatus === "initial" || this.#transitionStatus === "open");
|
|
412
|
+
this.toggleAttribute("data-ending-style", this.#transitionStatus === "close" || this.#transitionStatus === "unmounted");
|
|
413
|
+
this.toggleAttribute("data-closed", this.#transitionStatus === "close" || this.#transitionStatus === "unmounted");
|
|
422
414
|
}
|
|
423
415
|
#setupFloating() {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
const
|
|
427
|
-
|
|
428
|
-
const placement = this.#positionerElement?.side ?? "top";
|
|
429
|
-
const sideOffset = this.#positionerElement?.sideOffset;
|
|
416
|
+
const trigger = this.#triggerElement;
|
|
417
|
+
if (!trigger) return;
|
|
418
|
+
const placement = this.side ?? "top";
|
|
419
|
+
const sideOffset = this.sideOffset;
|
|
430
420
|
const updatePosition = () => {
|
|
431
|
-
computePosition(trigger,
|
|
421
|
+
computePosition(trigger, this, {
|
|
432
422
|
placement,
|
|
433
423
|
middleware: [
|
|
434
424
|
offset(sideOffset),
|
|
435
425
|
flip(),
|
|
436
426
|
shift()
|
|
437
|
-
]
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
427
|
+
],
|
|
428
|
+
strategy: "fixed"
|
|
429
|
+
}).then((data) => {
|
|
430
|
+
this.#floatingContext = {
|
|
431
|
+
...data,
|
|
432
|
+
elements: {
|
|
433
|
+
domReference: trigger,
|
|
434
|
+
floating: this
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
Object.assign(this.style, {
|
|
438
|
+
left: `${data.x}px`,
|
|
439
|
+
top: `${data.y}px`
|
|
442
440
|
});
|
|
443
441
|
});
|
|
444
442
|
};
|
|
445
443
|
updatePosition();
|
|
446
|
-
this.#cleanup = autoUpdate(trigger,
|
|
444
|
+
this.#cleanup = autoUpdate(trigger, this, updatePosition);
|
|
447
445
|
}
|
|
448
446
|
#clearHoverTimeout() {
|
|
449
447
|
if (this.#hoverTimeout) {
|
|
450
|
-
clearTimeout(this.#hoverTimeout);
|
|
448
|
+
globalThis.clearTimeout(this.#hoverTimeout);
|
|
451
449
|
this.#hoverTimeout = null;
|
|
452
450
|
}
|
|
453
451
|
}
|
|
454
|
-
#
|
|
452
|
+
#handlePointerEnter(event) {
|
|
455
453
|
if (!this.openOnHover) return;
|
|
456
454
|
this.#clearHoverTimeout();
|
|
455
|
+
if (event.currentTarget === this) this.#addPointerMoveListener();
|
|
456
|
+
if (this.#open) return;
|
|
457
457
|
this.#hoverTimeout = globalThis.setTimeout(() => {
|
|
458
|
-
this
|
|
458
|
+
this.#setOpen(true);
|
|
459
459
|
}, this.delay);
|
|
460
460
|
}
|
|
461
|
-
#
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
461
|
+
#handlePointerLeave(_event) {
|
|
462
|
+
this.#addPointerMoveListener();
|
|
463
|
+
}
|
|
464
|
+
#addPointerMoveListener() {
|
|
465
|
+
if (!globalThis.matchMedia?.("(hover: hover)")?.matches) return;
|
|
466
|
+
const { signal } = this.#abortController;
|
|
467
|
+
getDocument(this).documentElement.addEventListener("pointermove", this, { signal });
|
|
468
|
+
}
|
|
469
|
+
#handlePointerMove(event) {
|
|
470
|
+
if (!this.openOnHover || !this.#floatingContext) return;
|
|
471
|
+
safePolygon({ blockPointerEvents: true })({
|
|
472
|
+
...this.#floatingContext,
|
|
473
|
+
x: event.clientX,
|
|
474
|
+
y: event.clientY,
|
|
475
|
+
onClose: () => {
|
|
476
|
+
getDocument(this).documentElement.removeEventListener("pointermove", this);
|
|
477
|
+
this.#clearHoverTimeout();
|
|
478
|
+
this.#hoverTimeout = globalThis.setTimeout(() => {
|
|
479
|
+
this.#setOpen(false);
|
|
480
|
+
}, this.closeDelay);
|
|
481
|
+
}
|
|
482
|
+
})(event);
|
|
468
483
|
}
|
|
469
484
|
#handleFocusIn(_event) {
|
|
470
|
-
this
|
|
485
|
+
this.#setOpen(true);
|
|
471
486
|
}
|
|
472
487
|
#handleFocusOut(event) {
|
|
473
488
|
const relatedTarget = event.relatedTarget;
|
|
474
|
-
if (relatedTarget && relatedTarget
|
|
475
|
-
this
|
|
489
|
+
if (relatedTarget && contains(this, relatedTarget)) return;
|
|
490
|
+
this.#setOpen(false);
|
|
476
491
|
}
|
|
477
492
|
};
|
|
478
|
-
|
|
479
|
-
connectedCallback() {
|
|
480
|
-
this.style.display = "contents";
|
|
481
|
-
const triggerElement = this.firstElementChild;
|
|
482
|
-
if (triggerElement) {
|
|
483
|
-
triggerElement.setAttribute("aria-haspopup", "true");
|
|
484
|
-
triggerElement.setAttribute("aria-expanded", "false");
|
|
485
|
-
new MutationObserver((mutations) => {
|
|
486
|
-
mutations.forEach((mutation) => {
|
|
487
|
-
if (mutation.type === "attributes") {
|
|
488
|
-
const rootElement = this.closest("media-popover-root");
|
|
489
|
-
let popupElement = rootElement.querySelector("media-popover-popup");
|
|
490
|
-
if (!popupElement) {
|
|
491
|
-
const portalElement = rootElement.querySelector("media-popover-portal");
|
|
492
|
-
if (!portalElement) return;
|
|
493
|
-
popupElement = portalElement.querySelector("media-popover-popup");
|
|
494
|
-
if (!popupElement) return;
|
|
495
|
-
}
|
|
496
|
-
const attributeName = mutation.attributeName;
|
|
497
|
-
if (!attributeName || !attributeName.startsWith("data-")) return;
|
|
498
|
-
const attributeValue = triggerElement.getAttribute(attributeName);
|
|
499
|
-
if (attributeValue !== null) popupElement.setAttribute(attributeName, attributeValue);
|
|
500
|
-
else popupElement.removeAttribute(attributeName);
|
|
501
|
-
}
|
|
502
|
-
});
|
|
503
|
-
}).observe(triggerElement, { attributes: true });
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
};
|
|
507
|
-
var MediaPopoverPortal = class extends HTMLElement {
|
|
508
|
-
#portal = null;
|
|
509
|
-
#childrenArray = [];
|
|
510
|
-
#guards = [];
|
|
511
|
-
connectedCallback() {
|
|
512
|
-
this.style.display = "contents";
|
|
513
|
-
this.#setupPortal();
|
|
514
|
-
}
|
|
515
|
-
disconnectedCallback() {
|
|
516
|
-
this.#cleanupPortal();
|
|
517
|
-
}
|
|
518
|
-
querySelector(selector) {
|
|
519
|
-
return this.#portal.querySelector(selector);
|
|
520
|
-
}
|
|
521
|
-
querySelectorAll(selector) {
|
|
522
|
-
return this.#portal.querySelectorAll(selector);
|
|
523
|
-
}
|
|
524
|
-
handleEvent(event) {
|
|
525
|
-
this.dispatchEvent(new Event(event.type, { bubbles: true }));
|
|
526
|
-
}
|
|
527
|
-
#setupPortal() {
|
|
528
|
-
const portalId = this.getAttribute("root-id") ?? "@default_portal_id";
|
|
529
|
-
if (!portalId) return;
|
|
530
|
-
const portalContainer = this.getRootNode().getElementById(portalId) ?? this.getRootNode().querySelector("media-container")?.shadowRoot?.getElementById(portalId) ? this.getRootNode().querySelector("media-container") : void 0;
|
|
531
|
-
if (!portalContainer) return;
|
|
532
|
-
this.#portal = document.createElement("div");
|
|
533
|
-
this.#portal.slot = "portal";
|
|
534
|
-
this.#portal.id = uniqueId();
|
|
535
|
-
this.#childrenArray = Array.from(this.children);
|
|
536
|
-
this.#portal.append(...this.#childrenArray);
|
|
537
|
-
portalContainer.append(this.#portal);
|
|
538
|
-
}
|
|
539
|
-
#cleanupPortal() {
|
|
540
|
-
if (!this.#portal) return;
|
|
541
|
-
this.removeGuards();
|
|
542
|
-
this.append(...this.#childrenArray);
|
|
543
|
-
this.#portal.remove();
|
|
544
|
-
this.#portal = null;
|
|
545
|
-
this.#childrenArray = [];
|
|
546
|
-
}
|
|
547
|
-
renderGuards() {
|
|
548
|
-
if (!this.#portal) return;
|
|
549
|
-
if (this.#guards.length === 0) {
|
|
550
|
-
const beforeInsideGuard = createFocusGuard("inside");
|
|
551
|
-
const afterInsideGuard = createFocusGuard("inside");
|
|
552
|
-
const beforeOutsideGuard = createFocusGuard("outside");
|
|
553
|
-
const afterOutsideGuard = createFocusGuard("outside");
|
|
554
|
-
beforeOutsideGuard.addEventListener("focus", (event) => {
|
|
555
|
-
if (this.#portal && isOutsideEvent(event, this.#portal)) beforeInsideGuard.focus();
|
|
556
|
-
else getPreviousTabbable(this)?.focus();
|
|
557
|
-
});
|
|
558
|
-
afterOutsideGuard.addEventListener("focus", (event) => {
|
|
559
|
-
if (this.#portal && isOutsideEvent(event, this.#portal)) afterInsideGuard.focus();
|
|
560
|
-
else getNextTabbable(this)?.focus();
|
|
561
|
-
});
|
|
562
|
-
beforeInsideGuard.addEventListener("focus", (event) => {
|
|
563
|
-
if (this.#portal && isOutsideEvent(event, this.#portal)) getNextTabbable(this.#portal)?.focus();
|
|
564
|
-
else beforeOutsideGuard.focus();
|
|
565
|
-
});
|
|
566
|
-
afterInsideGuard.addEventListener("focus", (event) => {
|
|
567
|
-
if (this.#portal && isOutsideEvent(event, this.#portal)) getPreviousTabbable(this.#portal)?.focus();
|
|
568
|
-
else afterOutsideGuard.focus();
|
|
569
|
-
});
|
|
570
|
-
this.prepend(beforeOutsideGuard);
|
|
571
|
-
this.append(afterOutsideGuard);
|
|
572
|
-
this.#portal.prepend(beforeInsideGuard);
|
|
573
|
-
this.#portal.append(afterInsideGuard);
|
|
574
|
-
this.#guards = [
|
|
575
|
-
beforeOutsideGuard,
|
|
576
|
-
afterOutsideGuard,
|
|
577
|
-
beforeInsideGuard,
|
|
578
|
-
afterInsideGuard
|
|
579
|
-
];
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
removeGuards() {
|
|
583
|
-
this.#guards.forEach((guard) => guard.remove());
|
|
584
|
-
this.#guards = [];
|
|
585
|
-
}
|
|
586
|
-
};
|
|
587
|
-
function createFocusGuard(dataType) {
|
|
588
|
-
const focusGuard = document.createElement("span");
|
|
589
|
-
focusGuard.setAttribute("data-type", dataType);
|
|
590
|
-
focusGuard.setAttribute("tabindex", "0");
|
|
591
|
-
focusGuard.toggleAttribute("data-focus-guard", true);
|
|
592
|
-
return focusGuard;
|
|
593
|
-
}
|
|
594
|
-
var MediaPopoverPositioner = class extends HTMLElement {
|
|
595
|
-
connectedCallback() {
|
|
596
|
-
this.style.display = "contents";
|
|
597
|
-
const popup = this.firstElementChild;
|
|
598
|
-
if (popup) Object.assign(popup.style, {
|
|
599
|
-
position: "absolute",
|
|
600
|
-
top: "0",
|
|
601
|
-
left: "0"
|
|
602
|
-
});
|
|
603
|
-
}
|
|
604
|
-
get side() {
|
|
605
|
-
return this.getAttribute("side");
|
|
606
|
-
}
|
|
607
|
-
get sideOffset() {
|
|
608
|
-
return Number.parseInt(this.getAttribute("side-offset") ?? "0", 10);
|
|
609
|
-
}
|
|
610
|
-
};
|
|
611
|
-
var MediaPopoverPopup = class extends HTMLElement {
|
|
612
|
-
connectedCallback() {
|
|
613
|
-
this.setAttribute("role", "dialog");
|
|
614
|
-
this.setAttribute("aria-modal", "false");
|
|
615
|
-
this.id = uniqueId();
|
|
616
|
-
}
|
|
617
|
-
};
|
|
618
|
-
if (!globalThis.customElements.get("media-popover-root")) globalThis.customElements.define("media-popover-root", MediaPopoverRoot);
|
|
619
|
-
if (!globalThis.customElements.get("media-popover-trigger")) globalThis.customElements.define("media-popover-trigger", MediaPopoverTrigger);
|
|
620
|
-
if (!globalThis.customElements.get("media-popover-portal")) globalThis.customElements.define("media-popover-portal", MediaPopoverPortal);
|
|
621
|
-
if (!globalThis.customElements.get("media-popover-positioner")) globalThis.customElements.define("media-popover-positioner", MediaPopoverPositioner);
|
|
622
|
-
if (!globalThis.customElements.get("media-popover-popup")) globalThis.customElements.define("media-popover-popup", MediaPopoverPopup);
|
|
623
|
-
const Popover = {
|
|
624
|
-
Root: MediaPopoverRoot,
|
|
625
|
-
Trigger: MediaPopoverTrigger,
|
|
626
|
-
Portal: MediaPopoverPortal,
|
|
627
|
-
Positioner: MediaPopoverPositioner,
|
|
628
|
-
Popup: MediaPopoverPopup
|
|
629
|
-
};
|
|
493
|
+
if (!globalThis.customElements.get("media-popover")) globalThis.customElements.define("media-popover", Popover);
|
|
630
494
|
|
|
631
495
|
//#endregion
|
|
632
496
|
//#region src/components/media-time-slider.ts
|
|
@@ -765,11 +629,11 @@ var TimeSliderThumbBase = class extends HTMLElement {
|
|
|
765
629
|
if (props["data-orientation"] === "horizontal") {
|
|
766
630
|
this.style.left = "var(--slider-fill, 0%)";
|
|
767
631
|
this.style.top = "50%";
|
|
768
|
-
this.style.
|
|
632
|
+
this.style.translate = "-50% -50%";
|
|
769
633
|
} else {
|
|
770
634
|
this.style.bottom = "var(--slider-fill, 0%)";
|
|
771
635
|
this.style.left = "50%";
|
|
772
|
-
this.style.
|
|
636
|
+
this.style.translate = "-50% 50%";
|
|
773
637
|
}
|
|
774
638
|
}
|
|
775
639
|
};
|
|
@@ -834,21 +698,23 @@ var MediaTooltipRoot = class extends HTMLElement {
|
|
|
834
698
|
#hoverTimeout = null;
|
|
835
699
|
#cleanup = null;
|
|
836
700
|
#arrowElement = null;
|
|
837
|
-
#
|
|
701
|
+
#pointerPosition = {
|
|
838
702
|
x: 0,
|
|
839
703
|
y: 0
|
|
840
704
|
};
|
|
841
705
|
#transitionStatus = "initial";
|
|
842
706
|
constructor() {
|
|
843
707
|
super();
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
708
|
+
if (globalThis.matchMedia?.("(hover: hover)")?.matches) {
|
|
709
|
+
this.addEventListener("pointerenter", this);
|
|
710
|
+
this.addEventListener("pointerleave", this);
|
|
711
|
+
this.addEventListener("pointermove", this);
|
|
712
|
+
}
|
|
847
713
|
}
|
|
848
714
|
handleEvent(event) {
|
|
849
|
-
if (event.type === "
|
|
850
|
-
else if (event.type === "
|
|
851
|
-
else if (event.type === "
|
|
715
|
+
if (event.type === "pointerenter") this.#handlePointerEnter();
|
|
716
|
+
else if (event.type === "pointerleave") this.#handlePointerLeave(event);
|
|
717
|
+
else if (event.type === "pointermove") this.#handlePointerMove(event);
|
|
852
718
|
}
|
|
853
719
|
connectedCallback() {
|
|
854
720
|
this.#updateVisibility();
|
|
@@ -944,31 +810,31 @@ var MediaTooltipRoot = class extends HTMLElement {
|
|
|
944
810
|
width: 0,
|
|
945
811
|
height: 0,
|
|
946
812
|
top: triggerRect.top,
|
|
947
|
-
right: this.#
|
|
813
|
+
right: this.#pointerPosition.x,
|
|
948
814
|
bottom: triggerRect.bottom,
|
|
949
|
-
left: this.#
|
|
950
|
-
x: this.#
|
|
815
|
+
left: this.#pointerPosition.x,
|
|
816
|
+
x: this.#pointerPosition.x,
|
|
951
817
|
y: triggerRect.top
|
|
952
818
|
};
|
|
953
819
|
else if (this.trackCursorAxis === "y") return {
|
|
954
820
|
width: 0,
|
|
955
821
|
height: 0,
|
|
956
|
-
top: this.#
|
|
822
|
+
top: this.#pointerPosition.y,
|
|
957
823
|
right: triggerRect.right,
|
|
958
|
-
bottom: this.#
|
|
824
|
+
bottom: this.#pointerPosition.y,
|
|
959
825
|
left: triggerRect.left,
|
|
960
826
|
x: triggerRect.left,
|
|
961
|
-
y: this.#
|
|
827
|
+
y: this.#pointerPosition.y
|
|
962
828
|
};
|
|
963
829
|
else return {
|
|
964
830
|
width: 0,
|
|
965
831
|
height: 0,
|
|
966
|
-
top: this.#
|
|
967
|
-
right: this.#
|
|
968
|
-
bottom: this.#
|
|
969
|
-
left: this.#
|
|
970
|
-
x: this.#
|
|
971
|
-
y: this.#
|
|
832
|
+
top: this.#pointerPosition.y,
|
|
833
|
+
right: this.#pointerPosition.x,
|
|
834
|
+
bottom: this.#pointerPosition.y,
|
|
835
|
+
left: this.#pointerPosition.x,
|
|
836
|
+
x: this.#pointerPosition.x,
|
|
837
|
+
y: this.#pointerPosition.y
|
|
972
838
|
};
|
|
973
839
|
} } : trigger, popup, {
|
|
974
840
|
placement,
|
|
@@ -1000,21 +866,21 @@ var MediaTooltipRoot = class extends HTMLElement {
|
|
|
1000
866
|
this.#hoverTimeout = null;
|
|
1001
867
|
}
|
|
1002
868
|
}
|
|
1003
|
-
#
|
|
869
|
+
#handlePointerEnter() {
|
|
1004
870
|
this.#clearHoverTimeout();
|
|
1005
871
|
this.#hoverTimeout = globalThis.setTimeout(() => {
|
|
1006
872
|
this.#setOpen(true);
|
|
1007
873
|
}, this.delay);
|
|
1008
874
|
}
|
|
1009
|
-
#
|
|
875
|
+
#handlePointerLeave(_event) {
|
|
1010
876
|
this.#clearHoverTimeout();
|
|
1011
877
|
this.#hoverTimeout = globalThis.setTimeout(() => {
|
|
1012
878
|
this.#setOpen(false);
|
|
1013
879
|
}, this.closeDelay);
|
|
1014
880
|
}
|
|
1015
|
-
#
|
|
881
|
+
#handlePointerMove(event) {
|
|
1016
882
|
if (this.trackCursorAxis) {
|
|
1017
|
-
this.#
|
|
883
|
+
this.#pointerPosition = {
|
|
1018
884
|
x: event.clientX,
|
|
1019
885
|
y: event.clientY
|
|
1020
886
|
};
|
|
@@ -1245,11 +1111,11 @@ var VolumeSliderThumbBase = class extends HTMLElement {
|
|
|
1245
1111
|
if (props["data-orientation"] === "horizontal") {
|
|
1246
1112
|
this.style.left = "var(--slider-fill, 0%)";
|
|
1247
1113
|
this.style.top = "50%";
|
|
1248
|
-
this.style.
|
|
1114
|
+
this.style.translate = "-50% -50%";
|
|
1249
1115
|
} else {
|
|
1250
1116
|
this.style.bottom = "var(--slider-fill, 0%)";
|
|
1251
1117
|
this.style.left = "50%";
|
|
1252
|
-
this.style.
|
|
1118
|
+
this.style.translate = "-50% 50%";
|
|
1253
1119
|
}
|
|
1254
1120
|
}
|
|
1255
1121
|
};
|
|
@@ -1455,4 +1321,4 @@ if (!customElements.get("media-skin")) customElements.define("media-skin", Media
|
|
|
1455
1321
|
|
|
1456
1322
|
//#endregion
|
|
1457
1323
|
export { Tooltip as a, PlayButton as c, DurationDisplay as d, CurrentTimeDisplay as f, VolumeSlider$1 as i, MuteButton as l, MediaProvider as n, TimeSlider$1 as o, toConnectedHTMLComponent as p, MediaContainer as r, Popover as s, MediaSkin as t, FullscreenButton as u };
|
|
1458
|
-
//# sourceMappingURL=media-skin-
|
|
1324
|
+
//# sourceMappingURL=media-skin-DR8zj-LV.js.map
|