@arcgis/map-components 6.0.0-next.33 → 6.0.0-next.34
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/4UCQJWD2.js +2 -0
- package/dist/cdn/6UMEQS35.js +2 -0
- package/dist/cdn/7OLHJCFT.js +2 -0
- package/dist/cdn/AMRSK274.js +2 -0
- package/dist/cdn/D4UNIFIZ.js +2 -0
- package/dist/cdn/JKE3FA4Q.js +2 -0
- package/dist/cdn/JZTCF52M.js +2 -0
- package/dist/cdn/NZK2LVFA.js +2 -0
- package/dist/cdn/PTHNXKEA.js +2 -0
- package/dist/cdn/QCZQCLAT.js +2 -0
- package/dist/cdn/QVIQ66LA.js +2 -0
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/layer-list-next.js +49 -4
- package/dist/components/arcgis-basemap-layer-list-next/customElement.d.ts +3 -0
- package/dist/components/arcgis-basemap-layer-list-next/customElement.js +102 -101
- package/dist/components/arcgis-catalog-layer-list-next/customElement.d.ts +3 -0
- package/dist/components/arcgis-catalog-layer-list-next/customElement.js +87 -86
- package/dist/components/arcgis-expand/customElement.js +13 -13
- package/dist/components/arcgis-layer-list-next/customElement.d.ts +1 -0
- package/dist/components/arcgis-layer-list-next/customElement.js +72 -71
- package/dist/components/arcgis-sketch/customElement.d.ts +6 -4
- package/dist/components/arcgis-sketch/customElement.js +177 -167
- package/dist/components/arcgis-table-list-next/customElement.d.ts +3 -0
- package/dist/components/arcgis-table-list-next/customElement.js +44 -43
- package/dist/components/arcgis-utility-network-picker/customElement.js +32 -31
- package/dist/components/arcgis-utility-network-trace-configuration-picker/customElement.d.ts +10 -4
- package/dist/components/arcgis-utility-network-trace-configuration-picker/customElement.js +10 -9
- package/dist/components/arcgis-utility-network-trace-inputs/customElement.d.ts +3 -0
- package/dist/components/arcgis-utility-network-trace-inputs/customElement.js +7 -7
- package/dist/components/arcgis-utility-network-trace-results/customElement.d.ts +1 -1
- package/dist/components/arcgis-view-popover/customElement.d.ts +65 -33
- package/dist/components/arcgis-view-popover/customElement.js +196 -108
- package/dist/components/arcgis-view-popover/index.js +1 -1
- 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 +1 -1
- package/dist/types/lumina.d.ts +1 -1
- package/dist/types/preact.d.ts +1 -1
- package/dist/types/react.d.ts +1 -1
- package/dist/types/stencil.d.ts +1 -1
- package/package.json +7 -7
- package/dist/cdn/3NUN6DK3.js +0 -2
- package/dist/cdn/6FJUKYNB.js +0 -2
- package/dist/cdn/7Y6PADB5.js +0 -2
- package/dist/cdn/I5F7MVDT.js +0 -2
- package/dist/cdn/P5U37XIA.js +0 -2
- package/dist/cdn/PD4ELTMF.js +0 -2
- package/dist/cdn/RAADOJWX.js +0 -2
- package/dist/cdn/TY4XRXLB.js +0 -2
- package/dist/cdn/UZ4VANCL.js +0 -2
- package/dist/cdn/W4BA3ECA.js +0 -2
- package/dist/cdn/ZEQHIKTN.js +0 -2
|
@@ -1,81 +1,113 @@
|
|
|
1
1
|
/// <reference path="../../index.d.ts" />
|
|
2
|
-
import type MapView from "@arcgis/core/views/MapView.js";
|
|
3
|
-
import type SceneView from "@arcgis/core/views/SceneView.js";
|
|
4
2
|
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
5
3
|
import type { ActionBar as ActionBar } from "@esri/calcite-components/components/calcite-action-bar";
|
|
6
4
|
import type { Button as Button } from "@esri/calcite-components/components/calcite-button";
|
|
7
5
|
|
|
8
6
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* when the exact placement and content of the popover is highly variable.
|
|
7
|
+
* View popover solves the problem of showing dynamically sized content in a popover, which could be anchored just
|
|
8
|
+
* about anywhere and in any context, while ensuring a visually-consistent appearance.
|
|
12
9
|
*
|
|
13
|
-
*
|
|
14
|
-
* of the view, in multiple orientations, and with highly configurable settings contents.
|
|
10
|
+
* Key requirements driving this design (and that calcite-popover does not handle):
|
|
15
11
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
12
|
+
* - Does not expand to fill space; it is as small as it can be for the natural size of the content it is showing
|
|
13
|
+
* - Respects arcgis-map/arcgis-scene margins if slotted into a view, unless available width falls below
|
|
14
|
+
* `minimumUsableWidth`. Otherwise, applies a small margin between it and viewport edges;
|
|
15
|
+
* chosen to match the margin it applies between the popover and the anchoring bar.
|
|
16
|
+
* - Chooses the right 'side' of the anchoring element to open into; e.g. above or below the bar. It chooses
|
|
17
|
+
* optimally to give the most space to the content
|
|
18
|
+
* - Aligns the popover with the action and toolbar it is anchored to. This avoids old behavior where it was
|
|
19
|
+
* awkwardly offset.
|
|
18
20
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* to enable automatic positioning within the view.
|
|
21
|
+
* An earlier iteration of this component relied on setting various calcite-popover properties, but this was
|
|
22
|
+
* untenable; it essentially had two layout systems fighting each other and couldn't quite get to what we wanted.
|
|
22
23
|
*
|
|
23
|
-
*
|
|
24
|
+
* Assign [anchorElement](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-view-popover/#anchorElement) and
|
|
25
|
+
* [actionBarElement](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-view-popover/#actionBarElement) for toolbar-edge alignment.
|
|
26
|
+
*
|
|
27
|
+
* The panel aligns with the **toolbar** edge nearest the action, or centers on the action
|
|
28
|
+
* when edge alignment cannot keep the tail pointed at it.
|
|
29
|
+
*
|
|
30
|
+
* The header always includes a close action and remains visible while overflowing content scrolls.
|
|
31
|
+
* The tail is hidden when the action is fully clipped or cannot be reached without overlapping a corner;
|
|
32
|
+
* the popover is hidden when its action bar (or the action, when no bar is assigned) is fully clipped.
|
|
33
|
+
* Neither changes the requested open state.
|
|
34
|
+
*
|
|
35
|
+
* **Limitation**: Positioning responds to resizing, scrolling, component properties, and direct toolbar/view
|
|
36
|
+
* attribute changes. Position-only changes from ancestor layout or CSS animations are not tracked.
|
|
37
|
+
*
|
|
38
|
+
* Layout process overview:
|
|
39
|
+
*
|
|
40
|
+
* - Viewport selection: `_containingView` identifies the anchor's map/scene ancestor; otherwise viewport bounds apply.
|
|
41
|
+
* - Bounds measurement: `measureVisibleViewport`, `measurePaddedView`, and `measureFrameBounds` determine the outer usable area.
|
|
42
|
+
* - Frame: `showNativePopoverLayer` opens a native top-layer popover over that area, avoiding ancestor clipping.
|
|
43
|
+
* - Bounds element: inside the frame, CSS reserves the map/scene's inherited overlay-UI spacing.
|
|
44
|
+
* `_positionPopover` measures this inset rectangle to determine the panel's available space
|
|
45
|
+
* and positioning origin, letting the browser resolve CSS lengths into pixels.
|
|
46
|
+
* - Opening direction: `getToolbarCorner` and `getAttachmentInsets` reserve the attachment edge and tail gap.
|
|
47
|
+
* - Content sizing: `_layoutSurface` retries with viewport bounds if view-constrained width is below `minimumUsableWidth`,
|
|
48
|
+
* supplies size limits, then lets CSS and Calcite measure the content-sized panel.
|
|
49
|
+
* - Alignment: `alignPanelWithAction` chooses toolbar-edge alignment or action centering along the cross axis.
|
|
50
|
+
* - Placement: `applySurfacePosition` and `setPixelStyles` apply panel insets and the tail offset.
|
|
51
|
+
* - Presentation: `render` builds the frame/bounds/surface layers; `_renderPanel` supplies the heading, close action,
|
|
52
|
+
* scrolling content, and Calcite focus handling. CSS draws the optional tail without affecting layout.
|
|
53
|
+
* - Updates: `_observePosition` combines DOM observations, shadow-root scroll listeners, and view subscriptions;
|
|
54
|
+
* `_scheduleReposition` combines notifications to efficiently update the position.
|
|
55
|
+
* - Visibility and dismissal: `_hidePopover` hides unavailable or closed content; the close and keyboard handlers update `open`.
|
|
56
|
+
*
|
|
57
|
+
* @since 5.2
|
|
24
58
|
* @internal
|
|
25
59
|
*/
|
|
26
60
|
export abstract class ArcgisViewPopover extends LitElement {
|
|
27
|
-
/** The
|
|
61
|
+
/** The action bar whose visible edges align with the popover. */
|
|
28
62
|
accessor actionBarElement: ActionBar | undefined;
|
|
63
|
+
/** Resolves the toolbar orientation used to determine the main (opening up/down vs left/right) and cross axes (used for aligning the sides). */
|
|
29
64
|
get actionBarLayout(): ActionBarLayout;
|
|
30
65
|
/** The action element that anchors the popover. */
|
|
31
66
|
accessor anchorElement: HTMLElement | undefined;
|
|
32
|
-
/**
|
|
33
|
-
* Indicates whether the popover includes a close action in the header.
|
|
34
|
-
*
|
|
35
|
-
* @default true
|
|
36
|
-
*/
|
|
37
|
-
accessor closable: boolean;
|
|
38
|
-
/** The popover heading. */
|
|
67
|
+
/** The visible popover heading and accessible dialog name. */
|
|
39
68
|
accessor heading: string | undefined;
|
|
40
|
-
/** Accessible label for the popover. */
|
|
41
|
-
accessor label: string | undefined;
|
|
42
69
|
/**
|
|
43
|
-
* Maximum content width
|
|
70
|
+
* Maximum content width in pixels, further limited by available space.
|
|
44
71
|
*
|
|
45
72
|
* @default 400
|
|
46
73
|
*/
|
|
47
74
|
accessor maxContentWidth: number;
|
|
48
75
|
/**
|
|
49
|
-
*
|
|
76
|
+
* Preferred minimum content width in pixels; yields to smaller bounds.
|
|
50
77
|
*
|
|
51
78
|
* @default 300
|
|
52
79
|
*/
|
|
53
80
|
accessor minContentWidth: number;
|
|
54
81
|
/**
|
|
55
|
-
*
|
|
82
|
+
* Minimum available width in pixels before view-constrained layout falls back to viewport bounds.
|
|
83
|
+
* This does not enforce a minimum content width. Set to `0` to disable the fallback.
|
|
56
84
|
*
|
|
57
|
-
*
|
|
85
|
+
* @default 200
|
|
86
|
+
*/
|
|
87
|
+
accessor minimumUsableWidth: number;
|
|
88
|
+
/**
|
|
89
|
+
* Indicates whether the popover is open.
|
|
90
|
+
* Listen for [@arcgisPropertyChange](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-view-popover/#event-arcgisPropertyChange) for user-driven closing.
|
|
58
91
|
*
|
|
59
92
|
* @default false
|
|
60
93
|
*/
|
|
61
94
|
accessor open: boolean;
|
|
62
95
|
/**
|
|
63
|
-
*
|
|
96
|
+
* Whether the tail attaches to the action or its containing bar.
|
|
64
97
|
*
|
|
65
98
|
* @default "bar"
|
|
66
99
|
*/
|
|
67
100
|
accessor tailAttachmentAppearance: TailAttachmentAppearance;
|
|
68
|
-
/** The view that constrains popover placement and sizing. */
|
|
69
|
-
accessor view: MapView | SceneView | undefined;
|
|
70
101
|
/**
|
|
71
|
-
* Minimum inset
|
|
72
|
-
*
|
|
102
|
+
* Minimum inset from each usable view edge for anchors inside a map or scene, in pixels.
|
|
103
|
+
* View padding, visual layout-overlay spacing, and visible attribution are reserved separately.
|
|
104
|
+
* Anchors outside a map or scene instead use the measured anchor gap as their edge inset.
|
|
73
105
|
*
|
|
74
106
|
* @default 16
|
|
75
107
|
*/
|
|
76
108
|
accessor viewEdgeMargin: number;
|
|
77
109
|
/**
|
|
78
|
-
* Visual scale for the
|
|
110
|
+
* Visual scale for the header and close action.
|
|
79
111
|
*
|
|
80
112
|
* @default "m"
|
|
81
113
|
*/
|
|
@@ -1,128 +1,216 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import { c as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
offsetSkidding: P(t),
|
|
14
|
-
placement: C(t)
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function B({ actionBarLayout: t, actionRect: e, barRect: i, tailAttachmentAppearance: a }) {
|
|
18
|
-
const r = a === "bar" ? t === "vertical" ? Math.max(0, e.left - i.left) : Math.max(0, e.top - i.top) : 0;
|
|
19
|
-
return l + r;
|
|
20
|
-
}
|
|
21
|
-
function A({ actionBarLayout: t, barRect: { left: e, right: i }, actionRect: { left: a }, tailAttachmentAppearance: r, viewEdgeMargin: n }) {
|
|
22
|
-
const o = n * 2;
|
|
23
|
-
if (t === "vertical") {
|
|
24
|
-
const h = i - e, v = r === "action" ? -(a - e - l) : l;
|
|
25
|
-
return o + h + v;
|
|
26
|
-
}
|
|
27
|
-
return o;
|
|
28
|
-
}
|
|
29
|
-
function P(t) {
|
|
30
|
-
return t.actionBarLayout === "vertical" || f(t) === "left" ? t.viewEdgeMargin : -t.viewEdgeMargin;
|
|
31
|
-
}
|
|
32
|
-
function C(t) {
|
|
33
|
-
const { actionBarLayout: e, actionRect: i, viewRect: a } = t, r = f(t);
|
|
34
|
-
if (e === "vertical")
|
|
35
|
-
return r === "left" ? "right-end" : "left-end";
|
|
36
|
-
const n = i.bottom - a.top < a.height / 2 ? "bottom" : "top";
|
|
37
|
-
return r === "left" ? `${n}-end` : `${n}-start`;
|
|
38
|
-
}
|
|
39
|
-
function f({ barRect: { left: t, right: e }, viewRect: { left: i, right: a } }) {
|
|
40
|
-
return t - i < a - e ? "left" : "right";
|
|
41
|
-
}
|
|
42
|
-
function $({ actionRect: t, viewRect: e }) {
|
|
43
|
-
return t.top - e.top > e.height / 2 ? "bottom" : "top";
|
|
44
|
-
}
|
|
45
|
-
function k(t) {
|
|
46
|
-
const { actionBarLayout: e, actionRect: i, attributionHeight: a, viewEdgeMargin: r, viewRect: n } = t, o = $(t), h = i.bottom - n.top, v = i.top - n.top, g = o === "top" ? h : r, d = r, p = a + r, m = o === "top" ? p : n.height - v;
|
|
47
|
-
return (e === "vertical" ? d + p : g + m) + z;
|
|
48
|
-
}
|
|
49
|
-
function s() {
|
|
50
|
-
return new DOMRect(0, 0, 0, 0);
|
|
51
|
-
}
|
|
52
|
-
function c(t) {
|
|
53
|
-
return t?.getBoundingClientRect() ?? s();
|
|
54
|
-
}
|
|
55
|
-
class T extends _ {
|
|
2
|
+
import { c as E } from "../../chunks/runtime.js";
|
|
3
|
+
import { css as S, html as R } from "lit";
|
|
4
|
+
import { watch as A } from "@arcgis/core/core/reactiveUtils.js";
|
|
5
|
+
import { LitElement as C, safeStyleMap as M } from "@arcgis/lumina";
|
|
6
|
+
import { usePropertyChange as O } from "@arcgis/lumina/controllers";
|
|
7
|
+
import { getClosestElement as k } from "@arcgis/toolkit/dom";
|
|
8
|
+
import { clamp as w } from "@arcgis/toolkit/number";
|
|
9
|
+
import { createRef as m, ref as b } from "lit/directives/ref.js";
|
|
10
|
+
import { m as P } from "../../chunks/handle.js";
|
|
11
|
+
const B = S`:host{--arcgis-internal-view-popover-tail-size: 10px;display:block}.layout-metrics{position:absolute;visibility:hidden;pointer-events:none;width:var(--calcite-spacing-sm);height:var(--arcgis-internal-view-popover-tail-size)}.frame{position:fixed;inset:auto;margin:0;padding:0;border:0;overflow:visible;background:transparent;color:var(--calcite-color-text-1);pointer-events:none}.bounds{position:absolute;inset:0}[data-in-view] .bounds{top:var(--arcgis-layout-overlay-space-top, 0px);right:var(--arcgis-layout-overlay-space-right, 0px);bottom:var(--arcgis-layout-overlay-space-bottom, 0px);left:var(--arcgis-layout-overlay-space-left, 0px)}.surface{--arcgis-internal-view-popover-border-width: 1px;position:absolute;top:var(--top);right:var(--right);bottom:var(--bottom);left:var(--left);display:flex;flex-direction:column;width:max-content;height:fit-content;min-width:min(var(--min-content-width),var(--max-content-width),var(--available-width));max-width:min(var(--max-content-width),var(--available-width));max-height:var(--available-height);pointer-events:auto;box-sizing:border-box;border:var(--arcgis-internal-view-popover-border-width) solid var(--calcite-color-border-3);filter:drop-shadow(0 6px 10px rgb(0 0 0 / 10%)) drop-shadow(0 4px 6px rgb(0 0 0 / 8%));border-radius:var(--calcite-corner-radius-sm);background:var(--calcite-color-surface-2)}calcite-panel{--calcite-panel-corner-radius: var(--calcite-corner-radius-sm);--calcite-panel-background-color: var(--calcite-color-surface-2);block-size:auto;flex:1 1 auto;min-height:0;min-width:0;max-height:inherit}.content{flex:none;font-size:var(--calcite-font-size-0);color:var(--calcite-color-text-1);-webkit-user-select:none;user-select:none}.surface:before{--arcgis-internal-view-popover-tail-half-size: calc(var(--arcgis-internal-view-popover-tail-size) / 2);--arcgis-internal-view-popover-tail-half-diagonal: calc(var(--arcgis-internal-view-popover-tail-half-size) * sqrt(2));--arcgis-internal-view-popover-tail-stretch: calc( (var(--anchor-gap) + var(--arcgis-internal-view-popover-border-width)) / var(--arcgis-internal-view-popover-tail-half-diagonal) );content:"";position:absolute;box-sizing:border-box;width:var(--arcgis-internal-view-popover-tail-size);height:var(--arcgis-internal-view-popover-tail-size);background:var(--calcite-color-surface-2);border:calc(var(--arcgis-internal-view-popover-tail-size) / 10) solid var(--calcite-color-border-3);pointer-events:none;opacity:var(--arcgis-internal-view-popover-tail-opacity, 1);z-index:1}[data-anchor-hidden] .surface:before,[data-tail-hidden] .surface:before{display:none}[data-layout=horizontal][data-vertical=top] .surface:before{top:calc(-1 * var(--arcgis-internal-view-popover-tail-half-size));clip-path:polygon(0 0,100% 0,0 100%);border-right-color:transparent;border-bottom-color:transparent}[data-layout=horizontal][data-vertical=bottom] .surface:before{bottom:calc(-1 * var(--arcgis-internal-view-popover-tail-half-size));clip-path:polygon(100% 100%,100% 0,0 100%);border-left-color:transparent;border-top-color:transparent}[data-layout=horizontal] .surface:before{transform:scaleY(var(--arcgis-internal-view-popover-tail-stretch)) rotate(45deg);left:calc(var(--tail-offset) - var(--arcgis-internal-view-popover-tail-half-size) - var(--arcgis-internal-view-popover-border-width))}[data-layout=vertical][data-horizontal=left] .surface:before{left:calc(-1 * var(--arcgis-internal-view-popover-tail-half-size));clip-path:polygon(0 0,0 100%,100% 100%);border-right-color:transparent;border-top-color:transparent}[data-layout=vertical][data-horizontal=right] .surface:before{right:calc(-1 * var(--arcgis-internal-view-popover-tail-half-size));clip-path:polygon(0 0,100% 0,100% 100%);border-left-color:transparent;border-bottom-color:transparent}[data-layout=vertical] .surface:before{transform:scaleX(var(--arcgis-internal-view-popover-tail-stretch)) rotate(45deg);top:calc(var(--tail-offset) - var(--arcgis-internal-view-popover-tail-half-size) - var(--arcgis-internal-view-popover-border-width))}`;
|
|
12
|
+
class V extends C {
|
|
56
13
|
constructor() {
|
|
57
|
-
super(...arguments), this.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}, this._handlePopoverClose = (e) => {
|
|
63
|
-
e.target === e.currentTarget && (e.preventDefault(), this.open = !1, this._stopMeasuring());
|
|
64
|
-
}, this._viewRect = s(), this._barRect = s(), this._actionRect = s(), this._headerRect = s(), this._resizeObserver = new ResizeObserver(() => this._remeasureAndSolve()), this._placement = "bottom-end", this._effectiveTailOffset = l, this._offsetSkidding = y, this._horizontalMargin = S, this._verticalMargin = x, this.closable = !0, this.open = !1, this.maxContentWidth = 400, this.minContentWidth = 300, this.viewEdgeMargin = 16, this.visualScale = "m", this.tailAttachmentAppearance = "bar", this.arcgisPropertyChange = E()("open");
|
|
14
|
+
super(...arguments), this._nativePopoverLayer = m(), this._bounds = m(), this._surface = m(), this._calcitePanel = m(), this._layoutMetrics = m(), this._visibilityTrackedElements = /* @__PURE__ */ new Map(), this._scheduleReposition = () => {
|
|
15
|
+
!this.isConnected || !this.open || this._positionAnimationFrame !== void 0 || (this._positionAnimationFrame = requestAnimationFrame(() => {
|
|
16
|
+
this._positionAnimationFrame = void 0, this.isConnected && this.open && this._positionPopover();
|
|
17
|
+
}));
|
|
18
|
+
}, this._isPositionedAndVisible = !1, this.open = !1, this.maxContentWidth = 400, this.minContentWidth = 300, this.minimumUsableWidth = 200, this.viewEdgeMargin = 16, this.visualScale = "m", this.tailAttachmentAppearance = "bar", this.arcgisPropertyChange = O()("open");
|
|
65
19
|
}
|
|
66
20
|
static {
|
|
67
|
-
this.properties = {
|
|
21
|
+
this.properties = { _isPositionedAndVisible: 16, actionBarLayout: 32, actionBarElement: 0, anchorElement: 0, heading: 1, open: 5, maxContentWidth: 9, minContentWidth: 9, minimumUsableWidth: 9, viewEdgeMargin: 9, visualScale: 1, tailAttachmentAppearance: 1 };
|
|
68
22
|
}
|
|
69
23
|
static {
|
|
70
|
-
this.styles =
|
|
24
|
+
this.styles = B;
|
|
71
25
|
}
|
|
72
|
-
get
|
|
73
|
-
return this.
|
|
26
|
+
get _containingView() {
|
|
27
|
+
return k(this.anchorElement ?? this.el, "arcgis-map, arcgis-scene");
|
|
74
28
|
}
|
|
75
29
|
get actionBarLayout() {
|
|
76
30
|
return this.actionBarElement?.layout === "vertical" ? "vertical" : "horizontal";
|
|
77
31
|
}
|
|
78
|
-
|
|
79
|
-
|
|
32
|
+
loaded() {
|
|
33
|
+
this.listenOn(window, "resize", this._scheduleReposition), this.listenOn(window, "scroll", this._scheduleReposition, { capture: !0 }), window.visualViewport && (this.listenOn(window.visualViewport, "resize", this._scheduleReposition), this.listenOn(window.visualViewport, "scroll", this._scheduleReposition));
|
|
34
|
+
}
|
|
35
|
+
updated() {
|
|
36
|
+
this._cancelRepositionAndStopObserving(), this.isConnected && this.open ? (this._observePosition(), this._scheduleReposition()) : (this._visibilityTrackedElements.clear(), this._hidePopover());
|
|
37
|
+
}
|
|
38
|
+
willUpdate() {
|
|
39
|
+
this.open || (this._isPositionedAndVisible = !1);
|
|
80
40
|
}
|
|
81
41
|
disconnectedCallback() {
|
|
82
|
-
super.disconnectedCallback(), this.
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
return e.has("open") && this.open || e.has("tailAttachmentAppearance") || e.has("viewEdgeMargin") || e.has("visualScale");
|
|
89
|
-
}
|
|
90
|
-
_observeMeasurementElements() {
|
|
91
|
-
this._resizeObserver.disconnect();
|
|
92
|
-
for (const e of [this.anchorElement, this.actionBarElement, this._viewElement, this._headerElement])
|
|
93
|
-
e && this._resizeObserver.observe(e);
|
|
94
|
-
this._remeasureAndSolve();
|
|
95
|
-
}
|
|
96
|
-
_stopMeasuring() {
|
|
97
|
-
this._resizeObserver.disconnect(), this._headerElement = void 0;
|
|
98
|
-
}
|
|
99
|
-
_remeasureAndSolve() {
|
|
100
|
-
this._actionRect = c(this.anchorElement), this._barRect = c(this.actionBarElement), this._headerRect = c(this._headerElement), this._viewRect = c(this._viewElement), this._solveLayoutAndUpdate();
|
|
101
|
-
}
|
|
102
|
-
_solveLayoutAndUpdate() {
|
|
103
|
-
const { effectiveTailOffset: e, horizontalMargin: i, verticalMargin: a, offsetSkidding: r, placement: n } = O({
|
|
104
|
-
actionBarLayout: this.actionBarLayout,
|
|
105
|
-
actionRect: this._actionRect,
|
|
106
|
-
attributionHeight: this.view?.attributionHeight ?? 0,
|
|
107
|
-
barRect: this._barRect,
|
|
108
|
-
headerRect: this._headerRect,
|
|
109
|
-
visualScale: this.visualScale,
|
|
110
|
-
tailAttachmentAppearance: this.tailAttachmentAppearance,
|
|
111
|
-
viewEdgeMargin: this.viewEdgeMargin,
|
|
112
|
-
viewRect: this._viewRect
|
|
42
|
+
super.disconnectedCallback(), this._cancelRepositionAndStopObserving(), this._visibilityTrackedElements.clear(), this._hidePopover();
|
|
43
|
+
}
|
|
44
|
+
_observePosition() {
|
|
45
|
+
const t = this._containingView?.view, e = this._observeLayoutElements(t), o = A(() => [t?.padding.left, t?.padding.right, t?.padding.top, t?.padding.bottom, t?.attributionHeight], this._scheduleReposition);
|
|
46
|
+
this._observableHandle = P(() => {
|
|
47
|
+
e.remove(), o.remove();
|
|
113
48
|
});
|
|
114
|
-
|
|
49
|
+
}
|
|
50
|
+
_observeLayoutElements(t) {
|
|
51
|
+
const { anchorElement: e, actionBarElement: o } = this, a = /* @__PURE__ */ new Set([e, o ?? e]);
|
|
52
|
+
for (const r of this._visibilityTrackedElements.keys())
|
|
53
|
+
a.has(r) || this._visibilityTrackedElements.delete(r);
|
|
54
|
+
const n = new IntersectionObserver(
|
|
55
|
+
(r) => {
|
|
56
|
+
for (const h of r) {
|
|
57
|
+
const d = h.intersectionRect.width > 0 && h.intersectionRect.height > 0;
|
|
58
|
+
this._visibilityTrackedElements.get(h.target) !== d && (this._visibilityTrackedElements.set(h.target, d), this._scheduleReposition());
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
// Edge contact counts as intersecting at threshold 0, but has no visible area.
|
|
62
|
+
{ threshold: Number.EPSILON }
|
|
63
|
+
);
|
|
64
|
+
for (const r of a)
|
|
65
|
+
r && n.observe(r);
|
|
66
|
+
const l = new ResizeObserver(this._scheduleReposition), s = new MutationObserver(this._scheduleReposition);
|
|
67
|
+
for (const r of [this.el, e, o, t?.container])
|
|
68
|
+
r && (l.observe(r), s.observe(r, {
|
|
69
|
+
attributes: !0,
|
|
70
|
+
attributeFilter: [
|
|
71
|
+
"style",
|
|
72
|
+
"class",
|
|
73
|
+
"hidden",
|
|
74
|
+
"slot",
|
|
75
|
+
"layout",
|
|
76
|
+
"dir",
|
|
77
|
+
"scale",
|
|
78
|
+
"expanded",
|
|
79
|
+
"expand-position"
|
|
80
|
+
],
|
|
81
|
+
childList: r === o,
|
|
82
|
+
// Actions inside slotted groups can move the anchor without resizing the bar.
|
|
83
|
+
// Only observe descendants of the action bar, not the entire view.
|
|
84
|
+
subtree: r === o
|
|
85
|
+
}));
|
|
86
|
+
for (const r of [this._bounds.value, this._surface.value, this._layoutMetrics.value])
|
|
87
|
+
r && l.observe(r);
|
|
88
|
+
const c = L([e, o]);
|
|
89
|
+
for (const r of c)
|
|
90
|
+
r.addEventListener("scroll", this._scheduleReposition, !0);
|
|
91
|
+
return P(() => {
|
|
92
|
+
n.disconnect(), l.disconnect(), s.disconnect();
|
|
93
|
+
for (const r of c)
|
|
94
|
+
r.removeEventListener("scroll", this._scheduleReposition, !0);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
_cancelRepositionAndStopObserving() {
|
|
98
|
+
this._observableHandle?.remove(), this._observableHandle = void 0, this._positionAnimationFrame !== void 0 && (cancelAnimationFrame(this._positionAnimationFrame), this._positionAnimationFrame = void 0);
|
|
99
|
+
}
|
|
100
|
+
_hidePopover() {
|
|
101
|
+
this._isPositionedAndVisible = !1, this._nativePopoverLayer.value?.hidePopover();
|
|
102
|
+
}
|
|
103
|
+
_positionPopover(t = !0) {
|
|
104
|
+
const e = this._nativePopoverLayer.value, o = this._bounds.value, a = this._surface.value, n = this._layoutMetrics.value, l = this.anchorElement, s = this.actionBarElement ?? l;
|
|
105
|
+
if (!e || !o || !a || !n || !l?.isConnected || !s || !this._visibilityTrackedElements.get(s)) {
|
|
106
|
+
this._hidePopover();
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const c = l.getBoundingClientRect(), r = s.getBoundingClientRect(), h = this.actionBarElement ? T(c, r, this.actionBarLayout, getComputedStyle(s).direction === "rtl") : n.getBoundingClientRect().width, d = t ? this._containingView : void 0, v = d ? this.viewEdgeMargin : h, p = U(d?.view, v);
|
|
110
|
+
if (!p.width || !p.height || !c.width || !c.height || !r.width || !r.height) {
|
|
111
|
+
this._hidePopover();
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
$(e, p, !!d), e.toggleAttribute("data-anchor-hidden", !this._visibilityTrackedElements.get(l));
|
|
115
|
+
const u = o.getBoundingClientRect();
|
|
116
|
+
this._layoutSurface(e, a, { action: c, toolbar: r }, u, h);
|
|
117
|
+
}
|
|
118
|
+
_layoutSurface(t, e, o, a, n) {
|
|
119
|
+
const { action: l, toolbar: s } = o, c = this.actionBarLayout, r = D(s, a), h = this.tailAttachmentAppearance === "action" ? l : s, d = q(h, a, c, r, n), v = a.width - d.left - d.right, p = a.height - d.top - d.bottom;
|
|
120
|
+
if (t.hasAttribute("data-in-view") && v < this.minimumUsableWidth) {
|
|
121
|
+
this._positionPopover(!1);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (v <= 0 || p <= 0) {
|
|
125
|
+
this._hidePopover();
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
_(t, { "available-width": v, "available-height": p, "anchor-gap": n }, !0);
|
|
129
|
+
const u = e.getBoundingClientRect(), f = F(e), g = W(o, a, u, c, f), y = c === "vertical" ? u.height : u.width;
|
|
130
|
+
t.toggleAttribute("data-tail-hidden", g.tailOffset < f || g.tailOffset > y - f), H(t, c, r, d, g), this._isPositionedAndVisible = !0;
|
|
131
|
+
}
|
|
132
|
+
_handlePanelClose(t) {
|
|
133
|
+
t.target === this._calcitePanel.value && (t.preventDefault(), this.open = !1);
|
|
115
134
|
}
|
|
116
135
|
render() {
|
|
117
|
-
return
|
|
118
|
-
"--
|
|
119
|
-
"--
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
136
|
+
return R`<div class="layout-metrics" aria-hidden=true ${b(this._layoutMetrics)}></div><div class="frame" popover=manual style=${M({
|
|
137
|
+
"--min-content-width": `${this.minContentWidth}px`,
|
|
138
|
+
"--max-content-width": `${this.maxContentWidth}px`
|
|
139
|
+
})} ${b(this._nativePopoverLayer)}><div class="bounds" ${b(this._bounds)}><div class="surface" ${b(this._surface)}>${this._renderPanel()}</div></div></div>`;
|
|
140
|
+
}
|
|
141
|
+
_renderPanel() {
|
|
142
|
+
return R`<calcite-panel .closed=${!this.open} closable .heading=${this.heading} .scale=${this.visualScale} .focusTrapEnabled=${this.open && this._isPositionedAndVisible} @calcitePanelClose=${this._handlePanelClose} ${b(this._calcitePanel)}><div class="content"><slot></slot></div></calcite-panel>`;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function L(i) {
|
|
146
|
+
const t = /* @__PURE__ */ new Set();
|
|
147
|
+
for (let e of i)
|
|
148
|
+
for (; e; ) {
|
|
149
|
+
const o = e.getRootNode();
|
|
150
|
+
o instanceof ShadowRoot && t.add(o), e.shadowRoot && t.add(e.shadowRoot), e = e.assignedSlot ?? e.parentElement ?? (o instanceof ShadowRoot ? o.host : void 0);
|
|
151
|
+
}
|
|
152
|
+
return t;
|
|
153
|
+
}
|
|
154
|
+
function T(i, t, e, o) {
|
|
155
|
+
return e === "horizontal" ? i.top - t.top : o ? t.right - i.right : i.left - t.left;
|
|
156
|
+
}
|
|
157
|
+
function F(i) {
|
|
158
|
+
const t = getComputedStyle(i), e = getComputedStyle(i, "::before"), o = Math.max(...[
|
|
159
|
+
t.borderTopLeftRadius,
|
|
160
|
+
t.borderTopRightRadius,
|
|
161
|
+
t.borderBottomLeftRadius,
|
|
162
|
+
t.borderBottomRightRadius
|
|
163
|
+
].flatMap((n) => n.split(" ").map(Number.parseFloat))), a = Math.hypot(Number.parseFloat(e.width), Number.parseFloat(e.height)) / 2;
|
|
164
|
+
return Math.ceil(o + a);
|
|
165
|
+
}
|
|
166
|
+
function $(i, t, e) {
|
|
167
|
+
i.toggleAttribute("data-in-view", e), _(i, { left: t.x, top: t.y, width: t.width, height: t.height }), i.showPopover();
|
|
168
|
+
}
|
|
169
|
+
function H(i, t, e, o, a) {
|
|
170
|
+
const n = { left: "auto", right: "auto", top: "auto", bottom: "auto" };
|
|
171
|
+
t === "vertical" ? (n[e.horizontal] = o[e.horizontal], n.top = a.panelStart) : (n[e.vertical] = o[e.vertical], n.left = a.panelStart), _(i, { ...n, "tail-offset": a.tailOffset }, !0), i.dataset.horizontal = e.horizontal, i.dataset.vertical = e.vertical, i.dataset.layout = t;
|
|
172
|
+
}
|
|
173
|
+
function W(i, t, e, o, a) {
|
|
174
|
+
const { action: n, toolbar: l } = i, s = o === "vertical" ? "top" : "left", c = o === "vertical" ? "bottom" : "right", r = o === "vertical" ? "height" : "width", h = (n[s] + n[c]) / 2 - t[s], d = l[s] - t[s], v = l[c] - t[s], p = e[r], u = t[r], f = h - d <= v - h ? d : v - p, g = h - f, z = g >= a && g <= p - a ? f : h - p / 2, x = w(z, 0, Math.max(0, u - p));
|
|
175
|
+
return { panelStart: x, tailOffset: h - x };
|
|
176
|
+
}
|
|
177
|
+
function N() {
|
|
178
|
+
const i = window.visualViewport;
|
|
179
|
+
return new DOMRect(i?.offsetLeft ?? 0, i?.offsetTop ?? 0, i?.width ?? document.documentElement.clientWidth, i?.height ?? document.documentElement.clientHeight);
|
|
180
|
+
}
|
|
181
|
+
function I(i) {
|
|
182
|
+
const t = i?.container?.getBoundingClientRect();
|
|
183
|
+
if (!t)
|
|
184
|
+
return;
|
|
185
|
+
const e = i?.padding, o = i?.attributionHeight ?? 0;
|
|
186
|
+
return {
|
|
187
|
+
left: t.left + (e?.left ?? 0),
|
|
188
|
+
top: t.top + (e?.top ?? 0),
|
|
189
|
+
right: t.right - (e?.right ?? 0),
|
|
190
|
+
bottom: t.bottom - (e?.bottom ?? 0) - o
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function U(i, t) {
|
|
194
|
+
const e = N(), o = I(i) ?? e, a = Math.max(e.left, o.left) + t, n = Math.max(e.top, o.top) + t, l = Math.min(e.right, o.right) - t, s = Math.min(e.bottom, o.bottom) - t;
|
|
195
|
+
return new DOMRect(a, n, Math.max(0, l - a), Math.max(0, s - n));
|
|
196
|
+
}
|
|
197
|
+
function D(i, t) {
|
|
198
|
+
return {
|
|
199
|
+
horizontal: i.left - t.left <= t.right - i.right ? "left" : "right",
|
|
200
|
+
vertical: i.top - t.top <= t.bottom - i.bottom ? "top" : "bottom"
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
function q(i, t, e, o, a) {
|
|
204
|
+
const n = { top: 0, right: 0, bottom: 0, left: 0 };
|
|
205
|
+
return e === "vertical" ? o.horizontal === "left" ? n.left = w(i.right - t.left + a, 0, t.width) : n.right = w(t.right - i.left + a, 0, t.width) : o.vertical === "top" ? n.top = w(i.bottom - t.top + a, 0, t.height) : n.bottom = w(t.bottom - i.top + a, 0, t.height), n;
|
|
206
|
+
}
|
|
207
|
+
function _(i, t, e = !1) {
|
|
208
|
+
for (const [o, a] of Object.entries(t)) {
|
|
209
|
+
const n = e ? `--${o}` : o, l = typeof a == "number" ? `${a}px` : a;
|
|
210
|
+
i.style.setProperty(n, l);
|
|
123
211
|
}
|
|
124
212
|
}
|
|
125
|
-
|
|
213
|
+
E("arcgis-view-popover", V);
|
|
126
214
|
export {
|
|
127
|
-
|
|
215
|
+
V as ArcgisViewPopover
|
|
128
216
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import "@esri/calcite-components/components/calcite-
|
|
1
|
+
import "@esri/calcite-components/components/calcite-panel";
|
|
2
2
|
export * from "./customElement.js";
|