@fluentui/web-components 2.5.12 → 2.5.14

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.json CHANGED
@@ -2,7 +2,67 @@
2
2
  "name": "@fluentui/web-components",
3
3
  "entries": [
4
4
  {
5
- "date": "Thu, 26 Jan 2023 07:34:09 GMT",
5
+ "date": "Mon, 17 Apr 2023 07:38:52 GMT",
6
+ "tag": "@fluentui/web-components_v2.5.14",
7
+ "version": "2.5.14",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "chhol@microsoft.com",
12
+ "package": "@fluentui/web-components",
13
+ "commit": "2e1cf8928df3e4f0b64b7390408374db94ae9e2c",
14
+ "comment": "update FAST dependencies to mitigate Safari 16.4 AdoptedStyleSheets bug"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Tue, 11 Apr 2023 07:43:45 GMT",
21
+ "tag": "@fluentui/web-components_v2.5.13",
22
+ "version": "2.5.13",
23
+ "comments": {
24
+ "patch": [
25
+ {
26
+ "author": "chhol@microsoft.com",
27
+ "package": "@fluentui/web-components",
28
+ "commit": "d641ed3418a70dbcfcc29ca56acb4f2711551044",
29
+ "comment": "update fast foundation packages to import bug fixes"
30
+ }
31
+ ]
32
+ }
33
+ },
34
+ {
35
+ "date": "Fri, 03 Mar 2023 07:47:17 GMT",
36
+ "tag": "@fluentui/web-components_v2.5.12",
37
+ "version": "2.5.12",
38
+ "comments": {
39
+ "none": [
40
+ {
41
+ "author": "martinhochel@microsoft.com",
42
+ "package": "@fluentui/web-components",
43
+ "commit": "677a67b551966986db34a6fac608cb89ee150471",
44
+ "comment": "style: apply prettier 2.3-2.8 formatting on whole codebase"
45
+ }
46
+ ]
47
+ }
48
+ },
49
+ {
50
+ "date": "Mon, 13 Feb 2023 07:37:39 GMT",
51
+ "tag": "@fluentui/web-components_v2.5.12",
52
+ "version": "2.5.12",
53
+ "comments": {
54
+ "none": [
55
+ {
56
+ "author": "martinhochel@microsoft.com",
57
+ "package": "@fluentui/web-components",
58
+ "commit": "cbba19f7ed8a619b5fa856575fde872e79be99b9",
59
+ "comment": "style: fix formatting in files that were silently passed previously"
60
+ }
61
+ ]
62
+ }
63
+ },
64
+ {
65
+ "date": "Thu, 26 Jan 2023 07:35:32 GMT",
6
66
  "tag": "@fluentui/web-components_v2.5.12",
7
67
  "version": "2.5.12",
8
68
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,30 @@
1
1
  # Change Log - @fluentui/web-components
2
2
 
3
- This log was last generated on Thu, 26 Jan 2023 07:34:09 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 17 Apr 2023 07:38:52 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [2.5.14](https://github.com/microsoft/fluentui/tree/@fluentui/web-components_v2.5.14)
8
+
9
+ Mon, 17 Apr 2023 07:38:52 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/web-components_v2.5.13..@fluentui/web-components_v2.5.14)
11
+
12
+ ### Patches
13
+
14
+ - update FAST dependencies to mitigate Safari 16.4 AdoptedStyleSheets bug ([PR #27578](https://github.com/microsoft/fluentui/pull/27578) by chhol@microsoft.com)
15
+
16
+ ## [2.5.13](https://github.com/microsoft/fluentui/tree/@fluentui/web-components_v2.5.13)
17
+
18
+ Tue, 11 Apr 2023 07:43:45 GMT
19
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/web-components_v2.5.12..@fluentui/web-components_v2.5.13)
20
+
21
+ ### Patches
22
+
23
+ - update fast foundation packages to import bug fixes ([PR #27506](https://github.com/microsoft/fluentui/pull/27506) by chhol@microsoft.com)
24
+
7
25
  ## [2.5.12](https://github.com/microsoft/fluentui/tree/@fluentui/web-components_v2.5.12)
8
26
 
9
- Thu, 26 Jan 2023 07:34:09 GMT
27
+ Thu, 26 Jan 2023 07:35:32 GMT
10
28
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/web-components_v2.5.11..@fluentui/web-components_v2.5.12)
11
29
 
12
30
  ### Patches
@@ -17,7 +17,7 @@ export declare class Anchor extends FoundationAnchor {
17
17
  * @remarks
18
18
  * HTML Attribute: appearance
19
19
  */
20
- appearance: AnchorAppearance;
20
+ appearance?: AnchorAppearance;
21
21
  appearanceChanged(oldValue: AnchorAppearance, newValue: AnchorAppearance): void;
22
22
  /**
23
23
  * @internal
@@ -28,12 +28,13 @@ export class Anchor extends FoundationAnchor {
28
28
  * @internal
29
29
  */
30
30
  defaultSlottedContentChanged() {
31
+ var _a, _b;
31
32
  const slottedElements = this.defaultSlottedContent.filter(x => x.nodeType === Node.ELEMENT_NODE);
32
33
  if (slottedElements.length === 1 && slottedElements[0] instanceof SVGElement) {
33
- this.control.classList.add('icon-only');
34
+ (_a = this.control) === null || _a === void 0 ? void 0 : _a.classList.add('icon-only');
34
35
  }
35
36
  else {
36
- this.control.classList.remove('icon-only');
37
+ (_b = this.control) === null || _b === void 0 ? void 0 : _b.classList.remove('icon-only');
37
38
  }
38
39
  }
39
40
  }
@@ -259,7 +259,7 @@ export declare class Anchor extends Anchor_2 {
259
259
  * @remarks
260
260
  * HTML Attribute: appearance
261
261
  */
262
- appearance: AnchorAppearance;
262
+ appearance?: AnchorAppearance;
263
263
  appearanceChanged(oldValue: AnchorAppearance, newValue: AnchorAppearance): void;
264
264
  /**
265
265
  * @internal
@@ -1656,6 +1656,37 @@ function reduceBehaviors(styles) {
1656
1656
  return prev.concat(curr);
1657
1657
  }, null);
1658
1658
  }
1659
+ let addAdoptedStyleSheets = (target, sheets) => {
1660
+ target.adoptedStyleSheets = [...target.adoptedStyleSheets, ...sheets];
1661
+ };
1662
+ let removeAdoptedStyleSheets = (target, sheets) => {
1663
+ target.adoptedStyleSheets = target.adoptedStyleSheets.filter(x => sheets.indexOf(x) === -1);
1664
+ };
1665
+ if (DOM.supportsAdoptedStyleSheets) {
1666
+ try {
1667
+ // Test if browser implementation uses FrozenArray.
1668
+ // If not, use push / splice to alter the stylesheets
1669
+ // in place. This circumvents a bug in Safari 16.4 where
1670
+ // periodically, assigning the array would previously
1671
+ // cause sheets to be removed.
1672
+ document.adoptedStyleSheets.push();
1673
+ document.adoptedStyleSheets.splice();
1674
+ addAdoptedStyleSheets = (target, sheets) => {
1675
+ target.adoptedStyleSheets.push(...sheets);
1676
+ };
1677
+ removeAdoptedStyleSheets = (target, sheets) => {
1678
+ for (const sheet of sheets) {
1679
+ const index = target.adoptedStyleSheets.indexOf(sheet);
1680
+ if (index !== -1) {
1681
+ target.adoptedStyleSheets.splice(index, 1);
1682
+ }
1683
+ }
1684
+ };
1685
+ } catch (e) {
1686
+ // Do nothing if an error is thrown, the default
1687
+ // case handles FrozenArray.
1688
+ }
1689
+ }
1659
1690
  /**
1660
1691
  * https://wicg.github.io/construct-stylesheets/
1661
1692
  * https://developers.google.com/web/updates/2019/02/constructable-stylesheets
@@ -1690,12 +1721,11 @@ class AdoptedStyleSheetsStyles extends ElementStyles {
1690
1721
  return this._styleSheets;
1691
1722
  }
1692
1723
  addStylesTo(target) {
1693
- target.adoptedStyleSheets = [...target.adoptedStyleSheets, ...this.styleSheets];
1724
+ addAdoptedStyleSheets(target, this.styleSheets);
1694
1725
  super.addStylesTo(target);
1695
1726
  }
1696
1727
  removeStylesFrom(target) {
1697
- const sourceSheets = this.styleSheets;
1698
- target.adoptedStyleSheets = target.adoptedStyleSheets.filter(x => sourceSheets.indexOf(x) === -1);
1728
+ removeAdoptedStyleSheets(target, this.styleSheets);
1699
1729
  super.removeStylesFrom(target);
1700
1730
  }
1701
1731
  }
@@ -5551,7 +5581,8 @@ class Anchor$1 extends FoundationElement {
5551
5581
  // Check to see if delegatesFocus is supported
5552
5582
  if (window.ShadowRoot && !window.ShadowRoot.prototype.hasOwnProperty("delegatesFocus") && ((_a = this.$fastController.definition.shadowOptions) === null || _a === void 0 ? void 0 : _a.delegatesFocus)) {
5553
5583
  this.focus = () => {
5554
- this.control.focus();
5584
+ var _a;
5585
+ (_a = this.control) === null || _a === void 0 ? void 0 : _a.focus();
5555
5586
  };
5556
5587
  }
5557
5588
  };
@@ -7388,8 +7419,11 @@ class DateFormatter {
7388
7419
  year: this.yearFormat
7389
7420
  }, locale = this.locale) {
7390
7421
  const dateObj = this.getDateObject(date);
7422
+ if (!dateObj.getTime()) {
7423
+ return "";
7424
+ }
7391
7425
  const optionsWithTimeZone = Object.assign({
7392
- timeZone: "utc"
7426
+ timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone
7393
7427
  }, format);
7394
7428
  return new Intl.DateTimeFormat(locale, optionsWithTimeZone).format(dateObj);
7395
7429
  }
@@ -13928,6 +13962,20 @@ class HorizontalScroll$1 extends FoundationElement {
13928
13962
  this.scrollStops = stops;
13929
13963
  this.setFlippers();
13930
13964
  }
13965
+ /**
13966
+ * Checks to see if the stops are returning values
13967
+ * otherwise it will try to reinitialize them
13968
+ *
13969
+ * @returns boolean indicating that current scrollStops are valid non-zero values
13970
+ * @internal
13971
+ */
13972
+ validateStops(reinit = true) {
13973
+ const hasStops = () => !!this.scrollStops.find(stop => stop > 0);
13974
+ if (!hasStops() && reinit) {
13975
+ this.setStops();
13976
+ }
13977
+ return hasStops();
13978
+ }
13931
13979
  /**
13932
13980
  *
13933
13981
  */
@@ -13949,7 +13997,7 @@ class HorizontalScroll$1 extends FoundationElement {
13949
13997
  (_a = this.previousFlipperContainer) === null || _a === void 0 ? void 0 : _a.classList.toggle("disabled", position === 0);
13950
13998
  if (this.scrollStops) {
13951
13999
  const lastStop = Math.abs(this.scrollStops[this.scrollStops.length - 1]);
13952
- (_b = this.nextFlipperContainer) === null || _b === void 0 ? void 0 : _b.classList.toggle("disabled", Math.abs(position) + this.width >= lastStop);
14000
+ (_b = this.nextFlipperContainer) === null || _b === void 0 ? void 0 : _b.classList.toggle("disabled", this.validateStops(false) && Math.abs(position) + this.width >= lastStop);
13953
14001
  }
13954
14002
  }
13955
14003
  /**
@@ -14012,6 +14060,7 @@ class HorizontalScroll$1 extends FoundationElement {
14012
14060
  * @public
14013
14061
  */
14014
14062
  scrollToPrevious() {
14063
+ this.validateStops();
14015
14064
  const scrollPosition = this.scrollContainer.scrollLeft;
14016
14065
  const current = this.scrollStops.findIndex((stop, index) => stop >= scrollPosition && (this.isRtl || index === this.scrollStops.length - 1 || this.scrollStops[index + 1] > scrollPosition));
14017
14066
  const right = Math.abs(this.scrollStops[current + 1]);
@@ -14026,6 +14075,7 @@ class HorizontalScroll$1 extends FoundationElement {
14026
14075
  * @public
14027
14076
  */
14028
14077
  scrollToNext() {
14078
+ this.validateStops();
14029
14079
  const scrollPosition = this.scrollContainer.scrollLeft;
14030
14080
  const current = this.scrollStops.findIndex(stop => Math.abs(stop) >= Math.abs(scrollPosition));
14031
14081
  const outOfView = this.scrollStops.findIndex(stop => Math.abs(scrollPosition) + this.width <= Math.abs(stop));
@@ -15532,7 +15582,7 @@ __decorate$1([attr({
15532
15582
  * The template for the {@link @microsoft/fast-foundation#(Tabs:class)} component.
15533
15583
  * @public
15534
15584
  */
15535
- const tabsTemplate = (context, definition) => html`<template class="${x => x.orientation}">${startSlotTemplate(context, definition)}<div class="tablist" part="tablist" role="tablist"><slot class="tab" name="tab" part="tab" ${slotted("tabs")}></slot>${when(x => x.showActiveIndicator, html`<div ${ref("activeIndicatorRef")} class="activeIndicator" part="activeIndicator"></div>`)}</div>${endSlotTemplate(context, definition)}<div class="tabpanel"><slot name="tabpanel" part="tabpanel" ${slotted("tabpanels")}></slot></div></template>`;
15585
+ const tabsTemplate = (context, definition) => html`<template class="${x => x.orientation}">${startSlotTemplate(context, definition)}<div class="tablist" part="tablist" role="tablist"><slot class="tab" name="tab" part="tab" ${slotted("tabs")}></slot>${when(x => x.showActiveIndicator, html`<div ${ref("activeIndicatorRef")} class="activeIndicator" part="activeIndicator"></div>`)}</div>${endSlotTemplate(context, definition)}<div class="tabpanel" part="tabpanel"><slot name="tabpanel" ${slotted("tabpanels")}></slot></div></template>`;
15536
15586
 
15537
15587
  /**
15538
15588
  * The orientation of the {@link @microsoft/fast-foundation#(Tabs:class)} component
@@ -19999,11 +20049,12 @@ class Anchor extends Anchor$1 {
19999
20049
  * @internal
20000
20050
  */
20001
20051
  defaultSlottedContentChanged() {
20052
+ var _a, _b;
20002
20053
  const slottedElements = this.defaultSlottedContent.filter(x => x.nodeType === Node.ELEMENT_NODE);
20003
20054
  if (slottedElements.length === 1 && slottedElements[0] instanceof SVGElement) {
20004
- this.control.classList.add('icon-only');
20055
+ (_a = this.control) === null || _a === void 0 ? void 0 : _a.classList.add('icon-only');
20005
20056
  } else {
20006
- this.control.classList.remove('icon-only');
20057
+ (_b = this.control) === null || _b === void 0 ? void 0 : _b.classList.remove('icon-only');
20007
20058
  }
20008
20059
  }
20009
20060
  }