@arcgis/lumina 4.33.0-next.124 → 4.33.0-next.125
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 +20 -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 +6 -21
- package/dist/controllers/accessor/index.d.ts +1 -1
- package/dist/controllers/accessor/index.js +175 -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 +30 -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 +160 -192
- package/dist/{utils-BdB9g3GU.js → lazyLoad-DcVuFccH.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,207 @@
|
|
|
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, 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
|
+
that.setProvisionalExports(
|
|
16
|
+
makeBinderProxy(
|
|
15
17
|
component,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
new WeakRef(that),
|
|
19
|
+
component.M.length - 1,
|
|
20
|
+
that.instance,
|
|
21
|
+
that.Y
|
|
22
|
+
),
|
|
23
|
+
false
|
|
20
24
|
);
|
|
21
25
|
trackPropKey(
|
|
22
26
|
component,
|
|
23
27
|
(resolved) => {
|
|
24
28
|
if (resolved) {
|
|
25
|
-
|
|
29
|
+
const handle = watch(
|
|
30
|
+
// If the property to which controller is assigned is public, the user may
|
|
31
|
+
// manually create an accessor instance and assign it to this property
|
|
32
|
+
// We pick it up and replace our created accessor instance with user's.
|
|
33
|
+
() => component[resolved],
|
|
34
|
+
(newInstance) => {
|
|
35
|
+
if (newInstance === that.instance) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const oldInstance = that.instance;
|
|
39
|
+
that.exports = newInstance;
|
|
40
|
+
that.instance = newInstance;
|
|
41
|
+
that.Y.forEach(
|
|
42
|
+
(propName, propertyName) => component.requestUpdate(propName, oldInstance[propertyName])
|
|
43
|
+
);
|
|
44
|
+
if (that.#isInstanceOwner) {
|
|
45
|
+
oldInstance.destroy();
|
|
46
|
+
}
|
|
47
|
+
that.#isInstanceOwner = false;
|
|
48
|
+
},
|
|
49
|
+
{ sync: true }
|
|
50
|
+
);
|
|
51
|
+
that.onDestroy(handle.remove);
|
|
26
52
|
}
|
|
27
53
|
},
|
|
28
|
-
|
|
54
|
+
that.exports
|
|
29
55
|
);
|
|
30
56
|
}
|
|
31
|
-
|
|
32
|
-
|
|
57
|
+
#isInstanceOwner;
|
|
58
|
+
#exportsObservable;
|
|
59
|
+
#createInstance;
|
|
60
|
+
get exports() {
|
|
61
|
+
trackAccess(this.#exportsObservable);
|
|
62
|
+
return super.exports;
|
|
33
63
|
}
|
|
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;
|
|
64
|
+
set exports(value) {
|
|
65
|
+
super.exports = value;
|
|
66
|
+
this.#exportsObservable.notify();
|
|
54
67
|
}
|
|
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;
|
|
68
|
+
/** @private */
|
|
69
|
+
Z() {
|
|
70
|
+
const that = this;
|
|
71
|
+
that.instance = "prototype" in that.#createInstance && "declaredClass" in that.#createInstance.prototype ? new that.#createInstance() : that.#createInstance();
|
|
72
|
+
that.#isInstanceOwner = true;
|
|
64
73
|
}
|
|
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;
|
|
74
|
+
hostConnected() {
|
|
75
|
+
this.exports = this.instance;
|
|
74
76
|
}
|
|
77
|
+
// FEATURE: is there a way to detect that accessor does not need to be destroyed?
|
|
78
|
+
// Is it possible to write accessors that don't need to be destroyed?
|
|
75
79
|
hostDestroy() {
|
|
76
|
-
if (this
|
|
77
|
-
this.
|
|
80
|
+
if (this.#isInstanceOwner) {
|
|
81
|
+
this.instance.destroy?.();
|
|
78
82
|
}
|
|
79
83
|
}
|
|
80
|
-
async reCreate() {
|
|
81
|
-
this.hostDestroy();
|
|
82
|
-
await this.hostLoad();
|
|
83
|
-
}
|
|
84
84
|
}
|
|
85
85
|
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
|
-
}
|
|
86
|
+
const makeBinderProxy = (component, accessorControllerRef, accessorControllerIndex, instance, boundProperties) => new Proxy(instance, {
|
|
87
|
+
get: (target, propertyName) => {
|
|
88
|
+
const value = target[propertyName];
|
|
89
|
+
if (
|
|
90
|
+
// Possibly called by the JS engine
|
|
91
|
+
typeof propertyName === "symbol" || // Already bound?
|
|
92
|
+
boundProperties.has(propertyName)
|
|
93
|
+
) {
|
|
94
|
+
return value;
|
|
95
|
+
}
|
|
96
|
+
return trackKey(
|
|
97
|
+
component,
|
|
98
|
+
(resolved) => {
|
|
99
|
+
if (resolved !== void 0) {
|
|
100
|
+
const propName = resolved.key;
|
|
101
|
+
boundProperties.set(propertyName, propName);
|
|
102
|
+
const descriptor = component.constructor.getPropertyOptions(
|
|
103
|
+
propName
|
|
104
|
+
);
|
|
105
|
+
if (process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
|
|
106
|
+
if (!(propertyName in instance)) {
|
|
107
|
+
throw new Error(`"${propertyName}" does not exist on the accessor instance`);
|
|
128
108
|
}
|
|
129
|
-
|
|
130
|
-
|
|
109
|
+
const accessorController = component.M[accessorControllerIndex];
|
|
110
|
+
if (descriptor.i !== void 0 && descriptor.i !== accessorControllerIndex) {
|
|
111
|
+
console.error(component.M[descriptor.i], accessorController);
|
|
112
|
+
throw Error(
|
|
113
|
+
`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.`
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
if (accessorController !== accessorControllerRef.deref()) {
|
|
117
|
+
console.error(accessorController);
|
|
118
|
+
throw Error(
|
|
119
|
+
`Expected controller at index ${accessorControllerIndex} to be instance of useAccessor but it is not.`
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
const isFlippingBoolean = resolved.key.toLowerCase().includes("disable");
|
|
123
|
+
const collidesWithNativeProp = propertyName in HTMLElement.prototype;
|
|
124
|
+
const collidesWithCustomProp = accessorControllerRef.deref().constructor.devOnly$allowedPropNameMismatches?.has(propName) === true;
|
|
125
|
+
if (resolved.key !== propertyName && !collidesWithNativeProp && !collidesWithCustomProp && !isFlippingBoolean) {
|
|
126
|
+
throw new Error(
|
|
127
|
+
`Tried to bind "${resolved?.key}" property to "${propertyName.toString()}" - property names must match`
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
if (!resolved.isReactive) {
|
|
131
|
+
throw new Error(
|
|
132
|
+
`For two-way binding with Accessor to work, the property on your component must have @property() or @state() decorator. "${propertyName.toString()}" has neither`
|
|
133
|
+
);
|
|
131
134
|
}
|
|
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
135
|
}
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
if (resolvedDomValue != null && modelValue !== resolvedDomValue) {
|
|
188
|
-
genericInstance[propertyName] = resolvedDomValue;
|
|
136
|
+
const shouldFlipBoolean = propertyName !== propName && propName.toLowerCase().includes("disable");
|
|
137
|
+
watchBoundProperty(accessorControllerRef, descriptor, propertyName, propName, shouldFlipBoolean);
|
|
138
|
+
if (descriptor.i === void 0) {
|
|
139
|
+
bindPropToProperty(descriptor, accessorControllerIndex, propertyName, shouldFlipBoolean);
|
|
189
140
|
}
|
|
190
|
-
}
|
|
191
|
-
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
value
|
|
192
144
|
);
|
|
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
145
|
},
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
console.error("Unable to resolve the useAccessor controller from the provided value");
|
|
219
|
-
}
|
|
220
|
-
return;
|
|
146
|
+
set(_target, propertyName, newValue) {
|
|
147
|
+
if (boundProperties.has(propertyName) || // But some properties may be never bound, yet set in the constructor - let them through
|
|
148
|
+
newValue !== (instance[propertyName] ?? void 0)) {
|
|
149
|
+
instance[propertyName] = newValue;
|
|
221
150
|
}
|
|
222
|
-
|
|
151
|
+
return true;
|
|
223
152
|
}
|
|
153
|
+
});
|
|
154
|
+
const watchBoundProperty = (controllerRef, descriptor, propertyName, propName, shouldFlipBoolean, _handle) => _handle = watch(
|
|
155
|
+
() => {
|
|
156
|
+
const controller = controllerRef.deref();
|
|
157
|
+
return controller === void 0 || controller.component.manager.destroyed ? (
|
|
158
|
+
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
|
|
159
|
+
_handle = _handle.remove()
|
|
160
|
+
) : controller.exports[propertyName];
|
|
161
|
+
},
|
|
162
|
+
(_, oldValue) => {
|
|
163
|
+
if (!_handle) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
const component = controllerRef.deref().component;
|
|
167
|
+
component?.requestUpdate(propName, shouldFlipBoolean ? !oldValue : oldValue);
|
|
168
|
+
descriptor.c = false;
|
|
169
|
+
},
|
|
170
|
+
// At present, since useAccessor initializes the Accessor instance without
|
|
171
|
+
// any properties, it assumes that there is no need to do initial sync of
|
|
172
|
+
// accessor properties to the component, especially since the component
|
|
173
|
+
// setter always gets the newest value from the Accessor instance anyway.
|
|
174
|
+
// We might wish to change that if view model is shared between multiple
|
|
175
|
+
// components and has default value for some property. Even then, this issue
|
|
176
|
+
// will only manifest itself in default value not being reflected to
|
|
177
|
+
// attribute (). If fixing above becomes important, can do so by adding
|
|
178
|
+
// `initial: true` here and updating the above code to only call .notify()
|
|
179
|
+
// if hasChanged returns true (see reference implementation in
|
|
180
|
+
// _handleInstanceChanged). Not doing so yet as it is an edge case that is
|
|
181
|
+
// easy to work around and proper fix will add overhead to the startup of
|
|
182
|
+
// each component.
|
|
183
|
+
{ sync: true }
|
|
184
|
+
);
|
|
185
|
+
const bindPropToProperty = (descriptor, accessorControllerIndex, propertyName, shouldFlipBoolean) => {
|
|
186
|
+
descriptor.d.get = function() {
|
|
187
|
+
const value = this.M[accessorControllerIndex]?.exports[propertyName];
|
|
188
|
+
return shouldFlipBoolean ? !value : value;
|
|
189
|
+
};
|
|
190
|
+
descriptor.d.set = function(newValue) {
|
|
191
|
+
this.M[accessorControllerIndex].exports[propertyName] = shouldFlipBoolean ? !newValue : newValue;
|
|
192
|
+
};
|
|
224
193
|
};
|
|
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)));
|
|
194
|
+
const getAccessorControllerBoundProperties = (controller) => controller.Y;
|
|
195
|
+
const reCreateAccessor = (instance, component) => {
|
|
196
|
+
const accessorController = component.manager.useRefSync(instance);
|
|
197
|
+
accessorController?.hostDestroy();
|
|
198
|
+
accessorController?.Z();
|
|
199
|
+
accessorController?.hostConnected();
|
|
200
|
+
if (process.env.NODE_ENV !== "production" && accessorController === void 0) {
|
|
201
|
+
console.error("Unable to resolve the useAccessor controller from the provided value");
|
|
239
202
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
function reEmitEvent(getEventedAccessor, eventName) {
|
|
203
|
+
};
|
|
204
|
+
const reEmitEvent = (getEventedAccessor, eventName) => {
|
|
243
205
|
const component = retrieveComponent();
|
|
244
206
|
const manager = component.manager;
|
|
245
207
|
manager.onLoaded(() => manager.onLifecycle(() => on(getEventedAccessor, eventName, emitter.emit)));
|
|
@@ -250,10 +212,12 @@ function reEmitEvent(getEventedAccessor, eventName) {
|
|
|
250
212
|
}
|
|
251
213
|
}
|
|
252
214
|
return emitter;
|
|
253
|
-
}
|
|
215
|
+
};
|
|
254
216
|
export {
|
|
255
217
|
AccessorController,
|
|
256
|
-
|
|
218
|
+
getAccessorControllerBoundProperties,
|
|
257
219
|
makeAccessorController,
|
|
220
|
+
makeBinderProxy,
|
|
221
|
+
reCreateAccessor,
|
|
258
222
|
reEmitEvent
|
|
259
223
|
};
|
|
@@ -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
|
*/
|