lwc 2.50.0 → 3.0.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/README.md +18 -8
- package/aria-reflection.d.ts +7 -0
- package/aria-reflection.js +7 -0
- package/babel-plugin-component.d.ts +7 -0
- package/babel-plugin-component.js +7 -0
- package/compiler.d.ts +7 -0
- package/compiler.js +7 -0
- package/engine-core.d.ts +7 -0
- package/engine-core.js +7 -0
- package/engine-dom.d.ts +7 -0
- package/engine-dom.js +7 -0
- package/engine-server.d.ts +7 -0
- package/engine-server.js +7 -0
- package/errors.d.ts +7 -0
- package/errors.js +7 -0
- package/features.d.ts +7 -0
- package/features.js +7 -0
- package/{types.d.ts → index.d.ts} +1 -1
- package/index.js +2 -85
- package/module-resolver.d.ts +7 -0
- package/module-resolver.js +7 -0
- package/package.json +42 -29
- package/rollup-plugin.d.ts +7 -0
- package/rollup-plugin.js +7 -0
- package/shared.d.ts +7 -0
- package/shared.js +7 -0
- package/style-compiler.d.ts +7 -0
- package/style-compiler.js +7 -0
- package/synthetic-shadow.d.ts +7 -0
- package/synthetic-shadow.js +7 -0
- package/template-compiler.d.ts +7 -0
- package/template-compiler.js +7 -0
- package/wire-service.d.ts +7 -0
- package/wire-service.js +7 -0
- package/dist/engine-dom/esm/es2017/engine-dom.js +0 -8391
- package/dist/engine-dom/esm/es2017/engine-dom.js.map +0 -1
- package/dist/engine-dom/iife/es2017/engine-dom.js +0 -8429
- package/dist/engine-dom/iife/es2017/engine-dom.js.map +0 -1
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +0 -2
- package/dist/engine-dom/iife/es2017/engine-dom.min.js.map +0 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +0 -6912
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js.map +0 -1
- package/dist/engine-dom/iife/es5/engine-dom.js +0 -8815
- package/dist/engine-dom/iife/es5/engine-dom.js.map +0 -1
- package/dist/engine-dom/iife/es5/engine-dom.min.js +0 -2
- package/dist/engine-dom/iife/es5/engine-dom.min.js.map +0 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +0 -7325
- package/dist/engine-dom/iife/es5/engine-dom_debug.js.map +0 -1
- package/dist/engine-dom/umd/es2017/engine-dom.js +0 -8430
- package/dist/engine-dom/umd/es2017/engine-dom.js.map +0 -1
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +0 -2
- package/dist/engine-dom/umd/es2017/engine-dom.min.js.map +0 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +0 -6913
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js.map +0 -1
- package/dist/engine-dom/umd/es5/engine-dom.js +0 -8816
- package/dist/engine-dom/umd/es5/engine-dom.js.map +0 -1
- package/dist/engine-dom/umd/es5/engine-dom.min.js +0 -2
- package/dist/engine-dom/umd/es5/engine-dom.min.js.map +0 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +0 -7326
- package/dist/engine-dom/umd/es5/engine-dom_debug.js.map +0 -1
- package/dist/engine-server/commonjs/es2017/engine-server.js +0 -14541
- package/dist/engine-server/commonjs/es2017/engine-server.js.map +0 -1
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +0 -2
- package/dist/engine-server/commonjs/es2017/engine-server.min.js.map +0 -1
- package/dist/engine-server/esm/es2017/engine-server.js +0 -14517
- package/dist/engine-server/esm/es2017/engine-server.js.map +0 -1
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +0 -4757
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js.map +0 -1
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +0 -4762
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js.map +0 -1
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +0 -49
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js.map +0 -1
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +0 -4574
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js.map +0 -1
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +0 -4737
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js.map +0 -1
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +0 -49
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js.map +0 -1
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +0 -4538
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js.map +0 -1
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +0 -4764
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js.map +0 -1
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +0 -49
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js.map +0 -1
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +0 -4576
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js.map +0 -1
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +0 -4739
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js.map +0 -1
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +0 -49
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js.map +0 -1
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +0 -4540
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js.map +0 -1
- package/dist/wire-service/esm/es2017/wire-service.js +0 -195
- package/dist/wire-service/esm/es2017/wire-service.js.map +0 -1
- package/dist/wire-service/iife/es2017/wire-service.js +0 -204
- package/dist/wire-service/iife/es2017/wire-service.js.map +0 -1
- package/dist/wire-service/iife/es2017/wire-service.min.js +0 -2
- package/dist/wire-service/iife/es2017/wire-service.min.js.map +0 -1
- package/dist/wire-service/iife/es2017/wire-service_debug.js +0 -204
- package/dist/wire-service/iife/es2017/wire-service_debug.js.map +0 -1
- package/dist/wire-service/iife/es5/wire-service.js +0 -247
- package/dist/wire-service/iife/es5/wire-service.js.map +0 -1
- package/dist/wire-service/iife/es5/wire-service.min.js +0 -2
- package/dist/wire-service/iife/es5/wire-service.min.js.map +0 -1
- package/dist/wire-service/iife/es5/wire-service_debug.js +0 -247
- package/dist/wire-service/iife/es5/wire-service_debug.js.map +0 -1
- package/dist/wire-service/umd/es2017/wire-service.js +0 -205
- package/dist/wire-service/umd/es2017/wire-service.js.map +0 -1
- package/dist/wire-service/umd/es2017/wire-service.min.js +0 -2
- package/dist/wire-service/umd/es2017/wire-service.min.js.map +0 -1
- package/dist/wire-service/umd/es2017/wire-service_debug.js +0 -205
- package/dist/wire-service/umd/es2017/wire-service_debug.js.map +0 -1
- package/dist/wire-service/umd/es5/wire-service.js +0 -248
- package/dist/wire-service/umd/es5/wire-service.js.map +0 -1
- package/dist/wire-service/umd/es5/wire-service.min.js +0 -2
- package/dist/wire-service/umd/es5/wire-service.min.js.map +0 -1
- package/dist/wire-service/umd/es5/wire-service_debug.js +0 -248
- package/dist/wire-service/umd/es5/wire-service_debug.js.map +0 -1
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.WireService = {}));
|
|
5
|
-
})(this, (function (exports) { 'use strict';
|
|
6
|
-
|
|
7
|
-
/* proxy-compat-disable */
|
|
8
|
-
/**
|
|
9
|
-
* Copyright (C) 2023 salesforce.com, inc.
|
|
10
|
-
*/
|
|
11
|
-
/* proxy-compat-disable */
|
|
12
|
-
/**
|
|
13
|
-
* Copyright (C) 2023 salesforce.com, inc.
|
|
14
|
-
*/
|
|
15
|
-
/*
|
|
16
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
17
|
-
* All rights reserved.
|
|
18
|
-
* SPDX-License-Identifier: MIT
|
|
19
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
20
|
-
*/
|
|
21
|
-
function isUndefined(obj) {
|
|
22
|
-
return obj === undefined;
|
|
23
|
-
}
|
|
24
|
-
/** version: 2.50.0 */
|
|
25
|
-
|
|
26
|
-
/*
|
|
27
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
28
|
-
* All rights reserved.
|
|
29
|
-
* SPDX-License-Identifier: MIT
|
|
30
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
31
|
-
*/
|
|
32
|
-
const ValueChangedEventType = 'ValueChangedEvent';
|
|
33
|
-
/**
|
|
34
|
-
* Event fired by wire adapters to emit a new value.
|
|
35
|
-
*/
|
|
36
|
-
class ValueChangedEvent {
|
|
37
|
-
constructor(value) {
|
|
38
|
-
this.type = ValueChangedEventType;
|
|
39
|
-
this.value = value;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/*
|
|
44
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
45
|
-
* All rights reserved.
|
|
46
|
-
* SPDX-License-Identifier: MIT
|
|
47
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
48
|
-
*/
|
|
49
|
-
const { freeze, defineProperty, isExtensible } = Object;
|
|
50
|
-
// This value needs to be in sync with wiring.ts from @lwc/engine-core
|
|
51
|
-
const DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
|
|
52
|
-
const DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
|
|
53
|
-
/**
|
|
54
|
-
* Registers a wire adapter factory for Lightning Platform.
|
|
55
|
-
* @deprecated
|
|
56
|
-
*/
|
|
57
|
-
function register(adapterId, adapterEventTargetCallback) {
|
|
58
|
-
if (adapterId == null || !isExtensible(adapterId)) {
|
|
59
|
-
throw new TypeError('adapter id must be extensible');
|
|
60
|
-
}
|
|
61
|
-
if (typeof adapterEventTargetCallback !== 'function') {
|
|
62
|
-
throw new TypeError('adapter factory must be a callable');
|
|
63
|
-
}
|
|
64
|
-
if ('adapter' in adapterId) {
|
|
65
|
-
throw new TypeError('adapter id is already associated to an adapter factory');
|
|
66
|
-
}
|
|
67
|
-
const AdapterClass = class extends LegacyWireAdapterBridge {
|
|
68
|
-
constructor(dataCallback) {
|
|
69
|
-
super(dataCallback);
|
|
70
|
-
adapterEventTargetCallback(this.eventTarget);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
freeze(AdapterClass);
|
|
74
|
-
freeze(AdapterClass.prototype);
|
|
75
|
-
defineProperty(adapterId, 'adapter', {
|
|
76
|
-
writable: false,
|
|
77
|
-
configurable: false,
|
|
78
|
-
value: AdapterClass,
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Registers the wire service. noop
|
|
83
|
-
* @deprecated
|
|
84
|
-
*/
|
|
85
|
-
function registerWireService() { }
|
|
86
|
-
const { forEach, splice: ArraySplice, indexOf: ArrayIndexOf } = Array.prototype;
|
|
87
|
-
// wire event target life cycle connectedCallback hook event type
|
|
88
|
-
const CONNECT = 'connect';
|
|
89
|
-
// wire event target life cycle disconnectedCallback hook event type
|
|
90
|
-
const DISCONNECT = 'disconnect';
|
|
91
|
-
// wire event target life cycle config changed hook event type
|
|
92
|
-
const CONFIG = 'config';
|
|
93
|
-
function removeListener(listeners, toRemove) {
|
|
94
|
-
const idx = ArrayIndexOf.call(listeners, toRemove);
|
|
95
|
-
if (idx > -1) {
|
|
96
|
-
ArraySplice.call(listeners, idx, 1);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
function isEmptyConfig(config) {
|
|
100
|
-
return Object.keys(config).length === 0;
|
|
101
|
-
}
|
|
102
|
-
function isValidConfig(config, params) {
|
|
103
|
-
// The config is valid if there is no params, or if exist a param for which config[param] !== undefined.
|
|
104
|
-
return params.length === 0 || params.some((param) => !isUndefined(config[param]));
|
|
105
|
-
}
|
|
106
|
-
function isDifferentConfig(newConfig, oldConfig, params) {
|
|
107
|
-
return params.some((param) => newConfig[param] !== oldConfig[param]);
|
|
108
|
-
}
|
|
109
|
-
class LegacyWireAdapterBridge {
|
|
110
|
-
constructor(callback) {
|
|
111
|
-
this.connecting = [];
|
|
112
|
-
this.disconnecting = [];
|
|
113
|
-
this.configuring = [];
|
|
114
|
-
this.isFirstUpdate = true;
|
|
115
|
-
this.callback = callback;
|
|
116
|
-
this.wiredElementHost = callback[DeprecatedWiredElementHost];
|
|
117
|
-
this.dynamicParamsNames = callback[DeprecatedWiredParamsMeta];
|
|
118
|
-
this.eventTarget = {
|
|
119
|
-
addEventListener: (type, listener) => {
|
|
120
|
-
switch (type) {
|
|
121
|
-
case CONNECT: {
|
|
122
|
-
this.connecting.push(listener);
|
|
123
|
-
break;
|
|
124
|
-
}
|
|
125
|
-
case DISCONNECT: {
|
|
126
|
-
this.disconnecting.push(listener);
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
129
|
-
case CONFIG: {
|
|
130
|
-
this.configuring.push(listener);
|
|
131
|
-
if (this.currentConfig !== undefined) {
|
|
132
|
-
listener.call(undefined, this.currentConfig);
|
|
133
|
-
}
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
default:
|
|
137
|
-
throw new Error(`Invalid event type ${type}.`);
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
removeEventListener: (type, listener) => {
|
|
141
|
-
switch (type) {
|
|
142
|
-
case CONNECT: {
|
|
143
|
-
removeListener(this.connecting, listener);
|
|
144
|
-
break;
|
|
145
|
-
}
|
|
146
|
-
case DISCONNECT: {
|
|
147
|
-
removeListener(this.disconnecting, listener);
|
|
148
|
-
break;
|
|
149
|
-
}
|
|
150
|
-
case CONFIG: {
|
|
151
|
-
removeListener(this.configuring, listener);
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
154
|
-
default:
|
|
155
|
-
throw new Error(`Invalid event type ${type}.`);
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
dispatchEvent: (evt) => {
|
|
159
|
-
if (evt instanceof ValueChangedEvent) {
|
|
160
|
-
const value = evt.value;
|
|
161
|
-
this.callback(value);
|
|
162
|
-
}
|
|
163
|
-
else if (evt.type === 'wirecontextevent') {
|
|
164
|
-
// TODO [#1357]: remove this branch
|
|
165
|
-
return this.wiredElementHost.dispatchEvent(evt);
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
throw new Error(`Invalid event type ${evt.type}.`);
|
|
169
|
-
}
|
|
170
|
-
return false; // canceling signal since we don't want this to propagate
|
|
171
|
-
},
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
update(config) {
|
|
175
|
-
if (this.isFirstUpdate) {
|
|
176
|
-
// this is a special case for legacy wire adapters: when all the config params are undefined,
|
|
177
|
-
// the config on the wire adapter should not be called until one of them changes.
|
|
178
|
-
this.isFirstUpdate = false;
|
|
179
|
-
if (!isEmptyConfig(config) && !isValidConfig(config, this.dynamicParamsNames)) {
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
if (isUndefined(this.currentConfig) ||
|
|
184
|
-
isDifferentConfig(config, this.currentConfig, this.dynamicParamsNames)) {
|
|
185
|
-
this.currentConfig = config;
|
|
186
|
-
forEach.call(this.configuring, (listener) => {
|
|
187
|
-
listener.call(undefined, config);
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
connect() {
|
|
192
|
-
forEach.call(this.connecting, (listener) => listener.call(undefined));
|
|
193
|
-
}
|
|
194
|
-
disconnect() {
|
|
195
|
-
forEach.call(this.disconnecting, (listener) => listener.call(undefined));
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
/** version: 2.50.0 */
|
|
199
|
-
|
|
200
|
-
exports.ValueChangedEvent = ValueChangedEvent;
|
|
201
|
-
exports.register = register;
|
|
202
|
-
exports.registerWireService = registerWireService;
|
|
203
|
-
|
|
204
|
-
}));
|
|
205
|
-
//# sourceMappingURL=wire-service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wire-service.js","sources":["../../../../../@lwc/wire-service/dist/index.js"],"sourcesContent":["/* proxy-compat-disable */\n/**\n * Copyright (C) 2023 salesforce.com, inc.\n */\n/* proxy-compat-disable */\n/**\n * Copyright (C) 2023 salesforce.com, inc.\n */\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\nfunction isUndefined(obj) {\n return obj === undefined;\n}\n/** version: 2.50.0 */\n\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\nconst ValueChangedEventType = 'ValueChangedEvent';\n/**\n * Event fired by wire adapters to emit a new value.\n */\nclass ValueChangedEvent {\n constructor(value) {\n this.type = ValueChangedEventType;\n this.value = value;\n }\n}\n\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\nconst { freeze, defineProperty, isExtensible } = Object;\n// This value needs to be in sync with wiring.ts from @lwc/engine-core\nconst DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';\nconst DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';\n/**\n * Registers a wire adapter factory for Lightning Platform.\n * @deprecated\n */\nfunction register(adapterId, adapterEventTargetCallback) {\n if (adapterId == null || !isExtensible(adapterId)) {\n throw new TypeError('adapter id must be extensible');\n }\n if (typeof adapterEventTargetCallback !== 'function') {\n throw new TypeError('adapter factory must be a callable');\n }\n if ('adapter' in adapterId) {\n throw new TypeError('adapter id is already associated to an adapter factory');\n }\n const AdapterClass = class extends LegacyWireAdapterBridge {\n constructor(dataCallback) {\n super(dataCallback);\n adapterEventTargetCallback(this.eventTarget);\n }\n };\n freeze(AdapterClass);\n freeze(AdapterClass.prototype);\n defineProperty(adapterId, 'adapter', {\n writable: false,\n configurable: false,\n value: AdapterClass,\n });\n}\n/**\n * Registers the wire service. noop\n * @deprecated\n */\nfunction registerWireService() { }\nconst { forEach, splice: ArraySplice, indexOf: ArrayIndexOf } = Array.prototype;\n// wire event target life cycle connectedCallback hook event type\nconst CONNECT = 'connect';\n// wire event target life cycle disconnectedCallback hook event type\nconst DISCONNECT = 'disconnect';\n// wire event target life cycle config changed hook event type\nconst CONFIG = 'config';\nfunction removeListener(listeners, toRemove) {\n const idx = ArrayIndexOf.call(listeners, toRemove);\n if (idx > -1) {\n ArraySplice.call(listeners, idx, 1);\n }\n}\nfunction isEmptyConfig(config) {\n return Object.keys(config).length === 0;\n}\nfunction isValidConfig(config, params) {\n // The config is valid if there is no params, or if exist a param for which config[param] !== undefined.\n return params.length === 0 || params.some((param) => !isUndefined(config[param]));\n}\nfunction isDifferentConfig(newConfig, oldConfig, params) {\n return params.some((param) => newConfig[param] !== oldConfig[param]);\n}\nclass LegacyWireAdapterBridge {\n constructor(callback) {\n this.connecting = [];\n this.disconnecting = [];\n this.configuring = [];\n this.isFirstUpdate = true;\n this.callback = callback;\n this.wiredElementHost = callback[DeprecatedWiredElementHost];\n this.dynamicParamsNames = callback[DeprecatedWiredParamsMeta];\n this.eventTarget = {\n addEventListener: (type, listener) => {\n switch (type) {\n case CONNECT: {\n this.connecting.push(listener);\n break;\n }\n case DISCONNECT: {\n this.disconnecting.push(listener);\n break;\n }\n case CONFIG: {\n this.configuring.push(listener);\n if (this.currentConfig !== undefined) {\n listener.call(undefined, this.currentConfig);\n }\n break;\n }\n default:\n throw new Error(`Invalid event type ${type}.`);\n }\n },\n removeEventListener: (type, listener) => {\n switch (type) {\n case CONNECT: {\n removeListener(this.connecting, listener);\n break;\n }\n case DISCONNECT: {\n removeListener(this.disconnecting, listener);\n break;\n }\n case CONFIG: {\n removeListener(this.configuring, listener);\n break;\n }\n default:\n throw new Error(`Invalid event type ${type}.`);\n }\n },\n dispatchEvent: (evt) => {\n if (evt instanceof ValueChangedEvent) {\n const value = evt.value;\n this.callback(value);\n }\n else if (evt.type === 'wirecontextevent') {\n // TODO [#1357]: remove this branch\n return this.wiredElementHost.dispatchEvent(evt);\n }\n else {\n throw new Error(`Invalid event type ${evt.type}.`);\n }\n return false; // canceling signal since we don't want this to propagate\n },\n };\n }\n update(config) {\n if (this.isFirstUpdate) {\n // this is a special case for legacy wire adapters: when all the config params are undefined,\n // the config on the wire adapter should not be called until one of them changes.\n this.isFirstUpdate = false;\n if (!isEmptyConfig(config) && !isValidConfig(config, this.dynamicParamsNames)) {\n return;\n }\n }\n if (isUndefined(this.currentConfig) ||\n isDifferentConfig(config, this.currentConfig, this.dynamicParamsNames)) {\n this.currentConfig = config;\n forEach.call(this.configuring, (listener) => {\n listener.call(undefined, config);\n });\n }\n }\n connect() {\n forEach.call(this.connecting, (listener) => listener.call(undefined));\n }\n disconnect() {\n forEach.call(this.disconnecting, (listener) => listener.call(undefined));\n }\n}\n\nexport { ValueChangedEvent, register, registerWireService };\n/** version: 2.50.0 */\n//# sourceMappingURL=index.js.map\n"],"names":[],"mappings":";;;;;;IAAA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,SAAS,WAAW,CAAC,GAAG,EAAE;IAC1B,IAAI,OAAO,GAAG,KAAK,SAAS,CAAC;IAC7B,CAAC;IACD;AACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,MAAM,qBAAqB,GAAG,mBAAmB,CAAC;IAClD;IACA;IACA;IACA,MAAM,iBAAiB,CAAC;IACxB,IAAI,WAAW,CAAC,KAAK,EAAE;IACvB,QAAQ,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IAC1C,QAAQ,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IAC3B,KAAK;IACL,CAAC;AACD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,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,kBAAkB,CAAC,EAAE;IAC3F,gBAAgB,OAAO;IACvB,aAAa;IACb,SAAS;IACT,QAAQ,IAAI,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC;IAC3C,YAAY,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,kBAAkB,CAAC,EAAE;IACpF,YAAY,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;IACxC,YAAY,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,KAAK;IACzD,gBAAgB,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACjD,aAAa,CAAC,CAAC;IACf,SAAS;IACT,KAAK;IACL,IAAI,OAAO,GAAG;IACd,QAAQ,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,QAAQ,KAAK,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAC9E,KAAK;IACL,IAAI,UAAU,GAAG;IACjB,QAAQ,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,QAAQ,KAAK,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACjF,KAAK;IACL,CAAC;IAGD;;;;;;;;;;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
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 void 0===e}class n{constructor(e){this.type="ValueChangedEvent",this.value=e}}const{freeze:i,defineProperty:r,isExtensible:s}=Object;const{forEach:c,splice:a,indexOf:o}=Array.prototype,d="connect",l="disconnect",h="config";function u(e,t){const n=o.call(e,t);n>-1&&a.call(e,n,1)}class f{constructor(e){this.connecting=[],this.disconnecting=[],this.configuring=[],this.isFirstUpdate=!0,this.callback=e,this.wiredElementHost=e.$$DeprecatedWiredElementHostKey$$,this.dynamicParamsNames=e.$$DeprecatedWiredParamsMetaKey$$,this.eventTarget={addEventListener:(e,t)=>{switch(e){case d:this.connecting.push(t);break;case l:this.disconnecting.push(t);break;case h:this.configuring.push(t),void 0!==this.currentConfig&&t.call(void 0,this.currentConfig);break;default:throw new Error(`Invalid event type ${e}.`)}},removeEventListener:(e,t)=>{switch(e){case d:u(this.connecting,t);break;case l:u(this.disconnecting,t);break;case h:u(this.configuring,t);break;default:throw new Error(`Invalid event type ${e}.`)}},dispatchEvent:e=>{if(!(e instanceof n)){if("wirecontextevent"===e.type)return this.wiredElementHost.dispatchEvent(e);throw new Error(`Invalid event type ${e.type}.`)}{const t=e.value;this.callback(t)}return!1}}}update(e){var n,i;(!this.isFirstUpdate||(this.isFirstUpdate=!1,function(e){return 0===Object.keys(e).length}(e)||function(e,n){return 0===n.length||n.some((n=>!t(e[n])))}(e,this.dynamicParamsNames)))&&((t(this.currentConfig)||(n=e,i=this.currentConfig,this.dynamicParamsNames.some((e=>n[e]!==i[e]))))&&(this.currentConfig=e,c.call(this.configuring,(t=>{t.call(void 0,e)}))))}connect(){c.call(this.connecting,(e=>e.call(void 0)))}disconnect(){c.call(this.disconnecting,(e=>e.call(void 0)))}}e.ValueChangedEvent=n,e.register=function(e,t){if(null==e||!s(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");const n=class extends f{constructor(e){super(e),t(this.eventTarget)}};i(n),i(n.prototype),r(e,"adapter",{writable:!1,configurable:!1,value:n})},e.registerWireService=function(){}}));
|
|
2
|
-
//# sourceMappingURL=wire-service.min.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wire-service.min.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.WireService = {}));
|
|
5
|
-
})(this, (function (exports) { 'use strict';
|
|
6
|
-
|
|
7
|
-
/* proxy-compat-disable */
|
|
8
|
-
/**
|
|
9
|
-
* Copyright (C) 2023 salesforce.com, inc.
|
|
10
|
-
*/
|
|
11
|
-
/* proxy-compat-disable */
|
|
12
|
-
/**
|
|
13
|
-
* Copyright (C) 2023 salesforce.com, inc.
|
|
14
|
-
*/
|
|
15
|
-
/*
|
|
16
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
17
|
-
* All rights reserved.
|
|
18
|
-
* SPDX-License-Identifier: MIT
|
|
19
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
20
|
-
*/
|
|
21
|
-
function isUndefined(obj) {
|
|
22
|
-
return obj === undefined;
|
|
23
|
-
}
|
|
24
|
-
/** version: 2.50.0 */
|
|
25
|
-
|
|
26
|
-
/*
|
|
27
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
28
|
-
* All rights reserved.
|
|
29
|
-
* SPDX-License-Identifier: MIT
|
|
30
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
31
|
-
*/
|
|
32
|
-
const ValueChangedEventType = 'ValueChangedEvent';
|
|
33
|
-
/**
|
|
34
|
-
* Event fired by wire adapters to emit a new value.
|
|
35
|
-
*/
|
|
36
|
-
class ValueChangedEvent {
|
|
37
|
-
constructor(value) {
|
|
38
|
-
this.type = ValueChangedEventType;
|
|
39
|
-
this.value = value;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/*
|
|
44
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
45
|
-
* All rights reserved.
|
|
46
|
-
* SPDX-License-Identifier: MIT
|
|
47
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
48
|
-
*/
|
|
49
|
-
const { freeze, defineProperty, isExtensible } = Object;
|
|
50
|
-
// This value needs to be in sync with wiring.ts from @lwc/engine-core
|
|
51
|
-
const DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
|
|
52
|
-
const DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
|
|
53
|
-
/**
|
|
54
|
-
* Registers a wire adapter factory for Lightning Platform.
|
|
55
|
-
* @deprecated
|
|
56
|
-
*/
|
|
57
|
-
function register(adapterId, adapterEventTargetCallback) {
|
|
58
|
-
if (adapterId == null || !isExtensible(adapterId)) {
|
|
59
|
-
throw new TypeError('adapter id must be extensible');
|
|
60
|
-
}
|
|
61
|
-
if (typeof adapterEventTargetCallback !== 'function') {
|
|
62
|
-
throw new TypeError('adapter factory must be a callable');
|
|
63
|
-
}
|
|
64
|
-
if ('adapter' in adapterId) {
|
|
65
|
-
throw new TypeError('adapter id is already associated to an adapter factory');
|
|
66
|
-
}
|
|
67
|
-
const AdapterClass = class extends LegacyWireAdapterBridge {
|
|
68
|
-
constructor(dataCallback) {
|
|
69
|
-
super(dataCallback);
|
|
70
|
-
adapterEventTargetCallback(this.eventTarget);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
freeze(AdapterClass);
|
|
74
|
-
freeze(AdapterClass.prototype);
|
|
75
|
-
defineProperty(adapterId, 'adapter', {
|
|
76
|
-
writable: false,
|
|
77
|
-
configurable: false,
|
|
78
|
-
value: AdapterClass,
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Registers the wire service. noop
|
|
83
|
-
* @deprecated
|
|
84
|
-
*/
|
|
85
|
-
function registerWireService() { }
|
|
86
|
-
const { forEach, splice: ArraySplice, indexOf: ArrayIndexOf } = Array.prototype;
|
|
87
|
-
// wire event target life cycle connectedCallback hook event type
|
|
88
|
-
const CONNECT = 'connect';
|
|
89
|
-
// wire event target life cycle disconnectedCallback hook event type
|
|
90
|
-
const DISCONNECT = 'disconnect';
|
|
91
|
-
// wire event target life cycle config changed hook event type
|
|
92
|
-
const CONFIG = 'config';
|
|
93
|
-
function removeListener(listeners, toRemove) {
|
|
94
|
-
const idx = ArrayIndexOf.call(listeners, toRemove);
|
|
95
|
-
if (idx > -1) {
|
|
96
|
-
ArraySplice.call(listeners, idx, 1);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
function isEmptyConfig(config) {
|
|
100
|
-
return Object.keys(config).length === 0;
|
|
101
|
-
}
|
|
102
|
-
function isValidConfig(config, params) {
|
|
103
|
-
// The config is valid if there is no params, or if exist a param for which config[param] !== undefined.
|
|
104
|
-
return params.length === 0 || params.some((param) => !isUndefined(config[param]));
|
|
105
|
-
}
|
|
106
|
-
function isDifferentConfig(newConfig, oldConfig, params) {
|
|
107
|
-
return params.some((param) => newConfig[param] !== oldConfig[param]);
|
|
108
|
-
}
|
|
109
|
-
class LegacyWireAdapterBridge {
|
|
110
|
-
constructor(callback) {
|
|
111
|
-
this.connecting = [];
|
|
112
|
-
this.disconnecting = [];
|
|
113
|
-
this.configuring = [];
|
|
114
|
-
this.isFirstUpdate = true;
|
|
115
|
-
this.callback = callback;
|
|
116
|
-
this.wiredElementHost = callback[DeprecatedWiredElementHost];
|
|
117
|
-
this.dynamicParamsNames = callback[DeprecatedWiredParamsMeta];
|
|
118
|
-
this.eventTarget = {
|
|
119
|
-
addEventListener: (type, listener) => {
|
|
120
|
-
switch (type) {
|
|
121
|
-
case CONNECT: {
|
|
122
|
-
this.connecting.push(listener);
|
|
123
|
-
break;
|
|
124
|
-
}
|
|
125
|
-
case DISCONNECT: {
|
|
126
|
-
this.disconnecting.push(listener);
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
129
|
-
case CONFIG: {
|
|
130
|
-
this.configuring.push(listener);
|
|
131
|
-
if (this.currentConfig !== undefined) {
|
|
132
|
-
listener.call(undefined, this.currentConfig);
|
|
133
|
-
}
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
default:
|
|
137
|
-
throw new Error(`Invalid event type ${type}.`);
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
removeEventListener: (type, listener) => {
|
|
141
|
-
switch (type) {
|
|
142
|
-
case CONNECT: {
|
|
143
|
-
removeListener(this.connecting, listener);
|
|
144
|
-
break;
|
|
145
|
-
}
|
|
146
|
-
case DISCONNECT: {
|
|
147
|
-
removeListener(this.disconnecting, listener);
|
|
148
|
-
break;
|
|
149
|
-
}
|
|
150
|
-
case CONFIG: {
|
|
151
|
-
removeListener(this.configuring, listener);
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
154
|
-
default:
|
|
155
|
-
throw new Error(`Invalid event type ${type}.`);
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
dispatchEvent: (evt) => {
|
|
159
|
-
if (evt instanceof ValueChangedEvent) {
|
|
160
|
-
const value = evt.value;
|
|
161
|
-
this.callback(value);
|
|
162
|
-
}
|
|
163
|
-
else if (evt.type === 'wirecontextevent') {
|
|
164
|
-
// TODO [#1357]: remove this branch
|
|
165
|
-
return this.wiredElementHost.dispatchEvent(evt);
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
throw new Error(`Invalid event type ${evt.type}.`);
|
|
169
|
-
}
|
|
170
|
-
return false; // canceling signal since we don't want this to propagate
|
|
171
|
-
},
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
update(config) {
|
|
175
|
-
if (this.isFirstUpdate) {
|
|
176
|
-
// this is a special case for legacy wire adapters: when all the config params are undefined,
|
|
177
|
-
// the config on the wire adapter should not be called until one of them changes.
|
|
178
|
-
this.isFirstUpdate = false;
|
|
179
|
-
if (!isEmptyConfig(config) && !isValidConfig(config, this.dynamicParamsNames)) {
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
if (isUndefined(this.currentConfig) ||
|
|
184
|
-
isDifferentConfig(config, this.currentConfig, this.dynamicParamsNames)) {
|
|
185
|
-
this.currentConfig = config;
|
|
186
|
-
forEach.call(this.configuring, (listener) => {
|
|
187
|
-
listener.call(undefined, config);
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
connect() {
|
|
192
|
-
forEach.call(this.connecting, (listener) => listener.call(undefined));
|
|
193
|
-
}
|
|
194
|
-
disconnect() {
|
|
195
|
-
forEach.call(this.disconnecting, (listener) => listener.call(undefined));
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
/** version: 2.50.0 */
|
|
199
|
-
|
|
200
|
-
exports.ValueChangedEvent = ValueChangedEvent;
|
|
201
|
-
exports.register = register;
|
|
202
|
-
exports.registerWireService = registerWireService;
|
|
203
|
-
|
|
204
|
-
}));
|
|
205
|
-
//# sourceMappingURL=wire-service_debug.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wire-service_debug.js","sources":["../../../../../@lwc/wire-service/dist/index.js"],"sourcesContent":["/* proxy-compat-disable */\n/**\n * Copyright (C) 2023 salesforce.com, inc.\n */\n/* proxy-compat-disable */\n/**\n * Copyright (C) 2023 salesforce.com, inc.\n */\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\nfunction isUndefined(obj) {\n return obj === undefined;\n}\n/** version: 2.50.0 */\n\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\nconst ValueChangedEventType = 'ValueChangedEvent';\n/**\n * Event fired by wire adapters to emit a new value.\n */\nclass ValueChangedEvent {\n constructor(value) {\n this.type = ValueChangedEventType;\n this.value = value;\n }\n}\n\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\nconst { freeze, defineProperty, isExtensible } = Object;\n// This value needs to be in sync with wiring.ts from @lwc/engine-core\nconst DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';\nconst DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';\n/**\n * Registers a wire adapter factory for Lightning Platform.\n * @deprecated\n */\nfunction register(adapterId, adapterEventTargetCallback) {\n if (adapterId == null || !isExtensible(adapterId)) {\n throw new TypeError('adapter id must be extensible');\n }\n if (typeof adapterEventTargetCallback !== 'function') {\n throw new TypeError('adapter factory must be a callable');\n }\n if ('adapter' in adapterId) {\n throw new TypeError('adapter id is already associated to an adapter factory');\n }\n const AdapterClass = class extends LegacyWireAdapterBridge {\n constructor(dataCallback) {\n super(dataCallback);\n adapterEventTargetCallback(this.eventTarget);\n }\n };\n freeze(AdapterClass);\n freeze(AdapterClass.prototype);\n defineProperty(adapterId, 'adapter', {\n writable: false,\n configurable: false,\n value: AdapterClass,\n });\n}\n/**\n * Registers the wire service. noop\n * @deprecated\n */\nfunction registerWireService() { }\nconst { forEach, splice: ArraySplice, indexOf: ArrayIndexOf } = Array.prototype;\n// wire event target life cycle connectedCallback hook event type\nconst CONNECT = 'connect';\n// wire event target life cycle disconnectedCallback hook event type\nconst DISCONNECT = 'disconnect';\n// wire event target life cycle config changed hook event type\nconst CONFIG = 'config';\nfunction removeListener(listeners, toRemove) {\n const idx = ArrayIndexOf.call(listeners, toRemove);\n if (idx > -1) {\n ArraySplice.call(listeners, idx, 1);\n }\n}\nfunction isEmptyConfig(config) {\n return Object.keys(config).length === 0;\n}\nfunction isValidConfig(config, params) {\n // The config is valid if there is no params, or if exist a param for which config[param] !== undefined.\n return params.length === 0 || params.some((param) => !isUndefined(config[param]));\n}\nfunction isDifferentConfig(newConfig, oldConfig, params) {\n return params.some((param) => newConfig[param] !== oldConfig[param]);\n}\nclass LegacyWireAdapterBridge {\n constructor(callback) {\n this.connecting = [];\n this.disconnecting = [];\n this.configuring = [];\n this.isFirstUpdate = true;\n this.callback = callback;\n this.wiredElementHost = callback[DeprecatedWiredElementHost];\n this.dynamicParamsNames = callback[DeprecatedWiredParamsMeta];\n this.eventTarget = {\n addEventListener: (type, listener) => {\n switch (type) {\n case CONNECT: {\n this.connecting.push(listener);\n break;\n }\n case DISCONNECT: {\n this.disconnecting.push(listener);\n break;\n }\n case CONFIG: {\n this.configuring.push(listener);\n if (this.currentConfig !== undefined) {\n listener.call(undefined, this.currentConfig);\n }\n break;\n }\n default:\n throw new Error(`Invalid event type ${type}.`);\n }\n },\n removeEventListener: (type, listener) => {\n switch (type) {\n case CONNECT: {\n removeListener(this.connecting, listener);\n break;\n }\n case DISCONNECT: {\n removeListener(this.disconnecting, listener);\n break;\n }\n case CONFIG: {\n removeListener(this.configuring, listener);\n break;\n }\n default:\n throw new Error(`Invalid event type ${type}.`);\n }\n },\n dispatchEvent: (evt) => {\n if (evt instanceof ValueChangedEvent) {\n const value = evt.value;\n this.callback(value);\n }\n else if (evt.type === 'wirecontextevent') {\n // TODO [#1357]: remove this branch\n return this.wiredElementHost.dispatchEvent(evt);\n }\n else {\n throw new Error(`Invalid event type ${evt.type}.`);\n }\n return false; // canceling signal since we don't want this to propagate\n },\n };\n }\n update(config) {\n if (this.isFirstUpdate) {\n // this is a special case for legacy wire adapters: when all the config params are undefined,\n // the config on the wire adapter should not be called until one of them changes.\n this.isFirstUpdate = false;\n if (!isEmptyConfig(config) && !isValidConfig(config, this.dynamicParamsNames)) {\n return;\n }\n }\n if (isUndefined(this.currentConfig) ||\n isDifferentConfig(config, this.currentConfig, this.dynamicParamsNames)) {\n this.currentConfig = config;\n forEach.call(this.configuring, (listener) => {\n listener.call(undefined, config);\n });\n }\n }\n connect() {\n forEach.call(this.connecting, (listener) => listener.call(undefined));\n }\n disconnect() {\n forEach.call(this.disconnecting, (listener) => listener.call(undefined));\n }\n}\n\nexport { ValueChangedEvent, register, registerWireService };\n/** version: 2.50.0 */\n//# sourceMappingURL=index.js.map\n"],"names":[],"mappings":";;;;;;IAAA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,SAAS,WAAW,CAAC,GAAG,EAAE;IAC1B,IAAI,OAAO,GAAG,KAAK,SAAS,CAAC;IAC7B,CAAC;IACD;AACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,MAAM,qBAAqB,GAAG,mBAAmB,CAAC;IAClD;IACA;IACA;IACA,MAAM,iBAAiB,CAAC;IACxB,IAAI,WAAW,CAAC,KAAK,EAAE;IACvB,QAAQ,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IAC1C,QAAQ,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IAC3B,KAAK;IACL,CAAC;AACD;IACA;IACA;IACA;IACA;IACA;IACA;IACA,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC;IACxD;IACA,MAAM,0BAA0B,GAAG,mCAAmC,CAAC;IACvE,MAAM,yBAAyB,GAAG,kCAAkC,CAAC;IACrE;IACA;IACA;IACA;IACA,SAAS,QAAQ,CAAC,SAAS,EAAE,0BAA0B,EAAE;IACzD,IAAI,IAAI,SAAS,IAAI,IAAI,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE;IACvD,QAAQ,MAAM,IAAI,SAAS,CAAC,+BAA+B,CAAC,CAAC;IAC7D,KAAK;IACL,IAAI,IAAI,OAAO,0BAA0B,KAAK,UAAU,EAAE;IAC1D,QAAQ,MAAM,IAAI,SAAS,CAAC,oCAAoC,CAAC,CAAC;IAClE,KAAK;IACL,IAAI,IAAI,SAAS,IAAI,SAAS,EAAE;IAChC,QAAQ,MAAM,IAAI,SAAS,CAAC,wDAAwD,CAAC,CAAC;IACtF,KAAK;IACL,IAAI,MAAM,YAAY,GAAG,c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