lwc 2.8.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 +4362 -5763
- package/dist/engine-dom/iife/es2017/engine-dom.js +4362 -5763
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +3303 -4535
- package/dist/engine-dom/iife/es5/engine-dom.js +789 -580
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +650 -518
- package/dist/engine-dom/umd/es2017/engine-dom.js +4362 -5763
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +3303 -4535
- package/dist/engine-dom/umd/es5/engine-dom.js +789 -580
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +650 -518
- package/dist/engine-server/commonjs/es2017/engine-server.js +4062 -5273
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +4062 -5273
- 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
|
@@ -7,14 +7,13 @@
|
|
|
7
7
|
/**
|
|
8
8
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
10
|
/**
|
|
12
11
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
13
12
|
*/
|
|
14
13
|
function isUndefined(obj) {
|
|
15
|
-
|
|
14
|
+
return obj === undefined;
|
|
16
15
|
}
|
|
17
|
-
/** version: 2.
|
|
16
|
+
/** version: 2.11.0 */
|
|
18
17
|
|
|
19
18
|
/*
|
|
20
19
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -22,218 +21,173 @@
|
|
|
22
21
|
* SPDX-License-Identifier: MIT
|
|
23
22
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
24
23
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
24
|
const ValueChangedEventType = 'ValueChangedEvent';
|
|
28
25
|
/**
|
|
29
26
|
* Event fired by wire adapters to emit a new value.
|
|
30
27
|
*/
|
|
31
|
-
|
|
32
28
|
class ValueChangedEvent {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
constructor(value) {
|
|
30
|
+
this.type = ValueChangedEventType;
|
|
31
|
+
this.value = value;
|
|
32
|
+
}
|
|
38
33
|
}
|
|
34
|
+
|
|
39
35
|
/*
|
|
40
36
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
41
37
|
* All rights reserved.
|
|
42
38
|
* SPDX-License-Identifier: MIT
|
|
43
39
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
44
40
|
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const {
|
|
48
|
-
freeze,
|
|
49
|
-
defineProperty,
|
|
50
|
-
isExtensible
|
|
51
|
-
} = Object; // This value needs to be in sync with wiring.ts from @lwc/engine-core
|
|
52
|
-
|
|
41
|
+
const { freeze, defineProperty, isExtensible } = Object;
|
|
42
|
+
// This value needs to be in sync with wiring.ts from @lwc/engine-core
|
|
53
43
|
const DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
|
|
54
44
|
const DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
|
|
55
45
|
/**
|
|
56
46
|
* Registers a wire adapter factory for Lightning Platform.
|
|
57
47
|
* @deprecated
|
|
58
48
|
*/
|
|
59
|
-
|
|
60
49
|
function register(adapterId, adapterEventTargetCallback) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (typeof adapterEventTargetCallback !== 'function') {
|
|
66
|
-
throw new TypeError('adapter factory must be a callable');
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if ('adapter' in adapterId) {
|
|
70
|
-
throw new TypeError('adapter id is already associated to an adapter factory');
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const AdapterClass = class extends LegacyWireAdapterBridge {
|
|
74
|
-
constructor(dataCallback) {
|
|
75
|
-
super(dataCallback);
|
|
76
|
-
adapterEventTargetCallback(this.eventTarget);
|
|
50
|
+
if (adapterId == null || !isExtensible(adapterId)) {
|
|
51
|
+
throw new TypeError('adapter id must be extensible');
|
|
77
52
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
53
|
+
if (typeof adapterEventTargetCallback !== 'function') {
|
|
54
|
+
throw new TypeError('adapter factory must be a callable');
|
|
55
|
+
}
|
|
56
|
+
if ('adapter' in adapterId) {
|
|
57
|
+
throw new TypeError('adapter id is already associated to an adapter factory');
|
|
58
|
+
}
|
|
59
|
+
const AdapterClass = class extends LegacyWireAdapterBridge {
|
|
60
|
+
constructor(dataCallback) {
|
|
61
|
+
super(dataCallback);
|
|
62
|
+
adapterEventTargetCallback(this.eventTarget);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
freeze(AdapterClass);
|
|
66
|
+
freeze(AdapterClass.prototype);
|
|
67
|
+
defineProperty(adapterId, 'adapter', {
|
|
68
|
+
writable: false,
|
|
69
|
+
configurable: false,
|
|
70
|
+
value: AdapterClass,
|
|
71
|
+
});
|
|
87
72
|
}
|
|
88
73
|
/**
|
|
89
74
|
* Registers the wire service. noop
|
|
90
75
|
* @deprecated
|
|
91
76
|
*/
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
indexOf: ArrayIndexOf
|
|
100
|
-
} = Array.prototype; // wire event target life cycle connectedCallback hook event type
|
|
101
|
-
|
|
102
|
-
const CONNECT = 'connect'; // wire event target life cycle disconnectedCallback hook event type
|
|
103
|
-
|
|
104
|
-
const DISCONNECT = 'disconnect'; // wire event target life cycle config changed hook event type
|
|
105
|
-
|
|
77
|
+
function registerWireService() { }
|
|
78
|
+
const { forEach, splice: ArraySplice, indexOf: ArrayIndexOf } = Array.prototype;
|
|
79
|
+
// wire event target life cycle connectedCallback hook event type
|
|
80
|
+
const CONNECT = 'connect';
|
|
81
|
+
// wire event target life cycle disconnectedCallback hook event type
|
|
82
|
+
const DISCONNECT = 'disconnect';
|
|
83
|
+
// wire event target life cycle config changed hook event type
|
|
106
84
|
const CONFIG = 'config';
|
|
107
|
-
|
|
108
85
|
function removeListener(listeners, toRemove) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
86
|
+
const idx = ArrayIndexOf.call(listeners, toRemove);
|
|
87
|
+
if (idx > -1) {
|
|
88
|
+
ArraySplice.call(listeners, idx, 1);
|
|
89
|
+
}
|
|
114
90
|
}
|
|
115
|
-
|
|
116
91
|
function isEmptyConfig(config) {
|
|
117
|
-
|
|
92
|
+
return Object.keys(config).length === 0;
|
|
118
93
|
}
|
|
119
|
-
|
|
120
94
|
function isValidConfig(config, params) {
|
|
121
|
-
|
|
122
|
-
|
|
95
|
+
// The config is valid if there is no params, or if exist a param for which config[param] !== undefined.
|
|
96
|
+
return params.length === 0 || params.some((param) => !isUndefined(config[param]));
|
|
123
97
|
}
|
|
124
|
-
|
|
125
98
|
function isDifferentConfig(newConfig, oldConfig, params) {
|
|
126
|
-
|
|
99
|
+
return params.some((param) => newConfig[param] !== oldConfig[param]);
|
|
127
100
|
}
|
|
128
|
-
|
|
129
101
|
class LegacyWireAdapterBridge {
|
|
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
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
102
|
+
constructor(callback) {
|
|
103
|
+
this.connecting = [];
|
|
104
|
+
this.disconnecting = [];
|
|
105
|
+
this.configuring = [];
|
|
106
|
+
this.isFirstUpdate = true;
|
|
107
|
+
this.callback = callback;
|
|
108
|
+
this.wiredElementHost = callback[DeprecatedWiredElementHost];
|
|
109
|
+
this.dynamicParamsNames = callback[DeprecatedWiredParamsMeta];
|
|
110
|
+
this.eventTarget = {
|
|
111
|
+
addEventListener: (type, listener) => {
|
|
112
|
+
switch (type) {
|
|
113
|
+
case CONNECT: {
|
|
114
|
+
this.connecting.push(listener);
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
case DISCONNECT: {
|
|
118
|
+
this.disconnecting.push(listener);
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
case CONFIG: {
|
|
122
|
+
this.configuring.push(listener);
|
|
123
|
+
if (this.currentConfig !== undefined) {
|
|
124
|
+
listener.call(undefined, this.currentConfig);
|
|
125
|
+
}
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
default:
|
|
129
|
+
throw new Error(`Invalid event type ${type}.`);
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
removeEventListener: (type, listener) => {
|
|
133
|
+
switch (type) {
|
|
134
|
+
case CONNECT: {
|
|
135
|
+
removeListener(this.connecting, listener);
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
case DISCONNECT: {
|
|
139
|
+
removeListener(this.disconnecting, listener);
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
case CONFIG: {
|
|
143
|
+
removeListener(this.configuring, listener);
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
default:
|
|
147
|
+
throw new Error(`Invalid event type ${type}.`);
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
dispatchEvent: (evt) => {
|
|
151
|
+
if (evt instanceof ValueChangedEvent) {
|
|
152
|
+
const value = evt.value;
|
|
153
|
+
this.callback(value);
|
|
154
|
+
}
|
|
155
|
+
else if (evt.type === 'wirecontextevent') {
|
|
156
|
+
// TODO [#1357]: remove this branch
|
|
157
|
+
return this.wiredElementHost.dispatchEvent(evt);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
throw new Error(`Invalid event type ${evt.type}.`);
|
|
161
|
+
}
|
|
162
|
+
return false; // canceling signal since we don't want this to propagate
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
update(config) {
|
|
167
|
+
if (this.isFirstUpdate) {
|
|
168
|
+
// this is a special case for legacy wire adapters: when all the config params are undefined,
|
|
169
|
+
// the config on the wire adapter should not be called until one of them changes.
|
|
170
|
+
this.isFirstUpdate = false;
|
|
171
|
+
if (!isEmptyConfig(config) && !isValidConfig(config, this.dynamicParamsNames)) {
|
|
172
|
+
return;
|
|
186
173
|
}
|
|
187
|
-
|
|
188
|
-
default:
|
|
189
|
-
throw new Error(`Invalid event type ${type}.`);
|
|
190
174
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
// TODO [#1357]: remove this branch
|
|
198
|
-
return this.wiredElementHost.dispatchEvent(evt);
|
|
199
|
-
} else {
|
|
200
|
-
throw new Error(`Invalid event type ${evt.type}.`);
|
|
175
|
+
if (isUndefined(this.currentConfig) ||
|
|
176
|
+
isDifferentConfig(config, this.currentConfig, this.dynamicParamsNames)) {
|
|
177
|
+
this.currentConfig = config;
|
|
178
|
+
forEach.call(this.configuring, (listener) => {
|
|
179
|
+
listener.call(undefined, config);
|
|
180
|
+
});
|
|
201
181
|
}
|
|
202
|
-
|
|
203
|
-
return false; // canceling signal since we don't want this to propagate
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
update(config) {
|
|
209
|
-
if (this.isFirstUpdate) {
|
|
210
|
-
// this is a special case for legacy wire adapters: when all the config params are undefined,
|
|
211
|
-
// the config on the wire adapter should not be called until one of them changes.
|
|
212
|
-
this.isFirstUpdate = false;
|
|
213
|
-
|
|
214
|
-
if (!isEmptyConfig(config) && !isValidConfig(config, this.dynamicParamsNames)) {
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
182
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
});
|
|
183
|
+
connect() {
|
|
184
|
+
forEach.call(this.connecting, (listener) => listener.call(undefined));
|
|
185
|
+
}
|
|
186
|
+
disconnect() {
|
|
187
|
+
forEach.call(this.disconnecting, (listener) => listener.call(undefined));
|
|
224
188
|
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
connect() {
|
|
228
|
-
forEach.call(this.connecting, listener => listener.call(undefined));
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
disconnect() {
|
|
232
|
-
forEach.call(this.disconnecting, listener => listener.call(undefined));
|
|
233
|
-
}
|
|
234
|
-
|
|
235
189
|
}
|
|
236
|
-
/** version: 2.
|
|
190
|
+
/** version: 2.11.0 */
|
|
237
191
|
|
|
238
192
|
exports.ValueChangedEvent = ValueChangedEvent;
|
|
239
193
|
exports.register = register;
|