@arcgis/lumina 4.33.0-next.97 → 4.33.0-next.99

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 (34) hide show
  1. package/dist/{useWatch-CFtSpNnN.js → Controller-CZ8Djohh.js} +70 -368
  2. package/dist/LitElement.d.ts +33 -25
  3. package/dist/context.d.ts +12 -2
  4. package/dist/controllers/Controller.d.ts +18 -17
  5. package/dist/controllers/ControllerInternals.d.ts +19 -12
  6. package/dist/controllers/ControllerManager.d.ts +62 -42
  7. package/dist/controllers/accessor/index.js +12 -60
  8. package/dist/controllers/accessor/reEmitEvent.d.ts +1 -5
  9. package/dist/controllers/accessor/useAccessor.d.ts +6 -7
  10. package/dist/controllers/functional.d.ts +4 -4
  11. package/dist/controllers/index.d.ts +6 -5
  12. package/dist/controllers/index.js +35 -55
  13. package/dist/controllers/proxyExports.d.ts +1 -1
  14. package/dist/controllers/trackKey.d.ts +4 -4
  15. package/dist/controllers/trackPropKey.d.ts +6 -6
  16. package/dist/controllers/trackPropertyKey.d.ts +8 -7
  17. package/dist/controllers/types.d.ts +15 -45
  18. package/dist/controllers/usePropertyChange.d.ts +4 -3
  19. package/dist/controllers/useT9n.d.ts +1 -1
  20. package/dist/createEvent.d.ts +7 -2
  21. package/dist/hmrSupport.js +1 -1
  22. package/dist/index.d.ts +1 -1
  23. package/dist/index.js +331 -14
  24. package/dist/lazyLoad.d.ts +14 -14
  25. package/dist/proxyExports-CK5BLFLO.js +60 -0
  26. package/dist/{utils-GhKD5Lo-.js → utils-DBdf1Dqp.js} +4 -12
  27. package/package.json +2 -2
  28. package/dist/ControllerManager-B2comd8J.js +0 -310
  29. package/dist/controllers/ComponentInternals.d.ts +0 -92
  30. package/dist/controllers/framework.d.ts +0 -45
  31. package/dist/controllers/getSet.d.ts +0 -116
  32. package/dist/controllers/readonly.d.ts +0 -29
  33. package/dist/controllers/useWatch.d.ts +0 -27
  34. package/dist/proxyExports-Dl5CHmHQ.js +0 -150
@@ -1,13 +1,10 @@
1
- import { isEsriInternalEnv, safeCall, isNotUndefined, Deferred, safeAsyncCall } from "@arcgis/components-utils";
1
+ import { isEsriInternalEnv, safeCall, Deferred, safeAsyncCall } from "@arcgis/components-utils";
2
+ import { nothing } from "lit";
2
3
  const controllerSymbol = Symbol.for("controller");
3
4
  const name = "@arcgis/lumina";
4
5
  const isController = (value) => typeof value === "object" && value !== null && (controllerSymbol in value || "hostConnected" in value || "hostDisconnected" in value || "hostUpdate" in value || "hostUpdated" in value);
5
6
  const devOnlySetPersistentControllerData = process.env.NODE_ENV !== "production" && isEsriInternalEnv() ? (controller, data) => {
6
- const manager = controller.component.manager;
7
- const controllers = "_controllers" in manager ? manager._controllers : void 0;
8
- if (controllers === void 0) {
9
- return void 0;
10
- }
7
+ const controllers = controller.component._controllers;
11
8
  const index = Array.from(controllers).indexOf(controller);
12
9
  if (index === -1) {
13
10
  return;
@@ -132,7 +129,7 @@ const useRef = async (value) => {
132
129
  };
133
130
  const useRefSync = (value) => {
134
131
  const component = retrieveComponent();
135
- const controller = component.manager.internals.resolveExports(value);
132
+ const controller = component.manager._resolveExports(value);
136
133
  if (controller !== void 0) {
137
134
  return controller;
138
135
  }
@@ -145,12 +142,25 @@ const useRefSync = (value) => {
145
142
  }
146
143
  return void 0;
147
144
  };
148
- const shouldBypass = {
149
- setter: false,
150
- getter: false,
151
- readOnly: false
152
- };
153
- const elementToInstance = /* @__PURE__ */ new WeakMap();
145
+ let shouldBypassGetter = false;
146
+ let shouldBypassReadOnly = false;
147
+ function bypassReadOnly(callback) {
148
+ shouldBypassReadOnly = true;
149
+ try {
150
+ return callback();
151
+ } finally {
152
+ shouldBypassReadOnly = false;
153
+ }
154
+ }
155
+ const bypassSetter = bypassReadOnly;
156
+ function bypassGetter(callback) {
157
+ shouldBypassGetter = true;
158
+ try {
159
+ return callback();
160
+ } finally {
161
+ shouldBypassGetter = false;
162
+ }
163
+ }
154
164
  function trackPropertyKey(object, onResolved, defaultValue) {
155
165
  const keys = Object.keys(object);
156
166
  const keyCount = keys.length;
@@ -183,280 +193,22 @@ function trackPropertyKey(object, onResolved, defaultValue) {
183
193
  }
184
194
  let keyTrackMap = void 0;
185
195
  function keyTrackResolve() {
186
- Array.from(keyTrackMap?.entries() ?? []).forEach(([object, { callbacks }]) => {
196
+ keyTrackMap?.forEach(({ callbacks }, object) => {
187
197
  const keys = Object.keys(object);
188
198
  callbacks.forEach((commit) => commit(keys));
189
199
  });
190
200
  keyTrackMap = void 0;
191
201
  }
192
- var PropTypes = /* @__PURE__ */ ((PropTypes2) => {
193
- PropTypes2[PropTypes2["String"] = 1] = "String";
194
- PropTypes2[PropTypes2["Number"] = 2] = "Number";
195
- PropTypes2[PropTypes2["Boolean"] = 4] = "Boolean";
196
- PropTypes2[PropTypes2["Any"] = 8] = "Any";
197
- PropTypes2[PropTypes2["Unknown"] = 16] = "Unknown";
198
- PropTypes2[PropTypes2["State"] = 32] = "State";
199
- PropTypes2[PropTypes2["Method"] = 64] = "Method";
200
- PropTypes2[PropTypes2["Event"] = 128] = "Event";
201
- PropTypes2[PropTypes2["Element"] = 256] = "Element";
202
- PropTypes2[PropTypes2["ReflectAttr"] = 512] = "ReflectAttr";
203
- PropTypes2[PropTypes2["Mutable"] = 1024] = "Mutable";
204
- PropTypes2[PropTypes2["Prop"] = 31] = "Prop";
205
- PropTypes2[PropTypes2["HasAttribute"] = 15] = "HasAttribute";
206
- PropTypes2[PropTypes2["PropLike"] = 63] = "PropLike";
207
- PropTypes2[PropTypes2["ReadOnly"] = 2048] = "ReadOnly";
208
- return PropTypes2;
209
- })(PropTypes || {});
210
- function retrieveComponentMembers(component, isLit) {
211
- if (isLit) {
212
- const elementProperties = component.constructor.elementProperties;
213
- component.manager.internals.members = Object.fromEntries(
214
- Array.from(
215
- elementProperties,
216
- ([name2, descriptor]) => descriptor.noAccessor ? void 0 : [
217
- name2,
218
- [
219
- (descriptor.readOnly ? 2048 : 0) | (descriptor.state ? 32 : 16)
220
- ]
221
- ]
222
- ).filter(isNotUndefined)
223
- );
224
- } else {
225
- const constructor = component.constructor;
226
- const members = constructor.__registerControllers?.(component) ?? void 0;
227
- constructor.__registerControllers = void 0;
228
- if (typeof members !== "object") {
229
- throw new Error(
230
- process.env.NODE_ENV !== "production" && isEsriInternalEnv() ? "Failed to retrieve internal component meta. Make sure you have the useComponentsControllers() Rollup Plugin for Stencil Controllers configured in your Stencil config." : "Failed to retrieve component meta"
231
- );
232
- }
233
- component.manager.internals.members = Object.fromEntries(
234
- Object.entries(members).filter(([_name, [propType]]) => (propType & 63) !== 0)
235
- );
236
- }
237
- }
238
- function parsePropertyValue(value, type = 8) {
239
- const isComplex = value == null || typeof value === "object" || typeof value === "function";
240
- if (isComplex) {
241
- return value;
242
- }
243
- if ((type & 4) !== 0) {
244
- return value === "false" ? false : value === "" || !!value;
245
- } else if ((type & 2) !== 0) {
246
- return Number.parseFloat(value);
247
- } else if ((type & 1) !== 0) {
248
- return String(value);
249
- } else {
250
- return value;
251
- }
252
- }
253
- const getMemberType = (component, name2) => component.manager.internals.members?.[name2]?.[0];
254
- class ComponentInternals {
255
- constructor(component) {
256
- this.enabledWatchers = {};
257
- this.allWatchers = {};
258
- this.enableReadonly = () => {
259
- this.enableReadonly = void 0;
260
- if (!this.component.manager.isLit) {
261
- return;
262
- }
263
- const internals = this.component.manager.internals;
264
- Object.entries(internals.members).forEach(([name2, [type]]) => {
265
- const isReadOnly = type & PropTypes.ReadOnly;
266
- if (isReadOnly) {
267
- internals.setters[name2] ??= [];
268
- internals.setters[name2].push(internals.readonlySetter);
269
- }
270
- });
271
- };
272
- this.trackedValue = nothing;
273
- this.keyTrackers = [];
274
- this.getters = {};
275
- this.setters = {};
276
- this.accessorGetter = {};
277
- this.accessorSetter = {};
278
- this._exports = /* @__PURE__ */ new WeakMap();
279
- this.readonlySetter = (newValue, _oldValue, property) => {
280
- if (shouldBypass.readOnly) {
281
- return newValue;
282
- }
283
- throw new Error(
284
- `Cannot assign to read-only property "${property}" of ${this.component.el.localName}. Trying to assign "${String(
285
- newValue
286
- )}"`
287
- );
288
- };
289
- if (process.env.NODE_ENV !== "production") {
290
- Object.defineProperty(this, "component", {
291
- writable: false,
292
- enumerable: false,
293
- configurable: true,
294
- value: component
295
- });
296
- } else {
297
- this.component = component;
298
- }
299
- }
300
- firePropTrackers(key, value) {
301
- const trackers = this.keyTrackers;
302
- this.trackedValue = nothing;
303
- this.keyTrackers = [];
304
- trackers.forEach((tracker) => tracker(key, value));
305
- }
306
- // REFACTOR: once Stencil is no longer supported, simplify this with Lit's getPropertyDescriptor(), or https://github.com/shoelace-style/shoelace/issues/1990
307
- /**
308
- * Configure a getter or setter for a given \@Prop/\@State
309
- *
310
- * Since props are defined on the prototype, they are shared between all
311
- * instances of a component. Thus, instead of passing a reference to the
312
- * getter/setter function, you should update the
313
- * ComponentInternals.getters/setters properties, and then call getSetProxy
314
- * to apply the changes to the prototype
315
- */
316
- getSetProxy(property) {
317
- const component = this.component;
318
- const classPrototype = component.constructor.prototype;
319
- this._getSetProxy(classPrototype, property, "class");
320
- if (component.manager.isLit) {
321
- return;
322
- }
323
- const htmlPrototype = component.el.constructor.prototype;
324
- if (classPrototype !== htmlPrototype) {
325
- this._getSetProxy(htmlPrototype, property, "html");
326
- }
327
- }
328
- _getSetProxy(prototype, name2, type) {
329
- const component = this.component;
330
- const propType = getMemberType(component, name2);
331
- let descriptor;
332
- do {
333
- descriptor = Object.getOwnPropertyDescriptor(prototype, name2);
334
- } while (!descriptor && (prototype = Object.getPrototypeOf(prototype)));
335
- if (process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
336
- const tolerateNotFound = type === "html";
337
- if (descriptor?.set === void 0 || descriptor.get === void 0) {
338
- if (descriptor !== void 0 && "value" in descriptor) {
339
- throw new Error(
340
- `getSet() should only be used on @Prop/@property/@State/@state properties. For internal component properties, use regular get/set syntax. Tried to use it on "${name2}" in ${component.el.localName}`
341
- );
342
- } else if (tolerateNotFound) {
343
- return;
344
- } else {
345
- throw new Error(`Unable to find "${name2}" property on the ${component.el.localName} component`);
346
- }
347
- }
348
- if (propType === void 0) {
349
- throw new Error("Unable to retrieve prop type");
350
- }
351
- } else if (!descriptor) {
352
- return void 0;
353
- }
354
- const originalGet = descriptor.get;
355
- const originalSet = descriptor.set;
356
- const isGetterAlreadyOverwritten = customAccessor in originalGet;
357
- const isSetterAlreadyOverwritten = customAccessor in originalSet;
358
- if (isGetterAlreadyOverwritten && isSetterAlreadyOverwritten) {
359
- return;
360
- }
361
- const shouldOverwriteGet = !isGetterAlreadyOverwritten;
362
- const shouldOverwriteSet = !isSetterAlreadyOverwritten;
363
- const finalGetter = shouldOverwriteGet ? function getter() {
364
- let value = originalGet.call(this);
365
- const component2 = elementToInstance.get(this);
366
- if (shouldBypass.getter || component2 === void 0) {
367
- return value;
368
- }
369
- const internals = component2.manager.internals;
370
- value = internals.accessorGetter[name2](value, name2);
371
- const getters = internals.getters[name2] ?? emptyArray;
372
- for (let i = 0; i < getters.length; i++) {
373
- value = getters[i](value, name2);
374
- }
375
- return value;
376
- } : originalGet;
377
- const finalSetter = shouldOverwriteSet ? function setter(rawNewValue) {
378
- const oldValue = originalGet.call(this);
379
- const component2 = elementToInstance.get(this);
380
- if (component2 === void 0) {
381
- originalSet.call(this, rawNewValue);
382
- return;
383
- }
384
- let newValue = component2.manager.isLit ? (
385
- /*
386
- * Cast `null` to `undefined`.
387
- * See https://devtopia.esri.com/WebGIS/arcgis-web-components/discussions/1299
388
- */
389
- rawNewValue ?? void 0
390
- ) : parsePropertyValue(rawNewValue, propType);
391
- const internals = component2.manager.internals;
392
- if (newValue === oldValue) {
393
- originalSet.call(this, newValue);
394
- } else {
395
- const setters = shouldBypass.setter ? emptyArray : internals.setters[name2] ?? emptyArray;
396
- for (let i = 0; i < setters.length; i++) {
397
- newValue = setters[i](newValue, oldValue, name2);
398
- if (newValue === oldValue) {
399
- break;
400
- }
401
- }
402
- newValue = internals.accessorSetter[name2](newValue, oldValue, name2);
403
- originalSet.call(this, newValue);
404
- if (newValue !== oldValue) {
405
- internals.enabledWatchers[name2]?.forEach((watcher) => watcher(newValue, oldValue, name2));
406
- }
407
- }
408
- if (internals.keyTrackers.length > 0) {
409
- internals?.firePropTrackers(name2, rawNewValue);
410
- }
411
- } : originalSet;
412
- if (shouldOverwriteGet) {
413
- finalGetter[customAccessor] = true;
414
- }
415
- if (shouldOverwriteSet) {
416
- finalSetter[customAccessor] = true;
417
- }
418
- Object.defineProperty(prototype, name2, {
419
- ...descriptor,
420
- get: finalGetter,
421
- set: finalSetter
422
- });
423
- }
424
- /**
425
- * Associate an exports object with a controller for reverse lookup in
426
- * controller.use
427
- */
428
- markExports(controller, exports) {
429
- if (typeof exports === "object" && exports !== null || typeof exports === "function") {
430
- this._exports.set(exports, controller);
431
- }
432
- }
433
- resolveExports(exports) {
434
- if (typeof exports === "object" && exports !== null || typeof exports === "function") {
435
- return this._exports.get(exports);
436
- } else {
437
- return void 0;
438
- }
439
- }
440
- }
441
- const emptyArray = [];
442
- const customAccessor = Symbol();
443
- const nothing = process.env.NODE_ENV !== "production" ? Symbol.for(
444
- // Use Symbol.for in dev mode to make it easier to maintain state when doing HMR.
445
- `${name}: nothing`
446
- ) : (
447
- // eslint-disable-next-line symbol-description
448
- Symbol()
449
- );
450
202
  function trackPropKey(component, onResolved, defaultValue) {
451
- const internals = component.manager.internals;
452
- if (internals.trackedValue !== nothing && internals.trackedValue !== defaultValue) {
453
- internals.firePropTrackers(void 0, void 0);
203
+ const manager = component.manager;
204
+ if (manager._trackedValue !== nothing && manager._trackedValue !== defaultValue) {
205
+ manager._firePropTrackers(void 0, void 0);
454
206
  }
455
- if (internals.keyTrackers.length === 0) {
456
- queueMicrotask(() => internals.firePropTrackers(void 0, void 0));
207
+ if (manager._keyTrackers.length === 0) {
208
+ queueMicrotask(() => manager._firePropTrackers(void 0, void 0));
457
209
  }
458
- internals.trackedValue = defaultValue;
459
- internals.keyTrackers.push((key, value) => safeCall(onResolved, void 0, defaultValue === value ? key : void 0));
210
+ manager._trackedValue = defaultValue;
211
+ manager._keyTrackers.push((key, value) => safeCall(onResolved, void 0, defaultValue === value ? key : void 0));
460
212
  return defaultValue;
461
213
  }
462
214
  function trackKey(hostsCandidates = [
@@ -477,31 +229,19 @@ function trackKey(hostsCandidates = [
477
229
  candidateHosts.forEach(
478
230
  (host) => trackPropertyKey(
479
231
  host,
480
- (key) => resolved(
481
- key === void 0 ? void 0 : {
482
- key,
483
- host,
484
- isReactive: false
485
- }
486
- ),
232
+ (key) => resolved(key === void 0 ? void 0 : { key, host, isReactive: false }),
487
233
  defaultValue
488
234
  )
489
235
  );
490
- const component = candidateHosts.find(
491
- (host) => "manager" in host && typeof host.manager === "object" && host.manager.component === host
492
- );
493
- if (component) {
494
- trackPropKey(
495
- component,
496
- (key) => resolved(
497
- key === void 0 ? void 0 : {
498
- key,
499
- host: component,
500
- isReactive: true
501
- }
502
- ),
503
- defaultValue
504
- );
236
+ for (const host of candidateHosts) {
237
+ if ("manager" in host && typeof host.manager === "object" && host.manager.component === host) {
238
+ trackPropKey(
239
+ host,
240
+ (key) => resolved(key === void 0 ? void 0 : { key, host, isReactive: true }),
241
+ defaultValue
242
+ );
243
+ break;
244
+ }
505
245
  }
506
246
  return defaultValue;
507
247
  }
@@ -566,7 +306,7 @@ class Controller {
566
306
  this.ready = this._ready.promise;
567
307
  this._exports = makeProvisionalValue(this);
568
308
  this._exportWatchers = /* @__PURE__ */ new Set();
569
- const resolvedComponent = toControllerHost(component ?? retrieveComponent(new.target.name));
309
+ const resolvedComponent = component ?? retrieveComponent(new.target.name);
570
310
  if (process.env.NODE_ENV !== "production") {
571
311
  Object.defineProperty(this, "component", {
572
312
  writable: false,
@@ -575,7 +315,7 @@ class Controller {
575
315
  value: resolvedComponent
576
316
  });
577
317
  if ("hostDestroy" in this) {
578
- this.component.manager.ensureHasDestroy?.();
318
+ this.component.manager._ensureHasDestroy?.();
579
319
  }
580
320
  } else {
581
321
  this.component = resolvedComponent;
@@ -682,7 +422,7 @@ class Controller {
682
422
  /**
683
423
  * Like useRef, but doesn't wait for the controller to get ready
684
424
  *
685
- * @internal
425
+ * @private
686
426
  */
687
427
  get useRefSync() {
688
428
  setAmbientComponent(this.component);
@@ -715,7 +455,7 @@ class Controller {
715
455
  }
716
456
  onDestroy(callback) {
717
457
  if (process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
718
- this.component.manager.ensureHasDestroy?.();
458
+ this.component.manager._ensureHasDestroy?.();
719
459
  }
720
460
  this._callbacks.hostDestroy.push(callback);
721
461
  }
@@ -726,7 +466,7 @@ class Controller {
726
466
  }
727
467
  }
728
468
  // Call each lifecycle hook
729
- /** @internal */
469
+ /** @private */
730
470
  triggerConnected() {
731
471
  const genericController = this;
732
472
  if (genericController.hostConnected) {
@@ -736,7 +476,7 @@ class Controller {
736
476
  this.triggerLifecycle();
737
477
  this.connectedCalled = true;
738
478
  }
739
- /** @internal */
479
+ /** @private */
740
480
  triggerDisconnected() {
741
481
  const genericController = this;
742
482
  if (genericController.hostDisconnected) {
@@ -746,7 +486,7 @@ class Controller {
746
486
  this._lifecycleCleanups.forEach(safeCall);
747
487
  this._lifecycleCleanups = [];
748
488
  }
749
- /** @internal */
489
+ /** @private */
750
490
  async triggerLoad() {
751
491
  if (this._loadCalled) {
752
492
  return;
@@ -761,7 +501,7 @@ class Controller {
761
501
  }
762
502
  this._ready.resolve(this._exports);
763
503
  }
764
- /** @internal */
504
+ /** @private */
765
505
  triggerLoaded() {
766
506
  if (this.loadedCalled) {
767
507
  return;
@@ -773,7 +513,7 @@ class Controller {
773
513
  this._callbacks.hostLoaded.forEach(safeCall);
774
514
  this.loadedCalled = true;
775
515
  }
776
- /** @internal */
516
+ /** @private */
777
517
  triggerUpdate(changes) {
778
518
  const genericController = this;
779
519
  if (genericController.hostUpdate) {
@@ -781,7 +521,7 @@ class Controller {
781
521
  }
782
522
  this._callbacks.hostUpdate.forEach(callUpdate, changes);
783
523
  }
784
- /** @internal */
524
+ /** @private */
785
525
  triggerUpdated(changes) {
786
526
  const genericController = this;
787
527
  if (genericController.hostUpdated) {
@@ -789,7 +529,7 @@ class Controller {
789
529
  }
790
530
  this._callbacks.hostUpdated.forEach(callUpdate, changes);
791
531
  }
792
- /** @internal */
532
+ /** @private */
793
533
  triggerDestroy() {
794
534
  const genericController = this;
795
535
  if (genericController.hostDestroy) {
@@ -797,7 +537,7 @@ class Controller {
797
537
  }
798
538
  this._callbacks.hostDestroy.forEach(safeCall);
799
539
  }
800
- /** @internal */
540
+ /** @private */
801
541
  triggerLifecycle() {
802
542
  const genericController = this;
803
543
  if (genericController.hostLifecycle) {
@@ -828,7 +568,7 @@ function makeProvisionalValue(base) {
828
568
  }
829
569
  const proxy = new Proxy(base, {
830
570
  get(target, prop, receiver) {
831
- if (cyclical.has(prop) && prop in target && target[prop] === proxy) {
571
+ if ((prop === "exports" || prop === "_exports") && prop in target && target[prop] === proxy) {
832
572
  return void 0;
833
573
  }
834
574
  if (prop in target || prop in Promise.prototype || typeof prop === "symbol") {
@@ -853,7 +593,6 @@ function makeProvisionalValue(base) {
853
593
  });
854
594
  return proxy;
855
595
  }
856
- const cyclical = /* @__PURE__ */ new Set(["exports", "_exports"]);
857
596
  const accessBeforeLoad = process.env.NODE_ENV !== "production" && isEsriInternalEnv() ? [
858
597
  "This might be the case if you are trying to access an async controller in ",
859
598
  "connectedCallback(). Or, if you are using it inside of ",
@@ -861,65 +600,28 @@ const accessBeforeLoad = process.env.NODE_ENV !== "production" && isEsriInternal
861
600
  "usage:\n",
862
601
  "makeController(async (component, controller)=>{ await controller.use(someOtherController); });"
863
602
  ].join("") : void 0;
864
- function toControllerHost(component) {
865
- if (process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
866
- if ("addController" in component) {
867
- return component;
868
- } else {
869
- throw new Error(
870
- "Component does not implement ControllerHost. This might be because you forgot to add 'manager: Controller<this> = useControllerManager(this);' in your component, or you tried to use some controller before that line"
871
- );
872
- }
873
- } else {
874
- return component;
875
- }
876
- }
877
- function watch(component, property, callback) {
878
- const genericProperty = property;
879
- if (process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
880
- const type = getMemberType(component, genericProperty);
881
- if (type === void 0) {
882
- throw new Error(
883
- component.manager.isLit ? `Trying to watch a non-@property, non-@state property "${genericProperty}". Either convert it into a @state() to be able to use watch() on it, or use the get/set syntax` : `Trying to watch a non-@Prop, non-@State property "${genericProperty}". Convert it into a @State() or @Prop property if you need to use watch() on it`
884
- );
885
- }
886
- }
887
- const internals = component.manager.internals;
888
- internals.allWatchers[genericProperty] ??= [];
889
- const watchers = internals.allWatchers[genericProperty];
890
- const genericCallback = callback;
891
- const safeCallback = (newValue, oldValue, propertyName) => safeCall(genericCallback, null, newValue, oldValue, propertyName);
892
- watchers.push(safeCallback);
893
- return () => {
894
- const index = watchers.indexOf(safeCallback);
895
- if (index !== -1) {
896
- watchers.splice(index, 1);
897
- }
898
- };
899
- }
900
603
  export {
901
604
  Controller as C,
902
605
  GenericController as G,
903
- PropTypes as P,
904
- setParentController as a,
905
- retrieveParentControllers as b,
906
- createEvent as c,
907
- createEventFactory as d,
908
- trackPropertyKey as e,
909
- trackPropKey as f,
910
- isController as g,
911
- controllerSymbol as h,
606
+ shouldBypassGetter as a,
607
+ shouldBypassReadOnly as b,
608
+ controllerSymbol as c,
609
+ createEvent as d,
610
+ setParentController as e,
611
+ retrieveParentControllers as f,
612
+ createEventFactory as g,
613
+ bypassGetter as h,
912
614
  isPromise as i,
913
- ComponentInternals as j,
615
+ bypassSetter as j,
914
616
  keyTrackResolve as k,
915
- retrieveComponentMembers as l,
916
- elementToInstance as m,
917
- devOnlySetPersistentControllerData as n,
918
- devOnlyGetPersistentControllerData as o,
919
- shouldBypass as p,
920
- setAmbientChildController as q,
617
+ bypassReadOnly as l,
618
+ trackPropertyKey as m,
619
+ trackPropKey as n,
620
+ isController as o,
621
+ devOnlySetPersistentControllerData as p,
622
+ devOnlyGetPersistentControllerData as q,
921
623
  retrieveComponent as r,
922
624
  setAmbientComponent as s,
923
625
  trackKey as t,
924
- watch as w
626
+ setAmbientChildController as u
925
627
  };