@arcgis/coding-components
Version:
ArcGIS Coding Components
46 lines (45 loc) • 2.4 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import { c as i } from "../../chunks/runtime.js";
import { css as l, html as a } from "lit";
import { LitElement as o } from "@arcgis/lumina";
import { u as c } from "../../chunks/useT9n.js";
import { d as u, g as n, c as r, t as s } from "../../chunks/debugger-value-styles.js";
import { observeAncestorsMutation as d, unsafeGetCalciteModeName as g } from "@arcgis/toolkit/dom";
import { D as m, i as p, f as h, a as b, b as f } from "../../chunks/debugger-value-components.js";
const T = l`:host{display:flex;flex-direction:column;width:100%;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);--calcite-block-padding: var(--calcite-spacing-sm);overflow:auto;calcite-flow{height:100%}.disabled-state-text{font-size:var(--calcite-font-size-sm);color:var(--calcite-color-text-3);font-style:italic;display:block;margin:var(--calcite-spacing-md)}[class*=result-value-]{line-height:1.25rem}}`;
function v(t, e) {
return p(t) || h(t) || b(t) || f(t) ? e ?? "Output" : t.arcadeType;
}
class y extends o {
constructor() {
super(...arguments), this.messages = c();
}
static {
this.properties = { debuggerStore: 0, result: 0, outputTitle: 1 };
}
static {
this.styles = [T, u, n()];
}
load() {
this.manager.onLifecycle(() => {
const e = d(this.el, ["class"], this.updateTheme.bind(this));
return this.updateTheme(), () => e();
});
}
willUpdate(e) {
e.has("result") && this.result && this.debuggerStore?.lazyTreeState.reset();
}
updateTheme() {
g(this.el) === "dark" ? this.elementInternals.states.add(r) : this.elementInternals.states.delete(r);
}
render() {
if (!this.result)
return a`<span class="disabled-state-text">${this.messages.nooutput ?? "No output available."}</span>`;
const e = this.debuggerStore?.lazyTreeState;
return e ? a`<calcite-tree .scale=${s.scale} =${s.oncalciteTreeSelect} .lines=${s.lines} .selectionMode=${s.selectionMode}>${m({ expanded: !0, name: v(this.result, this.outputTitle), value: this.result, messages: this.messages, path: this.result.arcadeType, lazyTreeState: e })}</calcite-tree>` : a`<span class="disabled-state-text">${this.messages.nooutput ?? "No output available."}</span>`;
}
}
i("arcgis-arcade-debugger-output", y);
export {
y as ArcgisArcadeDebuggerOutput
};