@arcgis/lumina 4.33.0-next.124 → 4.33.0-next.126
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/{Controller-CZ8Djohh.js → Controller-B3mB4uaz.js} +173 -211
- package/dist/LitElement.d.ts +22 -18
- package/dist/config.d.ts +7 -9
- package/dist/config.js +15 -12
- package/dist/context.d.ts +2 -2
- package/dist/controllers/Controller.d.ts +4 -10
- package/dist/controllers/ControllerInternals.d.ts +7 -13
- package/dist/controllers/ControllerManager.d.ts +26 -22
- package/dist/controllers/accessor/index.d.ts +1 -1
- package/dist/controllers/accessor/index.js +177 -211
- package/dist/controllers/accessor/reEmitEvent.d.ts +1 -1
- package/dist/controllers/accessor/useAccessor.d.ts +29 -32
- package/dist/controllers/index.d.ts +2 -2
- package/dist/controllers/index.js +42 -39
- package/dist/controllers/trackKey.d.ts +1 -1
- package/dist/controllers/trackPropKey.d.ts +1 -1
- package/dist/controllers/trackPropertyKey.d.ts +2 -2
- package/dist/controllers/types.d.ts +35 -0
- package/dist/controllers/utils.d.ts +7 -9
- package/dist/hmrSupport.js +22 -22
- package/dist/index.d.ts +1 -1
- package/dist/index.js +186 -192
- package/dist/{utils-BdB9g3GU.js → lazyLoad-ByH-FaBP.js} +173 -185
- package/dist/lazyLoad.d.ts +22 -67
- package/dist/lifecycleSupport.d.ts +1 -1
- package/dist/makeRuntime.d.ts +23 -1
- package/dist/{proxyExports-CK5BLFLO.js → proxyExports-DQobuu44.js} +8 -8
- package/dist/render.d.ts +1 -1
- package/dist/utils.d.ts +8 -0
- package/package.json +2 -2
|
@@ -1,245 +1,209 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { p as proxyExports } from "../../proxyExports-
|
|
1
|
+
import { G as GenericController, l as trackPropKey, t as trackKey, r as retrieveComponent, f as createEventFactory } from "../../Controller-B3mB4uaz.js";
|
|
2
|
+
import { p as proxyExports } from "../../proxyExports-DQobuu44.js";
|
|
3
3
|
import { isEsriInternalEnv } from "@arcgis/components-utils";
|
|
4
4
|
import { watch, on } from "@arcgis/core/core/reactiveUtils.js";
|
|
5
|
-
|
|
5
|
+
import { createObservable, createTrackingTarget, runTracked, trackAccess } from "@arcgis/core/applications/Components/reactiveUtils.js";
|
|
6
|
+
const makeAccessorController = (createInstance, _options) => (component) => proxy(component, createInstance);
|
|
6
7
|
class AccessorController extends GenericController {
|
|
7
|
-
constructor(component,
|
|
8
|
+
constructor(component, createInstance) {
|
|
8
9
|
super(component);
|
|
9
|
-
this.
|
|
10
|
-
this
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
this.Y = /* @__PURE__ */ new Map();
|
|
11
|
+
this.#exportsObservable = createObservable();
|
|
12
|
+
const that = this;
|
|
13
|
+
that.#createInstance = createInstance;
|
|
14
|
+
that.Z();
|
|
15
|
+
component.manager.A = createTrackingTarget;
|
|
16
|
+
component.manager.B = runTracked;
|
|
17
|
+
that.setProvisionalExports(
|
|
18
|
+
makeBinderProxy(
|
|
15
19
|
component,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
new WeakRef(that),
|
|
21
|
+
component.M.length - 1,
|
|
22
|
+
that.instance,
|
|
23
|
+
that.Y
|
|
24
|
+
),
|
|
25
|
+
false
|
|
20
26
|
);
|
|
21
27
|
trackPropKey(
|
|
22
28
|
component,
|
|
23
29
|
(resolved) => {
|
|
24
30
|
if (resolved) {
|
|
25
|
-
|
|
31
|
+
const handle = watch(
|
|
32
|
+
// If the property to which controller is assigned is public, the user may
|
|
33
|
+
// manually create an accessor instance and assign it to this property
|
|
34
|
+
// We pick it up and replace our created accessor instance with user's.
|
|
35
|
+
() => component[resolved],
|
|
36
|
+
(newInstance) => {
|
|
37
|
+
if (newInstance === that.instance) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const oldInstance = that.instance;
|
|
41
|
+
that.exports = newInstance;
|
|
42
|
+
that.instance = newInstance;
|
|
43
|
+
that.Y.forEach(
|
|
44
|
+
(propName, propertyName) => component.requestUpdate(propName, oldInstance[propertyName])
|
|
45
|
+
);
|
|
46
|
+
if (that.#isInstanceOwner) {
|
|
47
|
+
oldInstance.destroy();
|
|
48
|
+
}
|
|
49
|
+
that.#isInstanceOwner = false;
|
|
50
|
+
},
|
|
51
|
+
{ sync: true }
|
|
52
|
+
);
|
|
53
|
+
that.onDestroy(handle.remove);
|
|
26
54
|
}
|
|
27
55
|
},
|
|
28
|
-
|
|
56
|
+
that.exports
|
|
29
57
|
);
|
|
30
58
|
}
|
|
31
|
-
|
|
32
|
-
|
|
59
|
+
#isInstanceOwner;
|
|
60
|
+
#exportsObservable;
|
|
61
|
+
#createInstance;
|
|
62
|
+
get exports() {
|
|
63
|
+
trackAccess(this.#exportsObservable);
|
|
64
|
+
return super.exports;
|
|
33
65
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const finalParameters = this._options?.editConstructorProperties?.call(component, parameters) ?? parameters;
|
|
38
|
-
const awaitedParameters = finalParameters instanceof Promise ? await finalParameters : finalParameters;
|
|
39
|
-
const genericComponent = component;
|
|
40
|
-
const existingInstance = typeof this._instancePropName === "string" ? genericComponent[this._instancePropName] : void 0;
|
|
41
|
-
const hasInstance = existingInstance != null && existingInstance !== this.exports;
|
|
42
|
-
if (hasInstance) {
|
|
43
|
-
this._instance = existingInstance;
|
|
44
|
-
existingInstance.set(awaitedParameters);
|
|
45
|
-
} else {
|
|
46
|
-
this._instance = await this._createInstance(awaitedParameters);
|
|
47
|
-
}
|
|
48
|
-
if (component.manager.destroyed) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
accessorSupport.watchComponentUpdates(this, this._instance, this._watchedProperties);
|
|
52
|
-
accessorSupport.watchAccessorUpdates(this, this._instance, this._watchedProperties);
|
|
53
|
-
this.exports = this._instance;
|
|
66
|
+
set exports(value) {
|
|
67
|
+
super.exports = value;
|
|
68
|
+
this.#exportsObservable.notify();
|
|
54
69
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
).filter(([, value]) => value !== void 0)
|
|
61
|
-
);
|
|
62
|
-
const props = process.env.NODE_ENV !== "production" && isEsriInternalEnv() ? filterWatchedProperties?.(this, data) ?? data : data;
|
|
63
|
-
return props;
|
|
70
|
+
/** @private */
|
|
71
|
+
Z() {
|
|
72
|
+
const that = this;
|
|
73
|
+
that.instance = "prototype" in that.#createInstance && "declaredClass" in that.#createInstance.prototype ? new that.#createInstance() : that.#createInstance();
|
|
74
|
+
that.#isInstanceOwner = true;
|
|
64
75
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return new this._loadAccessor(parameters);
|
|
68
|
-
} else {
|
|
69
|
-
return await this._loadAccessor(parameters);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
_isAccessorConstructor(loader) {
|
|
73
|
-
return "prototype" in loader && "declaredClass" in loader.prototype;
|
|
76
|
+
hostConnected() {
|
|
77
|
+
this.exports = this.instance;
|
|
74
78
|
}
|
|
79
|
+
// FEATURE: is there a way to detect that accessor does not need to be destroyed?
|
|
80
|
+
// Is it possible to write accessors that don't need to be destroyed?
|
|
75
81
|
hostDestroy() {
|
|
76
|
-
if (this
|
|
77
|
-
this.
|
|
82
|
+
if (this.#isInstanceOwner) {
|
|
83
|
+
this.instance.destroy?.();
|
|
78
84
|
}
|
|
79
85
|
}
|
|
80
|
-
async reCreate() {
|
|
81
|
-
this.hostDestroy();
|
|
82
|
-
await this.hostLoad();
|
|
83
|
-
}
|
|
84
86
|
}
|
|
85
87
|
const proxy = proxyExports(AccessorController);
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return trackKey(
|
|
109
|
-
component,
|
|
110
|
-
(resolved) => {
|
|
111
|
-
if (process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
|
|
112
|
-
if (resolved === void 0) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
const isFlippingBoolean = resolved.key.toLowerCase().includes("disable");
|
|
116
|
-
const collidesWithNativeProp = prop in HTMLElement.prototype;
|
|
117
|
-
const collidesWithCustomProp = allowedPropNameMismatches?.has(prop) === true;
|
|
118
|
-
if (resolved.key !== prop && !collidesWithNativeProp && !collidesWithCustomProp && !isFlippingBoolean) {
|
|
119
|
-
throw new Error(
|
|
120
|
-
`Tried to bind "${resolved?.key}" property to "${prop.toString()}" - property names must match`
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
if (!resolved.isReactive) {
|
|
124
|
-
throw new Error(
|
|
125
|
-
`For two-way binding with Accessor to work, the property on your component must have @property() or @state() decorator. "${prop.toString()}" has neither`
|
|
126
|
-
);
|
|
127
|
-
}
|
|
88
|
+
const makeBinderProxy = (component, accessorControllerRef, accessorControllerIndex, instance, boundProperties) => new Proxy(instance, {
|
|
89
|
+
get: (target, propertyName) => {
|
|
90
|
+
const value = target[propertyName];
|
|
91
|
+
if (
|
|
92
|
+
// Possibly called by the JS engine
|
|
93
|
+
typeof propertyName === "symbol" || // Already bound?
|
|
94
|
+
boundProperties.has(propertyName)
|
|
95
|
+
) {
|
|
96
|
+
return value;
|
|
97
|
+
}
|
|
98
|
+
return trackKey(
|
|
99
|
+
component,
|
|
100
|
+
(resolved) => {
|
|
101
|
+
if (resolved !== void 0) {
|
|
102
|
+
const propName = resolved.key;
|
|
103
|
+
boundProperties.set(propertyName, propName);
|
|
104
|
+
const descriptor = component.constructor.getPropertyOptions(
|
|
105
|
+
propName
|
|
106
|
+
);
|
|
107
|
+
if (process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
|
|
108
|
+
if (!(propertyName in instance)) {
|
|
109
|
+
throw new Error(`"${propertyName}" does not exist on the accessor instance`);
|
|
128
110
|
}
|
|
129
|
-
|
|
130
|
-
|
|
111
|
+
const accessorController = component.M[accessorControllerIndex];
|
|
112
|
+
if (descriptor.i !== void 0 && descriptor.i !== accessorControllerIndex) {
|
|
113
|
+
console.error(component.M[descriptor.i], accessorController);
|
|
114
|
+
throw Error(
|
|
115
|
+
`Expected property "${propName}" to be bound to the controller at index ${descriptor.i}, but tried to bind it to a controller at index ${accessorControllerIndex}. Double check whether you are calling useAccessor() conditionally in a way that is not supported.`
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
if (accessorController !== accessorControllerRef.deref()) {
|
|
119
|
+
console.error(accessorController);
|
|
120
|
+
throw Error(
|
|
121
|
+
`Expected controller at index ${accessorControllerIndex} to be instance of useAccessor but it is not.`
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
const isFlippingBoolean = resolved.key.toLowerCase().includes("disable");
|
|
125
|
+
const collidesWithNativeProp = propertyName in HTMLElement.prototype;
|
|
126
|
+
const collidesWithCustomProp = accessorControllerRef.deref().constructor.devOnly$allowedPropNameMismatches?.has(propName) === true;
|
|
127
|
+
if (resolved.key !== propertyName && !collidesWithNativeProp && !collidesWithCustomProp && !isFlippingBoolean) {
|
|
128
|
+
throw new Error(
|
|
129
|
+
`Tried to bind "${resolved?.key}" property to "${propertyName.toString()}" - property names must match`
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
if (!resolved.isReactive) {
|
|
133
|
+
throw new Error(
|
|
134
|
+
`For two-way binding with Accessor to work, the property on your component must have @property() or @state() decorator. "${propertyName.toString()}" has neither`
|
|
135
|
+
);
|
|
131
136
|
}
|
|
132
|
-
},
|
|
133
|
-
value
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
),
|
|
138
|
-
// Update Accessor on component prop change
|
|
139
|
-
watchComponentUpdates(controller, instance, watchedProperties) {
|
|
140
|
-
function getter(_value, propName) {
|
|
141
|
-
const propertyName = watchedProperties.get(propName);
|
|
142
|
-
const value = instance[propertyName];
|
|
143
|
-
const flipBoolean = typeof value === "boolean" && propertyName !== propName && propName.toLowerCase().includes("disable");
|
|
144
|
-
return flipBoolean ? !value : value;
|
|
145
|
-
}
|
|
146
|
-
const setter = (newValue, _oldValue, propName) => {
|
|
147
|
-
const propertyName = watchedProperties.get(propName);
|
|
148
|
-
const value = instance[propertyName];
|
|
149
|
-
const flipBoolean = typeof value === "boolean" && propertyName !== propName && propName.toLowerCase().includes("disable");
|
|
150
|
-
const currentValue = flipBoolean ? !value : value ?? void 0;
|
|
151
|
-
if (currentValue === newValue) {
|
|
152
|
-
return newValue;
|
|
153
|
-
}
|
|
154
|
-
instance[propertyName] = flipBoolean ? !newValue : newValue;
|
|
155
|
-
const finalValue = instance[propertyName];
|
|
156
|
-
return flipBoolean ? !finalValue : finalValue;
|
|
157
|
-
};
|
|
158
|
-
const manager = controller.component.manager;
|
|
159
|
-
watchedProperties.forEach((_propName, propertyName) => {
|
|
160
|
-
manager._accessorGetter[propertyName] = getter;
|
|
161
|
-
manager._accessorSetter[propertyName] = setter;
|
|
162
|
-
});
|
|
163
|
-
},
|
|
164
|
-
// Update component on Accessor prop change
|
|
165
|
-
watchAccessorUpdates(controller, instance, watchedProperties) {
|
|
166
|
-
const { component } = controller;
|
|
167
|
-
const genericComponent = component;
|
|
168
|
-
const genericInstance = instance;
|
|
169
|
-
const readonlyProps = findReadOnlyAccessorProps(instance);
|
|
170
|
-
if (process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
|
|
171
|
-
setReadonlyProps?.(controller, readonlyProps);
|
|
172
|
-
}
|
|
173
|
-
bypassGetter(
|
|
174
|
-
() => (
|
|
175
|
-
// Careful: Map's forEach callback arguments are (value, key), not (key, value)
|
|
176
|
-
watchedProperties.forEach((propertyName, propName) => {
|
|
177
|
-
if (process.env.NODE_ENV !== "production" && isEsriInternalEnv() && !(propertyName in instance)) {
|
|
178
|
-
throw new Error(`"${propertyName}" does not exist on the accessor instance`);
|
|
179
|
-
}
|
|
180
|
-
if (readonlyProps.has(propertyName)) {
|
|
181
|
-
return;
|
|
182
137
|
}
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
if (resolvedDomValue != null && modelValue !== resolvedDomValue) {
|
|
188
|
-
genericInstance[propertyName] = resolvedDomValue;
|
|
138
|
+
const shouldFlipBoolean = propertyName !== propName && propName.toLowerCase().includes("disable");
|
|
139
|
+
watchBoundProperty(accessorControllerRef, descriptor, propertyName, propName, shouldFlipBoolean);
|
|
140
|
+
if (descriptor.i === void 0) {
|
|
141
|
+
bindPropToProperty(descriptor, accessorControllerIndex, propertyName, shouldFlipBoolean);
|
|
189
142
|
}
|
|
190
|
-
}
|
|
191
|
-
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
value
|
|
192
146
|
);
|
|
193
|
-
controller.onLifecycle(() => {
|
|
194
|
-
if (instance.destroyed) {
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
return Array.from(
|
|
198
|
-
watchedProperties,
|
|
199
|
-
([propName, propertyName]) => watch(
|
|
200
|
-
() => genericInstance[propertyName],
|
|
201
|
-
() => {
|
|
202
|
-
const newValue = genericInstance[propertyName];
|
|
203
|
-
const flipBoolean = typeof newValue === "boolean" && propertyName !== propName && propName.toLowerCase().includes("disable");
|
|
204
|
-
const resolvedNewValue = flipBoolean ? !newValue : newValue;
|
|
205
|
-
bypassReadOnly(() => {
|
|
206
|
-
genericComponent[propName] = resolvedNewValue;
|
|
207
|
-
});
|
|
208
|
-
},
|
|
209
|
-
{ initial: true }
|
|
210
|
-
)
|
|
211
|
-
);
|
|
212
|
-
});
|
|
213
147
|
},
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
console.error("Unable to resolve the useAccessor controller from the provided value");
|
|
219
|
-
}
|
|
220
|
-
return;
|
|
148
|
+
set(_target, propertyName, newValue) {
|
|
149
|
+
if (boundProperties.has(propertyName) || // But some properties may be never bound, yet set in the constructor - let them through
|
|
150
|
+
newValue !== (instance[propertyName] ?? void 0)) {
|
|
151
|
+
instance[propertyName] = newValue;
|
|
221
152
|
}
|
|
222
|
-
|
|
153
|
+
return true;
|
|
223
154
|
}
|
|
155
|
+
});
|
|
156
|
+
const watchBoundProperty = (controllerRef, descriptor, propertyName, propName, shouldFlipBoolean, _handle) => _handle = watch(
|
|
157
|
+
() => {
|
|
158
|
+
const controller = controllerRef.deref();
|
|
159
|
+
return controller === void 0 || controller.component.manager.destroyed ? (
|
|
160
|
+
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
|
|
161
|
+
_handle = _handle.remove()
|
|
162
|
+
) : controller.exports[propertyName];
|
|
163
|
+
},
|
|
164
|
+
(_, oldValue) => {
|
|
165
|
+
if (!_handle) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const component = controllerRef.deref().component;
|
|
169
|
+
component?.requestUpdate(propName, shouldFlipBoolean ? !oldValue : oldValue);
|
|
170
|
+
descriptor.c = false;
|
|
171
|
+
},
|
|
172
|
+
// At present, since useAccessor initializes the Accessor instance without
|
|
173
|
+
// any properties, it assumes that there is no need to do initial sync of
|
|
174
|
+
// accessor properties to the component, especially since the component
|
|
175
|
+
// setter always gets the newest value from the Accessor instance anyway.
|
|
176
|
+
// We might wish to change that if view model is shared between multiple
|
|
177
|
+
// components and has default value for some property. Even then, this issue
|
|
178
|
+
// will only manifest itself in default value not being reflected to
|
|
179
|
+
// attribute (). If fixing above becomes important, can do so by adding
|
|
180
|
+
// `initial: true` here and updating the above code to only call .notify()
|
|
181
|
+
// if hasChanged returns true (see reference implementation in
|
|
182
|
+
// _handleInstanceChanged). Not doing so yet as it is an edge case that is
|
|
183
|
+
// easy to work around and proper fix will add overhead to the startup of
|
|
184
|
+
// each component.
|
|
185
|
+
{ sync: true }
|
|
186
|
+
);
|
|
187
|
+
const bindPropToProperty = (descriptor, accessorControllerIndex, propertyName, shouldFlipBoolean) => {
|
|
188
|
+
descriptor.d.get = function() {
|
|
189
|
+
const value = this.M[accessorControllerIndex]?.exports[propertyName];
|
|
190
|
+
return shouldFlipBoolean ? !value : value;
|
|
191
|
+
};
|
|
192
|
+
descriptor.d.set = function(newValue) {
|
|
193
|
+
this.M[accessorControllerIndex].exports[propertyName] = shouldFlipBoolean ? !newValue : newValue;
|
|
194
|
+
};
|
|
224
195
|
};
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
);
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
devOnlySetPersistentControllerData?.(controller, properties);
|
|
234
|
-
} : void 0;
|
|
235
|
-
const filterWatchedProperties = process.env.NODE_ENV !== "production" && isEsriInternalEnv() ? (controller, data) => {
|
|
236
|
-
const readonlyProperties = devOnlyGetPersistentControllerData?.(controller);
|
|
237
|
-
if (readonlyProperties instanceof Set) {
|
|
238
|
-
return Object.fromEntries(Object.entries(data).filter(([key]) => !readonlyProperties.has(key)));
|
|
196
|
+
const getAccessorControllerBoundProperties = (controller) => controller.Y;
|
|
197
|
+
const reCreateAccessor = (instance, component) => {
|
|
198
|
+
const accessorController = component.manager.useRefSync(instance);
|
|
199
|
+
accessorController?.hostDestroy();
|
|
200
|
+
accessorController?.Z();
|
|
201
|
+
accessorController?.hostConnected();
|
|
202
|
+
if (process.env.NODE_ENV !== "production" && accessorController === void 0) {
|
|
203
|
+
console.error("Unable to resolve the useAccessor controller from the provided value");
|
|
239
204
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
function reEmitEvent(getEventedAccessor, eventName) {
|
|
205
|
+
};
|
|
206
|
+
const reEmitEvent = (getEventedAccessor, eventName) => {
|
|
243
207
|
const component = retrieveComponent();
|
|
244
208
|
const manager = component.manager;
|
|
245
209
|
manager.onLoaded(() => manager.onLifecycle(() => on(getEventedAccessor, eventName, emitter.emit)));
|
|
@@ -250,10 +214,12 @@ function reEmitEvent(getEventedAccessor, eventName) {
|
|
|
250
214
|
}
|
|
251
215
|
}
|
|
252
216
|
return emitter;
|
|
253
|
-
}
|
|
217
|
+
};
|
|
254
218
|
export {
|
|
255
219
|
AccessorController,
|
|
256
|
-
|
|
220
|
+
getAccessorControllerBoundProperties,
|
|
257
221
|
makeAccessorController,
|
|
222
|
+
makeBinderProxy,
|
|
223
|
+
reCreateAccessor,
|
|
258
224
|
reEmitEvent
|
|
259
225
|
};
|
|
@@ -7,4 +7,4 @@ import { EventEmitter } from '../../createEvent';
|
|
|
7
7
|
* arcgisGo = reEmitEvent<__esri.HomeViewModelGoEvent>(() => this.viewModel, "go");
|
|
8
8
|
* ```
|
|
9
9
|
*/
|
|
10
|
-
export declare
|
|
10
|
+
export declare const reEmitEvent: <T>(getEventedAccessor: () => __esri.Evented, eventName: string) => EventEmitter<T>;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { Controller, GenericController } from '../Controller';
|
|
2
2
|
import { LitElement } from '../../LitElement';
|
|
3
|
-
type Requires<Props, Accessor extends __esri.Accessor> = LitElement & Pick<Accessor, keyof Accessor & keyof Props> & {
|
|
3
|
+
type Requires<Props, Accessor extends __esri.Accessor, OmitProps extends string = never> = LitElement & Omit<Pick<Accessor, keyof Accessor & keyof Props>, AlwaysOmit | OmitProps> & {
|
|
4
4
|
autoDestroyDisabled: boolean;
|
|
5
5
|
destroy: () => Promise<void>;
|
|
6
6
|
};
|
|
7
|
+
type AlwaysOmit = "addHandles" | "declaredClass" | "destroyed" | "hasHandles" | "initialized" | "removeHandles" | "set" | "watch";
|
|
7
8
|
/**
|
|
8
9
|
* Given an Accessor class, create a controller that will do two-way binding of
|
|
9
|
-
* props between the component and the Accessor
|
|
10
|
+
* props between the component and the Accessor.
|
|
10
11
|
*
|
|
11
|
-
* See
|
|
12
|
+
* See https://qawebgis.esri.com/components/lumina/controllers/useAccessor for
|
|
13
|
+
* documentation & examples.
|
|
12
14
|
*/
|
|
13
|
-
export declare const makeAccessorController: <Props, Accessor extends __esri.Accessor, OmitProps extends string = never>(
|
|
15
|
+
export declare const makeAccessorController: <Props, Accessor extends __esri.Accessor, OmitProps extends string = never>(createInstance: ((props?: Props) => Accessor) | (new (props?: Props) => Accessor), _options?: {
|
|
14
16
|
/**
|
|
15
17
|
* By default, to ensure that you didn't accidentally forget to bind any
|
|
16
18
|
* of the Accessor's properties on your component, every property that
|
|
@@ -35,40 +37,35 @@ export declare const makeAccessorController: <Props, Accessor extends __esri.Acc
|
|
|
35
37
|
* `makeAccessorController(..., {} as { omitProps: ["propName"] })`
|
|
36
38
|
*/
|
|
37
39
|
omitProps: OmitProps[];
|
|
38
|
-
}) => (component: Requires<
|
|
39
|
-
editConstructorProperties(props: Props): Promise<Props> | Props;
|
|
40
|
-
}) => Accessor;
|
|
40
|
+
}) => (component: Requires<Props, Accessor, OmitProps>) => Accessor;
|
|
41
41
|
export declare class AccessorController<Props, Accessor extends __esri.Accessor, ExtraRequires = Record<never, never>> extends GenericController<Accessor, ExtraRequires & Requires<Props, Accessor>> {
|
|
42
|
-
private
|
|
43
|
-
|
|
44
|
-
protected _instance: Accessor;
|
|
45
|
-
protected _watchedProperties: Map<string, string & keyof Props>;
|
|
46
|
-
private _instancePropName;
|
|
47
|
-
private _isBinding;
|
|
42
|
+
#private;
|
|
43
|
+
protected instance: Accessor;
|
|
48
44
|
/**
|
|
49
|
-
* (
|
|
50
|
-
*
|
|
45
|
+
* Use getAccessorControllerBoundProperties() helper to get access to this map
|
|
46
|
+
* @private
|
|
47
|
+
*/
|
|
48
|
+
_boundAccessorProperties: Map<string & keyof Accessor, string>;
|
|
49
|
+
/**
|
|
50
|
+
* (development only) Allow these props to mismatch the name of the Accessor's
|
|
51
|
+
* property to avoid collisions
|
|
51
52
|
*
|
|
52
53
|
* @private
|
|
53
54
|
*/
|
|
54
|
-
static allowedPropNameMismatches?:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
static devOnly$allowedPropNameMismatches?: ReadonlySet<string>;
|
|
56
|
+
get exports(): Accessor;
|
|
57
|
+
set exports(value: Accessor);
|
|
58
|
+
constructor(component: ExtraRequires & Requires<Props, Accessor>, createInstance: ((props?: Props) => Accessor) | (new (props?: Props) => Accessor));
|
|
59
|
+
/** @private */
|
|
60
|
+
_createAccessorInstance(): void;
|
|
58
61
|
hostConnected(): void;
|
|
59
|
-
hostLoad(): Promise<void>;
|
|
60
|
-
private _gatherParameters;
|
|
61
|
-
private _createInstance;
|
|
62
|
-
private _isAccessorConstructor;
|
|
63
62
|
hostDestroy(): void;
|
|
64
|
-
reCreate(): Promise<void>;
|
|
65
63
|
}
|
|
66
|
-
export declare const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
};
|
|
64
|
+
export declare const makeBinderProxy: (component: LitElement, accessorControllerRef: WeakRef<Pick<Controller<__esri.Accessor>, "component" | "exports"> & {
|
|
65
|
+
constructor: (typeof __esri.Accessor)["constructor"] & {
|
|
66
|
+
devOnly$allowedPropNameMismatches?: ReadonlySet<string>;
|
|
67
|
+
};
|
|
68
|
+
}>, accessorControllerIndex: number, instance: __esri.Accessor, boundProperties: Map<string, string>) => unknown;
|
|
69
|
+
export declare const getAccessorControllerBoundProperties: <Accessor extends __esri.Accessor>(controller: AccessorController<unknown, Accessor>) => Map<string & keyof Accessor, string>;
|
|
70
|
+
export declare const reCreateAccessor: (instance: __esri.Accessor, component: LitElement) => void;
|
|
74
71
|
export {};
|
|
@@ -2,7 +2,7 @@ import { EventEmitter as _EventEmitter } from '../createEvent';
|
|
|
2
2
|
export type { GenericControllerType } from './Controller';
|
|
3
3
|
export { Controller, GenericController } from './Controller';
|
|
4
4
|
export type { ControllerManager } from './ControllerManager';
|
|
5
|
-
export { retrieveComponent,
|
|
5
|
+
export { retrieveComponent, bypassSetter, bypassReadOnly } from './ControllerInternals';
|
|
6
6
|
export { trackPropertyKey, keyTrackResolve } from './trackPropertyKey';
|
|
7
7
|
export { trackPropKey } from './trackPropKey';
|
|
8
8
|
export { trackKey } from './trackKey';
|
|
@@ -17,7 +17,7 @@ export { useDirection } from './useDirection';
|
|
|
17
17
|
export type { UseT9n, T9nMeta } from './useT9n';
|
|
18
18
|
export { makeT9nController } from './useT9n';
|
|
19
19
|
export { usePropertyChange } from './usePropertyChange';
|
|
20
|
-
export { isController } from './utils';
|
|
20
|
+
export { isController, getControllersCount } from './utils';
|
|
21
21
|
/**
|
|
22
22
|
* @deprecated import from "@arcgis/lumina" instead
|
|
23
23
|
*/
|