lwc 2.10.0 → 2.11.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.
- package/dist/engine-dom/esm/es2017/engine-dom.js +4261 -5855
- package/dist/engine-dom/iife/es2017/engine-dom.js +4261 -5855
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +3244 -4594
- package/dist/engine-dom/iife/es5/engine-dom.js +50 -63
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +45 -40
- package/dist/engine-dom/umd/es2017/engine-dom.js +4261 -5855
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +3244 -4594
- package/dist/engine-dom/umd/es5/engine-dom.js +50 -63
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +45 -40
- package/dist/engine-server/commonjs/es2017/engine-server.js +4041 -5380
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +4041 -5380
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +2952 -3673
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +2952 -3673
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +2825 -3532
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +11 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +11 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +2952 -3673
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +2825 -3532
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +11 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +11 -3
- package/dist/wire-service/esm/es2017/wire-service.js +128 -174
- package/dist/wire-service/iife/es2017/wire-service.js +128 -174
- package/dist/wire-service/iife/es2017/wire-service_debug.js +128 -174
- package/dist/wire-service/iife/es5/wire-service.js +2 -2
- package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service.js +128 -174
- package/dist/wire-service/umd/es2017/wire-service_debug.js +128 -174
- package/dist/wire-service/umd/es5/wire-service.js +2 -2
- package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
- package/package.json +7 -7
|
@@ -199,7 +199,7 @@
|
|
|
199
199
|
var hasNativeSymbolSupport = /*@__PURE__*/function () {
|
|
200
200
|
return Symbol('x').toString() === 'Symbol(x)';
|
|
201
201
|
}();
|
|
202
|
-
/** version: 2.
|
|
202
|
+
/** version: 2.11.0 */
|
|
203
203
|
|
|
204
204
|
/*
|
|
205
205
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -207,6 +207,7 @@
|
|
|
207
207
|
* SPDX-License-Identifier: MIT
|
|
208
208
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
209
209
|
*/
|
|
210
|
+
// TODO [#2472]: Remove this workaround when appropriate.
|
|
210
211
|
// eslint-disable-next-line lwc-internal/no-global-node
|
|
211
212
|
|
|
212
213
|
|
|
@@ -477,6 +478,7 @@
|
|
|
477
478
|
* SPDX-License-Identifier: MIT
|
|
478
479
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
479
480
|
*/
|
|
481
|
+
// Helpful for tests running with jsdom
|
|
480
482
|
|
|
481
483
|
|
|
482
484
|
function getOwnerDocument(node) {
|
|
@@ -849,6 +851,7 @@
|
|
|
849
851
|
* SPDX-License-Identifier: MIT
|
|
850
852
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
851
853
|
*/
|
|
854
|
+
// Used as a back reference to identify the host element
|
|
852
855
|
|
|
853
856
|
|
|
854
857
|
var HostElementKey = '$$HostElementKey$$';
|
|
@@ -918,6 +921,7 @@
|
|
|
918
921
|
* SPDX-License-Identifier: MIT
|
|
919
922
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
920
923
|
*/
|
|
924
|
+
// when finding a slot in the DOM, we can fold it if it is contained
|
|
921
925
|
// inside another slot.
|
|
922
926
|
|
|
923
927
|
|
|
@@ -1414,6 +1418,7 @@
|
|
|
1414
1418
|
* SPDX-License-Identifier: MIT
|
|
1415
1419
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1416
1420
|
*/
|
|
1421
|
+
// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#escapingString
|
|
1417
1422
|
|
|
1418
1423
|
|
|
1419
1424
|
var escapeAttrRegExp = /[&\u00A0"]/g;
|
|
@@ -1525,7 +1530,7 @@
|
|
|
1525
1530
|
}
|
|
1526
1531
|
|
|
1527
1532
|
var runtimeFlags = _globalThis.lwcRuntimeFlags;
|
|
1528
|
-
/** version: 2.
|
|
1533
|
+
/** version: 2.11.0 */
|
|
1529
1534
|
|
|
1530
1535
|
/*
|
|
1531
1536
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -1987,6 +1992,7 @@
|
|
|
1987
1992
|
* SPDX-License-Identifier: MIT
|
|
1988
1993
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1989
1994
|
*/
|
|
1995
|
+
// Walk up the DOM tree, collecting all shadow roots plus the document root
|
|
1990
1996
|
|
|
1991
1997
|
|
|
1992
1998
|
function getAllRootNodes(node) {
|
|
@@ -3932,6 +3938,7 @@
|
|
|
3932
3938
|
* SPDX-License-Identifier: MIT
|
|
3933
3939
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3934
3940
|
*/
|
|
3941
|
+
// We can use a single observer without having to worry about leaking because
|
|
3935
3942
|
// "Registered observers in a node’s registered observer list have a weak
|
|
3936
3943
|
// reference to the node."
|
|
3937
3944
|
// https://dom.spec.whatwg.org/#garbage-collection
|
|
@@ -4089,6 +4096,7 @@
|
|
|
4089
4096
|
* SPDX-License-Identifier: MIT
|
|
4090
4097
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4091
4098
|
*/
|
|
4099
|
+
// Non-deep-traversing patches: this descriptor map includes all descriptors that
|
|
4092
4100
|
// do not five access to nodes beyond the immediate children.
|
|
4093
4101
|
|
|
4094
4102
|
defineProperties(Text.prototype, {
|
|
@@ -5605,6 +5613,6 @@
|
|
|
5605
5613
|
},
|
|
5606
5614
|
configurable: true
|
|
5607
5615
|
});
|
|
5608
|
-
/** version: 2.
|
|
5616
|
+
/** version: 2.11.0 */
|
|
5609
5617
|
|
|
5610
5618
|
}));
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
var KEY__SHADOW_TOKEN = '$shadowToken$';
|
|
124
124
|
var KEY__SHADOW_TOKEN_PRIVATE = '$$ShadowTokenKey$$';
|
|
125
125
|
var KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
|
|
126
|
-
/** version: 2.
|
|
126
|
+
/** version: 2.11.0 */
|
|
127
127
|
|
|
128
128
|
/*
|
|
129
129
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -131,6 +131,7 @@
|
|
|
131
131
|
* SPDX-License-Identifier: MIT
|
|
132
132
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
133
133
|
*/
|
|
134
|
+
// TODO [#2472]: Remove this workaround when appropriate.
|
|
134
135
|
// eslint-disable-next-line lwc-internal/no-global-node
|
|
135
136
|
|
|
136
137
|
|
|
@@ -399,6 +400,7 @@
|
|
|
399
400
|
* SPDX-License-Identifier: MIT
|
|
400
401
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
401
402
|
*/
|
|
403
|
+
// Helpful for tests running with jsdom
|
|
402
404
|
|
|
403
405
|
|
|
404
406
|
function getOwnerDocument(node) {
|
|
@@ -757,6 +759,7 @@
|
|
|
757
759
|
* SPDX-License-Identifier: MIT
|
|
758
760
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
759
761
|
*/
|
|
762
|
+
// Used as a back reference to identify the host element
|
|
760
763
|
|
|
761
764
|
|
|
762
765
|
var HostElementKey = '$$HostElementKey$$';
|
|
@@ -823,6 +826,7 @@
|
|
|
823
826
|
* SPDX-License-Identifier: MIT
|
|
824
827
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
825
828
|
*/
|
|
829
|
+
// when finding a slot in the DOM, we can fold it if it is contained
|
|
826
830
|
// inside another slot.
|
|
827
831
|
|
|
828
832
|
|
|
@@ -1309,6 +1313,7 @@
|
|
|
1309
1313
|
* SPDX-License-Identifier: MIT
|
|
1310
1314
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1311
1315
|
*/
|
|
1316
|
+
// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#escapingString
|
|
1312
1317
|
|
|
1313
1318
|
|
|
1314
1319
|
var escapeAttrRegExp = /[&\u00A0"]/g;
|
|
@@ -1420,7 +1425,7 @@
|
|
|
1420
1425
|
}
|
|
1421
1426
|
|
|
1422
1427
|
var runtimeFlags = _globalThis.lwcRuntimeFlags;
|
|
1423
|
-
/** version: 2.
|
|
1428
|
+
/** version: 2.11.0 */
|
|
1424
1429
|
|
|
1425
1430
|
/*
|
|
1426
1431
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -1843,6 +1848,7 @@
|
|
|
1843
1848
|
* SPDX-License-Identifier: MIT
|
|
1844
1849
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1845
1850
|
*/
|
|
1851
|
+
// Walk up the DOM tree, collecting all shadow roots plus the document root
|
|
1846
1852
|
|
|
1847
1853
|
|
|
1848
1854
|
function getAllRootNodes(node) {
|
|
@@ -3749,6 +3755,7 @@
|
|
|
3749
3755
|
* SPDX-License-Identifier: MIT
|
|
3750
3756
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3751
3757
|
*/
|
|
3758
|
+
// We can use a single observer without having to worry about leaking because
|
|
3752
3759
|
// "Registered observers in a node’s registered observer list have a weak
|
|
3753
3760
|
// reference to the node."
|
|
3754
3761
|
// https://dom.spec.whatwg.org/#garbage-collection
|
|
@@ -3903,6 +3910,7 @@
|
|
|
3903
3910
|
* SPDX-License-Identifier: MIT
|
|
3904
3911
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3905
3912
|
*/
|
|
3913
|
+
// Non-deep-traversing patches: this descriptor map includes all descriptors that
|
|
3906
3914
|
// do not five access to nodes beyond the immediate children.
|
|
3907
3915
|
|
|
3908
3916
|
defineProperties(Text.prototype, {
|
|
@@ -5409,6 +5417,6 @@
|
|
|
5409
5417
|
},
|
|
5410
5418
|
configurable: true
|
|
5411
5419
|
});
|
|
5412
|
-
/** version: 2.
|
|
5420
|
+
/** version: 2.11.0 */
|
|
5413
5421
|
|
|
5414
5422
|
}));
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
7
6
|
*/
|
|
8
7
|
function isUndefined(obj) {
|
|
9
|
-
|
|
8
|
+
return obj === undefined;
|
|
10
9
|
}
|
|
11
|
-
/** version: 2.
|
|
10
|
+
/** version: 2.11.0 */
|
|
12
11
|
|
|
13
12
|
/*
|
|
14
13
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -16,217 +15,172 @@ function isUndefined(obj) {
|
|
|
16
15
|
* SPDX-License-Identifier: MIT
|
|
17
16
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
18
17
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
18
|
const ValueChangedEventType = 'ValueChangedEvent';
|
|
22
19
|
/**
|
|
23
20
|
* Event fired by wire adapters to emit a new value.
|
|
24
21
|
*/
|
|
25
|
-
|
|
26
22
|
class ValueChangedEvent {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
constructor(value) {
|
|
24
|
+
this.type = ValueChangedEventType;
|
|
25
|
+
this.value = value;
|
|
26
|
+
}
|
|
32
27
|
}
|
|
28
|
+
|
|
33
29
|
/*
|
|
34
30
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
35
31
|
* All rights reserved.
|
|
36
32
|
* SPDX-License-Identifier: MIT
|
|
37
33
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
38
34
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const {
|
|
42
|
-
freeze,
|
|
43
|
-
defineProperty,
|
|
44
|
-
isExtensible
|
|
45
|
-
} = Object; // This value needs to be in sync with wiring.ts from @lwc/engine-core
|
|
46
|
-
|
|
35
|
+
const { freeze, defineProperty, isExtensible } = Object;
|
|
36
|
+
// This value needs to be in sync with wiring.ts from @lwc/engine-core
|
|
47
37
|
const DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
|
|
48
38
|
const DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
|
|
49
39
|
/**
|
|
50
40
|
* Registers a wire adapter factory for Lightning Platform.
|
|
51
41
|
* @deprecated
|
|
52
42
|
*/
|
|
53
|
-
|
|
54
43
|
function register(adapterId, adapterEventTargetCallback) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (typeof adapterEventTargetCallback !== 'function') {
|
|
60
|
-
throw new TypeError('adapter factory must be a callable');
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if ('adapter' in adapterId) {
|
|
64
|
-
throw new TypeError('adapter id is already associated to an adapter factory');
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const AdapterClass = class extends LegacyWireAdapterBridge {
|
|
68
|
-
constructor(dataCallback) {
|
|
69
|
-
super(dataCallback);
|
|
70
|
-
adapterEventTargetCallback(this.eventTarget);
|
|
44
|
+
if (adapterId == null || !isExtensible(adapterId)) {
|
|
45
|
+
throw new TypeError('adapter id must be extensible');
|
|
71
46
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
47
|
+
if (typeof adapterEventTargetCallback !== 'function') {
|
|
48
|
+
throw new TypeError('adapter factory must be a callable');
|
|
49
|
+
}
|
|
50
|
+
if ('adapter' in adapterId) {
|
|
51
|
+
throw new TypeError('adapter id is already associated to an adapter factory');
|
|
52
|
+
}
|
|
53
|
+
const AdapterClass = class extends LegacyWireAdapterBridge {
|
|
54
|
+
constructor(dataCallback) {
|
|
55
|
+
super(dataCallback);
|
|
56
|
+
adapterEventTargetCallback(this.eventTarget);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
freeze(AdapterClass);
|
|
60
|
+
freeze(AdapterClass.prototype);
|
|
61
|
+
defineProperty(adapterId, 'adapter', {
|
|
62
|
+
writable: false,
|
|
63
|
+
configurable: false,
|
|
64
|
+
value: AdapterClass,
|
|
65
|
+
});
|
|
81
66
|
}
|
|
82
67
|
/**
|
|
83
68
|
* Registers the wire service. noop
|
|
84
69
|
* @deprecated
|
|
85
70
|
*/
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
indexOf: ArrayIndexOf
|
|
94
|
-
} = Array.prototype; // wire event target life cycle connectedCallback hook event type
|
|
95
|
-
|
|
96
|
-
const CONNECT = 'connect'; // wire event target life cycle disconnectedCallback hook event type
|
|
97
|
-
|
|
98
|
-
const DISCONNECT = 'disconnect'; // wire event target life cycle config changed hook event type
|
|
99
|
-
|
|
71
|
+
function registerWireService() { }
|
|
72
|
+
const { forEach, splice: ArraySplice, indexOf: ArrayIndexOf } = Array.prototype;
|
|
73
|
+
// wire event target life cycle connectedCallback hook event type
|
|
74
|
+
const CONNECT = 'connect';
|
|
75
|
+
// wire event target life cycle disconnectedCallback hook event type
|
|
76
|
+
const DISCONNECT = 'disconnect';
|
|
77
|
+
// wire event target life cycle config changed hook event type
|
|
100
78
|
const CONFIG = 'config';
|
|
101
|
-
|
|
102
79
|
function removeListener(listeners, toRemove) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
80
|
+
const idx = ArrayIndexOf.call(listeners, toRemove);
|
|
81
|
+
if (idx > -1) {
|
|
82
|
+
ArraySplice.call(listeners, idx, 1);
|
|
83
|
+
}
|
|
108
84
|
}
|
|
109
|
-
|
|
110
85
|
function isEmptyConfig(config) {
|
|
111
|
-
|
|
86
|
+
return Object.keys(config).length === 0;
|
|
112
87
|
}
|
|
113
|
-
|
|
114
88
|
function isValidConfig(config, params) {
|
|
115
|
-
|
|
116
|
-
|
|
89
|
+
// The config is valid if there is no params, or if exist a param for which config[param] !== undefined.
|
|
90
|
+
return params.length === 0 || params.some((param) => !isUndefined(config[param]));
|
|
117
91
|
}
|
|
118
|
-
|
|
119
92
|
function isDifferentConfig(newConfig, oldConfig, params) {
|
|
120
|
-
|
|
93
|
+
return params.some((param) => newConfig[param] !== oldConfig[param]);
|
|
121
94
|
}
|
|
122
|
-
|
|
123
95
|
class LegacyWireAdapterBridge {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
96
|
+
constructor(callback) {
|
|
97
|
+
this.connecting = [];
|
|
98
|
+
this.disconnecting = [];
|
|
99
|
+
this.configuring = [];
|
|
100
|
+
this.isFirstUpdate = true;
|
|
101
|
+
this.callback = callback;
|
|
102
|
+
this.wiredElementHost = callback[DeprecatedWiredElementHost];
|
|
103
|
+
this.dynamicParamsNames = callback[DeprecatedWiredParamsMeta];
|
|
104
|
+
this.eventTarget = {
|
|
105
|
+
addEventListener: (type, listener) => {
|
|
106
|
+
switch (type) {
|
|
107
|
+
case CONNECT: {
|
|
108
|
+
this.connecting.push(listener);
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
case DISCONNECT: {
|
|
112
|
+
this.disconnecting.push(listener);
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
case CONFIG: {
|
|
116
|
+
this.configuring.push(listener);
|
|
117
|
+
if (this.currentConfig !== undefined) {
|
|
118
|
+
listener.call(undefined, this.currentConfig);
|
|
119
|
+
}
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
default:
|
|
123
|
+
throw new Error(`Invalid event type ${type}.`);
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
removeEventListener: (type, listener) => {
|
|
127
|
+
switch (type) {
|
|
128
|
+
case CONNECT: {
|
|
129
|
+
removeListener(this.connecting, listener);
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
case DISCONNECT: {
|
|
133
|
+
removeListener(this.disconnecting, listener);
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
case CONFIG: {
|
|
137
|
+
removeListener(this.configuring, listener);
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
default:
|
|
141
|
+
throw new Error(`Invalid event type ${type}.`);
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
dispatchEvent: (evt) => {
|
|
145
|
+
if (evt instanceof ValueChangedEvent) {
|
|
146
|
+
const value = evt.value;
|
|
147
|
+
this.callback(value);
|
|
148
|
+
}
|
|
149
|
+
else if (evt.type === 'wirecontextevent') {
|
|
150
|
+
// TODO [#1357]: remove this branch
|
|
151
|
+
return this.wiredElementHost.dispatchEvent(evt);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
throw new Error(`Invalid event type ${evt.type}.`);
|
|
155
|
+
}
|
|
156
|
+
return false; // canceling signal since we don't want this to propagate
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
update(config) {
|
|
161
|
+
if (this.isFirstUpdate) {
|
|
162
|
+
// this is a special case for legacy wire adapters: when all the config params are undefined,
|
|
163
|
+
// the config on the wire adapter should not be called until one of them changes.
|
|
164
|
+
this.isFirstUpdate = false;
|
|
165
|
+
if (!isEmptyConfig(config) && !isValidConfig(config, this.dynamicParamsNames)) {
|
|
166
|
+
return;
|
|
180
167
|
}
|
|
181
|
-
|
|
182
|
-
default:
|
|
183
|
-
throw new Error(`Invalid event type ${type}.`);
|
|
184
168
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
// TODO [#1357]: remove this branch
|
|
192
|
-
return this.wiredElementHost.dispatchEvent(evt);
|
|
193
|
-
} else {
|
|
194
|
-
throw new Error(`Invalid event type ${evt.type}.`);
|
|
169
|
+
if (isUndefined(this.currentConfig) ||
|
|
170
|
+
isDifferentConfig(config, this.currentConfig, this.dynamicParamsNames)) {
|
|
171
|
+
this.currentConfig = config;
|
|
172
|
+
forEach.call(this.configuring, (listener) => {
|
|
173
|
+
listener.call(undefined, config);
|
|
174
|
+
});
|
|
195
175
|
}
|
|
196
|
-
|
|
197
|
-
return false; // canceling signal since we don't want this to propagate
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
update(config) {
|
|
203
|
-
if (this.isFirstUpdate) {
|
|
204
|
-
// this is a special case for legacy wire adapters: when all the config params are undefined,
|
|
205
|
-
// the config on the wire adapter should not be called until one of them changes.
|
|
206
|
-
this.isFirstUpdate = false;
|
|
207
|
-
|
|
208
|
-
if (!isEmptyConfig(config) && !isValidConfig(config, this.dynamicParamsNames)) {
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
176
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
});
|
|
177
|
+
connect() {
|
|
178
|
+
forEach.call(this.connecting, (listener) => listener.call(undefined));
|
|
179
|
+
}
|
|
180
|
+
disconnect() {
|
|
181
|
+
forEach.call(this.disconnecting, (listener) => listener.call(undefined));
|
|
218
182
|
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
connect() {
|
|
222
|
-
forEach.call(this.connecting, listener => listener.call(undefined));
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
disconnect() {
|
|
226
|
-
forEach.call(this.disconnecting, listener => listener.call(undefined));
|
|
227
|
-
}
|
|
228
|
-
|
|
229
183
|
}
|
|
230
|
-
/** version: 2.
|
|
184
|
+
/** version: 2.11.0 */
|
|
231
185
|
|
|
232
186
|
export { ValueChangedEvent, register, registerWireService };
|