@fluentui/web-components 2.5.7 → 2.5.8

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,22 @@
2
2
  "name": "@fluentui/web-components",
3
3
  "entries": [
4
4
  {
5
- "date": "Fri, 21 Oct 2022 07:43:28 GMT",
5
+ "date": "Wed, 26 Oct 2022 07:51:18 GMT",
6
+ "tag": "@fluentui/web-components_v2.5.8",
7
+ "version": "2.5.8",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "chhol@microsoft.com",
12
+ "package": "@fluentui/web-components",
13
+ "commit": "400b81dc432ff1720a89ffafee0666c4e920272b",
14
+ "comment": "emit activeid as part of accordion change event"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Fri, 21 Oct 2022 07:44:53 GMT",
6
21
  "tag": "@fluentui/web-components_v2.5.7",
7
22
  "version": "2.5.7",
8
23
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,21 @@
1
1
  # Change Log - @fluentui/web-components
2
2
 
3
- This log was last generated on Fri, 21 Oct 2022 07:43:28 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 26 Oct 2022 07:51:18 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [2.5.8](https://github.com/microsoft/fluentui/tree/@fluentui/web-components_v2.5.8)
8
+
9
+ Wed, 26 Oct 2022 07:51:18 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/web-components_v2.5.7..@fluentui/web-components_v2.5.8)
11
+
12
+ ### Patches
13
+
14
+ - emit activeid as part of accordion change event ([PR #25364](https://github.com/microsoft/fluentui/pull/25364) by chhol@microsoft.com)
15
+
7
16
  ## [2.5.7](https://github.com/microsoft/fluentui/tree/@fluentui/web-components_v2.5.7)
8
17
 
9
- Fri, 21 Oct 2022 07:43:28 GMT
18
+ Fri, 21 Oct 2022 07:44:53 GMT
10
19
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/web-components_v2.5.6..@fluentui/web-components_v2.5.7)
11
20
 
12
21
  ### Patches
@@ -86,6 +86,32 @@ if (FAST.getById === void 0) {
86
86
 
87
87
 
88
88
  const emptyArray = Object.freeze([]);
89
+ /**
90
+ * Creates a function capable of locating metadata associated with a type.
91
+ * @returns A metadata locator function.
92
+ * @internal
93
+ */
94
+
95
+ function createMetadataLocator() {
96
+ const metadataLookup = new WeakMap();
97
+ return function (target) {
98
+ let metadata = metadataLookup.get(target);
99
+
100
+ if (metadata === void 0) {
101
+ let currentTarget = Reflect.getPrototypeOf(target);
102
+
103
+ while (metadata === void 0 && currentTarget !== null) {
104
+ metadata = metadataLookup.get(currentTarget);
105
+ currentTarget = Reflect.getPrototypeOf(currentTarget);
106
+ }
107
+
108
+ metadata = metadata === void 0 ? [] : metadata.slice(0);
109
+ metadataLookup.set(target, metadata);
110
+ }
111
+
112
+ return metadata;
113
+ };
114
+ }
89
115
 
90
116
  const updateQueue = $global.FAST.getById(1
91
117
  /* updateQueue */
@@ -530,7 +556,6 @@ const Observable = FAST.getById(2
530
556
  , () => {
531
557
  const volatileRegex = /(:|&&|\|\||if)/;
532
558
  const notifierLookup = new WeakMap();
533
- const accessorLookup = new WeakMap();
534
559
  const queueUpdate = DOM.queueUpdate;
535
560
  let watcher = void 0;
536
561
 
@@ -552,28 +577,7 @@ const Observable = FAST.getById(2
552
577
  return found;
553
578
  }
554
579
 
555
- function getAccessors(target) {
556
- let accessors = accessorLookup.get(target);
557
-
558
- if (accessors === void 0) {
559
- let currentTarget = Reflect.getPrototypeOf(target);
560
-
561
- while (accessors === void 0 && currentTarget !== null) {
562
- accessors = accessorLookup.get(currentTarget);
563
- currentTarget = Reflect.getPrototypeOf(currentTarget);
564
- }
565
-
566
- if (accessors === void 0) {
567
- accessors = [];
568
- } else {
569
- accessors = accessors.slice(0);
570
- }
571
-
572
- accessorLookup.set(target, accessors);
573
- }
574
-
575
- return accessors;
576
- }
580
+ const getAccessors = createMetadataLocator();
577
581
 
578
582
  class DefaultObservableAccessor {
579
583
  constructor(name) {
@@ -1609,8 +1613,9 @@ class HTMLView {
1609
1613
  if (this.fragment.hasChildNodes()) {
1610
1614
  node.parentNode.insertBefore(this.fragment, node);
1611
1615
  } else {
1612
- const parentNode = node.parentNode;
1613
1616
  const end = this.lastChild;
1617
+ if (node.previousSibling === end) return;
1618
+ const parentNode = node.parentNode;
1614
1619
  let current = this.firstChild;
1615
1620
  let next;
1616
1621
 
@@ -2096,6 +2101,17 @@ class StyleElementStyles extends ElementStyles {
2096
2101
 
2097
2102
  }
2098
2103
 
2104
+ /**
2105
+ * Metadata used to configure a custom attribute's behavior.
2106
+ * @public
2107
+ */
2108
+
2109
+ const AttributeConfiguration = Object.freeze({
2110
+ /**
2111
+ * Locates all attribute configurations associated with a type.
2112
+ */
2113
+ locate: createMetadataLocator()
2114
+ });
2099
2115
  /**
2100
2116
  * A {@link ValueConverter} that converts to and from `boolean` values.
2101
2117
  * @remarks
@@ -2262,7 +2278,7 @@ class AttributeDefinition {
2262
2278
 
2263
2279
  static collect(Owner, ...attributeLists) {
2264
2280
  const attributes = [];
2265
- attributeLists.push(Owner.attributes);
2281
+ attributeLists.push(AttributeConfiguration.locate(Owner));
2266
2282
 
2267
2283
  for (let i = 0, ii = attributeLists.length; i < ii; ++i) {
2268
2284
  const list = attributeLists[i];
@@ -2299,8 +2315,7 @@ function attr(configOrTarget, prop) {
2299
2315
  config.property = $prop;
2300
2316
  }
2301
2317
 
2302
- const attributes = $target.constructor.attributes || ($target.constructor.attributes = []);
2303
- attributes.push(config);
2318
+ AttributeConfiguration.locate($target.constructor).push(config);
2304
2319
  }
2305
2320
 
2306
2321
  if (arguments.length > 1) {
@@ -3876,7 +3891,7 @@ class RepeatBehavior {
3876
3891
  let addIndex = splice.index;
3877
3892
  const end = addIndex + splice.addedCount;
3878
3893
  const removedViews = views.splice(splice.index, removed.length);
3879
- availableViews = leftoverViews.length + removedViews.length;
3894
+ const totalAvailableViews = availableViews = leftoverViews.length + removedViews.length;
3880
3895
 
3881
3896
  for (; addIndex < end; ++addIndex) {
3882
3897
  const neighbor = views[addIndex];
@@ -3884,7 +3899,7 @@ class RepeatBehavior {
3884
3899
  let view;
3885
3900
 
3886
3901
  if (recycle && availableViews > 0) {
3887
- if (removeIndex <= availableViews && removedViews.length > 0) {
3902
+ if (removeIndex <= totalAvailableViews && removedViews.length > 0) {
3888
3903
  view = removedViews[removeIndex];
3889
3904
  removeIndex++;
3890
3905
  } else {
@@ -5946,7 +5961,9 @@ class FoundationElementRegistry {
5946
5961
  * Sourced from {@link https://www.typescriptlang.org/docs/handbook/mixins.html | TypeScript Documentation }.
5947
5962
  * @public
5948
5963
  */
5964
+
5949
5965
  function applyMixins(derivedCtor, ...baseCtors) {
5966
+ const derivedAttributes = AttributeConfiguration.locate(derivedCtor);
5950
5967
  baseCtors.forEach(baseCtor => {
5951
5968
  Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {
5952
5969
  if (name !== "constructor") {
@@ -5955,11 +5972,8 @@ function applyMixins(derivedCtor, ...baseCtors) {
5955
5972
  Object.getOwnPropertyDescriptor(baseCtor.prototype, name));
5956
5973
  }
5957
5974
  });
5958
-
5959
- if (baseCtor.attributes) {
5960
- const existing = derivedCtor.attributes || [];
5961
- derivedCtor.attributes = existing.concat(baseCtor.attributes);
5962
- }
5975
+ const baseAttributes = AttributeConfiguration.locate(baseCtor);
5976
+ baseAttributes.forEach(x => derivedAttributes.push(x));
5963
5977
  });
5964
5978
  }
5965
5979
 
@@ -6391,7 +6405,7 @@ class Accordion extends FoundationElement {
6391
6405
  this.activeItemIndex = 0;
6392
6406
 
6393
6407
  this.change = () => {
6394
- this.$emit("change");
6408
+ this.$emit("change", this.activeid);
6395
6409
  };
6396
6410
 
6397
6411
  this.setItems = () => {