@microsoft/fast-element 1.9.0 → 1.10.2

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,157 @@
2
2
  "name": "@microsoft/fast-element",
3
3
  "entries": [
4
4
  {
5
- "date": "Wed, 06 Apr 2022 07:10:25 GMT",
5
+ "date": "Tue, 24 May 2022 07:08:28 GMT",
6
+ "tag": "@microsoft/fast-element_v1.10.2",
7
+ "version": "1.10.2",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "comment": "fix(fast-element): do not notify splices for changes pre-subscription",
12
+ "author": "roeisenb@microsoft.com",
13
+ "commit": "476be7672653b2e63b9ab771949718aa8f43df0d",
14
+ "package": "@microsoft/fast-element"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Sun, 08 May 2022 07:08:18 GMT",
21
+ "tag": "@microsoft/fast-element_v1.10.1",
22
+ "version": "1.10.1",
23
+ "comments": {
24
+ "none": [
25
+ {
26
+ "comment": "adds missing types for chai-spies",
27
+ "author": "chhol@microsoft.com",
28
+ "commit": "890ff058b8771c84a9e669b4e9202c43f4d3e7fc",
29
+ "package": "@microsoft/fast-element"
30
+ }
31
+ ]
32
+ }
33
+ },
34
+ {
35
+ "date": "Fri, 06 May 2022 20:58:02 GMT",
36
+ "tag": "@microsoft/fast-element_v1.10.1",
37
+ "version": "1.10.1",
38
+ "comments": {
39
+ "none": [
40
+ {
41
+ "comment": "update api extractor to 7.23.1 to ensure we can support TS 4.7 internal API changes",
42
+ "author": "chhol@microsoft.com",
43
+ "commit": "fbc6a7fb670453322c93f8f12a223febad86f735",
44
+ "package": "@microsoft/fast-element"
45
+ }
46
+ ]
47
+ }
48
+ },
49
+ {
50
+ "date": "Wed, 04 May 2022 07:14:00 GMT",
51
+ "tag": "@microsoft/fast-element_v1.10.1",
52
+ "version": "1.10.1",
53
+ "comments": {
54
+ "none": [
55
+ {
56
+ "comment": "update markdown files",
57
+ "author": "steph@huynhicode.dev",
58
+ "commit": "c49a98f7f1bd8e167b0b7a96a181990f9a675f34",
59
+ "package": "@microsoft/fast-element"
60
+ }
61
+ ]
62
+ }
63
+ },
64
+ {
65
+ "date": "Tue, 03 May 2022 07:15:44 GMT",
66
+ "tag": "@microsoft/fast-element_v1.10.1",
67
+ "version": "1.10.1",
68
+ "comments": {
69
+ "patch": [
70
+ {
71
+ "comment": "Upgraded api-extractor",
72
+ "author": "44823142+williamw2@users.noreply.github.com",
73
+ "commit": "2341496a6fafe3051dc50333c21ca652026f725b",
74
+ "package": "@microsoft/fast-element"
75
+ }
76
+ ]
77
+ }
78
+ },
79
+ {
80
+ "date": "Wed, 27 Apr 2022 07:21:09 GMT",
81
+ "tag": "@microsoft/fast-element_v1.10.0",
82
+ "version": "1.10.0",
83
+ "comments": {
84
+ "minor": [
85
+ {
86
+ "comment": "update to typescript 4.6.2 and update ARIAMixin typings",
87
+ "author": "chhol@microsoft.com",
88
+ "commit": "35bdab45550b5d8b8762041110eccb06de78add5",
89
+ "package": "@microsoft/fast-element"
90
+ }
91
+ ]
92
+ }
93
+ },
94
+ {
95
+ "date": "Sun, 24 Apr 2022 07:13:26 GMT",
96
+ "tag": "@microsoft/fast-element_v1.9.0",
97
+ "version": "1.9.0",
98
+ "comments": {
99
+ "none": [
100
+ {
101
+ "comment": "Update to fix broken links and grammar.",
102
+ "author": "16669785+awentzel@users.noreply.github.com",
103
+ "commit": "ed08697132b639f3104562b16a0dcf5c5653a878",
104
+ "package": "@microsoft/fast-element"
105
+ }
106
+ ]
107
+ }
108
+ },
109
+ {
110
+ "date": "Wed, 20 Apr 2022 07:13:17 GMT",
111
+ "tag": "@microsoft/fast-element_v1.9.0",
112
+ "version": "1.9.0",
113
+ "comments": {
114
+ "none": [
115
+ {
116
+ "comment": "Pull up api-extractor.json to root and then extend it for each project",
117
+ "author": "stephanosp@microsoft.com",
118
+ "commit": "e3076337cbc2d260a497116061ee3bba3866a97d",
119
+ "package": "@microsoft/fast-element"
120
+ }
121
+ ]
122
+ }
123
+ },
124
+ {
125
+ "date": "Sun, 17 Apr 2022 07:11:18 GMT",
126
+ "tag": "@microsoft/fast-element_v1.9.0",
127
+ "version": "1.9.0",
128
+ "comments": {
129
+ "none": [
130
+ {
131
+ "comment": "Merge branch 'master' into wanFixString",
132
+ "author": "74849806+wannieman98@users.noreply.github.com",
133
+ "commit": "14bc5d5f2ae608328eb16ad7e619bab00415f60a",
134
+ "package": "@microsoft/fast-element"
135
+ }
136
+ ]
137
+ }
138
+ },
139
+ {
140
+ "date": "Tue, 12 Apr 2022 07:13:35 GMT",
141
+ "tag": "@microsoft/fast-element_v1.9.0",
142
+ "version": "1.9.0",
143
+ "comments": {
144
+ "none": [
145
+ {
146
+ "comment": "repeat directive documentation fix code snippet not rendering properly",
147
+ "author": "yinon@hotmail.com",
148
+ "commit": "3e4d72447520f40d234b1df2cc70446dcef8bb47",
149
+ "package": "@microsoft/fast-element"
150
+ }
151
+ ]
152
+ }
153
+ },
154
+ {
155
+ "date": "Wed, 06 Apr 2022 07:12:42 GMT",
6
156
  "tag": "@microsoft/fast-element_v1.9.0",
7
157
  "version": "1.9.0",
8
158
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,36 @@
1
1
  # Change Log - @microsoft/fast-element
2
2
 
3
- This log was last generated on Wed, 06 Apr 2022 07:10:25 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 24 May 2022 07:08:28 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 1.10.2
8
+
9
+ Tue, 24 May 2022 07:08:28 GMT
10
+
11
+ ### Patches
12
+
13
+ - fix(fast-element): do not notify splices for changes pre-subscription (roeisenb@microsoft.com)
14
+
15
+ ## 1.10.1
16
+
17
+ Tue, 03 May 2022 07:15:44 GMT
18
+
19
+ ### Patches
20
+
21
+ - Upgraded api-extractor (44823142+williamw2@users.noreply.github.com)
22
+
23
+ ## 1.10.0
24
+
25
+ Wed, 27 Apr 2022 07:21:09 GMT
26
+
27
+ ### Minor changes
28
+
29
+ - update to typescript 4.6.2 and update ARIAMixin typings (chhol@microsoft.com)
30
+
7
31
  ## 1.9.0
8
32
 
9
- Wed, 06 Apr 2022 07:10:25 GMT
33
+ Wed, 06 Apr 2022 07:12:42 GMT
10
34
 
11
35
  ### Minor changes
12
36
 
package/dist/esm/index.js CHANGED
@@ -11,6 +11,7 @@ export { CSSDirective } from "./styles/css-directive.js";
11
11
  export * from "./templating/view.js";
12
12
  export * from "./observation/observable.js";
13
13
  export * from "./observation/notifier.js";
14
+ export {} from "./observation/array-change-records.js";
14
15
  export { enableArrayObservation } from "./observation/array-observer.js";
15
16
  export { DOM } from "./dom.js";
16
17
  export * from "./templating/binding.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -31,6 +31,10 @@ class ArrayObserver extends SubscriberSet {
31
31
  enumerable: false,
32
32
  });
33
33
  }
34
+ subscribe(subscriber) {
35
+ this.flush();
36
+ super.subscribe(subscriber);
37
+ }
34
38
  addSplice(splice) {
35
39
  if (this.splices === void 0) {
36
40
  this.splices = [splice];
@@ -0,0 +1 @@
1
+ export {};
@@ -1,27 +1,3 @@
1
- function spilloverSubscribe(subscriber) {
2
- const spillover = this.spillover;
3
- const index = spillover.indexOf(subscriber);
4
- if (index === -1) {
5
- spillover.push(subscriber);
6
- }
7
- }
8
- function spilloverUnsubscribe(subscriber) {
9
- const spillover = this.spillover;
10
- const index = spillover.indexOf(subscriber);
11
- if (index !== -1) {
12
- spillover.splice(index, 1);
13
- }
14
- }
15
- function spilloverNotifySubscribers(args) {
16
- const spillover = this.spillover;
17
- const source = this.source;
18
- for (let i = 0, ii = spillover.length; i < ii; ++i) {
19
- spillover[i].handleChange(source, args);
20
- }
21
- }
22
- function spilloverHas(subscriber) {
23
- return this.spillover.indexOf(subscriber) !== -1;
24
- }
25
1
  /**
26
2
  * An implementation of {@link Notifier} that efficiently keeps track of
27
3
  * subscribers interested in a specific change notification on an
@@ -51,42 +27,58 @@ export class SubscriberSet {
51
27
  * @param subscriber - The subscriber to test for inclusion in this set.
52
28
  */
53
29
  has(subscriber) {
54
- return this.sub1 === subscriber || this.sub2 === subscriber;
30
+ return this.spillover === void 0
31
+ ? this.sub1 === subscriber || this.sub2 === subscriber
32
+ : this.spillover.indexOf(subscriber) !== -1;
55
33
  }
56
34
  /**
57
35
  * Subscribes to notification of changes in an object's state.
58
36
  * @param subscriber - The object that is subscribing for change notification.
59
37
  */
60
38
  subscribe(subscriber) {
61
- if (this.has(subscriber)) {
62
- return;
63
- }
64
- if (this.sub1 === void 0) {
65
- this.sub1 = subscriber;
66
- return;
39
+ const spillover = this.spillover;
40
+ if (spillover === void 0) {
41
+ if (this.has(subscriber)) {
42
+ return;
43
+ }
44
+ if (this.sub1 === void 0) {
45
+ this.sub1 = subscriber;
46
+ return;
47
+ }
48
+ if (this.sub2 === void 0) {
49
+ this.sub2 = subscriber;
50
+ return;
51
+ }
52
+ this.spillover = [this.sub1, this.sub2, subscriber];
53
+ this.sub1 = void 0;
54
+ this.sub2 = void 0;
67
55
  }
68
- if (this.sub2 === void 0) {
69
- this.sub2 = subscriber;
70
- return;
56
+ else {
57
+ const index = spillover.indexOf(subscriber);
58
+ if (index === -1) {
59
+ spillover.push(subscriber);
60
+ }
71
61
  }
72
- this.spillover = [this.sub1, this.sub2, subscriber];
73
- this.subscribe = spilloverSubscribe;
74
- this.unsubscribe = spilloverUnsubscribe;
75
- this.notify = spilloverNotifySubscribers;
76
- this.has = spilloverHas;
77
- this.sub1 = void 0;
78
- this.sub2 = void 0;
79
62
  }
80
63
  /**
81
64
  * Unsubscribes from notification of changes in an object's state.
82
65
  * @param subscriber - The object that is unsubscribing from change notification.
83
66
  */
84
67
  unsubscribe(subscriber) {
85
- if (this.sub1 === subscriber) {
86
- this.sub1 = void 0;
68
+ const spillover = this.spillover;
69
+ if (spillover === void 0) {
70
+ if (this.sub1 === subscriber) {
71
+ this.sub1 = void 0;
72
+ }
73
+ else if (this.sub2 === subscriber) {
74
+ this.sub2 = void 0;
75
+ }
87
76
  }
88
- else if (this.sub2 === subscriber) {
89
- this.sub2 = void 0;
77
+ else {
78
+ const index = spillover.indexOf(subscriber);
79
+ if (index !== -1) {
80
+ spillover.splice(index, 1);
81
+ }
90
82
  }
91
83
  }
92
84
  /**
@@ -94,14 +86,22 @@ export class SubscriberSet {
94
86
  * @param args - Data passed along to subscribers during notification.
95
87
  */
96
88
  notify(args) {
97
- const sub1 = this.sub1;
98
- const sub2 = this.sub2;
89
+ const spillover = this.spillover;
99
90
  const source = this.source;
100
- if (sub1 !== void 0) {
101
- sub1.handleChange(source, args);
91
+ if (spillover === void 0) {
92
+ const sub1 = this.sub1;
93
+ const sub2 = this.sub2;
94
+ if (sub1 !== void 0) {
95
+ sub1.handleChange(source, args);
96
+ }
97
+ if (sub2 !== void 0) {
98
+ sub2.handleChange(source, args);
99
+ }
102
100
  }
103
- if (sub2 !== void 0) {
104
- sub2.handleChange(source, args);
101
+ else {
102
+ for (let i = 0, ii = spillover.length; i < ii; ++i) {
103
+ spillover[i].handleChange(source, args);
104
+ }
105
105
  }
106
106
  }
107
107
  }
@@ -147,7 +147,8 @@ export class PropertyChangeNotifier {
147
147
  subscribers.subscribe(subscriber);
148
148
  }
149
149
  else {
150
- this.sourceSubscribers = (_a = this.sourceSubscribers) !== null && _a !== void 0 ? _a : new SubscriberSet(this.source);
150
+ this.sourceSubscribers =
151
+ (_a = this.sourceSubscribers) !== null && _a !== void 0 ? _a : new SubscriberSet(this.source);
151
152
  this.sourceSubscribers.subscribe(subscriber);
152
153
  }
153
154
  }
@@ -122,6 +122,7 @@ export const Observable = FAST.getById(2 /* observable */, () => {
122
122
  watcher = void 0;
123
123
  /* eslint-disable-next-line */
124
124
  prevValue = prev.propertySource[prev.propertyName];
125
+ /* eslint-disable-next-line @typescript-eslint/no-this-alias */
125
126
  watcher = this;
126
127
  if (propertySource === prevValue) {
127
128
  this.needsRefresh = true;
@@ -6,8 +6,6 @@ import { DOM } from "../dom.js";
6
6
  export class ElementStyles {
7
7
  constructor() {
8
8
  this.targets = new WeakSet();
9
- /** @internal */
10
- this.behaviors = null;
11
9
  }
12
10
  /** @internal */
13
11
  addStylesTo(target) {
@@ -15,6 +15,7 @@ class CompilationContext {
15
15
  this.targetIndex = -1;
16
16
  }
17
17
  release() {
18
+ /* eslint-disable-next-line @typescript-eslint/no-this-alias */
18
19
  sharedContext = this;
19
20
  }
20
21
  static borrow(directives) {