@arcgis/map-components
Version:
ArcGIS Map Components
64 lines (63 loc) • 2.52 kB
JavaScript
import { c } from "../../chunks/runtime.js";
import { html as l } from "lit-html";
import { usePropertyChange as m } from "@arcgis/components-controllers";
import { classes as d } from "@arcgis/components-utils";
import h from "@arcgis/core/widgets/Compass/CompassViewModel.js";
import { LitElement as p, createEvent as g, noShadowRoot as u, safeClassMap as s, nothing as o, safeStyleMap as f } from "@arcgis/lumina";
import { u as y } from "../../chunks/useT9n.js";
import { m as w } from "../../chunks/useViewModel.js";
import { g as i } from "../../chunks/globalCss.js";
import { css as $ } from "@lit/reactive-element/css-tag.js";
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
v4.32.13 */
const b = $` {arcgis-compass{display:block}}`, a = "esri-compass", r = {
base: a,
iconContainer: `${a}__icon-container`
}, v = w(h);
class C extends p {
constructor() {
super(...arguments), this.messages = y(), this.viewModel = v(this), this.autoDestroyDisabled = !1, this.orientation = this.viewModel.orientation, this.position = "top-left", this.state = this.viewModel.state, this.arcgisPropertyChange = m()("state", "orientation"), this.arcgisReady = g();
}
static {
this.properties = { autoDestroyDisabled: 5, icon: 3, label: 1, messageOverrides: 0, orientation: 0, position: 3, referenceElement: 1, state: 3 };
}
static {
this.shadowRootOptions = u;
}
static {
this.styles = b;
}
get icon() {
return this._icon ?? (this.state === "rotation" ? "arrow-up" : "compass-needle");
}
set icon(t) {
this._icon = t;
}
// #endregion
// #region Public Methods
async destroy() {
await this.manager.destroy();
}
async reset() {
this.viewModel.reset();
}
// #endregion
// #region Private Methods
_reset() {
this.viewModel.reset();
}
// #endregion
// #region Rendering
render() {
const { messages: t, icon: n } = this;
return l`<div class=${s(d(r.base, i.widget))}><calcite-button class=${s(i.widgetButton)} .disabled=${this.state === "disabled"} kind=neutral .label=${t.reset} =${this._reset} round scale=s title=${t.reset ?? o}><div aria-hidden=true class=${s(r.iconContainer)} title=${t.reset ?? o}><calcite-icon .icon=${n} style=${f(M(this.orientation))}></calcite-icon></div></calcite-button></div>`;
}
}
const M = (e) => ({
transform: `rotateZ(${e.z}deg)`
});
c("arcgis-compass", C);
export {
C as ArcgisCompass
};