@microsoft/fast-element 1.10.0 → 1.10.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.json +106 -1
- package/CHANGELOG.md +26 -2
- package/README.md +2 -2
- package/dist/esm/observation/array-observer.js +4 -0
- package/dist/esm/observation/notifier.js +51 -51
- package/dist/esm/templating/repeat.js +1 -1
- package/dist/fast-element.api.json +633 -173
- package/dist/fast-element.d.ts +0 -1
- package/dist/fast-element.js +60 -63
- package/dist/fast-element.min.js +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/docs/guide/declaring-templates.md +5 -4
- package/docs/guide/defining-elements.md +3 -2
- package/docs/guide/leveraging-css.md +1 -0
- package/docs/guide/next-steps.md +3 -2
- package/docs/guide/observables-and-state.md +2 -1
- package/docs/guide/using-directives.md +2 -1
- package/docs/guide/working-with-shadow-dom.md +1 -0
- package/package.json +4 -2
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,112 @@
|
|
|
2
2
|
"name": "@microsoft/fast-element",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Tue, 05 Jul 2022 18:02:34 GMT",
|
|
6
|
+
"tag": "@microsoft/fast-element_v1.10.3",
|
|
7
|
+
"version": "1.10.3",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "when recycle option is turn off in repeat, don't use existing views",
|
|
12
|
+
"author": "email not defined",
|
|
13
|
+
"commit": "0d9200abb9ca821602029d7cb1968e2e5ff9c87e",
|
|
14
|
+
"package": "@microsoft/fast-element"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Sun, 29 May 2022 07:08:52 GMT",
|
|
21
|
+
"tag": "@microsoft/fast-element_v1.10.2",
|
|
22
|
+
"version": "1.10.2",
|
|
23
|
+
"comments": {
|
|
24
|
+
"none": [
|
|
25
|
+
{
|
|
26
|
+
"comment": "add md extensions to referenced doc links for fast-element readme",
|
|
27
|
+
"author": "steph@huynhicode.dev",
|
|
28
|
+
"commit": "283b4838d46ed83c70ff4ad91f7f72a4936d59bf",
|
|
29
|
+
"package": "@microsoft/fast-element"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"date": "Tue, 24 May 2022 07:10:02 GMT",
|
|
36
|
+
"tag": "@microsoft/fast-element_v1.10.2",
|
|
37
|
+
"version": "1.10.2",
|
|
38
|
+
"comments": {
|
|
39
|
+
"patch": [
|
|
40
|
+
{
|
|
41
|
+
"comment": "fix(fast-element): do not notify splices for changes pre-subscription",
|
|
42
|
+
"author": "roeisenb@microsoft.com",
|
|
43
|
+
"commit": "476be7672653b2e63b9ab771949718aa8f43df0d",
|
|
44
|
+
"package": "@microsoft/fast-element"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"date": "Sun, 08 May 2022 07:08:18 GMT",
|
|
51
|
+
"tag": "@microsoft/fast-element_v1.10.1",
|
|
52
|
+
"version": "1.10.1",
|
|
53
|
+
"comments": {
|
|
54
|
+
"none": [
|
|
55
|
+
{
|
|
56
|
+
"comment": "adds missing types for chai-spies",
|
|
57
|
+
"author": "chhol@microsoft.com",
|
|
58
|
+
"commit": "890ff058b8771c84a9e669b4e9202c43f4d3e7fc",
|
|
59
|
+
"package": "@microsoft/fast-element"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"date": "Fri, 06 May 2022 20:58:02 GMT",
|
|
66
|
+
"tag": "@microsoft/fast-element_v1.10.1",
|
|
67
|
+
"version": "1.10.1",
|
|
68
|
+
"comments": {
|
|
69
|
+
"none": [
|
|
70
|
+
{
|
|
71
|
+
"comment": "update api extractor to 7.23.1 to ensure we can support TS 4.7 internal API changes",
|
|
72
|
+
"author": "chhol@microsoft.com",
|
|
73
|
+
"commit": "fbc6a7fb670453322c93f8f12a223febad86f735",
|
|
74
|
+
"package": "@microsoft/fast-element"
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"date": "Wed, 04 May 2022 07:14:00 GMT",
|
|
81
|
+
"tag": "@microsoft/fast-element_v1.10.1",
|
|
82
|
+
"version": "1.10.1",
|
|
83
|
+
"comments": {
|
|
84
|
+
"none": [
|
|
85
|
+
{
|
|
86
|
+
"comment": "update markdown files",
|
|
87
|
+
"author": "steph@huynhicode.dev",
|
|
88
|
+
"commit": "c49a98f7f1bd8e167b0b7a96a181990f9a675f34",
|
|
89
|
+
"package": "@microsoft/fast-element"
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"date": "Tue, 03 May 2022 07:15:44 GMT",
|
|
96
|
+
"tag": "@microsoft/fast-element_v1.10.1",
|
|
97
|
+
"version": "1.10.1",
|
|
98
|
+
"comments": {
|
|
99
|
+
"patch": [
|
|
100
|
+
{
|
|
101
|
+
"comment": "Upgraded api-extractor",
|
|
102
|
+
"author": "44823142+williamw2@users.noreply.github.com",
|
|
103
|
+
"commit": "2341496a6fafe3051dc50333c21ca652026f725b",
|
|
104
|
+
"package": "@microsoft/fast-element"
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"date": "Wed, 27 Apr 2022 07:21:09 GMT",
|
|
6
111
|
"tag": "@microsoft/fast-element_v1.10.0",
|
|
7
112
|
"version": "1.10.0",
|
|
8
113
|
"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
|
|
3
|
+
This log was last generated on Tue, 05 Jul 2022 18:02:34 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.10.3
|
|
8
|
+
|
|
9
|
+
Tue, 05 Jul 2022 18:02:34 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- when recycle option is turn off in repeat, don't use existing views (email not defined)
|
|
14
|
+
|
|
15
|
+
## 1.10.2
|
|
16
|
+
|
|
17
|
+
Tue, 24 May 2022 07:10:02 GMT
|
|
18
|
+
|
|
19
|
+
### Patches
|
|
20
|
+
|
|
21
|
+
- fix(fast-element): do not notify splices for changes pre-subscription (roeisenb@microsoft.com)
|
|
22
|
+
|
|
23
|
+
## 1.10.1
|
|
24
|
+
|
|
25
|
+
Tue, 03 May 2022 07:15:44 GMT
|
|
26
|
+
|
|
27
|
+
### Patches
|
|
28
|
+
|
|
29
|
+
- Upgraded api-extractor (44823142+williamw2@users.noreply.github.com)
|
|
30
|
+
|
|
7
31
|
## 1.10.0
|
|
8
32
|
|
|
9
|
-
Wed, 27 Apr 2022 07:
|
|
33
|
+
Wed, 27 Apr 2022 07:21:09 GMT
|
|
10
34
|
|
|
11
35
|
### Minor changes
|
|
12
36
|
|
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ import { FASTElement } from '@microsoft/fast-element';
|
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
:::tip
|
|
29
|
-
Looking for a setup that integrates with a particular front-end framework or bundler? Check out [our integration docs](
|
|
29
|
+
Looking for a setup that integrates with a particular front-end framework or bundler? Check out [our integration docs](../integrations/introduction.md).
|
|
30
30
|
:::
|
|
31
31
|
|
|
32
32
|
### From CDN
|
|
@@ -58,5 +58,5 @@ For simplicity, examples throughout the documentation will assume the library ha
|
|
|
58
58
|
:::
|
|
59
59
|
|
|
60
60
|
:::tip
|
|
61
|
-
Looking for a quick guide on building components? Check out [our Cheat Sheet](
|
|
61
|
+
Looking for a quick guide on building components? Check out [our Cheat Sheet](../resources/cheat-sheet.md#building-components).
|
|
62
62
|
:::
|
|
@@ -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.
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
|
|
86
|
-
|
|
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
|
|
89
|
-
|
|
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
|
|
98
|
-
const sub2 = this.sub2;
|
|
89
|
+
const spillover = this.spillover;
|
|
99
90
|
const source = this.source;
|
|
100
|
-
if (
|
|
101
|
-
sub1.
|
|
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
|
-
|
|
104
|
-
|
|
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
|
}
|
|
@@ -158,7 +158,7 @@ export class RepeatBehavior {
|
|
|
158
158
|
let itemsLength = items.length;
|
|
159
159
|
let views = this.views;
|
|
160
160
|
let viewsLength = views.length;
|
|
161
|
-
if (itemsLength === 0 || templateChanged) {
|
|
161
|
+
if (itemsLength === 0 || templateChanged || !this.options.recycle) {
|
|
162
162
|
// all views need to be removed
|
|
163
163
|
HTMLView.disposeContiguousBatch(views);
|
|
164
164
|
viewsLength = 0;
|