@arcgis/lumina-compiler 4.33.0-next.6 → 4.33.0-next.61

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.
@@ -48,6 +48,7 @@ export type JsxContext = {
48
48
  * not be converted to `keyed()` directives.
49
49
  */
50
50
  readonly liftedKeys: Set<ts.JsxAttributeName>;
51
+ readonly isInLightDomComponent: boolean;
51
52
  hasNonLuminaJsxImport: boolean;
52
53
  };
53
54
  /**
@@ -12,10 +12,76 @@ export declare const defaultNamespace = "cdn";
12
12
  * are assumed to be defined in the environment separately)
13
13
  */
14
14
  export declare function buildCdn(context: CompilerContext): Plugin | undefined;
15
- declare function transformAsyncCoreImports(code: string): string;
16
- declare function transformSyncCoreImports(code: string): string;
15
+ type Chunk = {
16
+ code: string;
17
+ isAsync: boolean | undefined;
18
+ };
19
+ /**
20
+ * Transform each core-importing chunk to use $arcgis.t for loading core in
21
+ * order to be both ESM and AMD CDN compatible.
22
+ *
23
+ * Previous solution
24
+ * (https://devtopia.esri.com/WebGIS/arcgis-web-components/pull/2995) relied on
25
+ * top-level await. However, due to a Safari bug
26
+ * (see https://devtopia.esri.com/WebGIS/arcgis-web-components/issues/3933
27
+ * and https://bugs.webkit.org/show_bug.cgi?id=242740), we are no longer using
28
+ * top-level await.
29
+ *
30
+ * Instead, we insert a top-level await polyfill - a promise called $$ is
31
+ * exported by core-containing modules - such promise needs to be awaited by the
32
+ * consuming modules before the imported variables are available.
33
+ *
34
+ * List of other solutions considered:
35
+ * https://devtopia.esri.com/WebGIS/arcgis-web-components/discussions/3999
36
+ *
37
+ * @example
38
+ * ```js
39
+ * /// BEFORE
40
+ * import { b } from "./U7MU7PMX.js";
41
+ * import { when as M } from "@arcgis/core/core/reactiveUtils.js";
42
+ * var s = class extends v {
43
+ * // ...
44
+ * };
45
+ * export { s as ArcgisNavigationToggle };
46
+ *
47
+ * /// AFTER
48
+ * // $$ is a promise we need to await before imports from that module are available
49
+ * import { $$ as _0, b } from "./U7MU7PMX.js";
50
+ * var _1,
51
+ * $$ = $arcgis.t(
52
+ * ([{ when: M }]) => {
53
+ * // The "meat" of the file is kept unchanged by the transform
54
+ * // (we only touch the imports, and the very last export line)
55
+ * s = class extends v {
56
+ * // ...
57
+ * };
58
+ * // Assign exported variables to global scope variables
59
+ * _1 = s;
60
+ * },
61
+ * "core/reactiveUtils",
62
+ * _0,
63
+ * );
64
+ * // _1 will only be assigned once $$ resolves
65
+ * export { $$, _1 as ArcgisNavigationToggle };
66
+ * ```
67
+ */
68
+ declare function transformChunk(chunk: Chunk, chunks: Map<string, Chunk>): void;
69
+ /**
70
+ * @example Dynamic core import
71
+ * ```diff
72
+ * - import("core/Handles");
73
+ * + $arcgis.t(_=>_[0],"core/Handles")
74
+ * ```
75
+ *
76
+ * @example Dynamic import of a chunk with top-level await
77
+ * ```diff
78
+ * - import("./chunk.js");
79
+ * + import("./chunk.js").then(m=>m.$$.then(_=>m))
80
+ * ```
81
+ */
82
+ declare function transformDynamicCoreImports(code: string, chunks: Map<string, Chunk>): string;
17
83
  export declare const exportsForTests: {
18
- transformAsyncCoreImports: typeof transformAsyncCoreImports;
19
- transformSyncCoreImports: typeof transformSyncCoreImports;
84
+ transformDynamicCoreImports: typeof transformDynamicCoreImports;
85
+ transformChunk: typeof transformChunk;
20
86
  };
21
87
  export {};
@@ -164,19 +164,13 @@ export type SsrOptions = {
164
164
  };
165
165
  /**
166
166
  * Options for creating React 18 wrapper.
167
+ *
168
+ * Documentation: https://qawebgis.esri.com/components/lumina/build#build-wrappers
167
169
  */
168
170
  export type React18WrapperOptions = {
169
171
  readonly type: "react18";
170
172
  /**
171
173
  * The file path to the React 18 wrapper proxies file.
172
- *
173
- * Workflow:
174
- * 1. Copy this starter package into your project:
175
- * https://devtopia.esri.com/WebGIS/arcgis-web-components/tree/main/packages/starter-packages/lumina-components-react
176
- * 2. Adjust the starter as necessary (package.json, README.md, LICENSE, etc.)
177
- * 3. Set this option to the path to the src/components.ts file in the wrapper
178
- * package
179
- *
180
174
  * @example
181
175
  * "../lumina-components-react/src/components.ts"
182
176
  */
@@ -282,13 +276,13 @@ export type GenerateDocumentationOptions = {
282
276
  * This URL will be visible in VS Code and IntelliJ when hovering over a
283
277
  * component tag in an .html file
284
278
  */
285
- readonly getComponentDocsUrl?: (tag: string, name: string) => string;
279
+ readonly getComponentDocsUrl?: (tag: string, name: string) => string | undefined;
286
280
  /**
287
281
  * Provide a URL to a page that documents the component.
288
282
  * This URL will be visible in VS Code and IntelliJ when hovering over a
289
283
  * component tag in an .html file
290
284
  */
291
- readonly getComponentDemoUrl?: (tag: string, name: string) => string;
285
+ readonly getComponentDemoUrl?: (tag: string, name: string) => string | undefined;
292
286
  /**
293
287
  * Additional options for web component documentation for VS Code. This
294
288
  * documentation provides intellisense when editing .html and .css files.
@@ -1,8 +1,8 @@
1
- import"../chunk-JFKSI6I7.js";import{render as Q}from"lit-html";import{html as X,unsafeStatic as R}from"lit-html/static.js";import{camelToKebab as Le}from"@arcgis/components-utils";import{onTestFinished as xe}from"vitest";async function De(e,{parent:t=document.body,afterConnect:n,dynamicComponents:o,cleanupAfterTest:s=!0}={}){let r=document.createElement("div");r.style.display="contents",t.append(r),s&&xe(()=>Oe(r)),Z(e);let a=o?.some(Z),i;if(typeof e=="string")i=X`<${R(e)}></${R(e)}>`;else if(typeof e=="function")i="tagName"in e?X`<${R(e.tagName)}></${R(e.tagName)}>`:e();else{if(a)throw new Error('When rendering a dynamically created custom element using Lit\'s html`` function, you must ensure that the custom element class name is unique in the test file, or the class should explicitly have the `static override tagName = "some-tag-name";` property with a unique tag name within the test file');i=e}let l=[];function d(h){l.push(h.error),h.preventDefault(),h.stopPropagation()}if(window.addEventListener("error",d),Q(i,r),window.removeEventListener("error",d),l.length===1)throw l[0];if(l.length>1)throw new AggregateError(l,"Multiple errors occurred while creating the custom element");let c=ee(r),p=V,k=n?.(c);k?.then!==void 0&&await k;let _=c;typeof _?.componentOnReady=="function"&&await _.componentOnReady();let g=_?._litElement??p??c;return{el:c,component:g,async reRender(){return typeof e=="function"&&!("tagName"in e)&&Q(e(),t),g.requestUpdate(),await g.updateComplete}}}var V,ke=globalThis;ke.devOnly$luminaComponentRefCallback=e=>{V=e};function Oe(e){for(;e.firstChild;)e.removeChild(e.firstChild);e instanceof HTMLElement&&e.remove()}function Z(e){if(!Te(e)||e.runtime!==void 0)return!1;let t=!1,n=e.tagName;if(!n){t=!1;let o=Le((e.name.length>1?e.name.replaceAll(Ne,""):"")||"Test"),s=o==="test"?"te-st":o.includes("-")?o:`${o}-`;n=s;for(let r=2,a=customElements.get(n);a!==e&&a!==void 0;r+=1)t=!0,n=`${s}-${r}`,a=customElements.get(n)}return globalThis.devOnly$luminaRuntime?.customElement(n,e),Object.defineProperty(e.prototype,"tagName",{value:n.toUpperCase()}),t}var Te=e=>typeof e=="function"&&"lumina"in e,Ne=/\d+$/gu;function ee(e){for(let t of e.children)if("lumina"in t.constructor)return t;for(let t of e.children){let n=ee(t);if(n!=null)return n}return e.firstElementChild??V?.el}import Ue from"vitest-fail-on-console";import{expect as Pe}from"vitest";import Re from"js-beautify";function te(){Pe.addSnapshotSerializer({test(e){return typeof e=="object"&&e!==null&&"innerHTML"in e&&"onslotchange"in e},serialize(e){let t=e.innerHTML.replaceAll(Se,"");return Re.html(t,{indent_size:2,indent_char:" ",preserve_newlines:!1,wrap_line_length:70,indent_inner_html:!1,indent_empty_lines:!1})}})}var Se=/<!--\??(?:lit\$\d+\$)?-->/gu;function $e(){if(ne[oe])return;ne[oe]=!0;let e={...console};Ue({silenceMessage(t,n){return e[n](t),!1}}),te()}var oe=Symbol.for("lumina:didSetupTest"),ne=globalThis;import{isEsriInternalEnv as Me,isNotUndefined as je}from"@arcgis/components-utils";function re(e,t){if(t){let n=e.constructor.elementProperties;e.manager.internals.members=Object.fromEntries(Array.from(n,([o,s])=>s.noAccessor?void 0:[o,[(s.readOnly?2048:0)|(s.state?32:16)]]).filter(je))}else{let n=e.constructor,o=n.__registerControllers?.(e)??void 0;if(n.__registerControllers=void 0,typeof o!="object")throw new Error(process.env.NODE_ENV!=="production"&&Me()?"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");e.manager.internals.members=Object.fromEntries(Object.entries(o).filter(([s,[r]])=>(r&63)!==0))}}function se(e,t=8){return e==null||typeof e=="object"||typeof e=="function"?e:t&4?e==="false"?!1:e===""||!!e:t&2?Number.parseFloat(e):t&1?String(e):e}var W=(e,t)=>e.manager.internals.members?.[t]?.[0];import{isEsriInternalEnv as de}from"@arcgis/components-utils";import{isEsriInternalEnv as U}from"@arcgis/components-utils";import{Deferred as He,isEsriInternalEnv as P,safeAsyncCall as ie,safeCall as u}from"@arcgis/components-utils";import{safeCall as qe}from"@arcgis/components-utils";import{isEsriInternalEnv as Je,safeCall as Be}from"@arcgis/components-utils";import{safeCall as Ke}from"@arcgis/components-utils";import{isEsriInternalEnv as ze}from"@arcgis/components-utils";import{isEsriInternalEnv as St}from"@arcgis/components-utils";var $=Symbol.for("controller"),F="@arcgis/components-controllers",pe=e=>typeof e=="object"&&e!==null&&($ in e||"hostConnected"in e||"hostDisconnected"in e||"hostUpdate"in e||"hostUpdated"in e),he=process.env.NODE_ENV!=="production"&&de()?(e,t)=>{let n=e.component.manager,o="_controllers"in n?n._controllers:void 0;if(o===void 0)return;let s=Array.from(o).indexOf(e);if(s===-1)return;let r=Symbol.for(`${F}: devOnlyControllerData`),a=e.component.el;a[r]??(a[r]={}),a[r][s]=t}:void 0,xt=process.env.NODE_ENV!=="production"&&de()?e=>{let t=e.component.manager,n="_controllers"in t?t._controllers:void 0;if(n===void 0)return;let o=Array.from(n).indexOf(e),s=Symbol.for(`${F}: devOnlyControllerData`);return e.component.el[s]?.[o]}:void 0,L;function E(e){L!==e&&(L=e,queueMicrotask(()=>{L===e&&(L=void 0)}))}function M(e){if(process.env.NODE_ENV!=="production"&&L===void 0)throw new Error([`Unable to find out which component ${e||"this"} controller `,`belongs to. Possible causes:
2
- `,"- You might also have multiple versions of ",`@arcgis/components-controllers package installed
1
+ import"../chunk-JFKSI6I7.js";import{render as Q}from"lit-html";import{html as X,unsafeStatic as R}from"lit-html/static.js";import{camelToKebab as xe}from"@arcgis/components-utils";import{onTestFinished as De}from"vitest";async function ke(e,{parent:t=document.body,afterConnect:n,dynamicComponents:o,cleanupAfterTest:s=!0}={}){let r=document.createElement("div");r.style.display="contents",t.append(r),s&&De(()=>Te(r)),Z(e);let a=o?.some(Z),i;if(typeof e=="string")i=X`<${R(e)}></${R(e)}>`;else if(typeof e=="function")i="tagName"in e?X`<${R(e.tagName)}></${R(e.tagName)}>`:e();else{if(a)throw new Error('When rendering a dynamically created custom element using Lit\'s html`` function, you must ensure that the custom element class name is unique in the test file, or the class should explicitly have the `static override tagName = "some-tag-name";` property with a unique tag name within the test file');i=e}let l=[];function d(h){l.push(h.error),h.preventDefault(),h.stopPropagation()}if(window.addEventListener("error",d),Q(i,r),window.removeEventListener("error",d),l.length===1)throw l[0];if(l.length>1)throw new AggregateError(l,"Multiple errors occurred while creating the custom element");let c=ee(r),p=V,k=n?.(c);k?.then!==void 0&&await k;let _=c;typeof _?.componentOnReady=="function"&&await _.componentOnReady();let g=_?._litElement??p??c;return{el:c,component:g,async reRender(){return typeof e=="function"&&!("tagName"in e)&&Q(e(),t),g.requestUpdate(),await g.updateComplete}}}var V,Oe=globalThis;Oe.devOnly$luminaComponentRefCallback=e=>{V=e};function Te(e){for(;e.firstChild;)e.removeChild(e.firstChild);e instanceof HTMLElement&&e.remove()}function Z(e){if(!Ne(e)||e.runtime!==void 0)return!1;let t=!1,n=e.tagName;if(!n){t=!1;let o=xe((e.name.length>1?e.name.replaceAll(Pe,""):"")||"Test"),s=o==="test"?"te-st":o.includes("-")?o:`${o}-`;n=s;for(let r=2,a=customElements.get(n);a!==e&&a!==void 0;r+=1)t=!0,n=`${s}-${r}`,a=customElements.get(n)}return globalThis.devOnly$luminaRuntime?.customElement(n,e),Object.defineProperty(e.prototype,"tagName",{value:n.toUpperCase()}),t}var Ne=e=>typeof e=="function"&&"lumina"in e,Pe=/\d+$/gu;function ee(e){for(let t of e.children)if("lumina"in t.constructor)return t;for(let t of e.children){let n=ee(t);if(n!=null)return n}return e.firstElementChild??V?.el}import $e from"vitest-fail-on-console";import{expect as Re}from"vitest";import Se from"js-beautify";function te(){Re.addSnapshotSerializer({test(e){return typeof e=="object"&&e!==null&&"innerHTML"in e&&"onslotchange"in e},serialize(e){let t=e.innerHTML.replaceAll(Ue,"");return Se.html(t,{indent_size:2,indent_char:" ",preserve_newlines:!1,wrap_line_length:70,indent_inner_html:!1,indent_empty_lines:!1})}})}var Ue=/<!--\??(?:lit\$\d+\$)?-->/gu;function Me(){if(ne[oe])return;ne[oe]=!0;let e={...console};$e({silenceMessage(t,n){return e[n](t),!1}}),te()}var oe=Symbol.for("lumina:didSetupTest"),ne=globalThis;import{isEsriInternalEnv as je,isNotUndefined as Ie}from"@arcgis/components-utils";function re(e,t){if(t){let n=e.constructor.elementProperties;e.manager.internals.members=Object.fromEntries(Array.from(n,([o,s])=>s.noAccessor?void 0:[o,[(s.readOnly?2048:0)|(s.state?32:16)]]).filter(Ie))}else{let n=e.constructor,o=n.__registerControllers?.(e)??void 0;if(n.__registerControllers=void 0,typeof o!="object")throw new Error(process.env.NODE_ENV!=="production"&&je()?"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");e.manager.internals.members=Object.fromEntries(Object.entries(o).filter(([s,[r]])=>(r&63)!==0))}}function se(e,t=8){return e==null||typeof e=="object"||typeof e=="function"?e:(t&4)!==0?e==="false"?!1:e===""||!!e:(t&2)!==0?Number.parseFloat(e):(t&1)!==0?String(e):e}var W=(e,t)=>e.manager.internals.members?.[t]?.[0];import{isEsriInternalEnv as de}from"@arcgis/components-utils";import{isEsriInternalEnv as U}from"@arcgis/components-utils";import{Deferred as Ge,isEsriInternalEnv as P,safeAsyncCall as ie,safeCall as u}from"@arcgis/components-utils";import{safeCall as Je}from"@arcgis/components-utils";import{isEsriInternalEnv as Be,safeCall as Ke}from"@arcgis/components-utils";import{safeCall as ze}from"@arcgis/components-utils";import{isEsriInternalEnv as Ye}from"@arcgis/components-utils";import{isEsriInternalEnv as Ut}from"@arcgis/components-utils";var $=Symbol.for("controller"),F="@arcgis/components-controllers",pe=e=>typeof e=="object"&&e!==null&&($ in e||"hostConnected"in e||"hostDisconnected"in e||"hostUpdate"in e||"hostUpdated"in e),he=process.env.NODE_ENV!=="production"&&de()?(e,t)=>{let n=e.component.manager,o="_controllers"in n?n._controllers:void 0;if(o===void 0)return;let s=Array.from(o).indexOf(e);if(s===-1)return;let r=Symbol.for(`${F}: devOnlyControllerData`),a=e.component.el;a[r]??(a[r]={}),a[r][s]=t}:void 0,Dt=process.env.NODE_ENV!=="production"&&de()?e=>{let t=e.component.manager,n="_controllers"in t?t._controllers:void 0;if(n===void 0)return;let o=Array.from(n).indexOf(e),s=Symbol.for(`${F}: devOnlyControllerData`);return e.component.el[s]?.[o]}:void 0;function ue(e){return typeof e?.then=="function"}var L;function E(e){L!==e&&(L=e,queueMicrotask(()=>{L===e&&(L=void 0)}))}function M(e){if(process.env.NODE_ENV!=="production"&&L===void 0)throw new Error([`Unable to find out which component ${e||"this"} controller `,`belongs to. Possible causes:
2
+ `,"- You might have multiple versions of ",`@arcgis/components-controllers package installed
3
3
  `,...U()?["- You tried to create controller outside the component. If so, ","please wrap your controller definition in an arrow function (like","`const myController = ()=>makeController(...);`) and call that","function inside the component (`my = myController();`), or ","define your controller using makeGenericController/GenericController ",`instead.
4
- `,"- You tried to create a controller inside an async function. ","This is allowed without calling controller.use(). Make sure you ","use it like `await controller.use(useController())`."]:[]].join(""));return L}var v=[];function j(e){if(e===void 0){v=[];return}let t=v.indexOf(e);v=t===-1?[...v,e]:v.slice(0,t+1),queueMicrotask(()=>{v=[]})}function I(){return v}var x;function Ie(e){x!==e&&(x=e,queueMicrotask(()=>{x===e&&(x=void 0)}))}function Ae(){let e=x;return x=void 0,e}var Ve=async(e,t)=>{let n=q(e);if(n===void 0){if(process.env.NODE_ENV!=="production"&&U()&&typeof t=="function")throw new Error("Unable to resolve a controller from the provided value, so can't watch it's exports. The value you passed is not a controller and not a controller exports. If your controller exports a literal value, try making your controller export an object instead");return e}if(await n.ready,typeof t=="function"){if(process.env.NODE_ENV!=="production"&&U()&&n.watchExports===void 0)throw new Error("The controller must implement watchExports method to support watching exports");let o=n.watchExports(s=>t(s,o))}return n.exports},We=async e=>{let t=q(e);if(process.env.NODE_ENV!=="production"&&U()&&t===void 0)throw new Error("Unable to resolve a controller from the provided value. The value you passed is not a controller and not a controller exports. If your controller exports a literal value, try making your controller export an object instead");return await t.ready,t},q=e=>{let n=M().manager.internals.resolveExports(e);if(n!==void 0)return n;if(pe(e))return e;let o=Ae();if(o!==void 0)return o},T={setter:!1,getter:!1,readOnly:!1},N=new WeakMap,ue;ue=$;var J=class{constructor(e){this._callbacks={hostConnected:[],hostDisconnected:[],hostLoad:[],hostLoaded:[],hostUpdate:[],hostUpdated:[],hostDestroy:[],hostLifecycle:[]},this._ready=new He,this._lifecycleCleanups=[],this.connectedCalled=!1,this._loadCalled=!1,this.loadedCalled=!1,this[ue]=!0,this.ready=this._ready.promise,this._exports=le(this),this._exportWatchers=new Set;let t=Fe(e??M(new.target.name));process.env.NODE_ENV!=="production"?(Object.defineProperty(this,"component",{writable:!1,enumerable:!1,configurable:!0,value:t}),"hostDestroy"in this&&this.component.manager.ensureHasDestroy?.()):this.component=t,this.component.addController(this),this.component.manager===void 0||(j(this),queueMicrotask(()=>this.catchUpLifecycle()))}catchUpLifecycle(){let{manager:e}=this.component;e.connectedCalled&&!this.connectedCalled&&this.triggerConnected(),e._loadCalled&&this.triggerLoad().then(()=>{e.loadedCalled&&this.triggerLoaded()}).catch(console.error)}get exports(){return this._exports}set exports(e){let t=this._exports;t!==e&&(this._exports=e,this._exportWatchers.forEach(u),this.connectedCalled&&this.assignedProperty!==!1&&this.component.requestUpdate(this.assignedProperty,t)),this._ready.resolve(e)}setProvisionalExports(e,t=!0){this._exports=t?le(e):e,this._exportWatchers.forEach(u)}watchExports(e){let t=()=>e(this._exports);return this._exportWatchers.add(t),()=>void this._exportWatchers.delete(t)}get use(){return E(this.component),Ve}get useRef(){return E(this.component),We}get useRefSync(){return E(this.component),q}controllerRemoved(){this.component.el.isConnected&&this.triggerDisconnected(),this.triggerDestroy()}onConnected(e){this._callbacks.hostConnected.push(e)}onDisconnected(e){this._callbacks.hostDisconnected.push(e)}onLoad(e){this._callbacks.hostLoad.push(e)}onLoaded(e){this._callbacks.hostLoaded.push(e)}onUpdate(e){this._callbacks.hostUpdate.push(e)}onUpdated(e){this._callbacks.hostUpdated.push(e)}onDestroy(e){process.env.NODE_ENV!=="production"&&P()&&this.component.manager.ensureHasDestroy?.(),this._callbacks.hostDestroy.push(e)}onLifecycle(e){this._callbacks.hostLifecycle.push(e),this.connectedCalled&&this.component.el.isConnected&&this._callLifecycle(e)}triggerConnected(){let e=this;e.hostConnected&&u(e.hostConnected,e),this._callbacks.hostConnected.forEach(u),this.triggerLifecycle(),this.connectedCalled=!0}triggerDisconnected(){let e=this;e.hostDisconnected&&u(e.hostDisconnected,e),this._callbacks.hostDisconnected.forEach(u),this._lifecycleCleanups.forEach(u),this._lifecycleCleanups=[]}async triggerLoad(){if(this._loadCalled)return;this._loadCalled=!0;let e=this;e.hostLoad&&await ie(e.hostLoad,e),this._callbacks.hostLoad.length>0&&await Promise.allSettled(this._callbacks.hostLoad.map(ie)),this._ready.resolve(this._exports)}triggerLoaded(){if(this.loadedCalled)return;let e=this;e.hostLoaded&&u(e.hostLoaded,e),this._callbacks.hostLoaded.forEach(u),this.loadedCalled=!0}triggerUpdate(e){let t=this;t.hostUpdate&&u(t.hostUpdate,t,e),this._callbacks.hostUpdate.forEach(ae,e)}triggerUpdated(e){let t=this;t.hostUpdated&&u(t.hostUpdated,t,e),this._callbacks.hostUpdated.forEach(ae,e)}triggerDestroy(){let e=this;e.hostDestroy&&u(e.hostDestroy,e),this._callbacks.hostDestroy.forEach(u)}triggerLifecycle(){let e=this;e.hostLifecycle&&this._callLifecycle(()=>e.hostLifecycle()),this._callbacks.hostLifecycle.forEach(this._callLifecycle,this)}_callLifecycle(e){E(this.component);let t=u(e);(Array.isArray(t)?t:[t]).forEach(o=>{typeof o=="function"?this._lifecycleCleanups.push(o):typeof o=="object"&&typeof o.remove=="function"&&this._lifecycleCleanups.push(o.remove)})}};function ae(e){u(e,void 0,this)}var me=J;function le(e){if(typeof e!="object"&&typeof e!="function"||e===null)return e;let t=new Proxy(e,{get(n,o,s){if(!(Ge.has(o)&&o in n&&n[o]===t)){if(o in n||o in Promise.prototype||typeof o=="symbol")return typeof n=="function"?n[o]:Reflect.get(n,o,s);if(process.env.NODE_ENV!=="production"&&P()){if(process.env.NODE_ENV==="test"&&(o.startsWith("$$")||o.startsWith("@@")||o==="nodeType"||o==="tagName"||o==="toJSON"||o==="hasAttribute"))return;console.error(`Trying to access "${o.toString()}" on the controller before it's loaded. ${ce}`)}}},set:(n,o,s,r)=>(process.env.NODE_ENV!=="production"&&P()&&console.error(`Trying to set "${o.toString()}" on the controller before it's loaded. ${ce}`),Reflect.set(n,o,s,r))});return t}var Ge=new Set(["exports","_exports"]),ce=process.env.NODE_ENV!=="production"&&P()?["This might be the case if you are trying to access an async controller in ","connectedCallback(). Or, if you are using it inside of ","componentWillLoad()/another controller without controller.use. Example correct ",`usage:
5
- `,"makeController(async (component, controller)=>{ await controller.use(someOtherController); });"].join(""):void 0;function Fe(e){if(process.env.NODE_ENV!=="production"&&P()){if("addController"in e)return e;throw new Error("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")}else return e}function fe(e,t,n){let o=Object.keys(e),s=o.length;C===void 0&&queueMicrotask(B),C??(C=new Map);let r=C.get(e);return r===void 0&&(r={callbacks:[],keyCount:s},C.set(e,r)),r.keyCount!==s&&(r.callbacks.forEach(a=>a(o)),r.callbacks=[],r.keyCount=s),r.callbacks.push(a=>{let i=d=>qe(t,null,d),l=a[s];l===void 0?i(void 0):e[l]===n?i(l):i(void 0)}),n}var C=void 0;function B(){Array.from(C?.entries()??[]).forEach(([e,{callbacks:t}])=>{let n=Object.keys(e);t.forEach(o=>o(n))}),C=void 0}function K(e,t,n){var o;let s=t;if(process.env.NODE_ENV!=="production"&&Je()&&W(e,s)===void 0)throw new Error(e.manager.isLit?`Trying to watch a non-@property, non-@state property "${s}". 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 "${s}". Convert it into a @State() or @Prop property if you need to use watch() on it`);let r=e.manager.internals;(o=r.allWatchers)[s]??(o[s]=[]);let a=r.allWatchers[s],i=n,l=(d,c,p)=>Be(i,null,d,c,p);return a.push(l),()=>{let d=a.indexOf(l);d!==-1&&a.splice(d,1)}}var ye=class{constructor(e){this.enabledWatchers={},this.allWatchers={},this.enableReadonly=()=>{if(this.enableReadonly=void 0,!this.component.manager.isLit)return;let t=this.component.manager.internals;Object.entries(t.members).forEach(([n,[o]])=>{var s;o&2048&&((s=t.setters)[n]??(s[n]=[]),t.setters[n].push(t.readonlySetter))})},this.trackedValue=G,this.keyTrackers=[],this.getters={},this.setters={},this.accessorGetter={},this.accessorSetter={},this._exports=new WeakMap,this.readonlySetter=(t,n,o)=>{if(T.readOnly)return t;throw new Error(`Cannot assign to read-only property "${o}" of ${this.component.el.tagName.toLowerCase()}. Trying to assign "${String(t)}"`)},process.env.NODE_ENV!=="production"?Object.defineProperty(this,"component",{writable:!1,enumerable:!1,configurable:!0,value:e}):this.component=e}firePropTrackers(e,t){let n=this.keyTrackers;this.trackedValue=G,this.keyTrackers=[],n.forEach(o=>o(e,t))}getSetProxy(e){let t=this.component,n=t.constructor.prototype;if(this._getSetProxy(n,e,"class"),t.manager.isLit)return;let o=t.el.constructor.prototype;n!==o&&this._getSetProxy(o,e,"html")}_getSetProxy(e,t,n){let o=this.component,s=W(o,t),r;do r=Object.getOwnPropertyDescriptor(e,t);while(!r&&(e=Object.getPrototypeOf(e)));if(process.env.NODE_ENV!=="production"&&ze()){let g=n==="html";if(r?.set===void 0||r.get===void 0){if(r!==void 0&&"value"in r)throw new Error(`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 "${t}" in ${o.el.tagName}`);if(g)return;throw new Error(`Unable to find "${t}" property on the ${o.el.tagName} component`)}if(s===void 0)throw new Error("Unable to retrieve prop type")}else if(!r)return;let a=r.get,i=r.set,l=S in a,d=S in i;if(l&&d)return;let c=!l,p=!d,k=c?function(){let h=a.call(this),f=N.get(this);if(T.getter||f===void 0)return h;let w=f.manager.internals;h=w.accessorGetter[t](h,t);let m=w.getters[t]??H;for(let y=0;y<m.length;y++)h=m[y](h,t);return h}:a,_=p?function(h){let f=a.call(this),w=N.get(this);if(w===void 0){i.call(this,h);return}let m=w.manager.isLit?h??void 0:se(h,s),y=w.manager.internals;if(m===f)i.call(this,m);else{let Y=T.setter?H:y.setters[t]??H;for(let O=0;O<Y.length&&(m=Y[O](m,f,t),m!==f);O++);m=y.accessorSetter[t](m,f,t),i.call(this,m),m!==f&&y.enabledWatchers[t]?.forEach(O=>O(m,f,t))}y.keyTrackers.length>0&&y?.firePropTrackers(t,h)}:i;c&&(k[S]=!0),p&&(_[S]=!0),Object.defineProperty(e,t,{...r,get:k,set:_})}markExports(e,t){(typeof t=="object"&&t!==null||typeof t=="function")&&this._exports.set(t,e)}resolveExports(e){if(typeof e=="object"&&e!==null||typeof e=="function")return this._exports.get(e)}},H=[],S=Symbol(),G=process.env.NODE_ENV!=="production"?Symbol.for(`${F}: nothing`):Symbol();function ge(e,t,n){let o=e.manager.internals;return o.trackedValue!==G&&o.trackedValue!==n&&o.firePropTrackers(void 0,void 0),o.keyTrackers.length===0&&queueMicrotask(()=>o.firePropTrackers(void 0,void 0)),o.trackedValue=n,o.keyTrackers.push((s,r)=>Ke(t,void 0,n===r?s:void 0)),n}function ve(e=[M(),...I()],t,n){let o=Array.isArray(e)?e:[e],s=o.length+1,r=i=>{s-=1,i!==void 0&&(s=Math.min(s,0)),s===0&&t(i)};o.forEach(i=>fe(i,l=>r(l===void 0?void 0:{key:l,host:i,isReactive:!1}),n));let a=o.find(i=>"manager"in i&&typeof i.manager=="object"&&i.manager.component===i);return a&&ge(a,i=>r(i===void 0?void 0:{key:i,host:a,isReactive:!0}),n),n}function Ce(e){T.readOnly=!0;try{return e()}finally{T.readOnly=!1}}var Ee=e=>(...t)=>{let n=I(),o=new e(...t),s=o.exports;j(n.at(-1));let r=o.component.manager.internals;r.markExports(o,s),o.watchExports(i=>r.markExports(o,i)),Ie(o);let a=[o.component,...n].reverse();return ve(a,i=>i===void 0?void 0:Ye(o,i,s),s)};function Ye(e,{host:t,key:n,isReactive:o},s){let r=t,a=r[n]!==e.exports,i=r[n]!==s,l=s!==e.exports;if(a&&!i&&l&&(r[n]=e.exports),t===e.component){if(o){let c=e.component.manager.internals;i&&c.markExports(e,r[n]),K(e.component,n,p=>{p!==e.exports&&c.markExports(e,p)})}e.assignedProperty=o?void 0:n}e.watchExports(()=>{if(r[n]===e.exports)return;let c=e.component.manager;c.internals.setters[n]?.includes(c.internals.readonlySetter)?Ce(()=>{r[n]=e.exports}):r[n]=e.exports})}import{Deferred as be,isEsriInternalEnv as b,safeAsyncCall as Qe,safeCall as D}from"@arcgis/components-utils";import{devToolsAwareTimeout as Xe}from"@arcgis/components-utils";import{getElementAttribute as zt,isEsriInternalEnv as Yt,observeAncestorsMutation as Qt}from"@arcgis/components-utils";import{getElementLocales as Zt,startLocaleObserver as eo}from"@arcgis/components-utils";import{isEsriInternalEnv as oo}from"@arcgis/components-utils";var Ze=class extends me{constructor(e,t){let n="addController"in e;process.env.NODE_ENV!=="production"&&b()&&!n&&Object.defineProperty(e.el,"__component",{value:e});let o=new Set;function s(l){o.add(l),!($ in l)&&e.renderRoot&&e.el.isConnected&&l.hostConnected?.()}function r(l){o.delete(l),l.controllerRemoved?.()}let a=e;if(a.addController=s,a.removeController=r,!n){let l=t??e.constructor.__forceUpdate;a.requestUpdate=()=>l(e)}if(process.env.NODE_ENV!=="production"&&b()&&(Object.entries({componentDidLoad:"loaded",componentDidRender:"updated",componentDidUpdate:"updated",componentShouldUpdate:"shouldUpdate",componentWillLoad:"load",componentWillRender:"willUpdate",componentWillUpdate:"willUpdate"}).forEach(([d,c])=>{if(n&&d in e)throw new Error(`Unexpected ${d}() in a Lit component ${e.el.tagName.toLowerCase()}. In Lit, you should use ${c}() instead`);if(!n&&c in e)throw new Error(`Unexpected ${c}() in a Stencil component ${e.el.tagName.toLowerCase()}. In Stencil, you should use ${c}() instead`)}),n)){let d=0,c=!1;for(let p=e;!c;d++){if(p===null)throw new Error("Expected controllers to be used in a LitElement class");if(Object.hasOwn(p,"_load")){c=!0;break}p=Object.getPrototypeOf(p)}if(d<1)throw new Error("It looks like you are trying to call useControllerManager in a component that uses LitElement imported from 'lit'. useControllerManager should only be used in the LitElement coming from `@arcgis/lumina`")}super(e),this.internals=new ye(this.component),this.destroyed=!1,this._updatePromise=new be,this._originalLifecycles={},this.isLit=n,this.component.manager=this,re(e,n),this._controllers=o,this.exports=void 0,this.hasDestroy=A in this.component&&typeof this.component.destroy=="function",this._bindLifecycleMethods();let i=this.internals;Object.keys(i.members).forEach(l=>{i.accessorGetter[l]=_e,i.accessorSetter[l]=_e,i.getSetProxy(l)}),n?this.internals.enabledWatchers=this.internals.allWatchers:Object.defineProperty(e,"updateComplete",{get:async()=>await this._updatePromise.promise}),queueMicrotask(i.enableReadonly),E(e),N.set(e.el,e),N.set(e,e)}_bindLifecycleMethods(){let e=this.component,t=this.isLit,n=e.el===e;this._originalLifecycles={_connectedCallback:t||n?void 0:e.connectedCallback,_disconnectedCallback:t||n?void 0:e.disconnectedCallback,_load:t?e.load:e.componentWillLoad,_loaded:t?e.loaded:e.componentDidLoad,_willUpdate:t?void 0:e.componentWillUpdate,_updated:t?void 0:e.componentDidUpdate,_destroy:e.destroy};let o=this._connectedCallback.bind(this),s=this._disconnectedCallback.bind(this),r=this._update.bind(this),a=this._updated.bind(this);t?e.constructor.prototype.addController.call(e,{hostConnected:o,hostDisconnected:s,hostUpdate:r,hostUpdated:a}):(e.connectedCallback=o,e.disconnectedCallback=s,e.componentWillLoad=this._load.bind(this),e.componentDidLoad=this._loaded.bind(this),e.componentWillUpdate=r,e.componentDidUpdate=a),this.hasDestroy&&(e.destroy=this.destroy.bind(this))}_connectedCallback(){if(this.destroyed){let t=this.component.el.tagName.toLowerCase();throw this.component.el.remove(),new Error(`The ${t} component has already been destroyed. It cannot be used again. If you meant to disconnect and reconnect a component without automatic destroy, set the ${A} prop.`)}this._autoDestroyTimeout!==void 0&&clearTimeout(this._autoDestroyTimeout);let e=this.internals;e.enabledWatchers=e.allWatchers,B(),e.enableReadonly?.(),this._controllers.forEach(et),this._originalLifecycles._connectedCallback?.call(this.component),process.env.NODE_ENV!=="production"&&b()&&he?.(this,!0)}_disconnectedCallback(){this.destroyed||(this._controllers.forEach(tt),this._originalLifecycles._disconnectedCallback?.call(this.component),this.hasDestroy&&this._setAutoDestroyTimeout())}async _load(){await Promise.allSettled(Array.from(this._controllers,ot)),await this._originalLifecycles._load?.call(this.component),this.hasDestroy&&K(this.component,A,()=>this._setAutoDestroyTimeout())}_loaded(){this._controllers.forEach(nt),this._originalLifecycles._loaded?.call(this.component)}_update(){let e=this.component;return this._controllers.forEach(rt,e.$changes),this._originalLifecycles._willUpdate?.call(this.component)}_updated(){let e=this.component;if(this._controllers.forEach(st,e.$changes),this._originalLifecycles._updated?.call(this.component),this.isLit)e.$changes=new Map;else{let t=this._updatePromise;this._updatePromise=new be,t.resolve(!0)}}async destroy(){if(process.env.NODE_ENV!=="production"&&b()&&this.ensureHasDestroy?.(),!this.destroyed){if(this.component.el.isConnected){this.hasDestroy=!1;try{this.component.el.remove()}finally{this.hasDestroy=!0}}this._autoDestroyTimeout=void 0,this.destroyed=!0,this._controllers.forEach(it),this._controllers.clear(),await this._originalLifecycles._destroy?.call(this.component)}}_setAutoDestroyTimeout(){if(this._autoDestroyTimeout!==void 0&&clearTimeout(this._autoDestroyTimeout),!this.component.el.isConnected&&!this.component.autoDestroyDisabled){let e=()=>void this.destroy().catch(console.error);process.env.NODE_ENV!=="production"&&b()&&z===0?queueMicrotask(e):this._autoDestroyTimeout=Xe(e,z)}}};process.env.NODE_ENV!=="production"&&b()&&(Ze.prototype.ensureHasDestroy=function(){if(!this.hasDestroy)throw new Error(`
4
+ `,"- You tried to create a controller inside an async function. ","This is allowed without calling controller.use(). Make sure you ","use it like `await controller.use(useController())`."]:[]].join(""));return L}var v=[];function j(e){if(e===void 0){v=[];return}let t=v.indexOf(e);v=t===-1?[...v,e]:v.slice(0,t+1),queueMicrotask(()=>{v=[]})}function I(){return v}var x;function Ae(e){x!==e&&(x=e,queueMicrotask(()=>{x===e&&(x=void 0)}))}function Ve(){let e=x;return x=void 0,e}var We=async(e,t)=>{let n=q(e);if(n===void 0){if(process.env.NODE_ENV!=="production"&&U()&&typeof t=="function")throw new Error("Unable to resolve a controller from the provided value, so can't watch it's exports. The value you passed is not a controller and not a controller exports. If your controller exports a literal value, try making your controller export an object instead");return e}if(await n.ready,typeof t=="function"){if(process.env.NODE_ENV!=="production"&&U()&&n.watchExports===void 0)throw new Error("The controller must implement watchExports method to support watching exports");let o=n.watchExports(s=>t(s,o))}return n.exports},He=async e=>{let t=q(e);if(process.env.NODE_ENV!=="production"&&U()&&t===void 0)throw new Error("Unable to resolve a controller from the provided value. The value you passed is not a controller and not a controller exports. If your controller exports a literal value, try making your controller export an object instead");return await t.ready,t},q=e=>{let n=M().manager.internals.resolveExports(e);if(n!==void 0)return n;if(pe(e))return e;let o=Ve();if(o!==void 0)return o},T={setter:!1,getter:!1,readOnly:!1},N=new WeakMap,fe;fe=$;var J=class{constructor(e){this._callbacks={hostConnected:[],hostDisconnected:[],hostLoad:[],hostLoaded:[],hostUpdate:[],hostUpdated:[],hostDestroy:[],hostLifecycle:[]},this._ready=new Ge,this._lifecycleCleanups=[],this.connectedCalled=!1,this._loadCalled=!1,this.loadedCalled=!1,this[fe]=!0,this.ready=this._ready.promise,this._exports=le(this),this._exportWatchers=new Set;let t=qe(e??M(new.target.name));process.env.NODE_ENV!=="production"?(Object.defineProperty(this,"component",{writable:!1,enumerable:!1,configurable:!0,value:t}),"hostDestroy"in this&&this.component.manager.ensureHasDestroy?.()):this.component=t,this.component.addController(this),this.component.manager===void 0||(j(this),queueMicrotask(()=>this.catchUpLifecycle()))}catchUpLifecycle(){let{manager:e}=this.component;e.connectedCalled&&!this.connectedCalled&&this.triggerConnected(),e._loadCalled&&this.triggerLoad().then(()=>{e.loadedCalled&&this.triggerLoaded()}).catch(console.error)}get exports(){return this._exports}set exports(e){let t=this._exports;t!==e&&(this._exports=e,this._exportWatchers.forEach(u),this.connectedCalled&&this.assignedProperty!==!1&&this.component.requestUpdate(this.assignedProperty,t)),this._ready.resolve(e)}setProvisionalExports(e,t=!0){this._exports=t?le(e):e,this._exportWatchers.forEach(u)}watchExports(e){let t=()=>e(this._exports);return this._exportWatchers.add(t),()=>void this._exportWatchers.delete(t)}get use(){return E(this.component),We}get useRef(){return E(this.component),He}get useRefSync(){return E(this.component),q}controllerRemoved(){this.component.el.isConnected&&this.triggerDisconnected(),this.triggerDestroy()}onConnected(e){this._callbacks.hostConnected.push(e)}onDisconnected(e){this._callbacks.hostDisconnected.push(e)}onLoad(e){this._callbacks.hostLoad.push(e)}onLoaded(e){this._callbacks.hostLoaded.push(e)}onUpdate(e){this._callbacks.hostUpdate.push(e)}onUpdated(e){this._callbacks.hostUpdated.push(e)}onDestroy(e){process.env.NODE_ENV!=="production"&&P()&&this.component.manager.ensureHasDestroy?.(),this._callbacks.hostDestroy.push(e)}onLifecycle(e){this._callbacks.hostLifecycle.push(e),this.connectedCalled&&this.component.el.isConnected&&this._callLifecycle(e)}triggerConnected(){let e=this;e.hostConnected&&u(e.hostConnected,e),this._callbacks.hostConnected.forEach(u),this.triggerLifecycle(),this.connectedCalled=!0}triggerDisconnected(){let e=this;e.hostDisconnected&&u(e.hostDisconnected,e),this._callbacks.hostDisconnected.forEach(u),this._lifecycleCleanups.forEach(u),this._lifecycleCleanups=[]}async triggerLoad(){if(this._loadCalled)return;this._loadCalled=!0;let e=this;e.hostLoad&&await ie(e.hostLoad,e),this._callbacks.hostLoad.length>0&&await Promise.allSettled(this._callbacks.hostLoad.map(ie)),this._ready.resolve(this._exports)}triggerLoaded(){if(this.loadedCalled)return;let e=this;e.hostLoaded&&u(e.hostLoaded,e),this._callbacks.hostLoaded.forEach(u),this.loadedCalled=!0}triggerUpdate(e){let t=this;t.hostUpdate&&u(t.hostUpdate,t,e),this._callbacks.hostUpdate.forEach(ae,e)}triggerUpdated(e){let t=this;t.hostUpdated&&u(t.hostUpdated,t,e),this._callbacks.hostUpdated.forEach(ae,e)}triggerDestroy(){let e=this;e.hostDestroy&&u(e.hostDestroy,e),this._callbacks.hostDestroy.forEach(u)}triggerLifecycle(){let e=this;e.hostLifecycle&&this._callLifecycle(()=>e.hostLifecycle()),this._callbacks.hostLifecycle.forEach(this._callLifecycle,this)}_callLifecycle(e){E(this.component);let t=u(e);(Array.isArray(t)?t:[t]).forEach(o=>{typeof o=="function"?this._lifecycleCleanups.push(o):typeof o=="object"&&typeof o.remove=="function"&&this._lifecycleCleanups.push(o.remove)})}};function ae(e){u(e,void 0,this)}var me=J;function le(e){if(typeof e!="object"&&typeof e!="function"||e===null)return e;let t=new Proxy(e,{get(n,o,s){if(!(Fe.has(o)&&o in n&&n[o]===t)){if(o in n||o in Promise.prototype||typeof o=="symbol")return typeof n=="function"?n[o]:Reflect.get(n,o,s);if(process.env.NODE_ENV!=="production"&&P()){if(process.env.NODE_ENV==="test"&&(o.startsWith("$$")||o.startsWith("@@")||o==="nodeType"||o==="tagName"||o==="toJSON"||o==="hasAttribute"))return;console.error(`Trying to access "${o.toString()}" on the controller before it's loaded. ${ce}`)}}},set:(n,o,s,r)=>(process.env.NODE_ENV!=="production"&&P()&&console.error(`Trying to set "${o.toString()}" on the controller before it's loaded. ${ce}`),Reflect.set(n,o,s,r))});return t}var Fe=new Set(["exports","_exports"]),ce=process.env.NODE_ENV!=="production"&&P()?["This might be the case if you are trying to access an async controller in ","connectedCallback(). Or, if you are using it inside of ","componentWillLoad()/another controller without controller.use. Example correct ",`usage:
5
+ `,"makeController(async (component, controller)=>{ await controller.use(someOtherController); });"].join(""):void 0;function qe(e){if(process.env.NODE_ENV!=="production"&&P()){if("addController"in e)return e;throw new Error("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")}else return e}function ye(e,t,n){let o=Object.keys(e),s=o.length;C===void 0&&queueMicrotask(B),C??(C=new Map);let r=C.get(e);return r===void 0&&(r={callbacks:[],keyCount:s},C.set(e,r)),r.keyCount!==s&&(r.callbacks.forEach(a=>a(o)),r.callbacks=[],r.keyCount=s),r.callbacks.push(a=>{let i=d=>Je(t,null,d),l=a[s];l===void 0?i(void 0):e[l]===n?i(l):i(void 0)}),n}var C=void 0;function B(){Array.from(C?.entries()??[]).forEach(([e,{callbacks:t}])=>{let n=Object.keys(e);t.forEach(o=>o(n))}),C=void 0}function K(e,t,n){var o;let s=t;if(process.env.NODE_ENV!=="production"&&Be()&&W(e,s)===void 0)throw new Error(e.manager.isLit?`Trying to watch a non-@property, non-@state property "${s}". 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 "${s}". Convert it into a @State() or @Prop property if you need to use watch() on it`);let r=e.manager.internals;(o=r.allWatchers)[s]??(o[s]=[]);let a=r.allWatchers[s],i=n,l=(d,c,p)=>Ke(i,null,d,c,p);return a.push(l),()=>{let d=a.indexOf(l);d!==-1&&a.splice(d,1)}}var ge=class{constructor(e){this.enabledWatchers={},this.allWatchers={},this.enableReadonly=()=>{if(this.enableReadonly=void 0,!this.component.manager.isLit)return;let t=this.component.manager.internals;Object.entries(t.members).forEach(([n,[o]])=>{var s;o&2048&&((s=t.setters)[n]??(s[n]=[]),t.setters[n].push(t.readonlySetter))})},this.trackedValue=G,this.keyTrackers=[],this.getters={},this.setters={},this.accessorGetter={},this.accessorSetter={},this._exports=new WeakMap,this.readonlySetter=(t,n,o)=>{if(T.readOnly)return t;throw new Error(`Cannot assign to read-only property "${o}" of ${this.component.el.tagName.toLowerCase()}. Trying to assign "${String(t)}"`)},process.env.NODE_ENV!=="production"?Object.defineProperty(this,"component",{writable:!1,enumerable:!1,configurable:!0,value:e}):this.component=e}firePropTrackers(e,t){let n=this.keyTrackers;this.trackedValue=G,this.keyTrackers=[],n.forEach(o=>o(e,t))}getSetProxy(e){let t=this.component,n=t.constructor.prototype;if(this._getSetProxy(n,e,"class"),t.manager.isLit)return;let o=t.el.constructor.prototype;n!==o&&this._getSetProxy(o,e,"html")}_getSetProxy(e,t,n){let o=this.component,s=W(o,t),r;do r=Object.getOwnPropertyDescriptor(e,t);while(!r&&(e=Object.getPrototypeOf(e)));if(process.env.NODE_ENV!=="production"&&Ye()){let g=n==="html";if(r?.set===void 0||r.get===void 0){if(r!==void 0&&"value"in r)throw new Error(`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 "${t}" in ${o.el.tagName}`);if(g)return;throw new Error(`Unable to find "${t}" property on the ${o.el.tagName} component`)}if(s===void 0)throw new Error("Unable to retrieve prop type")}else if(!r)return;let a=r.get,i=r.set,l=S in a,d=S in i;if(l&&d)return;let c=!l,p=!d,k=c?function(){let h=a.call(this),m=N.get(this);if(T.getter||m===void 0)return h;let w=m.manager.internals;h=w.accessorGetter[t](h,t);let f=w.getters[t]??H;for(let y=0;y<f.length;y++)h=f[y](h,t);return h}:a,_=p?function(h){let m=a.call(this),w=N.get(this);if(w===void 0){i.call(this,h);return}let f=w.manager.isLit?h??void 0:se(h,s),y=w.manager.internals;if(f===m)i.call(this,f);else{let Y=T.setter?H:y.setters[t]??H;for(let O=0;O<Y.length&&(f=Y[O](f,m,t),f!==m);O++);f=y.accessorSetter[t](f,m,t),i.call(this,f),f!==m&&y.enabledWatchers[t]?.forEach(O=>O(f,m,t))}y.keyTrackers.length>0&&y?.firePropTrackers(t,h)}:i;c&&(k[S]=!0),p&&(_[S]=!0),Object.defineProperty(e,t,{...r,get:k,set:_})}markExports(e,t){(typeof t=="object"&&t!==null||typeof t=="function")&&this._exports.set(t,e)}resolveExports(e){if(typeof e=="object"&&e!==null||typeof e=="function")return this._exports.get(e)}},H=[],S=Symbol(),G=process.env.NODE_ENV!=="production"?Symbol.for(`${F}: nothing`):Symbol();function ve(e,t,n){let o=e.manager.internals;return o.trackedValue!==G&&o.trackedValue!==n&&o.firePropTrackers(void 0,void 0),o.keyTrackers.length===0&&queueMicrotask(()=>o.firePropTrackers(void 0,void 0)),o.trackedValue=n,o.keyTrackers.push((s,r)=>ze(t,void 0,n===r?s:void 0)),n}function Ce(e=[M(),...I()],t,n){let o=Array.isArray(e)?e:[e],s=o.length+1,r=i=>{s-=1,i!==void 0&&(s=Math.min(s,0)),s===0&&t(i)};o.forEach(i=>ye(i,l=>r(l===void 0?void 0:{key:l,host:i,isReactive:!1}),n));let a=o.find(i=>"manager"in i&&typeof i.manager=="object"&&i.manager.component===i);return a&&ve(a,i=>r(i===void 0?void 0:{key:i,host:a,isReactive:!0}),n),n}function Ee(e){T.readOnly=!0;try{return e()}finally{T.readOnly=!1}}var be=e=>(...t)=>{let n=I(),o=new e(...t),s=o.exports;j(n.at(-1));let r=o.component.manager.internals;r.markExports(o,s),o.watchExports(i=>r.markExports(o,i)),Ae(o);let a=[o.component,...n].reverse();return Ce(a,i=>i===void 0?void 0:Qe(o,i,s),s)};function Qe(e,{host:t,key:n,isReactive:o},s){let r=t,a=r[n]!==e.exports,i=r[n]!==s,l=s!==e.exports;if(a&&!i&&l&&(r[n]=e.exports),t===e.component){if(o){let c=e.component.manager.internals;i&&c.markExports(e,r[n]),K(e.component,n,p=>{p!==e.exports&&c.markExports(e,p)})}e.assignedProperty=o?void 0:n}e.watchExports(()=>{if(r[n]===e.exports)return;let c=e.component.manager;c.internals.setters[n]?.includes(c.internals.readonlySetter)?Ee(()=>{r[n]=e.exports}):r[n]=e.exports})}import{Deferred as _e,isEsriInternalEnv as b,safeAsyncCall as Xe,safeCall as D}from"@arcgis/components-utils";import{devToolsAwareTimeout as Ze}from"@arcgis/components-utils";import{getElementAttribute as Yt,isEsriInternalEnv as Qt,observeAncestorsMutation as Xt}from"@arcgis/components-utils";import{getElementLocales as eo,startLocaleObserver as to}from"@arcgis/components-utils";import{isEsriInternalEnv as no}from"@arcgis/components-utils";var et=class extends me{constructor(e,t){let n="addController"in e;process.env.NODE_ENV!=="production"&&b()&&!n&&Object.defineProperty(e.el,"__component",{value:e});let o=new Set;function s(l){o.add(l),!($ in l)&&e.renderRoot&&e.el.isConnected&&l.hostConnected?.()}function r(l){o.delete(l),l.controllerRemoved?.()}let a=e;if(a.addController=s,a.removeController=r,!n){let l=t??e.constructor.__forceUpdate;a.requestUpdate=()=>l(e)}if(process.env.NODE_ENV!=="production"&&b()&&(Object.entries({componentDidLoad:"loaded",componentDidRender:"updated",componentDidUpdate:"updated",componentShouldUpdate:"shouldUpdate",componentWillLoad:"load",componentWillRender:"willUpdate",componentWillUpdate:"willUpdate"}).forEach(([d,c])=>{if(n&&d in e)throw new Error(`Unexpected ${d}() in a Lit component ${e.el.tagName.toLowerCase()}. In Lit, you should use ${c}() instead`);if(!n&&c in e)throw new Error(`Unexpected ${c}() in a Stencil component ${e.el.tagName.toLowerCase()}. In Stencil, you should use ${c}() instead`)}),n)){let d=0,c=!1;for(let p=e;!c;d++){if(p===null)throw new Error("Expected controllers to be used in a LitElement class");if(Object.hasOwn(p,"_load")){c=!0;break}p=Object.getPrototypeOf(p)}if(d<1)throw new Error("It looks like you are trying to call useControllerManager in a component that uses LitElement imported from 'lit'. useControllerManager should only be used in the LitElement coming from `@arcgis/lumina`")}super(e),this.internals=new ge(this.component),this.destroyed=!1,this._updatePromise=new _e,this._originalLifecycles={},this.isLit=n,this.component.manager=this,re(e,n),this._controllers=o,this.exports=void 0,this.hasDestroy=A in this.component&&typeof this.component.destroy=="function",this._bindLifecycleMethods();let i=this.internals;Object.keys(i.members).forEach(l=>{i.accessorGetter[l]=we,i.accessorSetter[l]=we,i.getSetProxy(l)}),n?this.internals.enabledWatchers=this.internals.allWatchers:Object.defineProperty(e,"updateComplete",{get:async()=>await this._updatePromise.promise}),queueMicrotask(i.enableReadonly),E(e),N.set(e.el,e),N.set(e,e)}_bindLifecycleMethods(){let e=this.component,t=this.isLit,n=e.el===e;this._originalLifecycles={_connectedCallback:t||n?void 0:e.connectedCallback,_disconnectedCallback:t||n?void 0:e.disconnectedCallback,_load:t?e.load:e.componentWillLoad,_loaded:t?e.loaded:e.componentDidLoad,_willUpdate:t?void 0:e.componentWillUpdate,_updated:t?void 0:e.componentDidUpdate,_destroy:e.destroy};let o=this._connectedCallback.bind(this),s=this._disconnectedCallback.bind(this),r=this._update.bind(this),a=this._updated.bind(this);t?e.constructor.prototype.addController.call(e,{hostConnected:o,hostDisconnected:s,hostUpdate:r,hostUpdated:a}):(e.connectedCallback=o,e.disconnectedCallback=s,e.componentWillLoad=this._load.bind(this),e.componentDidLoad=this._loaded.bind(this),e.componentWillUpdate=r,e.componentDidUpdate=a),this.hasDestroy&&(e.destroy=this.destroy.bind(this))}_connectedCallback(){if(this.destroyed){let t=this.component.el.tagName.toLowerCase();throw this.component.el.remove(),new Error(`The ${t} component has already been destroyed. It cannot be used again. If you meant to disconnect and reconnect a component without automatic destroy, set the ${A} prop.`)}this._autoDestroyTimeout!==void 0&&clearTimeout(this._autoDestroyTimeout);let e=this.internals;e.enabledWatchers=e.allWatchers,B(),e.enableReadonly?.(),this._controllers.forEach(tt),this._originalLifecycles._connectedCallback?.call(this.component),process.env.NODE_ENV!=="production"&&b()&&he?.(this,!0)}_disconnectedCallback(){this.destroyed||(this._controllers.forEach(ot),this._originalLifecycles._disconnectedCallback?.call(this.component),this.hasDestroy&&this._setAutoDestroyTimeout())}async _load(){await Promise.allSettled(Array.from(this._controllers,nt)),await this._originalLifecycles._load?.call(this.component),this.hasDestroy&&K(this.component,A,()=>this._setAutoDestroyTimeout())}_loaded(){this._controllers.forEach(rt),this._originalLifecycles._loaded?.call(this.component)}_update(){let e=this.component;return this._controllers.forEach(st,e.$changes),this._originalLifecycles._willUpdate?.call(this.component)}_updated(){let e=this.component;if(this._controllers.forEach(it,e.$changes),this._originalLifecycles._updated?.call(this.component),this.isLit)e.$changes=new Map;else{let t=this._updatePromise;this._updatePromise=new _e,t.resolve(!0)}}async destroy(){if(process.env.NODE_ENV!=="production"&&b()&&this.ensureHasDestroy?.(),!this.destroyed){if(this.component.el.isConnected){this.hasDestroy=!1;try{this.component.el.remove()}finally{this.hasDestroy=!0}}this._autoDestroyTimeout=void 0,this.destroyed=!0,this._controllers.forEach(at),this._controllers.clear(),await this._originalLifecycles._destroy?.call(this.component)}}_setAutoDestroyTimeout(){if(this._autoDestroyTimeout!==void 0&&clearTimeout(this._autoDestroyTimeout),!this.component.el.isConnected&&!this.component.autoDestroyDisabled){let e=()=>void this.destroy().catch(console.error);process.env.NODE_ENV!=="production"&&b()&&z===0?queueMicrotask(e):this._autoDestroyTimeout=Ze(e,z)}}};process.env.NODE_ENV!=="production"&&b()&&(et.prototype.ensureHasDestroy=function(){if(!this.hasDestroy)throw new Error(`
6
6
  If the component uses a controller that uses destroy() method, then the
7
7
  component must have the following properties:
8
8
  /**
@@ -21,4 +21,4 @@ import"../chunk-JFKSI6I7.js";import{render as Q}from"lit-html";import{html as X,
21
21
  }
22
22
  `.trim().split(`
23
23
  `).map(t=>t.trim()).join(`
24
- `))});var A="autoDestroyDisabled",z=1e3,Jt=process.env.NODE_ENV!=="production"&&b()?{setAutoDestroyOnDisconnectTimeout:e=>{z=e}}:void 0,_e=e=>e;function et(e){"triggerConnected"in e?e.triggerConnected():D(e.hostConnected,e)}function tt(e){"triggerDisconnected"in e?e.triggerDisconnected():D(e.hostDisconnected,e)}async function ot(e){"triggerLoad"in e?await e.triggerLoad():await Qe(e.hostLoad,e)}function nt(e){"triggerLoaded"in e?e.triggerLoaded():D(e.hostLoaded,e)}function rt(e){"triggerUpdate"in e?e.triggerUpdate(this):D(e.hostUpdate,e,this)}function st(e){"triggerUpdated"in e?e.triggerUpdated(this):D(e.hostUpdated,e,this)}function it(e){"triggerDestroy"in e?e.triggerDestroy():D(e.hostDestroy,e)}var at=class extends J{constructor(e,t){super(e);let n=this.exports;try{E(this.component);let o=t(this.component,this),s=this.exports!==n;if(o instanceof Promise){s||this.setProvisionalExports(o);let r=o.then(a=>{this.exports=a,super.catchUpLifecycle()}).catch(a=>{this._ready.reject(a),console.error(a)});this.onLoad(async()=>await r)}else(!s||o!==void 0)&&(this.exports=o),queueMicrotask(()=>super.catchUpLifecycle())}catch(o){this._ready.reject(o),console.error(o)}}catchUpLifecycle(){}},Bt=Ee(at);var we=e=>(...t)=>{let n=I(),o=new e(...t);return j(n.at(-1)),o};import{LitElement as lt}from"@arcgis/lumina";function ct(e,t){class n extends lt{constructor(){super();let s="prototype"in e?we(e):e;this.controller=s(this),Promise.resolve(t?.(this)).catch(console.error)}render(){return String(typeof this.controller=="object"&&this.controller!==null&&"exports"in this.controller?this.controller.exports:this.controller)}}return n}export{De as mount,$e as setupLuminaTest,ct as wrapController};
24
+ `))});var A="autoDestroyDisabled",z=1e3,Bt=process.env.NODE_ENV!=="production"&&b()?{setAutoDestroyOnDisconnectTimeout:e=>{z=e}}:void 0,we=e=>e;function tt(e){"triggerConnected"in e?e.triggerConnected():D(e.hostConnected,e)}function ot(e){"triggerDisconnected"in e?e.triggerDisconnected():D(e.hostDisconnected,e)}async function nt(e){"triggerLoad"in e?await e.triggerLoad():await Xe(e.hostLoad,e)}function rt(e){"triggerLoaded"in e?e.triggerLoaded():D(e.hostLoaded,e)}function st(e){"triggerUpdate"in e?e.triggerUpdate(this):D(e.hostUpdate,e,this)}function it(e){"triggerUpdated"in e?e.triggerUpdated(this):D(e.hostUpdated,e,this)}function at(e){"triggerDestroy"in e?e.triggerDestroy():D(e.hostDestroy,e)}var lt=class extends J{constructor(e,t){super(e);let n=this.exports;try{E(this.component);let o=t(this.component,this),s=this.exports!==n;if(ue(o)){s||this.setProvisionalExports(o);let r=o.then(a=>{this.exports=a,super.catchUpLifecycle()}).catch(a=>{this._ready.reject(a),console.error(a)});this.onLoad(async()=>await r)}else(!s||o!==void 0)&&(this.exports=o),queueMicrotask(()=>super.catchUpLifecycle())}catch(o){this._ready.reject(o),console.error(o)}}catchUpLifecycle(){}},Kt=be(lt);var Le=e=>(...t)=>{let n=I(),o=new e(...t);return j(n.at(-1)),o};import{LitElement as ct}from"@arcgis/lumina";function dt(e,t){class n extends ct{constructor(){super();let s="prototype"in e?Le(e):e;this.controller=s(this),Promise.resolve(t?.(this)).catch(console.error)}render(){return String(typeof this.controller=="object"&&this.controller!==null&&"exports"in this.controller?this.controller.exports:this.controller)}}return n}export{ke as mount,Me as setupLuminaTest,dt as wrapController};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/lumina-compiler",
3
- "version": "4.33.0-next.6",
3
+ "version": "4.33.0-next.61",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -18,9 +18,9 @@
18
18
  ],
19
19
  "license": "SEE LICENSE IN LICENSE.md",
20
20
  "dependencies": {
21
- "@arcgis/api-extractor": "4.33.0-next.6",
22
- "@arcgis/components-build-utils": "4.33.0-next.6",
23
- "@arcgis/components-utils": "4.33.0-next.6",
21
+ "@arcgis/api-extractor": "4.33.0-next.61",
22
+ "@arcgis/components-build-utils": "4.33.0-next.61",
23
+ "@arcgis/components-utils": "4.33.0-next.61",
24
24
  "chalk": "^5.3.0",
25
25
  "esbuild": "^0.24.0",
26
26
  "js-beautify": "^1.15.1",
@@ -36,6 +36,6 @@
36
36
  "vitest-fail-on-console": "^0.7.1"
37
37
  },
38
38
  "peerDependencies": {
39
- "@arcgis/lumina": "~4.33.0-next.6"
39
+ "@arcgis/lumina": "~4.33.0-next.61"
40
40
  }
41
41
  }