@vonage/vivid 5.3.0 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/accordion-item/definition.js +1 -1
  2. package/alert/definition.cjs +1 -1
  3. package/alert/definition.js +2 -2
  4. package/badge/definition.js +1 -1
  5. package/banner/definition.js +1 -1
  6. package/bundled/calendar-picker.template.cjs +7 -7
  7. package/bundled/calendar-picker.template.js +101 -101
  8. package/bundled/definition11.cjs +13 -13
  9. package/bundled/definition11.js +202 -50
  10. package/bundled/definition19.cjs +24 -25
  11. package/bundled/definition19.js +152 -164
  12. package/bundled/definition6.cjs +3 -3
  13. package/bundled/definition6.js +19 -19
  14. package/bundled/definition9.cjs +5 -5
  15. package/bundled/definition9.js +394 -392
  16. package/bundled/listbox.cjs +1 -1
  17. package/bundled/listbox.js +82 -102
  18. package/bundled/localized.cjs +1 -1
  19. package/bundled/localized.js +18 -14
  20. package/bundled/vivid-element.cjs +5 -1
  21. package/bundled/vivid-element.js +401 -358
  22. package/calendar/index.cjs +1 -1
  23. package/calendar/index.js +14 -14
  24. package/card/definition.cjs +1 -1
  25. package/card/definition.js +1 -1
  26. package/color-picker/definition.cjs +1 -1
  27. package/color-picker/definition.js +1 -1
  28. package/combobox/definition.cjs +7 -27
  29. package/combobox/definition.js +8 -28
  30. package/combobox/index.cjs +6 -6
  31. package/combobox/index.js +57 -71
  32. package/custom-elements.json +305 -2
  33. package/date-picker/definition.cjs +1 -1
  34. package/date-picker/definition.js +1 -1
  35. package/date-range-picker/definition.cjs +1 -1
  36. package/date-range-picker/definition.js +1 -1
  37. package/date-time-picker/definition.cjs +1 -1
  38. package/date-time-picker/definition.js +1 -1
  39. package/dialog/definition.cjs +2 -2
  40. package/dialog/definition.js +2 -2
  41. package/dialog/index.cjs +7 -7
  42. package/dialog/index.js +6 -6
  43. package/elevation/definition.cjs +1 -1
  44. package/elevation/definition.js +1 -1
  45. package/fab/definition.js +1 -1
  46. package/header/definition.cjs +1 -1
  47. package/header/definition.js +1 -1
  48. package/index.cjs +3 -4
  49. package/index.js +2 -3
  50. package/lib/accordion/accordion.d.ts +1 -1
  51. package/lib/accordion/definition.d.ts +1 -1
  52. package/lib/audio-player/audio-player.d.ts +1 -1
  53. package/lib/combobox/combobox.d.ts +1 -0
  54. package/lib/combobox/combobox.options.d.ts +1 -1
  55. package/lib/divider/divider.d.ts +1 -1
  56. package/lib/menu-item/menu-item-role.d.ts +1 -1
  57. package/lib/popup/popup.d.ts +1 -1
  58. package/lib/searchable-select/locale.d.ts +4 -0
  59. package/lib/searchable-select/searchable-select.d.ts +3 -0
  60. package/lib/select/select.d.ts +3 -1
  61. package/lib/slider/slider.d.ts +1 -1
  62. package/lib/tabs/tabs.d.ts +2 -2
  63. package/lib/text-area/text-area.d.ts +1 -1
  64. package/lib/text-field/text-field.d.ts +1 -1
  65. package/locales/de-DE.cjs +4 -0
  66. package/locales/de-DE.js +4 -0
  67. package/locales/en-GB.cjs +4 -0
  68. package/locales/en-GB.js +4 -0
  69. package/locales/en-US.cjs +4 -0
  70. package/locales/en-US.js +4 -0
  71. package/locales/ja-JP.cjs +4 -0
  72. package/locales/ja-JP.js +4 -0
  73. package/locales/zh-CN.cjs +4 -0
  74. package/locales/zh-CN.js +4 -0
  75. package/menu/definition.cjs +4 -4
  76. package/menu/definition.js +4 -4
  77. package/nav-disclosure/definition.js +1 -1
  78. package/nav-item/definition.js +1 -1
  79. package/note/definition.js +1 -1
  80. package/number-field/definition.js +1 -1
  81. package/option/definition.cjs +6 -77
  82. package/option/definition.js +3 -78
  83. package/package.json +31 -5
  84. package/popup/definition.cjs +2 -2
  85. package/popup/definition.js +2 -2
  86. package/range-slider/definition.cjs +1 -1
  87. package/range-slider/definition.js +1 -1
  88. package/rich-text-editor/definition.cjs +2 -3
  89. package/rich-text-editor/definition.js +1 -2
  90. package/rich-text-editor/index.cjs +27 -27
  91. package/rich-text-editor/index.js +1208 -1198
  92. package/searchable-select/definition.cjs +103 -11
  93. package/searchable-select/definition.js +103 -11
  94. package/searchable-select/index.cjs +81 -69
  95. package/searchable-select/index.js +359 -273
  96. package/select/definition.cjs +24 -41
  97. package/select/definition.js +24 -41
  98. package/selectable-box/definition.cjs +1 -1
  99. package/selectable-box/definition.js +1 -1
  100. package/selectable-box/index.cjs +1 -1
  101. package/selectable-box/index.js +1 -1
  102. package/shared/aria/aria-mixin.d.ts +1 -1
  103. package/shared/foundation/listbox/listbox.d.ts +4 -0
  104. package/simple-color-picker/definition.cjs +1 -1
  105. package/simple-color-picker/definition.js +1 -1
  106. package/slider/definition.cjs +1 -1
  107. package/slider/definition.js +1 -1
  108. package/split-button/definition.js +1 -1
  109. package/styles/core/all.css +1 -1
  110. package/styles/core/theme.css +1 -1
  111. package/styles/core/typography.css +1 -1
  112. package/styles/tokens/theme-dark.css +4 -4
  113. package/styles/tokens/theme-light.css +4 -4
  114. package/styles/tokens/vivid-2-compat.css +1 -1
  115. package/tab/definition.js +1 -1
  116. package/tag/definition.js +1 -1
  117. package/text-field/definition.js +1 -1
  118. package/time-picker/definition.cjs +1 -1
  119. package/time-picker/definition.js +1 -1
  120. package/toggletip/definition.cjs +1 -1
  121. package/toggletip/definition.js +1 -1
  122. package/tooltip/definition.cjs +1 -1
  123. package/tooltip/definition.js +1 -1
  124. package/tree-item/definition.cjs +1 -1
  125. package/tree-item/definition.js +1 -1
  126. package/tree-view/definition.cjs +1 -1
  127. package/tree-view/definition.js +1 -1
  128. package/unbundled/affix.js +1 -1
  129. package/unbundled/calendar-picker.template.cjs +1 -1
  130. package/unbundled/calendar-picker.template.js +1 -1
  131. package/unbundled/definition.js +1 -1
  132. package/unbundled/definition2.js +1 -1
  133. package/unbundled/definition3.cjs +222 -141
  134. package/unbundled/definition3.js +220 -139
  135. package/unbundled/definition4.cjs +145 -235
  136. package/unbundled/definition4.js +143 -233
  137. package/unbundled/definition5.cjs +269 -27
  138. package/unbundled/definition5.js +267 -26
  139. package/unbundled/definition6.cjs +56 -0
  140. package/unbundled/definition6.js +52 -0
  141. package/unbundled/listbox.cjs +41 -63
  142. package/unbundled/listbox.js +39 -61
  143. package/unbundled/picker-field.template.cjs +1 -1
  144. package/unbundled/picker-field.template.js +1 -1
  145. package/unbundled/slider.template.cjs +1 -1
  146. package/unbundled/slider.template.js +1 -1
  147. package/unbundled/vivid-element.cjs +1 -1
  148. package/unbundled/vivid-element.js +1 -1
  149. package/video-player/definition.cjs +56 -16
  150. package/video-player/definition.js +56 -16
  151. package/video-player/index.cjs +36 -36
  152. package/video-player/index.js +2461 -2445
  153. package/vivid.api.json +285 -38
  154. package/bundled/option.cjs +0 -1
  155. package/bundled/option.js +0 -158
  156. package/unbundled/option.cjs +0 -217
  157. package/unbundled/option.js +0 -214
@@ -0,0 +1,56 @@
1
+ 'use strict';
2
+
3
+ const vividElement = require('./vivid-element.cjs');
4
+ const fastElement = require('@microsoft/fast-element');
5
+ const fastWebUtilities = require('@microsoft/fast-web-utilities');
6
+
7
+ var __defProp = Object.defineProperty;
8
+ var __decorateClass = (decorators, target, key, kind) => {
9
+ var result = void 0 ;
10
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
11
+ if (decorator = decorators[i])
12
+ result = (decorator(target, key, result) ) || result;
13
+ if (result) __defProp(target, key, result);
14
+ return result;
15
+ };
16
+ class Elevation extends vividElement.VividElement {
17
+ }
18
+ __decorateClass([
19
+ fastElement.attr
20
+ ], Elevation.prototype, "dp");
21
+ __decorateClass([
22
+ fastElement.attr({ attribute: "no-shadow", mode: "boolean" })
23
+ ], Elevation.prototype, "noShadow");
24
+ __decorateClass([
25
+ fastElement.attr({ attribute: "not-relative", mode: "boolean" })
26
+ ], Elevation.prototype, "notRelative");
27
+
28
+ const styles = ":host{display:contents}.control{display:contents}.control.dp-0{--_elevation-fill: var(--_vvd-tinted-color-surface-0dp, var(--vvd-color-surface-0dp));--_elevation-shadow: var(--_vvd-tinted-shadow-surface-0dp, var(--vvd-shadow-surface-0dp))}.control.dp-4{--_elevation-fill: var(--_vvd-tinted-color-surface-4dp, var(--vvd-color-surface-4dp));--_elevation-shadow: var(--_vvd-tinted-shadow-surface-4dp, var(--vvd-shadow-surface-4dp))}.control.dp-8{--_elevation-fill: var(--_vvd-tinted-color-surface-8dp, var(--vvd-color-surface-8dp));--_elevation-shadow: var(--_vvd-tinted-shadow-surface-8dp, var(--vvd-shadow-surface-8dp))}.control.dp-12{--_elevation-fill: var(--_vvd-tinted-color-surface-12dp, var(--vvd-color-surface-12dp));--_elevation-shadow: var(--_vvd-tinted-shadow-surface-12dp, var(--vvd-shadow-surface-12dp))}.control.dp-16{--_elevation-fill: var(--_vvd-tinted-color-surface-16dp, var(--vvd-color-surface-16dp));--_elevation-shadow: var(--_vvd-tinted-shadow-surface-16dp, var(--vvd-shadow-surface-16dp))}.control.dp-24{--_elevation-fill: var(--_vvd-tinted-color-surface-24dp, var(--vvd-color-surface-24dp));--_elevation-shadow: var(--_vvd-tinted-shadow-surface-24dp, var(--vvd-shadow-surface-24dp))}.control:not(.dp-0,.dp-4,.dp-8,.dp-12,.dp-16,.dp-24){--_elevation-fill: var(--_vvd-tinted-color-surface-2dp, var(--vvd-color-surface-2dp));--_elevation-shadow: var(--_vvd-tinted-shadow-surface-2dp, var(--vvd-shadow-surface-2dp))}.control ::slotted(*){isolation:isolate}.control ::slotted(*):before{position:absolute;z-index:-1;border-radius:inherit;background:var(--_elevation-fill);block-size:100%;content:\"\";filter:var(--_elevation-shadow);inline-size:100%;inset-block-start:0;inset-inline-start:0;transition:background-color .15s linear,filter .15s linear}.control:not(.not-relative) ::slotted(*){position:relative}.control.no-shadow ::slotted(*):before{filter:none}";
29
+
30
+ const getClasses = ({ dp, noShadow, notRelative }) => fastWebUtilities.classNames(
31
+ "control",
32
+ [`dp-${dp}`, Boolean(dp)],
33
+ ["no-shadow", Boolean(noShadow)],
34
+ ["not-relative", Boolean(notRelative)]
35
+ );
36
+ const elevationTemplate = fastElement.html` <div
37
+ class="${getClasses}"
38
+ part="base"
39
+ >
40
+ <slot></slot>
41
+ </div>`;
42
+
43
+ const elevationDefinition = vividElement.defineVividComponent(
44
+ "elevation",
45
+ Elevation,
46
+ elevationTemplate,
47
+ [],
48
+ {
49
+ styles
50
+ }
51
+ );
52
+ const registerElevation = vividElement.createRegisterFunction(elevationDefinition);
53
+
54
+ exports.Elevation = Elevation;
55
+ exports.elevationDefinition = elevationDefinition;
56
+ exports.registerElevation = registerElevation;
@@ -0,0 +1,52 @@
1
+ import { V as VividElement, d as defineVividComponent, c as createRegisterFunction } from './vivid-element.js';
2
+ import { attr, html } from '@microsoft/fast-element';
3
+ import { classNames } from '@microsoft/fast-web-utilities';
4
+
5
+ var __defProp = Object.defineProperty;
6
+ var __decorateClass = (decorators, target, key, kind) => {
7
+ var result = void 0 ;
8
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
9
+ if (decorator = decorators[i])
10
+ result = (decorator(target, key, result) ) || result;
11
+ if (result) __defProp(target, key, result);
12
+ return result;
13
+ };
14
+ class Elevation extends VividElement {
15
+ }
16
+ __decorateClass([
17
+ attr
18
+ ], Elevation.prototype, "dp");
19
+ __decorateClass([
20
+ attr({ attribute: "no-shadow", mode: "boolean" })
21
+ ], Elevation.prototype, "noShadow");
22
+ __decorateClass([
23
+ attr({ attribute: "not-relative", mode: "boolean" })
24
+ ], Elevation.prototype, "notRelative");
25
+
26
+ const styles = ":host{display:contents}.control{display:contents}.control.dp-0{--_elevation-fill: var(--_vvd-tinted-color-surface-0dp, var(--vvd-color-surface-0dp));--_elevation-shadow: var(--_vvd-tinted-shadow-surface-0dp, var(--vvd-shadow-surface-0dp))}.control.dp-4{--_elevation-fill: var(--_vvd-tinted-color-surface-4dp, var(--vvd-color-surface-4dp));--_elevation-shadow: var(--_vvd-tinted-shadow-surface-4dp, var(--vvd-shadow-surface-4dp))}.control.dp-8{--_elevation-fill: var(--_vvd-tinted-color-surface-8dp, var(--vvd-color-surface-8dp));--_elevation-shadow: var(--_vvd-tinted-shadow-surface-8dp, var(--vvd-shadow-surface-8dp))}.control.dp-12{--_elevation-fill: var(--_vvd-tinted-color-surface-12dp, var(--vvd-color-surface-12dp));--_elevation-shadow: var(--_vvd-tinted-shadow-surface-12dp, var(--vvd-shadow-surface-12dp))}.control.dp-16{--_elevation-fill: var(--_vvd-tinted-color-surface-16dp, var(--vvd-color-surface-16dp));--_elevation-shadow: var(--_vvd-tinted-shadow-surface-16dp, var(--vvd-shadow-surface-16dp))}.control.dp-24{--_elevation-fill: var(--_vvd-tinted-color-surface-24dp, var(--vvd-color-surface-24dp));--_elevation-shadow: var(--_vvd-tinted-shadow-surface-24dp, var(--vvd-shadow-surface-24dp))}.control:not(.dp-0,.dp-4,.dp-8,.dp-12,.dp-16,.dp-24){--_elevation-fill: var(--_vvd-tinted-color-surface-2dp, var(--vvd-color-surface-2dp));--_elevation-shadow: var(--_vvd-tinted-shadow-surface-2dp, var(--vvd-shadow-surface-2dp))}.control ::slotted(*){isolation:isolate}.control ::slotted(*):before{position:absolute;z-index:-1;border-radius:inherit;background:var(--_elevation-fill);block-size:100%;content:\"\";filter:var(--_elevation-shadow);inline-size:100%;inset-block-start:0;inset-inline-start:0;transition:background-color .15s linear,filter .15s linear}.control:not(.not-relative) ::slotted(*){position:relative}.control.no-shadow ::slotted(*):before{filter:none}";
27
+
28
+ const getClasses = ({ dp, noShadow, notRelative }) => classNames(
29
+ "control",
30
+ [`dp-${dp}`, Boolean(dp)],
31
+ ["no-shadow", Boolean(noShadow)],
32
+ ["not-relative", Boolean(notRelative)]
33
+ );
34
+ const elevationTemplate = html` <div
35
+ class="${getClasses}"
36
+ part="base"
37
+ >
38
+ <slot></slot>
39
+ </div>`;
40
+
41
+ const elevationDefinition = defineVividComponent(
42
+ "elevation",
43
+ Elevation,
44
+ elevationTemplate,
45
+ [],
46
+ {
47
+ styles
48
+ }
49
+ );
50
+ const registerElevation = createRegisterFunction(elevationDefinition);
51
+
52
+ export { Elevation as E, elevationDefinition as e, registerElevation as r };
@@ -2,7 +2,7 @@
2
2
 
3
3
  const fastElement = require('@microsoft/fast-element');
4
4
  const fastWebUtilities = require('@microsoft/fast-web-utilities');
5
- const option = require('./option.cjs');
5
+ const option_definition = require('./definition3.cjs');
6
6
  const vividElement = require('./vivid-element.cjs');
7
7
 
8
8
  var __defProp = Object.defineProperty;
@@ -55,14 +55,6 @@ const _Listbox = class _Listbox extends vividElement.VividElement {
55
55
  get firstSelectedOption() {
56
56
  return this.selectedOptions[0] ?? null;
57
57
  }
58
- /**
59
- * Returns true if there is one or more selectable option.
60
- *
61
- * @internal
62
- */
63
- get hasSelectableOptions() {
64
- return this.options.length > 0 && !this.options.every((o) => o.disabled);
65
- }
66
58
  /**
67
59
  * The number of options.
68
60
  *
@@ -81,8 +73,19 @@ const _Listbox = class _Listbox extends vividElement.VividElement {
81
73
  return this._options;
82
74
  }
83
75
  set options(value) {
76
+ const prev = this._options;
84
77
  this._options = value;
85
78
  fastElement.Observable.notify(this, "options");
79
+ if (this.$fastController.isConnected) {
80
+ const newSelectedIndex = this._newDefaultSelectedIndex(
81
+ prev,
82
+ value,
83
+ this.selectedIndex
84
+ );
85
+ if (newSelectedIndex !== null) {
86
+ this.selectedIndex = newSelectedIndex;
87
+ }
88
+ }
86
89
  }
87
90
  static {
88
91
  /**
@@ -91,7 +94,7 @@ const _Listbox = class _Listbox extends vividElement.VividElement {
91
94
  * @param n - element to filter
92
95
  * @public
93
96
  */
94
- this.slottedOptionFilter = (n) => option.isListboxOption(n) && !n.hidden;
97
+ this.slottedOptionFilter = (n) => option_definition.isListboxOption(n) && !n.hidden;
95
98
  }
96
99
  static {
97
100
  /**
@@ -156,34 +159,11 @@ const _Listbox = class _Listbox extends vividElement.VividElement {
156
159
  const re = new RegExp(`^${pattern}`, "gi");
157
160
  return this.options.filter((o) => o.text.trim().match(re));
158
161
  }
159
- /**
160
- * Determines the index of the next option which is selectable, if any.
161
- *
162
- * @param prev - the previous selected index
163
- * @param next - the next index to select
164
- *
165
- * @internal
166
- */
167
- getSelectableIndex(prev, next) {
168
- const direction = prev > next ? -1 : 1;
169
- const potentialDirection = prev + direction;
170
- let nextSelectableOption = null;
171
- switch (direction) {
172
- case -1: {
173
- nextSelectableOption = this.options.reduceRight(
174
- (nextSelectableOption2, thisOption, index) => !nextSelectableOption2 && !thisOption.disabled && index < potentialDirection ? thisOption : nextSelectableOption2,
175
- nextSelectableOption
176
- );
177
- break;
178
- }
179
- case 1: {
180
- nextSelectableOption = this.options.reduce(
181
- (nextSelectableOption2, thisOption, index) => !nextSelectableOption2 && !thisOption.disabled && index > potentialDirection ? thisOption : nextSelectableOption2,
182
- nextSelectableOption
183
- );
184
- break;
185
- }
186
- }
162
+ getNextSelectableIndex(fromIndex) {
163
+ const nextSelectableOption = this.options.reduce(
164
+ (nextSelectableOption2, thisOption, index) => !nextSelectableOption2 && !thisOption.disabled && index >= fromIndex ? thisOption : nextSelectableOption2,
165
+ null
166
+ );
187
167
  return this.options.indexOf(nextSelectableOption);
188
168
  }
189
169
  /**
@@ -301,18 +281,17 @@ const _Listbox = class _Listbox extends vividElement.VividElement {
301
281
  * @internal
302
282
  */
303
283
  selectedIndexChanged(prev, next) {
304
- if (!this.hasSelectableOptions) {
305
- this.selectedIndex = -1;
306
- return;
307
- }
308
- if (this.options[this.selectedIndex]?.disabled && typeof prev === "number") {
309
- const selectableIndex = this.getSelectableIndex(prev, next);
310
- const newNext = selectableIndex > -1 ? selectableIndex : prev;
311
- this.selectedIndex = newNext;
284
+ const validNext = this._validSelectedIndex(next);
285
+ if (next !== validNext) {
286
+ this.selectedIndex = validNext;
312
287
  return;
313
288
  }
314
289
  this.setSelectedOptions();
315
290
  }
291
+ _validSelectedIndex(index) {
292
+ const outOfRange = index > this.options.length - 1 || index < -1;
293
+ return outOfRange ? -1 : index;
294
+ }
316
295
  /**
317
296
  * Updates the selectedness of each option when the list of selected options changes.
318
297
  *
@@ -367,13 +346,18 @@ const _Listbox = class _Listbox extends vividElement.VividElement {
367
346
  this.selectedIndex = this.selectedIndex - 1;
368
347
  }
369
348
  }
370
- /**
371
- * Updates the selected index to match the first selected option.
372
- *
373
- * @internal
374
- */
375
- setDefaultSelectedOption() {
376
- this.selectedIndex = this.options.findIndex((el) => el.defaultSelected);
349
+ /// For this options change, determine if selectedIndex should change based on defaultSelected. Otherwise, returns null.
350
+ _newDefaultSelectedIndex(prev, next, currentSelectedIndex) {
351
+ for (const [index, newOption] of next.entries()) {
352
+ if (this._isDefaultSelected(newOption) && !prev.includes(newOption)) {
353
+ return index;
354
+ }
355
+ }
356
+ return null;
357
+ }
358
+ /// Whether an option should be considered defaultSelected
359
+ _isDefaultSelected(option) {
360
+ return option.defaultSelected;
377
361
  }
378
362
  /**
379
363
  * Sets an option as selected and gives it focus.
@@ -381,11 +365,9 @@ const _Listbox = class _Listbox extends vividElement.VividElement {
381
365
  * @public
382
366
  */
383
367
  setSelectedOptions() {
384
- if (this.options.length) {
385
- this.selectedOptions = [this.options[this.selectedIndex]];
386
- this._activeDescendant = this.firstSelectedOption?.id ?? "";
387
- this.focusAndScrollOptionIntoView();
388
- }
368
+ this.selectedOptions = this.selectedIndex !== -1 ? [this.options[this.selectedIndex]] : [];
369
+ this._activeDescendant = this.firstSelectedOption?.id ?? "";
370
+ this.focusAndScrollOptionIntoView();
389
371
  }
390
372
  /**
391
373
  * Updates the list of options and resets the selected option when the slotted option content changes.
@@ -394,7 +376,7 @@ const _Listbox = class _Listbox extends vividElement.VividElement {
394
376
  */
395
377
  slottedOptionsChanged(_, next) {
396
378
  this.options = next.reduce((options, item) => {
397
- if (option.isListboxOption(item)) {
379
+ if (option_definition.isListboxOption(item)) {
398
380
  options.push(item);
399
381
  }
400
382
  return options;
@@ -407,10 +389,6 @@ const _Listbox = class _Listbox extends vividElement.VividElement {
407
389
  option.ariaPosInSet = `${index + 1}`;
408
390
  option.ariaSetSize = setSize;
409
391
  });
410
- if (this.$fastController.isConnected) {
411
- this.setSelectedOptions();
412
- this.setDefaultSelectedOption();
413
- }
414
392
  }
415
393
  /**
416
394
  * Updates the filtered list of options when the typeahead buffer changes.
@@ -1,6 +1,6 @@
1
1
  import { Observable, attr, observable } from '@microsoft/fast-element';
2
2
  import { keySpace, keyEscape, keyEnter, keyTab, keyEnd, keyArrowUp, keyArrowDown, keyHome, findLastIndex, uniqueId } from '@microsoft/fast-web-utilities';
3
- import { i as isListboxOption } from './option.js';
3
+ import { i as isListboxOption } from './definition3.js';
4
4
  import { V as VividElement } from './vivid-element.js';
5
5
 
6
6
  var __defProp = Object.defineProperty;
@@ -53,14 +53,6 @@ const _Listbox = class _Listbox extends VividElement {
53
53
  get firstSelectedOption() {
54
54
  return this.selectedOptions[0] ?? null;
55
55
  }
56
- /**
57
- * Returns true if there is one or more selectable option.
58
- *
59
- * @internal
60
- */
61
- get hasSelectableOptions() {
62
- return this.options.length > 0 && !this.options.every((o) => o.disabled);
63
- }
64
56
  /**
65
57
  * The number of options.
66
58
  *
@@ -79,8 +71,19 @@ const _Listbox = class _Listbox extends VividElement {
79
71
  return this._options;
80
72
  }
81
73
  set options(value) {
74
+ const prev = this._options;
82
75
  this._options = value;
83
76
  Observable.notify(this, "options");
77
+ if (this.$fastController.isConnected) {
78
+ const newSelectedIndex = this._newDefaultSelectedIndex(
79
+ prev,
80
+ value,
81
+ this.selectedIndex
82
+ );
83
+ if (newSelectedIndex !== null) {
84
+ this.selectedIndex = newSelectedIndex;
85
+ }
86
+ }
84
87
  }
85
88
  static {
86
89
  /**
@@ -154,34 +157,11 @@ const _Listbox = class _Listbox extends VividElement {
154
157
  const re = new RegExp(`^${pattern}`, "gi");
155
158
  return this.options.filter((o) => o.text.trim().match(re));
156
159
  }
157
- /**
158
- * Determines the index of the next option which is selectable, if any.
159
- *
160
- * @param prev - the previous selected index
161
- * @param next - the next index to select
162
- *
163
- * @internal
164
- */
165
- getSelectableIndex(prev, next) {
166
- const direction = prev > next ? -1 : 1;
167
- const potentialDirection = prev + direction;
168
- let nextSelectableOption = null;
169
- switch (direction) {
170
- case -1: {
171
- nextSelectableOption = this.options.reduceRight(
172
- (nextSelectableOption2, thisOption, index) => !nextSelectableOption2 && !thisOption.disabled && index < potentialDirection ? thisOption : nextSelectableOption2,
173
- nextSelectableOption
174
- );
175
- break;
176
- }
177
- case 1: {
178
- nextSelectableOption = this.options.reduce(
179
- (nextSelectableOption2, thisOption, index) => !nextSelectableOption2 && !thisOption.disabled && index > potentialDirection ? thisOption : nextSelectableOption2,
180
- nextSelectableOption
181
- );
182
- break;
183
- }
184
- }
160
+ getNextSelectableIndex(fromIndex) {
161
+ const nextSelectableOption = this.options.reduce(
162
+ (nextSelectableOption2, thisOption, index) => !nextSelectableOption2 && !thisOption.disabled && index >= fromIndex ? thisOption : nextSelectableOption2,
163
+ null
164
+ );
185
165
  return this.options.indexOf(nextSelectableOption);
186
166
  }
187
167
  /**
@@ -299,18 +279,17 @@ const _Listbox = class _Listbox extends VividElement {
299
279
  * @internal
300
280
  */
301
281
  selectedIndexChanged(prev, next) {
302
- if (!this.hasSelectableOptions) {
303
- this.selectedIndex = -1;
304
- return;
305
- }
306
- if (this.options[this.selectedIndex]?.disabled && typeof prev === "number") {
307
- const selectableIndex = this.getSelectableIndex(prev, next);
308
- const newNext = selectableIndex > -1 ? selectableIndex : prev;
309
- this.selectedIndex = newNext;
282
+ const validNext = this._validSelectedIndex(next);
283
+ if (next !== validNext) {
284
+ this.selectedIndex = validNext;
310
285
  return;
311
286
  }
312
287
  this.setSelectedOptions();
313
288
  }
289
+ _validSelectedIndex(index) {
290
+ const outOfRange = index > this.options.length - 1 || index < -1;
291
+ return outOfRange ? -1 : index;
292
+ }
314
293
  /**
315
294
  * Updates the selectedness of each option when the list of selected options changes.
316
295
  *
@@ -365,13 +344,18 @@ const _Listbox = class _Listbox extends VividElement {
365
344
  this.selectedIndex = this.selectedIndex - 1;
366
345
  }
367
346
  }
368
- /**
369
- * Updates the selected index to match the first selected option.
370
- *
371
- * @internal
372
- */
373
- setDefaultSelectedOption() {
374
- this.selectedIndex = this.options.findIndex((el) => el.defaultSelected);
347
+ /// For this options change, determine if selectedIndex should change based on defaultSelected. Otherwise, returns null.
348
+ _newDefaultSelectedIndex(prev, next, currentSelectedIndex) {
349
+ for (const [index, newOption] of next.entries()) {
350
+ if (this._isDefaultSelected(newOption) && !prev.includes(newOption)) {
351
+ return index;
352
+ }
353
+ }
354
+ return null;
355
+ }
356
+ /// Whether an option should be considered defaultSelected
357
+ _isDefaultSelected(option) {
358
+ return option.defaultSelected;
375
359
  }
376
360
  /**
377
361
  * Sets an option as selected and gives it focus.
@@ -379,11 +363,9 @@ const _Listbox = class _Listbox extends VividElement {
379
363
  * @public
380
364
  */
381
365
  setSelectedOptions() {
382
- if (this.options.length) {
383
- this.selectedOptions = [this.options[this.selectedIndex]];
384
- this._activeDescendant = this.firstSelectedOption?.id ?? "";
385
- this.focusAndScrollOptionIntoView();
386
- }
366
+ this.selectedOptions = this.selectedIndex !== -1 ? [this.options[this.selectedIndex]] : [];
367
+ this._activeDescendant = this.firstSelectedOption?.id ?? "";
368
+ this.focusAndScrollOptionIntoView();
387
369
  }
388
370
  /**
389
371
  * Updates the list of options and resets the selected option when the slotted option content changes.
@@ -405,10 +387,6 @@ const _Listbox = class _Listbox extends VividElement {
405
387
  option.ariaPosInSet = `${index + 1}`;
406
388
  option.ariaSetSize = setSize;
407
389
  });
408
- if (this.$fastController.isConnected) {
409
- this.setSelectedOptions();
410
- this.setDefaultSelectedOption();
411
- }
412
390
  }
413
391
  /**
414
392
  * Updates the filtered list of options when the typeahead buffer changes.
@@ -10,7 +10,7 @@ const withErrorText = require('./with-error-text.cjs');
10
10
  const formElement = require('./form-element.cjs');
11
11
  const localized = require('./localized.cjs');
12
12
  const fastWebUtilities = require('@microsoft/fast-web-utilities');
13
- const popup_definition = require('./definition4.cjs');
13
+ const popup_definition = require('./definition5.cjs');
14
14
  const textField_definition = require('../text-field/definition.cjs');
15
15
  const button_definition = require('./definition.cjs');
16
16
 
@@ -8,7 +8,7 @@ import { W as WithErrorText } from './with-error-text.js';
8
8
  import { F as FormElement } from './form-element.js';
9
9
  import { L as Localized } from './localized.js';
10
10
  import { classNames } from '@microsoft/fast-web-utilities';
11
- import { P as Popup } from './definition4.js';
11
+ import { P as Popup } from './definition5.js';
12
12
  import { VwcTextFieldElement as TextField } from '../text-field/definition.js';
13
13
  import { B as Button } from './definition.js';
14
14
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  const fastWebUtilities = require('@microsoft/fast-web-utilities');
4
4
  const fastElement = require('@microsoft/fast-element');
5
- const popup_definition = require('./definition4.cjs');
5
+ const popup_definition = require('./definition5.cjs');
6
6
  const delegatesAria = require('./delegates-aria.cjs');
7
7
 
8
8
  const getDecimalPlaces = (num) => {
@@ -1,6 +1,6 @@
1
1
  import { limit, classNames, Orientation } from '@microsoft/fast-web-utilities';
2
2
  import { ref, when, html } from '@microsoft/fast-element';
3
- import { P as Popup, a as PlacementStrategy } from './definition4.js';
3
+ import { P as Popup, a as PlacementStrategy } from './definition5.js';
4
4
  import { d as delegateAria } from './delegates-aria.js';
5
5
 
6
6
  const getDecimalPlaces = (num) => {
@@ -268,7 +268,7 @@ const ReplacedPropHandling = (Base) => {
268
268
 
269
269
  class VividElement extends AriaMixin(ReplacedPropHandling(fastElement.FASTElement)) {
270
270
  static {
271
- this.VIVID_VERSION = "5.3.0";
271
+ this.VIVID_VERSION = "5.4.0";
272
272
  }
273
273
  /**
274
274
  * Add data-vvd-component attribute with component name globally,
@@ -266,7 +266,7 @@ const ReplacedPropHandling = (Base) => {
266
266
 
267
267
  class VividElement extends AriaMixin(ReplacedPropHandling(FASTElement)) {
268
268
  static {
269
- this.VIVID_VERSION = "5.3.0";
269
+ this.VIVID_VERSION = "5.4.0";
270
270
  }
271
271
  /**
272
272
  * Add data-vvd-component attribute with component name globally,
@@ -6313,6 +6313,9 @@ function _insertBefore(parent, node, child, _inDocumentAssertion) {
6313
6313
  }
6314
6314
  do{
6315
6315
  newFirst.parentNode = parent;
6316
+ // Update ownerDocument for each node being inserted
6317
+ var targetDoc = parent.ownerDocument || parent;
6318
+ _updateOwnerDocument(newFirst, targetDoc);
6316
6319
  }while(newFirst !== newLast && (newFirst= newFirst.nextSibling))
6317
6320
  _onUpdateChild(parent.ownerDocument||parent, parent);
6318
6321
  //console.log(parent.lastChild.nextSibling == null)
@@ -6322,6 +6325,37 @@ function _insertBefore(parent, node, child, _inDocumentAssertion) {
6322
6325
  return node;
6323
6326
  }
6324
6327
 
6328
+ /**
6329
+ * Recursively updates the ownerDocument property for a node and all its descendants
6330
+ * @param {Node} node
6331
+ * @param {Document} newOwnerDocument
6332
+ * @private
6333
+ */
6334
+ function _updateOwnerDocument(node, newOwnerDocument) {
6335
+ if (node.ownerDocument === newOwnerDocument) {
6336
+ return;
6337
+ }
6338
+
6339
+ node.ownerDocument = newOwnerDocument;
6340
+
6341
+ // Update attributes if this is an element
6342
+ if (node.nodeType === ELEMENT_NODE && node.attributes) {
6343
+ for (var i = 0; i < node.attributes.length; i++) {
6344
+ var attr = node.attributes.item(i);
6345
+ if (attr) {
6346
+ attr.ownerDocument = newOwnerDocument;
6347
+ }
6348
+ }
6349
+ }
6350
+
6351
+ // Recursively update child nodes
6352
+ var child = node.firstChild;
6353
+ while (child) {
6354
+ _updateOwnerDocument(child, newOwnerDocument);
6355
+ child = child.nextSibling;
6356
+ }
6357
+ }
6358
+
6325
6359
  /**
6326
6360
  * Appends `newChild` to `parentNode`.
6327
6361
  * If `newChild` is already connected to a `parentNode` it is first removed from it.
@@ -6347,6 +6381,11 @@ function _appendSingleChild (parentNode, newChild) {
6347
6381
  }
6348
6382
  parentNode.lastChild = newChild;
6349
6383
  _onUpdateChild(parentNode.ownerDocument, parentNode, newChild);
6384
+
6385
+ // Update ownerDocument for the new child and all its descendants
6386
+ var targetDoc = parentNode.ownerDocument || parentNode;
6387
+ _updateOwnerDocument(newChild, targetDoc);
6388
+
6350
6389
  return newChild;
6351
6390
  }
6352
6391
 
@@ -6375,7 +6414,7 @@ Document.prototype = {
6375
6414
  return newChild;
6376
6415
  }
6377
6416
  _insertBefore(this, newChild, refChild);
6378
- newChild.ownerDocument = this;
6417
+ _updateOwnerDocument(newChild, this);
6379
6418
  if (this.documentElement === null && newChild.nodeType === ELEMENT_NODE) {
6380
6419
  this.documentElement = newChild;
6381
6420
  }
@@ -6391,7 +6430,7 @@ Document.prototype = {
6391
6430
  replaceChild: function (newChild, oldChild) {
6392
6431
  //raises
6393
6432
  _insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);
6394
- newChild.ownerDocument = this;
6433
+ _updateOwnerDocument(newChild, this);
6395
6434
  if (oldChild) {
6396
6435
  this.removeChild(oldChild);
6397
6436
  }
@@ -13743,7 +13782,7 @@ var clock = {
13743
13782
 
13744
13783
  /**
13745
13784
  * @license
13746
- * Video.js 8.23.3 <http://videojs.com/>
13785
+ * Video.js 8.23.4 <http://videojs.com/>
13747
13786
  * Copyright Brightcove, Inc. <https://www.brightcove.com/>
13748
13787
  * Available under Apache License Version 2.0
13749
13788
  * <https://github.com/videojs/video.js/blob/main/LICENSE>
@@ -13754,7 +13793,7 @@ var clock = {
13754
13793
  */
13755
13794
 
13756
13795
 
13757
- var version$6 = "8.23.3";
13796
+ var version$6 = "8.23.4";
13758
13797
 
13759
13798
  /**
13760
13799
  * An Object that contains lifecycle hooks as keys which point to an array
@@ -17852,8 +17891,8 @@ class Component$1 {
17852
17891
  * Remove a child `Component` from this `Component`s list of children. Also removes
17853
17892
  * the child `Component`s element from this `Component`s element.
17854
17893
  *
17855
- * @param {Component} component
17856
- * The child `Component` to remove.
17894
+ * @param {string|Component} component
17895
+ * The name or instance of a child to remove.
17857
17896
  */
17858
17897
  removeChild(component) {
17859
17898
  if (typeof component === 'string') {
@@ -41966,7 +42005,7 @@ videojs.registerPlugin('qualityLevels', qualityLevels);
41966
42005
  // Include the version number.
41967
42006
  qualityLevels.VERSION = version$5;
41968
42007
 
41969
- /*! @name @videojs/http-streaming @version 3.17.0 @license Apache-2.0 */
42008
+ /*! @name @videojs/http-streaming @version 3.17.2 @license Apache-2.0 */
41970
42009
 
41971
42010
  /**
41972
42011
  * @file resolve-url.js - Handling how URLs are resolved and manipulated
@@ -43470,7 +43509,7 @@ const getStreamingNetworkErrorMetadata = ({
43470
43509
  } else if (request.aborted) {
43471
43510
  errorMetadata.errorType = videojs.Error.NetworkRequestAborted;
43472
43511
  } else if (request.timedout) {
43473
- errorMetadata.erroType = videojs.Error.NetworkRequestTimeout;
43512
+ errorMetadata.errorType = videojs.Error.NetworkRequestTimeout;
43474
43513
  } else if (isBadStatusOrParseFailure) {
43475
43514
  const errorType = parseFailure ? videojs.Error.NetworkBodyParserFailed : videojs.Error.NetworkBadStatus;
43476
43515
  errorMetadata.errorType = errorType;
@@ -44746,16 +44785,17 @@ class PlaylistLoader extends EventTarget$1 {
44746
44785
  */
44747
44786
 
44748
44787
  getKeyIdSet(playlist) {
44749
- if (playlist.contentProtection) {
44750
- const keyIds = new Set();
44751
- for (const keysystem in playlist.contentProtection) {
44788
+ const keyIds = new Set();
44789
+ if (!playlist || !playlist.contentProtection) {
44790
+ return keyIds;
44791
+ }
44792
+ for (const keysystem in playlist.contentProtection) {
44793
+ if (playlist.contentProtection[keysystem] && playlist.contentProtection[keysystem].attributes && playlist.contentProtection[keysystem].attributes.keyId) {
44752
44794
  const keyId = playlist.contentProtection[keysystem].attributes.keyId;
44753
- if (keyId) {
44754
- keyIds.add(keyId.toLowerCase());
44755
- }
44795
+ keyIds.add(keyId.toLowerCase());
44756
44796
  }
44757
- return keyIds;
44758
44797
  }
44798
+ return keyIds;
44759
44799
  }
44760
44800
  }
44761
44801
 
@@ -67811,7 +67851,7 @@ const initPlugin = function (player, options) {
67811
67851
  const reloadSourceOnError = function (options) {
67812
67852
  initPlugin(this, options);
67813
67853
  };
67814
- var version$4 = "3.17.0";
67854
+ var version$4 = "3.17.2";
67815
67855
  var version$3 = "7.1.0";
67816
67856
  var version$2 = "1.3.1";
67817
67857
  var version$1 = "7.2.0";