streamit-player 1.0.1 → 1.0.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/CHANGELOG.md CHANGED
@@ -5,9 +5,9 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [Unreleased]
8
+ ## [Released]
9
9
 
10
- ## [1.0.1] - 2026-09-12
10
+ ## [1.0.2] - 2026-09-12
11
11
 
12
12
  ### Fixed
13
13
 
@@ -7483,6 +7483,37 @@ const edgeStyles = [
7483
7483
  ];
7484
7484
  const STANDARD_SPEEDS = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.5, 3, 4];
7485
7485
  const VERTICAL_SPEEDS = [0.5, 1, 2];
7486
+ function buildAttributeAliases(canonical) {
7487
+ const aliases = /* @__PURE__ */ new Map();
7488
+ for (const name of canonical) {
7489
+ if (!name.includes("-")) continue;
7490
+ for (const alias of [name.replace(/-/g, ""), name.replace(/-/g, "_")]) {
7491
+ if (alias !== name && !canonical.includes(alias)) {
7492
+ aliases.set(alias, name);
7493
+ }
7494
+ }
7495
+ }
7496
+ return aliases;
7497
+ }
7498
+ function parseConfigAttribute(value) {
7499
+ if (value === null) return void 0;
7500
+ const trimmed = value.trim();
7501
+ if (trimmed === "") return void 0;
7502
+ if (trimmed.startsWith("[object ")) {
7503
+ console.warn(
7504
+ `[streamit-player] The "config" attribute received a stringified object ("${trimmed}") and has been ignored. Pass config as a DOM property (element.config = {...}, or .config=\${...} / :config="..." in a framework template) rather than as an attribute.`
7505
+ );
7506
+ return void 0;
7507
+ }
7508
+ try {
7509
+ return JSON.parse(trimmed);
7510
+ } catch {
7511
+ console.warn(
7512
+ '[streamit-player] The "config" attribute is not valid JSON and has been ignored. Pass config as a DOM property instead.'
7513
+ );
7514
+ return void 0;
7515
+ }
7516
+ }
7486
7517
  const _PlayerPlayer = class _PlayerPlayer extends LitElement {
7487
7518
  constructor() {
7488
7519
  super(...arguments);
@@ -7811,6 +7842,26 @@ const _PlayerPlayer = class _PlayerPlayer extends LitElement {
7811
7842
  const settingsLabels = ((_c = (_b = this.config) == null ? void 0 : _b.settings) == null ? void 0 : _c.labels) || {};
7812
7843
  return settingsLabels[key] || localeConfig[key] || defaultText;
7813
7844
  }
7845
+ static get observedAttributes() {
7846
+ const canonical = super.observedAttributes;
7847
+ if (!Object.prototype.hasOwnProperty.call(this, "attributeAliases")) {
7848
+ this.attributeAliases = buildAttributeAliases(canonical);
7849
+ }
7850
+ return [...canonical, ...this.attributeAliases.keys()];
7851
+ }
7852
+ attributeChangedCallback(name, old, value) {
7853
+ var _a;
7854
+ const canonical = (_a = this.constructor.attributeAliases) == null ? void 0 : _a.get(name);
7855
+ if (canonical) {
7856
+ if (value === null) {
7857
+ this.removeAttribute(canonical);
7858
+ } else if (this.getAttribute(canonical) !== value) {
7859
+ this.setAttribute(canonical, value);
7860
+ }
7861
+ return;
7862
+ }
7863
+ super.attributeChangedCallback(name, old, value);
7864
+ }
7814
7865
  get controllerInstance() {
7815
7866
  return this.controller;
7816
7867
  }
@@ -8132,6 +8183,29 @@ const _PlayerPlayer = class _PlayerPlayer extends LitElement {
8132
8183
  if (changedProperties.has("liveMode") && this.controller) {
8133
8184
  this.controller.setLiveMode(this.liveMode);
8134
8185
  }
8186
+ this.adoptDisplayModeFromConfig(changedProperties);
8187
+ }
8188
+ /**
8189
+ * `displayMode` is the single source of truth for the layout: the host
8190
+ * stylesheet keys off the attribute it reflects and render() picks the
8191
+ * control set from it. `config.displayMode` and `config.layout.mode` are
8192
+ * equivalent ways to ask for a mode, so they are folded into the property
8193
+ * here - before the first render - rather than being read separately further
8194
+ * down, which is how a 9:16 host could end up wearing the standard control
8195
+ * bar.
8196
+ *
8197
+ * Only a config that changes the mode it asks for wins, so an unrelated
8198
+ * config update never clobbers a display-mode set on the element itself.
8199
+ */
8200
+ adoptDisplayModeFromConfig(changedProperties) {
8201
+ var _a, _b, _c;
8202
+ if (!changedProperties.has("config")) return;
8203
+ const requested = ((_a = this.config) == null ? void 0 : _a.displayMode) || ((_c = (_b = this.config) == null ? void 0 : _b.layout) == null ? void 0 : _c.mode);
8204
+ if (!requested || requested === this.configRequestedMode) return;
8205
+ this.configRequestedMode = requested;
8206
+ if (this.displayMode !== requested) {
8207
+ this.displayMode = requested;
8208
+ }
8135
8209
  }
8136
8210
  firstUpdated() {
8137
8211
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
@@ -10757,8 +10831,7 @@ const _PlayerPlayer = class _PlayerPlayer extends LitElement {
10757
10831
  `;
10758
10832
  }
10759
10833
  renderDefaultLiveOverlay(player) {
10760
- var _a, _b;
10761
- const layoutMode = ((_b = (_a = player.config) == null ? void 0 : _a.layout) == null ? void 0 : _b.mode) || player.displayMode;
10834
+ const layoutMode = player.displayMode;
10762
10835
  if (layoutMode !== "vertical" || !player.playerState.isLive) return "";
10763
10836
  return html`
10764
10837
  <div
@@ -11105,7 +11178,7 @@ const _PlayerPlayer = class _PlayerPlayer extends LitElement {
11105
11178
  `;
11106
11179
  }
11107
11180
  render() {
11108
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
11181
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
11109
11182
  const {
11110
11183
  isPlaying,
11111
11184
  status,
@@ -11118,7 +11191,7 @@ const _PlayerPlayer = class _PlayerPlayer extends LitElement {
11118
11191
  loop
11119
11192
  } = this.playerState;
11120
11193
  const isVisible = this.controlsVisible || !isPlaying;
11121
- const layoutMode = ((_b = (_a = this.config) == null ? void 0 : _a.layout) == null ? void 0 : _b.mode) || this.displayMode;
11194
+ const layoutMode = this.displayMode;
11122
11195
  return html`
11123
11196
  <div
11124
11197
  part="player-container"
@@ -11139,12 +11212,12 @@ const _PlayerPlayer = class _PlayerPlayer extends LitElement {
11139
11212
  <canvas part="transition-canvas" class="transition-canvas"></canvas>
11140
11213
  </div>
11141
11214
 
11142
- ${!currentSource && this.emptyStateSectionEnabled && ((_d = (_c = this.config) == null ? void 0 : _c.controls) == null ? void 0 : _d.emptyState) !== false ? this.renderEmptyState() : html`
11215
+ ${!currentSource && this.emptyStateSectionEnabled && ((_b = (_a = this.config) == null ? void 0 : _a.controls) == null ? void 0 : _b.emptyState) !== false ? this.renderEmptyState() : html`
11143
11216
  <!-- Custom overlay slot -->
11144
11217
  <slot name="top-overlay"></slot>
11145
11218
 
11146
11219
  <!-- Center Play Button Overlay -->
11147
- ${!((_e = this.playerState) == null ? void 0 : _e.isAdPlaying) ? this.renderOverlay("center-play", (p2) => this.renderDefaultCenterPlayOverlay(p2)) : ""}
11220
+ ${!((_c = this.playerState) == null ? void 0 : _c.isAdPlaying) ? this.renderOverlay("center-play", (p2) => this.renderDefaultCenterPlayOverlay(p2)) : ""}
11148
11221
 
11149
11222
  <!-- Audio only cover -->
11150
11223
  ${layoutMode === "audio-only" ? html`
@@ -11217,22 +11290,22 @@ const _PlayerPlayer = class _PlayerPlayer extends LitElement {
11217
11290
  ${isBuffering && !error ? this.renderOverlay("buffering", (p2) => this.renderDefaultBufferingOverlay(p2)) : ""}
11218
11291
 
11219
11292
  <!-- Centered Replay Overlay (not shown in vertical mode) -->
11220
- ${status === "ended" && !this.playerState.isLive && this.displayMode !== "vertical" && !loop && !((_f = this.playerState) == null ? void 0 : _f.isAdPlaying) ? this.renderOverlay("replay", (p2) => this.renderDefaultReplayOverlay(p2)) : ""}
11293
+ ${status === "ended" && !this.playerState.isLive && this.displayMode !== "vertical" && !loop && !((_d = this.playerState) == null ? void 0 : _d.isAdPlaying) ? this.renderOverlay("replay", (p2) => this.renderDefaultReplayOverlay(p2)) : ""}
11221
11294
 
11222
11295
  <!-- Ambient Tap Skip / Volume / Playback Speed gesture feedback ripples -->
11223
- ${this.tapFeedback && !((_g = this.playerState) == null ? void 0 : _g.isAdPlaying) ? this.renderOverlay(
11296
+ ${this.tapFeedback && !((_e = this.playerState) == null ? void 0 : _e.isAdPlaying) ? this.renderOverlay(
11224
11297
  "seek",
11225
11298
  (p2, dir) => this.renderDefaultSeekOverlay(p2, dir),
11226
11299
  this.tapFeedback
11227
11300
  ) : ""}
11228
- ${this.playPauseFeedback && !((_h = this.playerState) == null ? void 0 : _h.isAdPlaying) ? this.renderOverlay("play-pause", (p2) => this.renderDefaultPlayPauseOverlay(p2)) : ""}
11229
- ${this.activeVolumeFeedback && !((_i = this.playerState) == null ? void 0 : _i.isAdPlaying) ? this.renderOverlay("volume", (p2) => this.renderDefaultVolumeOverlay(p2)) : ""}
11230
- ${this.activeSpeedFeedback && !((_j = this.playerState) == null ? void 0 : _j.isAdPlaying) ? this.renderOverlay("speed", (p2) => this.renderDefaultSpeedOverlay(p2)) : ""}
11301
+ ${this.playPauseFeedback && !((_f = this.playerState) == null ? void 0 : _f.isAdPlaying) ? this.renderOverlay("play-pause", (p2) => this.renderDefaultPlayPauseOverlay(p2)) : ""}
11302
+ ${this.activeVolumeFeedback && !((_g = this.playerState) == null ? void 0 : _g.isAdPlaying) ? this.renderOverlay("volume", (p2) => this.renderDefaultVolumeOverlay(p2)) : ""}
11303
+ ${this.activeSpeedFeedback && !((_h = this.playerState) == null ? void 0 : _h.isAdPlaying) ? this.renderOverlay("speed", (p2) => this.renderDefaultSpeedOverlay(p2)) : ""}
11231
11304
 
11232
11305
  <!-- Persistent Live Badge for Vertical Player -->
11233
- ${layoutMode === "vertical" && this.playerState.isLive && !((_k = this.playerState) == null ? void 0 : _k.isAdPlaying) ? this.renderOverlay("live", (p2) => this.renderDefaultLiveOverlay(p2)) : ""}
11306
+ ${layoutMode === "vertical" && this.playerState.isLive && !((_i = this.playerState) == null ? void 0 : _i.isAdPlaying) ? this.renderOverlay("live", (p2) => this.renderDefaultLiveOverlay(p2)) : ""}
11234
11307
 
11235
- ${!((_l = this.playerState) == null ? void 0 : _l.isAdPlaying) ? html`
11308
+ ${!((_j = this.playerState) == null ? void 0 : _j.isAdPlaying) ? html`
11236
11309
  <!-- Ambient top/bottom vignette scrim -->
11237
11310
  <div part="scrim" class="scrim ${isVisible ? "visible" : ""}"></div>
11238
11311
 
@@ -11251,12 +11324,12 @@ const _PlayerPlayer = class _PlayerPlayer extends LitElement {
11251
11324
 
11252
11325
  <!-- Control overlays wrapper -->
11253
11326
  <div part="controls-overlay" class="controls-overlay">
11254
- ${layoutMode === "custom" ? html`<slot></slot>` : layoutMode === "vertical" ? ((_n = (_m = this.config) == null ? void 0 : _m.controls) == null ? void 0 : _n.verticalControls) !== false && this.controlsSectionEnabled ? html`
11327
+ ${layoutMode === "custom" ? html`<slot></slot>` : layoutMode === "vertical" ? ((_l = (_k = this.config) == null ? void 0 : _k.controls) == null ? void 0 : _l.verticalControls) !== false && this.controlsSectionEnabled ? html`
11255
11328
  <player-vertical-controls
11256
11329
  part="vertical-controls"
11257
11330
  exportparts="vertical-controls-container, action-rail, rail-btn, seekbar, seekbar-container, hover-tooltip, tooltip-marker-label, thumbnail-container, thumbnail-preview, tooltip-time-text, track, buffer-bar, progress-bar, handle, marker, time-display"
11258
- ?hideCurrentTime=${((_p = (_o = this.config) == null ? void 0 : _o.controls) == null ? void 0 : _p.currentTime) === false}
11259
- ?hideDuration=${((_r = (_q = this.config) == null ? void 0 : _q.controls) == null ? void 0 : _r.duration) === false}
11331
+ ?hideCurrentTime=${((_n = (_m = this.config) == null ? void 0 : _m.controls) == null ? void 0 : _n.currentTime) === false}
11332
+ ?hideDuration=${((_p = (_o = this.config) == null ? void 0 : _o.controls) == null ? void 0 : _p.duration) === false}
11260
11333
  .currentTime=${currentTime}
11261
11334
  .duration=${duration}
11262
11335
  .bufferedRanges=${bufferedRanges}
@@ -11283,7 +11356,7 @@ const _PlayerPlayer = class _PlayerPlayer extends LitElement {
11283
11356
  <slot name="social-actions" slot="social-actions"></slot>
11284
11357
  <slot name="bottom-actions" slot="bottom-actions"></slot>
11285
11358
  </player-vertical-controls>
11286
- ` : "" : ((_t = (_s = this.config) == null ? void 0 : _s.controls) == null ? void 0 : _t.controlsBar) !== false && this.controlsSectionEnabled ? this.renderStandardControls() : ""}
11359
+ ` : "" : ((_r = (_q = this.config) == null ? void 0 : _q.controls) == null ? void 0 : _r.controlsBar) !== false && this.controlsSectionEnabled ? this.renderStandardControls() : ""}
11287
11360
  </div>
11288
11361
  ` : ""}
11289
11362
 
@@ -11419,7 +11492,10 @@ __decorateClass([
11419
11492
  property({ type: String, attribute: "live-mode", reflect: true })
11420
11493
  ], PlayerPlayer.prototype, "liveMode");
11421
11494
  __decorateClass([
11422
- property({ type: Object })
11495
+ property({
11496
+ type: Object,
11497
+ converter: { fromAttribute: parseConfigAttribute }
11498
+ })
11423
11499
  ], PlayerPlayer.prototype, "config");
11424
11500
  __decorateClass([
11425
11501
  property({ type: Boolean, attribute: "precise-seek", reflect: true })
@@ -7484,6 +7484,37 @@ const edgeStyles = [
7484
7484
  ];
7485
7485
  const STANDARD_SPEEDS = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.5, 3, 4];
7486
7486
  const VERTICAL_SPEEDS = [0.5, 1, 2];
7487
+ function buildAttributeAliases(canonical) {
7488
+ const aliases = /* @__PURE__ */ new Map();
7489
+ for (const name of canonical) {
7490
+ if (!name.includes("-")) continue;
7491
+ for (const alias of [name.replace(/-/g, ""), name.replace(/-/g, "_")]) {
7492
+ if (alias !== name && !canonical.includes(alias)) {
7493
+ aliases.set(alias, name);
7494
+ }
7495
+ }
7496
+ }
7497
+ return aliases;
7498
+ }
7499
+ function parseConfigAttribute(value) {
7500
+ if (value === null) return void 0;
7501
+ const trimmed = value.trim();
7502
+ if (trimmed === "") return void 0;
7503
+ if (trimmed.startsWith("[object ")) {
7504
+ console.warn(
7505
+ `[streamit-player] The "config" attribute received a stringified object ("${trimmed}") and has been ignored. Pass config as a DOM property (element.config = {...}, or .config=\${...} / :config="..." in a framework template) rather than as an attribute.`
7506
+ );
7507
+ return void 0;
7508
+ }
7509
+ try {
7510
+ return JSON.parse(trimmed);
7511
+ } catch {
7512
+ console.warn(
7513
+ '[streamit-player] The "config" attribute is not valid JSON and has been ignored. Pass config as a DOM property instead.'
7514
+ );
7515
+ return void 0;
7516
+ }
7517
+ }
7487
7518
  const _PlayerPlayer = class _PlayerPlayer extends lit.LitElement {
7488
7519
  constructor() {
7489
7520
  super(...arguments);
@@ -7812,6 +7843,26 @@ const _PlayerPlayer = class _PlayerPlayer extends lit.LitElement {
7812
7843
  const settingsLabels = ((_c = (_b = this.config) == null ? void 0 : _b.settings) == null ? void 0 : _c.labels) || {};
7813
7844
  return settingsLabels[key] || localeConfig[key] || defaultText;
7814
7845
  }
7846
+ static get observedAttributes() {
7847
+ const canonical = super.observedAttributes;
7848
+ if (!Object.prototype.hasOwnProperty.call(this, "attributeAliases")) {
7849
+ this.attributeAliases = buildAttributeAliases(canonical);
7850
+ }
7851
+ return [...canonical, ...this.attributeAliases.keys()];
7852
+ }
7853
+ attributeChangedCallback(name, old, value) {
7854
+ var _a;
7855
+ const canonical = (_a = this.constructor.attributeAliases) == null ? void 0 : _a.get(name);
7856
+ if (canonical) {
7857
+ if (value === null) {
7858
+ this.removeAttribute(canonical);
7859
+ } else if (this.getAttribute(canonical) !== value) {
7860
+ this.setAttribute(canonical, value);
7861
+ }
7862
+ return;
7863
+ }
7864
+ super.attributeChangedCallback(name, old, value);
7865
+ }
7815
7866
  get controllerInstance() {
7816
7867
  return this.controller;
7817
7868
  }
@@ -8133,6 +8184,29 @@ const _PlayerPlayer = class _PlayerPlayer extends lit.LitElement {
8133
8184
  if (changedProperties.has("liveMode") && this.controller) {
8134
8185
  this.controller.setLiveMode(this.liveMode);
8135
8186
  }
8187
+ this.adoptDisplayModeFromConfig(changedProperties);
8188
+ }
8189
+ /**
8190
+ * `displayMode` is the single source of truth for the layout: the host
8191
+ * stylesheet keys off the attribute it reflects and render() picks the
8192
+ * control set from it. `config.displayMode` and `config.layout.mode` are
8193
+ * equivalent ways to ask for a mode, so they are folded into the property
8194
+ * here - before the first render - rather than being read separately further
8195
+ * down, which is how a 9:16 host could end up wearing the standard control
8196
+ * bar.
8197
+ *
8198
+ * Only a config that changes the mode it asks for wins, so an unrelated
8199
+ * config update never clobbers a display-mode set on the element itself.
8200
+ */
8201
+ adoptDisplayModeFromConfig(changedProperties) {
8202
+ var _a, _b, _c;
8203
+ if (!changedProperties.has("config")) return;
8204
+ const requested = ((_a = this.config) == null ? void 0 : _a.displayMode) || ((_c = (_b = this.config) == null ? void 0 : _b.layout) == null ? void 0 : _c.mode);
8205
+ if (!requested || requested === this.configRequestedMode) return;
8206
+ this.configRequestedMode = requested;
8207
+ if (this.displayMode !== requested) {
8208
+ this.displayMode = requested;
8209
+ }
8136
8210
  }
8137
8211
  firstUpdated() {
8138
8212
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
@@ -10758,8 +10832,7 @@ const _PlayerPlayer = class _PlayerPlayer extends lit.LitElement {
10758
10832
  `;
10759
10833
  }
10760
10834
  renderDefaultLiveOverlay(player) {
10761
- var _a, _b;
10762
- const layoutMode = ((_b = (_a = player.config) == null ? void 0 : _a.layout) == null ? void 0 : _b.mode) || player.displayMode;
10835
+ const layoutMode = player.displayMode;
10763
10836
  if (layoutMode !== "vertical" || !player.playerState.isLive) return "";
10764
10837
  return lit.html`
10765
10838
  <div
@@ -11106,7 +11179,7 @@ const _PlayerPlayer = class _PlayerPlayer extends lit.LitElement {
11106
11179
  `;
11107
11180
  }
11108
11181
  render() {
11109
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
11182
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
11110
11183
  const {
11111
11184
  isPlaying,
11112
11185
  status,
@@ -11119,7 +11192,7 @@ const _PlayerPlayer = class _PlayerPlayer extends lit.LitElement {
11119
11192
  loop
11120
11193
  } = this.playerState;
11121
11194
  const isVisible = this.controlsVisible || !isPlaying;
11122
- const layoutMode = ((_b = (_a = this.config) == null ? void 0 : _a.layout) == null ? void 0 : _b.mode) || this.displayMode;
11195
+ const layoutMode = this.displayMode;
11123
11196
  return lit.html`
11124
11197
  <div
11125
11198
  part="player-container"
@@ -11140,12 +11213,12 @@ const _PlayerPlayer = class _PlayerPlayer extends lit.LitElement {
11140
11213
  <canvas part="transition-canvas" class="transition-canvas"></canvas>
11141
11214
  </div>
11142
11215
 
11143
- ${!currentSource && this.emptyStateSectionEnabled && ((_d = (_c = this.config) == null ? void 0 : _c.controls) == null ? void 0 : _d.emptyState) !== false ? this.renderEmptyState() : lit.html`
11216
+ ${!currentSource && this.emptyStateSectionEnabled && ((_b = (_a = this.config) == null ? void 0 : _a.controls) == null ? void 0 : _b.emptyState) !== false ? this.renderEmptyState() : lit.html`
11144
11217
  <!-- Custom overlay slot -->
11145
11218
  <slot name="top-overlay"></slot>
11146
11219
 
11147
11220
  <!-- Center Play Button Overlay -->
11148
- ${!((_e = this.playerState) == null ? void 0 : _e.isAdPlaying) ? this.renderOverlay("center-play", (p2) => this.renderDefaultCenterPlayOverlay(p2)) : ""}
11221
+ ${!((_c = this.playerState) == null ? void 0 : _c.isAdPlaying) ? this.renderOverlay("center-play", (p2) => this.renderDefaultCenterPlayOverlay(p2)) : ""}
11149
11222
 
11150
11223
  <!-- Audio only cover -->
11151
11224
  ${layoutMode === "audio-only" ? lit.html`
@@ -11218,22 +11291,22 @@ const _PlayerPlayer = class _PlayerPlayer extends lit.LitElement {
11218
11291
  ${isBuffering && !error ? this.renderOverlay("buffering", (p2) => this.renderDefaultBufferingOverlay(p2)) : ""}
11219
11292
 
11220
11293
  <!-- Centered Replay Overlay (not shown in vertical mode) -->
11221
- ${status === "ended" && !this.playerState.isLive && this.displayMode !== "vertical" && !loop && !((_f = this.playerState) == null ? void 0 : _f.isAdPlaying) ? this.renderOverlay("replay", (p2) => this.renderDefaultReplayOverlay(p2)) : ""}
11294
+ ${status === "ended" && !this.playerState.isLive && this.displayMode !== "vertical" && !loop && !((_d = this.playerState) == null ? void 0 : _d.isAdPlaying) ? this.renderOverlay("replay", (p2) => this.renderDefaultReplayOverlay(p2)) : ""}
11222
11295
 
11223
11296
  <!-- Ambient Tap Skip / Volume / Playback Speed gesture feedback ripples -->
11224
- ${this.tapFeedback && !((_g = this.playerState) == null ? void 0 : _g.isAdPlaying) ? this.renderOverlay(
11297
+ ${this.tapFeedback && !((_e = this.playerState) == null ? void 0 : _e.isAdPlaying) ? this.renderOverlay(
11225
11298
  "seek",
11226
11299
  (p2, dir) => this.renderDefaultSeekOverlay(p2, dir),
11227
11300
  this.tapFeedback
11228
11301
  ) : ""}
11229
- ${this.playPauseFeedback && !((_h = this.playerState) == null ? void 0 : _h.isAdPlaying) ? this.renderOverlay("play-pause", (p2) => this.renderDefaultPlayPauseOverlay(p2)) : ""}
11230
- ${this.activeVolumeFeedback && !((_i = this.playerState) == null ? void 0 : _i.isAdPlaying) ? this.renderOverlay("volume", (p2) => this.renderDefaultVolumeOverlay(p2)) : ""}
11231
- ${this.activeSpeedFeedback && !((_j = this.playerState) == null ? void 0 : _j.isAdPlaying) ? this.renderOverlay("speed", (p2) => this.renderDefaultSpeedOverlay(p2)) : ""}
11302
+ ${this.playPauseFeedback && !((_f = this.playerState) == null ? void 0 : _f.isAdPlaying) ? this.renderOverlay("play-pause", (p2) => this.renderDefaultPlayPauseOverlay(p2)) : ""}
11303
+ ${this.activeVolumeFeedback && !((_g = this.playerState) == null ? void 0 : _g.isAdPlaying) ? this.renderOverlay("volume", (p2) => this.renderDefaultVolumeOverlay(p2)) : ""}
11304
+ ${this.activeSpeedFeedback && !((_h = this.playerState) == null ? void 0 : _h.isAdPlaying) ? this.renderOverlay("speed", (p2) => this.renderDefaultSpeedOverlay(p2)) : ""}
11232
11305
 
11233
11306
  <!-- Persistent Live Badge for Vertical Player -->
11234
- ${layoutMode === "vertical" && this.playerState.isLive && !((_k = this.playerState) == null ? void 0 : _k.isAdPlaying) ? this.renderOverlay("live", (p2) => this.renderDefaultLiveOverlay(p2)) : ""}
11307
+ ${layoutMode === "vertical" && this.playerState.isLive && !((_i = this.playerState) == null ? void 0 : _i.isAdPlaying) ? this.renderOverlay("live", (p2) => this.renderDefaultLiveOverlay(p2)) : ""}
11235
11308
 
11236
- ${!((_l = this.playerState) == null ? void 0 : _l.isAdPlaying) ? lit.html`
11309
+ ${!((_j = this.playerState) == null ? void 0 : _j.isAdPlaying) ? lit.html`
11237
11310
  <!-- Ambient top/bottom vignette scrim -->
11238
11311
  <div part="scrim" class="scrim ${isVisible ? "visible" : ""}"></div>
11239
11312
 
@@ -11252,12 +11325,12 @@ const _PlayerPlayer = class _PlayerPlayer extends lit.LitElement {
11252
11325
 
11253
11326
  <!-- Control overlays wrapper -->
11254
11327
  <div part="controls-overlay" class="controls-overlay">
11255
- ${layoutMode === "custom" ? lit.html`<slot></slot>` : layoutMode === "vertical" ? ((_n = (_m = this.config) == null ? void 0 : _m.controls) == null ? void 0 : _n.verticalControls) !== false && this.controlsSectionEnabled ? lit.html`
11328
+ ${layoutMode === "custom" ? lit.html`<slot></slot>` : layoutMode === "vertical" ? ((_l = (_k = this.config) == null ? void 0 : _k.controls) == null ? void 0 : _l.verticalControls) !== false && this.controlsSectionEnabled ? lit.html`
11256
11329
  <player-vertical-controls
11257
11330
  part="vertical-controls"
11258
11331
  exportparts="vertical-controls-container, action-rail, rail-btn, seekbar, seekbar-container, hover-tooltip, tooltip-marker-label, thumbnail-container, thumbnail-preview, tooltip-time-text, track, buffer-bar, progress-bar, handle, marker, time-display"
11259
- ?hideCurrentTime=${((_p = (_o = this.config) == null ? void 0 : _o.controls) == null ? void 0 : _p.currentTime) === false}
11260
- ?hideDuration=${((_r = (_q = this.config) == null ? void 0 : _q.controls) == null ? void 0 : _r.duration) === false}
11332
+ ?hideCurrentTime=${((_n = (_m = this.config) == null ? void 0 : _m.controls) == null ? void 0 : _n.currentTime) === false}
11333
+ ?hideDuration=${((_p = (_o = this.config) == null ? void 0 : _o.controls) == null ? void 0 : _p.duration) === false}
11261
11334
  .currentTime=${currentTime}
11262
11335
  .duration=${duration}
11263
11336
  .bufferedRanges=${bufferedRanges}
@@ -11284,7 +11357,7 @@ const _PlayerPlayer = class _PlayerPlayer extends lit.LitElement {
11284
11357
  <slot name="social-actions" slot="social-actions"></slot>
11285
11358
  <slot name="bottom-actions" slot="bottom-actions"></slot>
11286
11359
  </player-vertical-controls>
11287
- ` : "" : ((_t = (_s = this.config) == null ? void 0 : _s.controls) == null ? void 0 : _t.controlsBar) !== false && this.controlsSectionEnabled ? this.renderStandardControls() : ""}
11360
+ ` : "" : ((_r = (_q = this.config) == null ? void 0 : _q.controls) == null ? void 0 : _r.controlsBar) !== false && this.controlsSectionEnabled ? this.renderStandardControls() : ""}
11288
11361
  </div>
11289
11362
  ` : ""}
11290
11363
 
@@ -11420,7 +11493,10 @@ __decorateClass([
11420
11493
  decorators_js.property({ type: String, attribute: "live-mode", reflect: true })
11421
11494
  ], PlayerPlayer.prototype, "liveMode");
11422
11495
  __decorateClass([
11423
- decorators_js.property({ type: Object })
11496
+ decorators_js.property({
11497
+ type: Object,
11498
+ converter: { fromAttribute: parseConfigAttribute }
11499
+ })
11424
11500
  ], PlayerPlayer.prototype, "config");
11425
11501
  __decorateClass([
11426
11502
  decorators_js.property({ type: Boolean, attribute: "precise-seek", reflect: true })
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const Player = require("./Player-DrKG8tPQ.cjs");
3
+ const Player = require("./Player-CgkT9GAK.cjs");
4
4
  const PlayerController = require("./PlayerController-BaQ27TT9.cjs");
5
5
  const core_index = require("./core/index.cjs");
6
6
  exports.IconRegistry = Player.IconRegistry;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { I, P, a, b, c, d, e, f, g, T, h, r } from "./Player-CqgNV9Pd.js";
1
+ import { I, P, a, b, c, d, e, f, g, T, h, r } from "./Player-BhwMyjyV.js";
2
2
  import { A, a as a2, b as b2, c as c2, d as d2, e as e2, f as f2, g as g2, h as h2, i, j, D, H, I as I2, K, P as P2, S, k, l, m, n, o, T as T2, p, V, q, r as r2, s, t, u, v, w, x, y, z, B, C } from "./PlayerController-D68pc3mj.js";
3
3
  import { DrmValidator } from "./core/index.js";
4
4
  export {
@@ -22074,6 +22074,37 @@ const edgeStyles = [
22074
22074
  ];
22075
22075
  const STANDARD_SPEEDS = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.5, 3, 4];
22076
22076
  const VERTICAL_SPEEDS = [0.5, 1, 2];
22077
+ function buildAttributeAliases(canonical) {
22078
+ const aliases = /* @__PURE__ */ new Map();
22079
+ for (const name of canonical) {
22080
+ if (!name.includes("-")) continue;
22081
+ for (const alias of [name.replace(/-/g, ""), name.replace(/-/g, "_")]) {
22082
+ if (alias !== name && !canonical.includes(alias)) {
22083
+ aliases.set(alias, name);
22084
+ }
22085
+ }
22086
+ }
22087
+ return aliases;
22088
+ }
22089
+ function parseConfigAttribute(value) {
22090
+ if (value === null) return void 0;
22091
+ const trimmed = value.trim();
22092
+ if (trimmed === "") return void 0;
22093
+ if (trimmed.startsWith("[object ")) {
22094
+ console.warn(
22095
+ `[streamit-player] The "config" attribute received a stringified object ("${trimmed}") and has been ignored. Pass config as a DOM property (element.config = {...}, or .config=\${...} / :config="..." in a framework template) rather than as an attribute.`
22096
+ );
22097
+ return void 0;
22098
+ }
22099
+ try {
22100
+ return JSON.parse(trimmed);
22101
+ } catch {
22102
+ console.warn(
22103
+ '[streamit-player] The "config" attribute is not valid JSON and has been ignored. Pass config as a DOM property instead.'
22104
+ );
22105
+ return void 0;
22106
+ }
22107
+ }
22077
22108
  const _PlayerPlayer = class _PlayerPlayer extends i$1 {
22078
22109
  constructor() {
22079
22110
  super(...arguments);
@@ -22402,6 +22433,26 @@ const _PlayerPlayer = class _PlayerPlayer extends i$1 {
22402
22433
  const settingsLabels = ((_c = (_b = this.config) == null ? void 0 : _b.settings) == null ? void 0 : _c.labels) || {};
22403
22434
  return settingsLabels[key] || localeConfig[key] || defaultText;
22404
22435
  }
22436
+ static get observedAttributes() {
22437
+ const canonical = super.observedAttributes;
22438
+ if (!Object.prototype.hasOwnProperty.call(this, "attributeAliases")) {
22439
+ this.attributeAliases = buildAttributeAliases(canonical);
22440
+ }
22441
+ return [...canonical, ...this.attributeAliases.keys()];
22442
+ }
22443
+ attributeChangedCallback(name, old, value) {
22444
+ var _a2;
22445
+ const canonical = (_a2 = this.constructor.attributeAliases) == null ? void 0 : _a2.get(name);
22446
+ if (canonical) {
22447
+ if (value === null) {
22448
+ this.removeAttribute(canonical);
22449
+ } else if (this.getAttribute(canonical) !== value) {
22450
+ this.setAttribute(canonical, value);
22451
+ }
22452
+ return;
22453
+ }
22454
+ super.attributeChangedCallback(name, old, value);
22455
+ }
22405
22456
  get controllerInstance() {
22406
22457
  return this.controller;
22407
22458
  }
@@ -22723,6 +22774,29 @@ const _PlayerPlayer = class _PlayerPlayer extends i$1 {
22723
22774
  if (changedProperties.has("liveMode") && this.controller) {
22724
22775
  this.controller.setLiveMode(this.liveMode);
22725
22776
  }
22777
+ this.adoptDisplayModeFromConfig(changedProperties);
22778
+ }
22779
+ /**
22780
+ * `displayMode` is the single source of truth for the layout: the host
22781
+ * stylesheet keys off the attribute it reflects and render() picks the
22782
+ * control set from it. `config.displayMode` and `config.layout.mode` are
22783
+ * equivalent ways to ask for a mode, so they are folded into the property
22784
+ * here - before the first render - rather than being read separately further
22785
+ * down, which is how a 9:16 host could end up wearing the standard control
22786
+ * bar.
22787
+ *
22788
+ * Only a config that changes the mode it asks for wins, so an unrelated
22789
+ * config update never clobbers a display-mode set on the element itself.
22790
+ */
22791
+ adoptDisplayModeFromConfig(changedProperties) {
22792
+ var _a2, _b, _c;
22793
+ if (!changedProperties.has("config")) return;
22794
+ const requested = ((_a2 = this.config) == null ? void 0 : _a2.displayMode) || ((_c = (_b = this.config) == null ? void 0 : _b.layout) == null ? void 0 : _c.mode);
22795
+ if (!requested || requested === this.configRequestedMode) return;
22796
+ this.configRequestedMode = requested;
22797
+ if (this.displayMode !== requested) {
22798
+ this.displayMode = requested;
22799
+ }
22726
22800
  }
22727
22801
  firstUpdated() {
22728
22802
  var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
@@ -25348,8 +25422,7 @@ const _PlayerPlayer = class _PlayerPlayer extends i$1 {
25348
25422
  `;
25349
25423
  }
25350
25424
  renderDefaultLiveOverlay(player) {
25351
- var _a2, _b;
25352
- const layoutMode = ((_b = (_a2 = player.config) == null ? void 0 : _a2.layout) == null ? void 0 : _b.mode) || player.displayMode;
25425
+ const layoutMode = player.displayMode;
25353
25426
  if (layoutMode !== "vertical" || !player.playerState.isLive) return "";
25354
25427
  return b`
25355
25428
  <div
@@ -25696,7 +25769,7 @@ const _PlayerPlayer = class _PlayerPlayer extends i$1 {
25696
25769
  `;
25697
25770
  }
25698
25771
  render() {
25699
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
25772
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
25700
25773
  const {
25701
25774
  isPlaying,
25702
25775
  status,
@@ -25709,7 +25782,7 @@ const _PlayerPlayer = class _PlayerPlayer extends i$1 {
25709
25782
  loop
25710
25783
  } = this.playerState;
25711
25784
  const isVisible = this.controlsVisible || !isPlaying;
25712
- const layoutMode = ((_b = (_a2 = this.config) == null ? void 0 : _a2.layout) == null ? void 0 : _b.mode) || this.displayMode;
25785
+ const layoutMode = this.displayMode;
25713
25786
  return b`
25714
25787
  <div
25715
25788
  part="player-container"
@@ -25730,12 +25803,12 @@ const _PlayerPlayer = class _PlayerPlayer extends i$1 {
25730
25803
  <canvas part="transition-canvas" class="transition-canvas"></canvas>
25731
25804
  </div>
25732
25805
 
25733
- ${!currentSource && this.emptyStateSectionEnabled && ((_d = (_c = this.config) == null ? void 0 : _c.controls) == null ? void 0 : _d.emptyState) !== false ? this.renderEmptyState() : b`
25806
+ ${!currentSource && this.emptyStateSectionEnabled && ((_b = (_a2 = this.config) == null ? void 0 : _a2.controls) == null ? void 0 : _b.emptyState) !== false ? this.renderEmptyState() : b`
25734
25807
  <!-- Custom overlay slot -->
25735
25808
  <slot name="top-overlay"></slot>
25736
25809
 
25737
25810
  <!-- Center Play Button Overlay -->
25738
- ${!((_e = this.playerState) == null ? void 0 : _e.isAdPlaying) ? this.renderOverlay("center-play", (p2) => this.renderDefaultCenterPlayOverlay(p2)) : ""}
25811
+ ${!((_c = this.playerState) == null ? void 0 : _c.isAdPlaying) ? this.renderOverlay("center-play", (p2) => this.renderDefaultCenterPlayOverlay(p2)) : ""}
25739
25812
 
25740
25813
  <!-- Audio only cover -->
25741
25814
  ${layoutMode === "audio-only" ? b`
@@ -25808,22 +25881,22 @@ const _PlayerPlayer = class _PlayerPlayer extends i$1 {
25808
25881
  ${isBuffering && !error ? this.renderOverlay("buffering", (p2) => this.renderDefaultBufferingOverlay(p2)) : ""}
25809
25882
 
25810
25883
  <!-- Centered Replay Overlay (not shown in vertical mode) -->
25811
- ${status === "ended" && !this.playerState.isLive && this.displayMode !== "vertical" && !loop && !((_f = this.playerState) == null ? void 0 : _f.isAdPlaying) ? this.renderOverlay("replay", (p2) => this.renderDefaultReplayOverlay(p2)) : ""}
25884
+ ${status === "ended" && !this.playerState.isLive && this.displayMode !== "vertical" && !loop && !((_d = this.playerState) == null ? void 0 : _d.isAdPlaying) ? this.renderOverlay("replay", (p2) => this.renderDefaultReplayOverlay(p2)) : ""}
25812
25885
 
25813
25886
  <!-- Ambient Tap Skip / Volume / Playback Speed gesture feedback ripples -->
25814
- ${this.tapFeedback && !((_g = this.playerState) == null ? void 0 : _g.isAdPlaying) ? this.renderOverlay(
25887
+ ${this.tapFeedback && !((_e = this.playerState) == null ? void 0 : _e.isAdPlaying) ? this.renderOverlay(
25815
25888
  "seek",
25816
25889
  (p2, dir) => this.renderDefaultSeekOverlay(p2, dir),
25817
25890
  this.tapFeedback
25818
25891
  ) : ""}
25819
- ${this.playPauseFeedback && !((_h = this.playerState) == null ? void 0 : _h.isAdPlaying) ? this.renderOverlay("play-pause", (p2) => this.renderDefaultPlayPauseOverlay(p2)) : ""}
25820
- ${this.activeVolumeFeedback && !((_i = this.playerState) == null ? void 0 : _i.isAdPlaying) ? this.renderOverlay("volume", (p2) => this.renderDefaultVolumeOverlay(p2)) : ""}
25821
- ${this.activeSpeedFeedback && !((_j = this.playerState) == null ? void 0 : _j.isAdPlaying) ? this.renderOverlay("speed", (p2) => this.renderDefaultSpeedOverlay(p2)) : ""}
25892
+ ${this.playPauseFeedback && !((_f = this.playerState) == null ? void 0 : _f.isAdPlaying) ? this.renderOverlay("play-pause", (p2) => this.renderDefaultPlayPauseOverlay(p2)) : ""}
25893
+ ${this.activeVolumeFeedback && !((_g = this.playerState) == null ? void 0 : _g.isAdPlaying) ? this.renderOverlay("volume", (p2) => this.renderDefaultVolumeOverlay(p2)) : ""}
25894
+ ${this.activeSpeedFeedback && !((_h = this.playerState) == null ? void 0 : _h.isAdPlaying) ? this.renderOverlay("speed", (p2) => this.renderDefaultSpeedOverlay(p2)) : ""}
25822
25895
 
25823
25896
  <!-- Persistent Live Badge for Vertical Player -->
25824
- ${layoutMode === "vertical" && this.playerState.isLive && !((_k = this.playerState) == null ? void 0 : _k.isAdPlaying) ? this.renderOverlay("live", (p2) => this.renderDefaultLiveOverlay(p2)) : ""}
25897
+ ${layoutMode === "vertical" && this.playerState.isLive && !((_i = this.playerState) == null ? void 0 : _i.isAdPlaying) ? this.renderOverlay("live", (p2) => this.renderDefaultLiveOverlay(p2)) : ""}
25825
25898
 
25826
- ${!((_l = this.playerState) == null ? void 0 : _l.isAdPlaying) ? b`
25899
+ ${!((_j = this.playerState) == null ? void 0 : _j.isAdPlaying) ? b`
25827
25900
  <!-- Ambient top/bottom vignette scrim -->
25828
25901
  <div part="scrim" class="scrim ${isVisible ? "visible" : ""}"></div>
25829
25902
 
@@ -25842,12 +25915,12 @@ const _PlayerPlayer = class _PlayerPlayer extends i$1 {
25842
25915
 
25843
25916
  <!-- Control overlays wrapper -->
25844
25917
  <div part="controls-overlay" class="controls-overlay">
25845
- ${layoutMode === "custom" ? b`<slot></slot>` : layoutMode === "vertical" ? ((_n = (_m = this.config) == null ? void 0 : _m.controls) == null ? void 0 : _n.verticalControls) !== false && this.controlsSectionEnabled ? b`
25918
+ ${layoutMode === "custom" ? b`<slot></slot>` : layoutMode === "vertical" ? ((_l = (_k = this.config) == null ? void 0 : _k.controls) == null ? void 0 : _l.verticalControls) !== false && this.controlsSectionEnabled ? b`
25846
25919
  <player-vertical-controls
25847
25920
  part="vertical-controls"
25848
25921
  exportparts="vertical-controls-container, action-rail, rail-btn, seekbar, seekbar-container, hover-tooltip, tooltip-marker-label, thumbnail-container, thumbnail-preview, tooltip-time-text, track, buffer-bar, progress-bar, handle, marker, time-display"
25849
- ?hideCurrentTime=${((_p = (_o = this.config) == null ? void 0 : _o.controls) == null ? void 0 : _p.currentTime) === false}
25850
- ?hideDuration=${((_r = (_q = this.config) == null ? void 0 : _q.controls) == null ? void 0 : _r.duration) === false}
25922
+ ?hideCurrentTime=${((_n = (_m = this.config) == null ? void 0 : _m.controls) == null ? void 0 : _n.currentTime) === false}
25923
+ ?hideDuration=${((_p = (_o = this.config) == null ? void 0 : _o.controls) == null ? void 0 : _p.duration) === false}
25851
25924
  .currentTime=${currentTime}
25852
25925
  .duration=${duration}
25853
25926
  .bufferedRanges=${bufferedRanges}
@@ -25874,7 +25947,7 @@ const _PlayerPlayer = class _PlayerPlayer extends i$1 {
25874
25947
  <slot name="social-actions" slot="social-actions"></slot>
25875
25948
  <slot name="bottom-actions" slot="bottom-actions"></slot>
25876
25949
  </player-vertical-controls>
25877
- ` : "" : ((_t = (_s = this.config) == null ? void 0 : _s.controls) == null ? void 0 : _t.controlsBar) !== false && this.controlsSectionEnabled ? this.renderStandardControls() : ""}
25950
+ ` : "" : ((_r = (_q = this.config) == null ? void 0 : _q.controls) == null ? void 0 : _r.controlsBar) !== false && this.controlsSectionEnabled ? this.renderStandardControls() : ""}
25878
25951
  </div>
25879
25952
  ` : ""}
25880
25953
 
@@ -26010,7 +26083,10 @@ __decorateClass([
26010
26083
  n2({ type: String, attribute: "live-mode", reflect: true })
26011
26084
  ], PlayerPlayer.prototype, "liveMode");
26012
26085
  __decorateClass([
26013
- n2({ type: Object })
26086
+ n2({
26087
+ type: Object,
26088
+ converter: { fromAttribute: parseConfigAttribute }
26089
+ })
26014
26090
  ], PlayerPlayer.prototype, "config");
26015
26091
  __decorateClass([
26016
26092
  n2({ type: Boolean, attribute: "precise-seek", reflect: true })