@arcgis/common-components 5.2.0 → 5.2.1
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.
- package/dist/cdn/{VIJOYDJV.js → 3DHXYXS2.js} +1 -1
- package/dist/cdn/{5BL2ZVAO.js → 43HCS4AO.js} +1 -1
- package/dist/cdn/{YVFMVC7S.js → 5BB2PYUS.js} +1 -1
- package/dist/cdn/{POTARK2J.js → 5NZNPGU3.js} +1 -1
- package/dist/cdn/6R2N3R36.js +2 -0
- package/dist/cdn/{MXOYFUNA.js → 74NTMZR7.js} +1 -1
- package/dist/cdn/{KSPDGVUU.js → AX52UB4P.js} +1 -1
- package/dist/cdn/{3TI3WMQ7.js → BP4QEH5P.js} +1 -1
- package/dist/cdn/{B4XGN56Y.js → C2YXXM3L.js} +1 -1
- package/dist/cdn/{ENYZ2JUB.js → CZ7RWWO5.js} +1 -1
- package/dist/cdn/{H34RAA2R.js → EAFPJSRR.js} +1 -1
- package/dist/cdn/{C462OTP3.js → EXAPENBG.js} +1 -1
- package/dist/cdn/{VDY6O5OG.js → FQR3WLX6.js} +1 -1
- package/dist/cdn/{AAPEBXI5.js → G2PB4FKM.js} +1 -1
- package/dist/cdn/{PXM22A4W.js → GBQ7KYFH.js} +1 -1
- package/dist/cdn/{AQDHLYTU.js → GHLRFVJM.js} +1 -1
- package/dist/cdn/{G3JARXLK.js → JSL66BXT.js} +1 -1
- package/dist/cdn/{E5KC44AF.js → KNMXI4BK.js} +1 -1
- package/dist/cdn/{RB3GRZTS.js → KPRGHVBL.js} +1 -1
- package/dist/cdn/{U4YHH4XW.js → L2GQ4HN7.js} +1 -1
- package/dist/cdn/{RWIUPBP3.js → MISZPRPI.js} +1 -1
- package/dist/cdn/{YLLIIP6N.js → OVHD7LQQ.js} +1 -1
- package/dist/cdn/{7LLZKIWR.js → OX5TPWYK.js} +1 -1
- package/dist/cdn/{MSWZITYE.js → PFMVALV4.js} +1 -1
- package/dist/cdn/PG3S4WHV.js +2 -0
- package/dist/cdn/{PCX66U2U.js → QQP6RA4E.js} +1 -1
- package/dist/cdn/{QO7Y7FVY.js → RJSMGCM2.js} +1 -1
- package/dist/cdn/{3DRZ5HBF.js → SVJLMDXU.js} +1 -1
- package/dist/cdn/{3VE4YUY3.js → UHIBCDWU.js} +1 -1
- package/dist/cdn/{OTBUP6VU.js → ULHP5UH5.js} +1 -1
- package/dist/cdn/VWIEMSU3.js +2 -0
- package/dist/cdn/{RNLPUNWJ.js → W2BJNMVY.js} +1 -1
- package/dist/cdn/{H7YT6M7U.js → W4XQSSUS.js} +1 -1
- package/dist/cdn/{EW33LYTO.js → WS4247GN.js} +1 -1
- package/dist/cdn/{7GQB27Y6.js → WYNW4BNC.js} +1 -1
- package/dist/cdn/{D7EBOKKR.js → XTL4S4TJ.js} +1 -1
- package/dist/cdn/{JVBXHMZZ.js → XUOAAIZO.js} +1 -1
- package/dist/cdn/{LESK7PJP.js → ZDNNNWXQ.js} +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/intrinsic-sizing.js +18 -0
- package/dist/chunks/runtime.js +1 -1
- package/dist/components/arcgis-toolbar/customElement.d.ts +20 -0
- package/dist/components/arcgis-toolbar/customElement.js +40 -37
- package/dist/components/arcgis-toolbar-stack/customElement.d.ts +9 -2
- package/dist/components/arcgis-toolbar-stack/customElement.js +72 -74
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/loader.js +2 -2
- package/dist/types/lumina.d.ts +2 -2
- package/dist/types/preact.d.ts +2 -2
- package/dist/types/react.d.ts +2 -2
- package/dist/types/stencil.d.ts +2 -2
- package/package.json +5 -5
- package/dist/cdn/2BAY5JIH.js +0 -2
- package/dist/cdn/D2DHNMUH.js +0 -2
- package/dist/cdn/SWJQKQVE.js +0 -2
- package/dist/chunks/toolbar.js +0 -9
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import { c as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class K {
|
|
2
|
+
import { c as k } from "../../chunks/runtime.js";
|
|
3
|
+
import { css as _, render as C, nothing as z, html as b } from "lit";
|
|
4
|
+
import { LitElement as L, nothing as P } from "@arcgis/lumina";
|
|
5
|
+
import { useDirection as T } from "@arcgis/lumina/controllers";
|
|
6
|
+
import { s as x, a as A, b as $, c as w, r as S } from "../../chunks/intrinsic-sizing.js";
|
|
7
|
+
import { AsyncDirective as R } from "lit/async-directive.js";
|
|
8
|
+
import { directive as D, PartType as K } from "lit/directive.js";
|
|
9
|
+
import { getCommittedValue as u, clearPart as V, insertPart as v, setCommittedValue as g } from "lit/directive-helpers.js";
|
|
10
|
+
const M = _`:host{--calcite-internal-animation-timing-slow: 0}.stack{block-size:100%}.toolbar-stack{display:flex;gap:8px}:host([toolbar-kind="docked"]) .toolbar-stack{gap:0}.line{display:flex;gap:8px}:host([layout="vertical"]) .line{block-size:100%;flex-direction:column}:host([layout="vertical"]) .line[data-alignment=bottom]{align-self:end}.line[data-alignment=left]{justify-content:left}.line[data-alignment=right]{justify-content:right}:host([layout="vertical"]) .toolbar-stack{block-size:100%}:host([layout="horizontal"]) .toolbar-stack{flex-direction:column}:host([toolbar-kind="docked"][layout="horizontal"]) .toolbar-stack{min-inline-size:100%}:host([toolbar-kind="docked"][layout="vertical"]) .toolbar-stack{min-block-size:100%}:host(:not([allocated-length])){.toolbar-stack{grid-area:1 / 1;min-inline-size:0;min-block-size:0}.toolbar-grid-wrapper{flex:1 1 auto}}`;
|
|
11
|
+
class E {
|
|
13
12
|
constructor(t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Set()) {
|
|
14
13
|
this.cachedParts = t, this.directives = e;
|
|
15
14
|
}
|
|
@@ -18,12 +17,12 @@ class K {
|
|
|
18
17
|
t.moveToCache();
|
|
19
18
|
}
|
|
20
19
|
}
|
|
21
|
-
class
|
|
22
|
-
#e;
|
|
20
|
+
class I extends R {
|
|
23
21
|
#i;
|
|
22
|
+
#e;
|
|
24
23
|
#t;
|
|
25
24
|
constructor(t) {
|
|
26
|
-
if (super(t), t.type !==
|
|
25
|
+
if (super(t), t.type !== K.CHILD)
|
|
27
26
|
throw new Error("sharedCache() can only be used in child expressions");
|
|
28
27
|
}
|
|
29
28
|
/**
|
|
@@ -31,13 +30,13 @@ class S extends x {
|
|
|
31
30
|
* @param _key Uniquely identifies the element being rendered
|
|
32
31
|
* @param value The content to render
|
|
33
32
|
*/
|
|
34
|
-
render(t, e,
|
|
35
|
-
return [
|
|
33
|
+
render(t, e, i) {
|
|
34
|
+
return [i];
|
|
36
35
|
}
|
|
37
|
-
update(t, [e,
|
|
38
|
-
this.#t !== e && (this.#t && this.#t.directives.delete(this), e.directives.add(this), this.#t = e), this.#
|
|
39
|
-
const
|
|
40
|
-
return
|
|
36
|
+
update(t, [e, i, a]) {
|
|
37
|
+
this.#t !== e && (this.#t && this.#t.directives.delete(this), e.directives.add(this), this.#t = e), this.#i = t, this.#e = i;
|
|
38
|
+
const o = e.cachedParts.get(i), s = o ? u(o).pop() : void 0;
|
|
39
|
+
return s && (V(t), v(t, void 0, s), g(t, [s])), this.render(e, i, a);
|
|
41
40
|
}
|
|
42
41
|
/**
|
|
43
42
|
* During the update phase, a toolbar may need to be pulled from the cache in a situation
|
|
@@ -50,20 +49,20 @@ class S extends x {
|
|
|
50
49
|
* @returns
|
|
51
50
|
*/
|
|
52
51
|
moveToCache() {
|
|
53
|
-
const t = this.#
|
|
52
|
+
const t = this.#i, e = this.#t;
|
|
54
53
|
if (!t || !e)
|
|
55
54
|
return;
|
|
56
|
-
const
|
|
57
|
-
if (!
|
|
55
|
+
const a = u(t).pop();
|
|
56
|
+
if (!a)
|
|
58
57
|
return;
|
|
59
|
-
let
|
|
60
|
-
if (!
|
|
61
|
-
const
|
|
62
|
-
|
|
58
|
+
let o = e.cachedParts.get(this.#e);
|
|
59
|
+
if (!o) {
|
|
60
|
+
const l = document.createDocumentFragment();
|
|
61
|
+
o = C(z, l), e.cachedParts.set(this.#e, o);
|
|
63
62
|
}
|
|
64
|
-
if (u(
|
|
63
|
+
if (u(o).length > 0)
|
|
65
64
|
throw new Error("sharedCache() keys must be unique");
|
|
66
|
-
|
|
65
|
+
g(o, [a]), v(o, void 0, a);
|
|
67
66
|
}
|
|
68
67
|
disconnected() {
|
|
69
68
|
this.#t?.directives.delete(this);
|
|
@@ -72,83 +71,82 @@ class S extends x {
|
|
|
72
71
|
this.#t?.directives.add(this);
|
|
73
72
|
}
|
|
74
73
|
}
|
|
75
|
-
const O =
|
|
76
|
-
class
|
|
74
|
+
const O = D(I), p = 8;
|
|
75
|
+
class W extends L {
|
|
77
76
|
constructor() {
|
|
78
|
-
super(), this.#
|
|
77
|
+
super(), this.#i = new ResizeObserver((t) => this._updateMeasurement(t)), this.#e = new MutationObserver(() => this._syncToolbars()), this.#a = T(), this.#o = new E(), this._layout = "horizontal", this.scale = "m", this.tooltipAppearance = "native", this.relativePosition = "top-left", this.toolbarKind = "floating", this.listen("arcgisInternalLayoutUpdate", () => this.requestUpdate());
|
|
79
78
|
}
|
|
80
79
|
static {
|
|
81
|
-
this.properties = { _availableLength: 16, _toolbars: 16, effectiveRelativeDirection: 16, layout: 3, scale: 3, tooltipAppearance: 1, relativePosition: 1, toolbarKind: 3 };
|
|
80
|
+
this.properties = { _observedSize: 16, _availableLength: 16, _toolbars: 16, effectiveRelativeDirection: 16, layout: 3, scale: 3, tooltipAppearance: 1, relativePosition: 1, toolbarKind: 3, allocatedLength: 11 };
|
|
82
81
|
}
|
|
83
82
|
static {
|
|
84
|
-
this.styles = [
|
|
83
|
+
this.styles = [M, x, A, $, w];
|
|
85
84
|
}
|
|
86
|
-
#e;
|
|
87
85
|
#i;
|
|
86
|
+
#e;
|
|
88
87
|
#t;
|
|
89
|
-
#
|
|
90
|
-
#s;
|
|
88
|
+
#a;
|
|
91
89
|
#o;
|
|
90
|
+
get _availableLength() {
|
|
91
|
+
return this.allocatedLength ?? (this.layout === "horizontal" ? this._observedSize?.width : this._observedSize?.height) ?? 0;
|
|
92
|
+
}
|
|
92
93
|
get effectiveRelativeDirection() {
|
|
93
|
-
const [t, e] = this.relativePosition.split("-"),
|
|
94
|
+
const [t, e] = this.relativePosition.split("-"), i = this.#a;
|
|
94
95
|
switch (e) {
|
|
95
96
|
case "left":
|
|
96
97
|
case "right":
|
|
97
98
|
return `${t}-${e}`;
|
|
98
99
|
case "end":
|
|
99
|
-
return `${t}-${
|
|
100
|
+
return `${t}-${i === "ltr" ? "right" : "left"}`;
|
|
100
101
|
case "start":
|
|
101
|
-
return `${t}-${
|
|
102
|
+
return `${t}-${i === "ltr" ? "left" : "right"}`;
|
|
102
103
|
}
|
|
103
104
|
}
|
|
104
105
|
get layout() {
|
|
105
106
|
return this._layout;
|
|
106
107
|
}
|
|
107
108
|
set layout(t) {
|
|
108
|
-
t !== this._layout && (this._layout = t
|
|
109
|
+
t !== this._layout && (this._layout = t);
|
|
109
110
|
}
|
|
110
111
|
connectedCallback() {
|
|
111
|
-
super.connectedCallback(), this.
|
|
112
|
+
super.connectedCallback(), this.#i.observe(this.el), this.#e.observe(this.el, { childList: !0 }), this._syncToolbars();
|
|
112
113
|
}
|
|
113
114
|
disconnectedCallback() {
|
|
114
|
-
this.#
|
|
115
|
-
}
|
|
116
|
-
_setRulerEl(t) {
|
|
117
|
-
this.#o !== t && (this.#o = t, this.isConnected && this._connectMeasurement(t));
|
|
118
|
-
}
|
|
119
|
-
_connectMeasurement(t) {
|
|
120
|
-
this.#e.disconnect(), t && (this.#e.observe(t), this._updateMeasurement());
|
|
115
|
+
this.#i.disconnect(), this.#e.disconnect(), super.disconnectedCallback();
|
|
121
116
|
}
|
|
122
117
|
_updateMeasurement(t) {
|
|
123
|
-
|
|
124
|
-
e && (this._availableLength = this.layout === "horizontal" ? e.width : e.height);
|
|
118
|
+
this._observedSize = t?.at(0)?.contentRect;
|
|
125
119
|
}
|
|
126
120
|
_syncToolbars() {
|
|
127
121
|
this.#t?.abort();
|
|
128
|
-
const t = Array.from(this.el.children).filter(
|
|
129
|
-
this.#t = e, Promise.all(t.map((
|
|
122
|
+
const t = Array.from(this.el.children).filter(j), e = new AbortController();
|
|
123
|
+
this.#t = e, Promise.all(t.map((i) => i.componentOnReady())).then(() => {
|
|
130
124
|
!this.isConnected || e.signal.aborted || (this._toolbars = t);
|
|
131
125
|
});
|
|
132
126
|
}
|
|
133
127
|
_arrangeToolbarLines(t, e) {
|
|
134
|
-
const
|
|
128
|
+
const i = t.map((r) => {
|
|
135
129
|
const d = r.allocate(e, this._availableLength);
|
|
136
|
-
return { toolbar: r, budget: d.reduce((
|
|
137
|
-
}),
|
|
138
|
-
let
|
|
139
|
-
for (const r of
|
|
140
|
-
const d =
|
|
141
|
-
|
|
130
|
+
return { toolbar: r, budget: d.reduce((f, y) => f + y.budget, 0) };
|
|
131
|
+
}), a = [];
|
|
132
|
+
let o = [], s = 0;
|
|
133
|
+
for (const r of i) {
|
|
134
|
+
const d = s + (o.length === 0 ? 0 : p) + r.budget;
|
|
135
|
+
o.length > 0 && (this.toolbarKind === "docked" || d > this._availableLength) ? (a.push(o), o = [r], s = r.budget) : (o.push(r), s = d);
|
|
142
136
|
}
|
|
143
|
-
|
|
144
|
-
const [
|
|
145
|
-
return (
|
|
137
|
+
o.length > 0 && a.push(o);
|
|
138
|
+
const [l, h] = e.relativePosition.split("-"), c = e.layout === "vertical";
|
|
139
|
+
return (c ? h === "right" : l === "bottom") && a.reverse(), (c ? l === "bottom" : h === "right") && a.forEach((r) => r.reverse()), a;
|
|
140
|
+
}
|
|
141
|
+
#s;
|
|
142
|
+
_renderIntrinsicSizeContribution(t, e) {
|
|
143
|
+
const i = t.map((s) => s.measureIntrinsicSize(e)), a = this.toolbarKind === "docked" ? Math.max(...i.map(({ maximum: s }) => s)) : i.reduce((s, { maximum: l }) => s + l, 0) + p * (t.length - 1), o = Math.max(...i.map(({ minimum: s }) => s));
|
|
144
|
+
return S(o, a, this.layout);
|
|
146
145
|
}
|
|
147
|
-
#a;
|
|
148
146
|
render() {
|
|
149
147
|
const t = this._toolbars;
|
|
150
148
|
if (!t?.length) {
|
|
151
|
-
this.#
|
|
149
|
+
this.#s?.length && (this.#o.moveAllToCache(), this.#s = []);
|
|
152
150
|
return;
|
|
153
151
|
}
|
|
154
152
|
const e = {
|
|
@@ -157,19 +155,19 @@ class j extends P {
|
|
|
157
155
|
scale: this.scale,
|
|
158
156
|
tooltipAppearance: this.tooltipAppearance,
|
|
159
157
|
toolbarKind: this.toolbarKind
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
const [
|
|
163
|
-
return b`<div class="stack
|
|
158
|
+
}, i = this._arrangeToolbarLines(t, e);
|
|
159
|
+
q(this.#s, i) || (this.#o.moveAllToCache(), this.#s = i.map((h) => h.map(({ toolbar: c }) => c)));
|
|
160
|
+
const [a, o] = e.relativePosition.split("-"), s = this.layout === "vertical" ? a : o, l = this.#o;
|
|
161
|
+
return b`<div class="stack intrinsic-sizing-container">${this.allocatedLength === void 0 && this._renderIntrinsicSizeContribution(t, e) || ""}<div class="toolbar-stack">${i.map((h) => b`<div class="line" data-alignment=${s ?? P}>${h.map(({ toolbar: c, budget: m }) => O(l, c, c.proxiedRender(e, m, this.toolbarKind, this._availableLength)))}</div>`)}</div></div>`;
|
|
164
162
|
}
|
|
165
163
|
}
|
|
166
|
-
function
|
|
164
|
+
function j(n) {
|
|
167
165
|
return n.localName === "arcgis-toolbar";
|
|
168
166
|
}
|
|
169
|
-
function
|
|
170
|
-
return n?.length === t.length && t.every((e,
|
|
167
|
+
function q(n, t) {
|
|
168
|
+
return n?.length === t.length && t.every((e, i) => e.length === n[i].length && e.every(({ toolbar: a }, o) => a === n[i][o]));
|
|
171
169
|
}
|
|
172
|
-
|
|
170
|
+
k("arcgis-toolbar-stack", W);
|
|
173
171
|
export {
|
|
174
|
-
|
|
172
|
+
W as ArcgisToolbarStack
|
|
175
173
|
};
|