@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.
Files changed (59) hide show
  1. package/dist/cdn/{VIJOYDJV.js → 3DHXYXS2.js} +1 -1
  2. package/dist/cdn/{5BL2ZVAO.js → 43HCS4AO.js} +1 -1
  3. package/dist/cdn/{YVFMVC7S.js → 5BB2PYUS.js} +1 -1
  4. package/dist/cdn/{POTARK2J.js → 5NZNPGU3.js} +1 -1
  5. package/dist/cdn/6R2N3R36.js +2 -0
  6. package/dist/cdn/{MXOYFUNA.js → 74NTMZR7.js} +1 -1
  7. package/dist/cdn/{KSPDGVUU.js → AX52UB4P.js} +1 -1
  8. package/dist/cdn/{3TI3WMQ7.js → BP4QEH5P.js} +1 -1
  9. package/dist/cdn/{B4XGN56Y.js → C2YXXM3L.js} +1 -1
  10. package/dist/cdn/{ENYZ2JUB.js → CZ7RWWO5.js} +1 -1
  11. package/dist/cdn/{H34RAA2R.js → EAFPJSRR.js} +1 -1
  12. package/dist/cdn/{C462OTP3.js → EXAPENBG.js} +1 -1
  13. package/dist/cdn/{VDY6O5OG.js → FQR3WLX6.js} +1 -1
  14. package/dist/cdn/{AAPEBXI5.js → G2PB4FKM.js} +1 -1
  15. package/dist/cdn/{PXM22A4W.js → GBQ7KYFH.js} +1 -1
  16. package/dist/cdn/{AQDHLYTU.js → GHLRFVJM.js} +1 -1
  17. package/dist/cdn/{G3JARXLK.js → JSL66BXT.js} +1 -1
  18. package/dist/cdn/{E5KC44AF.js → KNMXI4BK.js} +1 -1
  19. package/dist/cdn/{RB3GRZTS.js → KPRGHVBL.js} +1 -1
  20. package/dist/cdn/{U4YHH4XW.js → L2GQ4HN7.js} +1 -1
  21. package/dist/cdn/{RWIUPBP3.js → MISZPRPI.js} +1 -1
  22. package/dist/cdn/{YLLIIP6N.js → OVHD7LQQ.js} +1 -1
  23. package/dist/cdn/{7LLZKIWR.js → OX5TPWYK.js} +1 -1
  24. package/dist/cdn/{MSWZITYE.js → PFMVALV4.js} +1 -1
  25. package/dist/cdn/PG3S4WHV.js +2 -0
  26. package/dist/cdn/{PCX66U2U.js → QQP6RA4E.js} +1 -1
  27. package/dist/cdn/{QO7Y7FVY.js → RJSMGCM2.js} +1 -1
  28. package/dist/cdn/{3DRZ5HBF.js → SVJLMDXU.js} +1 -1
  29. package/dist/cdn/{3VE4YUY3.js → UHIBCDWU.js} +1 -1
  30. package/dist/cdn/{OTBUP6VU.js → ULHP5UH5.js} +1 -1
  31. package/dist/cdn/VWIEMSU3.js +2 -0
  32. package/dist/cdn/{RNLPUNWJ.js → W2BJNMVY.js} +1 -1
  33. package/dist/cdn/{H7YT6M7U.js → W4XQSSUS.js} +1 -1
  34. package/dist/cdn/{EW33LYTO.js → WS4247GN.js} +1 -1
  35. package/dist/cdn/{7GQB27Y6.js → WYNW4BNC.js} +1 -1
  36. package/dist/cdn/{D7EBOKKR.js → XTL4S4TJ.js} +1 -1
  37. package/dist/cdn/{JVBXHMZZ.js → XUOAAIZO.js} +1 -1
  38. package/dist/cdn/{LESK7PJP.js → ZDNNNWXQ.js} +1 -1
  39. package/dist/cdn/index.js +1 -1
  40. package/dist/chunks/intrinsic-sizing.js +18 -0
  41. package/dist/chunks/runtime.js +1 -1
  42. package/dist/components/arcgis-toolbar/customElement.d.ts +20 -0
  43. package/dist/components/arcgis-toolbar/customElement.js +40 -37
  44. package/dist/components/arcgis-toolbar-stack/customElement.d.ts +9 -2
  45. package/dist/components/arcgis-toolbar-stack/customElement.js +72 -74
  46. package/dist/docs/api.json +1 -1
  47. package/dist/docs/docs.json +1 -1
  48. package/dist/docs/vscode.html-custom-data.json +1 -1
  49. package/dist/docs/web-types.json +1 -1
  50. package/dist/loader.js +2 -2
  51. package/dist/types/lumina.d.ts +2 -2
  52. package/dist/types/preact.d.ts +2 -2
  53. package/dist/types/react.d.ts +2 -2
  54. package/dist/types/stencil.d.ts +2 -2
  55. package/package.json +5 -5
  56. package/dist/cdn/2BAY5JIH.js +0 -2
  57. package/dist/cdn/D2DHNMUH.js +0 -2
  58. package/dist/cdn/SWJQKQVE.js +0 -2
  59. 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 y } from "../../chunks/runtime.js";
3
- import { ref as _ } from "lit/directives/ref.js";
4
- import { css as k, render as C, nothing as L, html as b } from "lit";
5
- import { LitElement as P, nothing as T } from "@arcgis/lumina";
6
- import { useDirection as A } from "@arcgis/lumina/controllers";
7
- import { s as $, a as R, b as w, c as z } from "../../chunks/toolbar.js";
8
- import { AsyncDirective as x } from "lit/async-directive.js";
9
- import { directive as M, PartType as D } from "lit/directive.js";
10
- import { getCommittedValue as u, clearPart as E, insertPart as v, setCommittedValue as p } from "lit/directive-helpers.js";
11
- const V = k`: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%}`;
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 S extends x {
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 !== D.CHILD)
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, s) {
35
- return [s];
33
+ render(t, e, i) {
34
+ return [i];
36
35
  }
37
- update(t, [e, s, o]) {
38
- this.#t !== e && (this.#t && this.#t.directives.delete(this), e.directives.add(this), this.#t = e), this.#e = t, this.#i = s;
39
- const i = e.cachedParts.get(s), a = i ? u(i).pop() : void 0;
40
- return a && (E(t), v(t, void 0, a), p(t, [a])), this.render(e, s, o);
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.#e, e = this.#t;
52
+ const t = this.#i, e = this.#t;
54
53
  if (!t || !e)
55
54
  return;
56
- const o = u(t).pop();
57
- if (!o)
55
+ const a = u(t).pop();
56
+ if (!a)
58
57
  return;
59
- let i = e.cachedParts.get(this.#i);
60
- if (!i) {
61
- const c = document.createDocumentFragment();
62
- i = C(L, c), e.cachedParts.set(this.#i, i);
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(i).length > 0)
63
+ if (u(o).length > 0)
65
64
  throw new Error("sharedCache() keys must be unique");
66
- p(i, [o]), v(i, void 0, o);
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 = M(S), W = 8;
76
- class j extends P {
74
+ const O = D(I), p = 8;
75
+ class W extends L {
77
76
  constructor() {
78
- super(), this.#e = new ResizeObserver((t) => this._updateMeasurement(t)), this.#i = new MutationObserver(() => this._syncToolbars()), this.#r = A(), this.#s = new K(), this._layout = "horizontal", this._availableLength = 0, this.scale = "m", this.tooltipAppearance = "native", this.relativePosition = "top-left", this.toolbarKind = "floating", this.listen("arcgisInternalLayoutUpdate", () => this.requestUpdate());
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 = [V, $, R, w, z];
83
+ this.styles = [M, x, A, $, w];
85
84
  }
86
- #e;
87
85
  #i;
86
+ #e;
88
87
  #t;
89
- #r;
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("-"), s = this.#r;
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}-${s === "ltr" ? "right" : "left"}`;
100
+ return `${t}-${i === "ltr" ? "right" : "left"}`;
100
101
  case "start":
101
- return `${t}-${s === "ltr" ? "left" : "right"}`;
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, this._updateMeasurement());
109
+ t !== this._layout && (this._layout = t);
109
110
  }
110
111
  connectedCallback() {
111
- super.connectedCallback(), this._connectMeasurement(this.#o), this.#i.observe(this.el, { childList: !0 }), this._syncToolbars();
112
+ super.connectedCallback(), this.#i.observe(this.el), this.#e.observe(this.el, { childList: !0 }), this._syncToolbars();
112
113
  }
113
114
  disconnectedCallback() {
114
- this.#e.disconnect(), this.#i.disconnect(), super.disconnectedCallback();
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
- const e = t?.at(0)?.contentRect ?? this.#o?.getBoundingClientRect();
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(q), e = new AbortController();
129
- this.#t = e, Promise.all(t.map((s) => s.componentOnReady())).then(() => {
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 s = t.map((r) => {
128
+ const i = t.map((r) => {
135
129
  const d = r.allocate(e, this._availableLength);
136
- return { toolbar: r, budget: d.reduce((g, f) => g + f.budget, 0) };
137
- }), o = [];
138
- let i = [], a = 0;
139
- for (const r of s) {
140
- const d = a + (i.length === 0 ? 0 : W) + r.budget;
141
- i.length > 0 && (this.toolbarKind === "docked" || d > this._availableLength) ? (o.push(i), i = [r], a = r.budget) : (i.push(r), a = d);
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
- i.length > 0 && o.push(i);
144
- const [c, h] = e.relativePosition.split("-"), l = e.layout === "vertical";
145
- return (l ? h === "right" : c === "bottom") && o.reverse(), (l ? c === "bottom" : h === "right") && o.forEach((r) => r.reverse()), o;
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.#a?.length && (this.#s.moveAllToCache(), this.#a = []);
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
- }, s = this._arrangeToolbarLines(t, e);
161
- U(this.#a, s) || (this.#s.moveAllToCache(), this.#a = s.map((h) => h.map(({ toolbar: l }) => l)));
162
- const [o, i] = e.relativePosition.split("-"), a = this.layout === "vertical" ? o : i, c = this.#s;
163
- return b`<div class="stack"><div class="ruler" ${_(this._setRulerEl)}></div><div class="toolbar-stack">${s.map((h) => b`<div class="line" data-alignment=${a ?? T}>${h.map(({ toolbar: l, budget: m }) => O(c, l, l.proxiedRender(e, m, this.toolbarKind, this._availableLength)))}</div>`)}</div></div>`;
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 q(n) {
164
+ function j(n) {
167
165
  return n.localName === "arcgis-toolbar";
168
166
  }
169
- function U(n, t) {
170
- return n?.length === t.length && t.every((e, s) => e.length === n[s].length && e.every(({ toolbar: o }, i) => o === n[s][i]));
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
- y("arcgis-toolbar-stack", j);
170
+ k("arcgis-toolbar-stack", W);
173
171
  export {
174
- j as ArcgisToolbarStack
172
+ W as ArcgisToolbarStack
175
173
  };