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