lwc 2.13.2 → 2.14.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 +339 -113
- package/dist/engine-dom/iife/es2017/engine-dom.js +339 -112
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -2
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +185 -107
- package/dist/engine-dom/iife/es5/engine-dom.js +7560 -5747
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +5942 -4572
- package/dist/engine-dom/umd/es2017/engine-dom.js +339 -112
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -2
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +185 -107
- package/dist/engine-dom/umd/es5/engine-dom.js +7560 -5747
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +5942 -4572
- package/dist/engine-server/commonjs/es2017/engine-server.js +176 -36
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +176 -37
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +29 -4
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +29 -4
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +10 -13
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +4 -4
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +4601 -3603
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +10 -1
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +4424 -3481
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +29 -4
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +10 -13
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +4 -4
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +4601 -3603
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +10 -1
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +4424 -3481
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.min.js +1 -1
- package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js +243 -258
- package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
- package/dist/wire-service/iife/es5/wire-service_debug.js +243 -258
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service.min.js +1 -1
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js +243 -258
- package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
- package/dist/wire-service/umd/es5/wire-service_debug.js +243 -258
- package/package.json +7 -7
|
@@ -4,301 +4,286 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.WireService = {}));
|
|
5
5
|
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
30
|
-
return Constructor;
|
|
31
|
-
}
|
|
32
|
-
function _getPrototypeOf(o1) {
|
|
33
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
34
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
35
|
-
};
|
|
36
|
-
return _getPrototypeOf(o1);
|
|
37
|
-
}
|
|
38
|
-
function _inherits(subClass, superClass) {
|
|
39
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
40
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
41
|
-
}
|
|
42
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
43
|
-
constructor: {
|
|
44
|
-
value: subClass,
|
|
45
|
-
writable: true,
|
|
46
|
-
configurable: true
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
50
|
-
}
|
|
51
|
-
function _instanceof(left, right) {
|
|
52
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
53
|
-
return !!right[Symbol.hasInstance](left);
|
|
54
|
-
} else {
|
|
55
|
-
return left instanceof right;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
function _possibleConstructorReturn(self, call) {
|
|
59
|
-
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
60
|
-
return call;
|
|
61
|
-
}
|
|
62
|
-
return _assertThisInitialized(self);
|
|
63
|
-
}
|
|
64
|
-
function _setPrototypeOf(o2, p1) {
|
|
65
|
-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
66
|
-
o.__proto__ = p;
|
|
67
|
-
return o;
|
|
68
|
-
};
|
|
69
|
-
return _setPrototypeOf(o2, p1);
|
|
70
|
-
}
|
|
71
|
-
var _typeof = function(obj) {
|
|
72
|
-
"@swc/helpers - typeof";
|
|
73
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
74
|
-
};
|
|
75
|
-
function _isNativeReflectConstruct() {
|
|
76
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
77
|
-
if (Reflect.construct.sham) return false;
|
|
78
|
-
if (typeof Proxy === "function") return true;
|
|
79
|
-
try {
|
|
80
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
81
|
-
return true;
|
|
82
|
-
} catch (e) {
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
function _createSuper(Derived) {
|
|
87
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
88
|
-
return function _createSuperInternal() {
|
|
89
|
-
var Super = _getPrototypeOf(Derived), result;
|
|
90
|
-
if (hasNativeReflectConstruct) {
|
|
91
|
-
var NewTarget = _getPrototypeOf(this).constructor;
|
|
92
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
93
|
-
} else {
|
|
94
|
-
result = Super.apply(this, arguments);
|
|
95
|
-
}
|
|
96
|
-
return _possibleConstructorReturn(this, result);
|
|
97
|
-
};
|
|
98
|
-
}
|
|
7
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
8
|
+
|
|
9
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
10
|
+
|
|
11
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
12
|
+
|
|
13
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
14
|
+
|
|
15
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
16
|
+
|
|
17
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
|
+
|
|
19
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
20
|
+
|
|
21
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
|
+
|
|
23
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
24
|
+
|
|
25
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
26
|
+
|
|
27
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
28
|
+
|
|
99
29
|
/**
|
|
100
30
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
101
|
-
*/
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
102
34
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
103
|
-
*/
|
|
104
|
-
|
|
35
|
+
*/
|
|
36
|
+
function isUndefined(obj) {
|
|
37
|
+
return obj === undefined;
|
|
105
38
|
}
|
|
106
|
-
/** version: 2.
|
|
39
|
+
/** version: 2.14.0 */
|
|
40
|
+
|
|
41
|
+
/*
|
|
107
42
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
108
43
|
* All rights reserved.
|
|
109
44
|
* SPDX-License-Identifier: MIT
|
|
110
45
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
111
|
-
*/
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
var ValueChangedEventType = 'ValueChangedEvent';
|
|
112
50
|
/**
|
|
113
51
|
* Event fired by wire adapters to emit a new value.
|
|
114
|
-
*/
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
var ValueChangedEvent = /*#__PURE__*/_createClass(function ValueChangedEvent(value) {
|
|
55
|
+
_classCallCheck(this, ValueChangedEvent);
|
|
56
|
+
|
|
57
|
+
this.type = ValueChangedEventType;
|
|
58
|
+
this.value = value;
|
|
59
|
+
});
|
|
119
60
|
/*
|
|
120
61
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
121
62
|
* All rights reserved.
|
|
122
63
|
* SPDX-License-Identifier: MIT
|
|
123
64
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
124
|
-
*/
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
var
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
var freeze = Object.freeze,
|
|
69
|
+
defineProperty = Object.defineProperty,
|
|
70
|
+
isExtensible = Object.isExtensible; // This value needs to be in sync with wiring.ts from @lwc/engine-core
|
|
71
|
+
|
|
72
|
+
var DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
|
|
73
|
+
var DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
|
|
128
74
|
/**
|
|
129
75
|
* Registers a wire adapter factory for Lightning Platform.
|
|
130
76
|
* @deprecated
|
|
131
|
-
*/
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
function register(adapterId, adapterEventTargetCallback) {
|
|
80
|
+
if (adapterId == null || !isExtensible(adapterId)) {
|
|
81
|
+
throw new TypeError('adapter id must be extensible');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (typeof adapterEventTargetCallback !== 'function') {
|
|
85
|
+
throw new TypeError('adapter factory must be a callable');
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if ('adapter' in adapterId) {
|
|
89
|
+
throw new TypeError('adapter id is already associated to an adapter factory');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
var AdapterClass = /*#__PURE__*/function (_LegacyWireAdapterBri) {
|
|
93
|
+
_inherits(AdapterClass, _LegacyWireAdapterBri);
|
|
94
|
+
|
|
95
|
+
var _super = _createSuper(AdapterClass);
|
|
96
|
+
|
|
97
|
+
function AdapterClass(dataCallback) {
|
|
98
|
+
var _this;
|
|
99
|
+
|
|
100
|
+
_classCallCheck(this, AdapterClass);
|
|
101
|
+
|
|
102
|
+
_this = _super.call(this, dataCallback);
|
|
103
|
+
adapterEventTargetCallback(_this.eventTarget);
|
|
104
|
+
return _this;
|
|
140
105
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}(LegacyWireAdapterBridge);
|
|
153
|
-
freeze(AdapterClass);
|
|
154
|
-
freeze(AdapterClass.prototype);
|
|
155
|
-
defineProperty(adapterId, "adapter", {
|
|
156
|
-
writable: false,
|
|
157
|
-
configurable: false,
|
|
158
|
-
value: AdapterClass
|
|
159
|
-
});
|
|
106
|
+
|
|
107
|
+
return _createClass(AdapterClass);
|
|
108
|
+
}(LegacyWireAdapterBridge);
|
|
109
|
+
|
|
110
|
+
freeze(AdapterClass);
|
|
111
|
+
freeze(AdapterClass.prototype);
|
|
112
|
+
defineProperty(adapterId, 'adapter', {
|
|
113
|
+
writable: false,
|
|
114
|
+
configurable: false,
|
|
115
|
+
value: AdapterClass
|
|
116
|
+
});
|
|
160
117
|
}
|
|
161
118
|
/**
|
|
162
119
|
* Registers the wire service. noop
|
|
163
120
|
* @deprecated
|
|
164
|
-
*/
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
var
|
|
170
|
-
|
|
171
|
-
|
|
121
|
+
*/
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
function registerWireService() {}
|
|
125
|
+
|
|
126
|
+
var _Array$prototype = Array.prototype,
|
|
127
|
+
forEach = _Array$prototype.forEach,
|
|
128
|
+
ArraySplice = _Array$prototype.splice,
|
|
129
|
+
ArrayIndexOf = _Array$prototype.indexOf; // wire event target life cycle connectedCallback hook event type
|
|
130
|
+
|
|
131
|
+
var CONNECT = 'connect'; // wire event target life cycle disconnectedCallback hook event type
|
|
132
|
+
|
|
133
|
+
var DISCONNECT = 'disconnect'; // wire event target life cycle config changed hook event type
|
|
134
|
+
|
|
135
|
+
var CONFIG = 'config';
|
|
136
|
+
|
|
172
137
|
function removeListener(listeners, toRemove) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
138
|
+
var idx = ArrayIndexOf.call(listeners, toRemove);
|
|
139
|
+
|
|
140
|
+
if (idx > -1) {
|
|
141
|
+
ArraySplice.call(listeners, idx, 1);
|
|
142
|
+
}
|
|
177
143
|
}
|
|
144
|
+
|
|
178
145
|
function isEmptyConfig(config) {
|
|
179
|
-
|
|
146
|
+
return Object.keys(config).length === 0;
|
|
180
147
|
}
|
|
148
|
+
|
|
181
149
|
function isValidConfig(config, params) {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
150
|
+
// The config is valid if there is no params, or if exist a param for which config[param] !== undefined.
|
|
151
|
+
return params.length === 0 || params.some(function (param) {
|
|
152
|
+
return !isUndefined(config[param]);
|
|
153
|
+
});
|
|
186
154
|
}
|
|
155
|
+
|
|
187
156
|
function isDifferentConfig(newConfig, oldConfig, params) {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
157
|
+
return params.some(function (param) {
|
|
158
|
+
return newConfig[param] !== oldConfig[param];
|
|
159
|
+
});
|
|
191
160
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
break;
|
|
215
|
-
}
|
|
216
|
-
case CONFIG:
|
|
217
|
-
{
|
|
218
|
-
_this.configuring.push(listener);
|
|
219
|
-
if (_this.currentConfig !== undefined) {
|
|
220
|
-
listener.call(undefined, _this.currentConfig);
|
|
221
|
-
}
|
|
222
|
-
break;
|
|
223
|
-
}
|
|
224
|
-
default:
|
|
225
|
-
throw new Error("Invalid event type ".concat(type, "."));
|
|
226
|
-
}
|
|
227
|
-
},
|
|
228
|
-
removeEventListener: function(type, listener) {
|
|
229
|
-
switch(type){
|
|
230
|
-
case CONNECT:
|
|
231
|
-
{
|
|
232
|
-
removeListener(_this.connecting, listener);
|
|
233
|
-
break;
|
|
234
|
-
}
|
|
235
|
-
case DISCONNECT:
|
|
236
|
-
{
|
|
237
|
-
removeListener(_this.disconnecting, listener);
|
|
238
|
-
break;
|
|
239
|
-
}
|
|
240
|
-
case CONFIG:
|
|
241
|
-
{
|
|
242
|
-
removeListener(_this.configuring, listener);
|
|
243
|
-
break;
|
|
244
|
-
}
|
|
245
|
-
default:
|
|
246
|
-
throw new Error("Invalid event type ".concat(type, "."));
|
|
247
|
-
}
|
|
248
|
-
},
|
|
249
|
-
dispatchEvent: function(evt) {
|
|
250
|
-
if (_instanceof(evt, ValueChangedEvent)) {
|
|
251
|
-
var value = evt.value;
|
|
252
|
-
_this.callback(value);
|
|
253
|
-
} else if (evt.type === "wirecontextevent") {
|
|
254
|
-
// TODO [#1357]: remove this branch
|
|
255
|
-
return _this.wiredElementHost.dispatchEvent(evt);
|
|
256
|
-
} else {
|
|
257
|
-
throw new Error("Invalid event type ".concat(evt.type, "."));
|
|
258
|
-
}
|
|
259
|
-
return false; // canceling signal since we don't want this to propagate
|
|
161
|
+
|
|
162
|
+
var LegacyWireAdapterBridge = /*#__PURE__*/function () {
|
|
163
|
+
function LegacyWireAdapterBridge(callback) {
|
|
164
|
+
var _this2 = this;
|
|
165
|
+
|
|
166
|
+
_classCallCheck(this, LegacyWireAdapterBridge);
|
|
167
|
+
|
|
168
|
+
this.connecting = [];
|
|
169
|
+
this.disconnecting = [];
|
|
170
|
+
this.configuring = [];
|
|
171
|
+
this.isFirstUpdate = true;
|
|
172
|
+
this.callback = callback;
|
|
173
|
+
this.wiredElementHost = callback[DeprecatedWiredElementHost];
|
|
174
|
+
this.dynamicParamsNames = callback[DeprecatedWiredParamsMeta];
|
|
175
|
+
this.eventTarget = {
|
|
176
|
+
addEventListener: function addEventListener(type, listener) {
|
|
177
|
+
switch (type) {
|
|
178
|
+
case CONNECT:
|
|
179
|
+
{
|
|
180
|
+
_this2.connecting.push(listener);
|
|
181
|
+
|
|
182
|
+
break;
|
|
260
183
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
if (this.isFirstUpdate) {
|
|
268
|
-
// this is a special case for legacy wire adapters: when all the config params are undefined,
|
|
269
|
-
// the config on the wire adapter should not be called until one of them changes.
|
|
270
|
-
this.isFirstUpdate = false;
|
|
271
|
-
if (!isEmptyConfig(config) && !isValidConfig(config, this.dynamicParamsNames)) {
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
if (isUndefined(this.currentConfig) || isDifferentConfig(config, this.currentConfig, this.dynamicParamsNames)) {
|
|
276
|
-
this.currentConfig = config;
|
|
277
|
-
forEach.call(this.configuring, function(listener) {
|
|
278
|
-
listener.call(undefined, config);
|
|
279
|
-
});
|
|
280
|
-
}
|
|
184
|
+
|
|
185
|
+
case DISCONNECT:
|
|
186
|
+
{
|
|
187
|
+
_this2.disconnecting.push(listener);
|
|
188
|
+
|
|
189
|
+
break;
|
|
281
190
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
191
|
+
|
|
192
|
+
case CONFIG:
|
|
193
|
+
{
|
|
194
|
+
_this2.configuring.push(listener);
|
|
195
|
+
|
|
196
|
+
if (_this2.currentConfig !== undefined) {
|
|
197
|
+
listener.call(undefined, _this2.currentConfig);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
break;
|
|
289
201
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
202
|
+
|
|
203
|
+
default:
|
|
204
|
+
throw new Error("Invalid event type ".concat(type, "."));
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
removeEventListener: function removeEventListener(type, listener) {
|
|
208
|
+
switch (type) {
|
|
209
|
+
case CONNECT:
|
|
210
|
+
{
|
|
211
|
+
removeListener(_this2.connecting, listener);
|
|
212
|
+
break;
|
|
297
213
|
}
|
|
214
|
+
|
|
215
|
+
case DISCONNECT:
|
|
216
|
+
{
|
|
217
|
+
removeListener(_this2.disconnecting, listener);
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
case CONFIG:
|
|
222
|
+
{
|
|
223
|
+
removeListener(_this2.configuring, listener);
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
default:
|
|
228
|
+
throw new Error("Invalid event type ".concat(type, "."));
|
|
298
229
|
}
|
|
299
|
-
|
|
300
|
-
|
|
230
|
+
},
|
|
231
|
+
dispatchEvent: function dispatchEvent(evt) {
|
|
232
|
+
if (evt instanceof ValueChangedEvent) {
|
|
233
|
+
var value = evt.value;
|
|
234
|
+
|
|
235
|
+
_this2.callback(value);
|
|
236
|
+
} else if (evt.type === 'wirecontextevent') {
|
|
237
|
+
// TODO [#1357]: remove this branch
|
|
238
|
+
return _this2.wiredElementHost.dispatchEvent(evt);
|
|
239
|
+
} else {
|
|
240
|
+
throw new Error("Invalid event type ".concat(evt.type, "."));
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
return false; // canceling signal since we don't want this to propagate
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
_createClass(LegacyWireAdapterBridge, [{
|
|
249
|
+
key: "update",
|
|
250
|
+
value: function update(config) {
|
|
251
|
+
if (this.isFirstUpdate) {
|
|
252
|
+
// this is a special case for legacy wire adapters: when all the config params are undefined,
|
|
253
|
+
// the config on the wire adapter should not be called until one of them changes.
|
|
254
|
+
this.isFirstUpdate = false;
|
|
255
|
+
|
|
256
|
+
if (!isEmptyConfig(config) && !isValidConfig(config, this.dynamicParamsNames)) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
if (isUndefined(this.currentConfig) || isDifferentConfig(config, this.currentConfig, this.dynamicParamsNames)) {
|
|
262
|
+
this.currentConfig = config;
|
|
263
|
+
forEach.call(this.configuring, function (listener) {
|
|
264
|
+
listener.call(undefined, config);
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}, {
|
|
269
|
+
key: "connect",
|
|
270
|
+
value: function connect() {
|
|
271
|
+
forEach.call(this.connecting, function (listener) {
|
|
272
|
+
return listener.call(undefined);
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
}, {
|
|
276
|
+
key: "disconnect",
|
|
277
|
+
value: function disconnect() {
|
|
278
|
+
forEach.call(this.disconnecting, function (listener) {
|
|
279
|
+
return listener.call(undefined);
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
}]);
|
|
283
|
+
|
|
284
|
+
return LegacyWireAdapterBridge;
|
|
301
285
|
}();
|
|
286
|
+
/** version: 2.14.0 */
|
|
302
287
|
|
|
303
288
|
exports.ValueChangedEvent = ValueChangedEvent;
|
|
304
289
|
exports.register = register;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).WireService={})}(this,(function(e){"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function n(e,t){return n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(e,t)}function r(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=i(e);if(t){var c=i(this).constructor;n=Reflect.construct(r,arguments,c)}else n=r.apply(this,arguments);return o(this,n)}}function o(e,n){if(n&&("object"===t(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function i(e){return i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},i(e)}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return t&&c(e.prototype,t),n&&c(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e){return void 0===e}var s=a((function e(t){u(this,e),this.type="ValueChangedEvent",this.value=t})),l=Object.freeze,p=Object.defineProperty,d=Object.isExtensible;var y=Array.prototype,h=y.forEach,v=y.splice,b=y.indexOf,g="connect",m="disconnect",w="config";function E(e,t){var n=b.call(e,t);n>-1&&v.call(e,n,1)}var O=function(){function e(t){var n=this;u(this,e),this.connecting=[],this.disconnecting=[],this.configuring=[],this.isFirstUpdate=!0,this.callback=t,this.wiredElementHost=t.$$DeprecatedWiredElementHostKey$$,this.dynamicParamsNames=t.$$DeprecatedWiredParamsMetaKey$$,this.eventTarget={addEventListener:function(e,t){switch(e){case g:n.connecting.push(t);break;case m:n.disconnecting.push(t);break;case w:n.configuring.push(t),void 0!==n.currentConfig&&t.call(void 0,n.currentConfig);break;default:throw new Error("Invalid event type ".concat(e,"."))}},removeEventListener:function(e,t){switch(e){case g:E(n.connecting,t);break;case m:E(n.disconnecting,t);break;case w:E(n.configuring,t);break;default:throw new Error("Invalid event type ".concat(e,"."))}},dispatchEvent:function(e){if(!(e instanceof s)){if("wirecontextevent"===e.type)return n.wiredElementHost.dispatchEvent(e);throw new Error("Invalid event type ".concat(e.type,"."))}var t=e.value;return n.callback(t),!1}}}return a(e,[{key:"update",value:function(e){var t,n;(!this.isFirstUpdate||(this.isFirstUpdate=!1,function(e){return 0===Object.keys(e).length}(e)||function(e,t){return 0===t.length||t.some((function(t){return!f(e[t])}))}(e,this.dynamicParamsNames)))&&((f(this.currentConfig)||(t=e,n=this.currentConfig,this.dynamicParamsNames.some((function(e){return t[e]!==n[e]}))))&&(this.currentConfig=e,h.call(this.configuring,(function(t){t.call(void 0,e)}))))}},{key:"connect",value:function(){h.call(this.connecting,(function(e){return e.call(void 0)}))}},{key:"disconnect",value:function(){h.call(this.disconnecting,(function(e){return e.call(void 0)}))}}]),e}();e.ValueChangedEvent=s,e.register=function(e,t){if(null==e||!d(e))throw new TypeError("adapter id must be extensible");if("function"!=typeof t)throw new TypeError("adapter factory must be a callable");if("adapter"in e)throw new TypeError("adapter id is already associated to an adapter factory");var o=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&n(e,t)}(i,e);var o=r(i);function i(e){var n;return u(this,i),n=o.call(this,e),t(n.eventTarget),n}return a(i)}(O);l(o),l(o.prototype),p(e,"adapter",{writable:!1,configurable:!1,value:o})},e.registerWireService=function(){},Object.defineProperty(e,"__esModule",{value:!0})}));
|