@arcgis/common-components 6.0.0-next.2 → 6.0.0-next.20
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/22ZJC66J.js +2 -0
- package/dist/cdn/{OMROUY3L.js → 2STNPR2K.js} +1 -1
- package/dist/cdn/{BZFAYVKR.js → 3AMC2MYL.js} +1 -1
- package/dist/cdn/4X3PGY53.js +2 -0
- package/dist/cdn/4YTPZVS3.js +8207 -0
- package/dist/cdn/5AYF7ZV7.js +2 -0
- package/dist/cdn/5STQ23EC.js +2 -0
- package/dist/cdn/{IECXEZNI.js → 6CP2VGMT.js} +1 -1
- package/dist/cdn/A5VZ22LK.js +4 -0
- package/dist/cdn/{TO3YFXVJ.js → AK25UPRZ.js} +1 -1
- package/dist/cdn/C65ROMJK.js +2 -0
- package/dist/cdn/CT5YQHEK.js +2 -0
- package/dist/cdn/DAAON2UO.js +3 -0
- package/dist/cdn/{YEFEVEP6.js → DJSPDBWO.js} +1 -1
- package/dist/cdn/DPWHB7KO.js +2 -0
- package/dist/cdn/EC4D5ASN.js +2 -0
- package/dist/cdn/GHI6WOGS.js +2 -0
- package/dist/cdn/GWWTMM5J.js +2 -0
- package/dist/cdn/{TXQKK4DJ.js → JMTBKMVF.js} +1 -1
- package/dist/cdn/{X6DNIKWY.js → JXWME7J2.js} +1 -1
- package/dist/cdn/{JTQN5KMG.js → K4BKCMJ7.js} +1 -1
- package/dist/cdn/{LNXO5YIS.js → K6VKF5UM.js} +1 -1
- package/dist/cdn/{OTWADB4M.js → LE34WS2E.js} +1 -1
- package/dist/cdn/{OIGA7XBZ.js → MAEWWG5A.js} +1 -1
- package/dist/cdn/MEMAD5D4.js +2 -0
- package/dist/cdn/{HYFFUYAU.js → NLURLVXP.js} +1 -1
- package/dist/cdn/{D4UHHQ35.js → NU4RWRS7.js} +1 -1
- package/dist/cdn/{HJ3EJZFF.js → OOQF2DBR.js} +1 -1
- package/dist/cdn/{3AFEXHZ5.js → PMXKCVOF.js} +1 -1
- package/dist/cdn/PWLYBU5B.js +2 -0
- package/dist/cdn/{735FTIBP.js → RLH5OKTL.js} +1 -1
- package/dist/cdn/{34AP2EEB.js → SBWYOBOD.js} +1 -1
- package/dist/cdn/SISTGQAE.js +2 -0
- package/dist/cdn/U4PTVQN7.js +2 -0
- package/dist/cdn/U4Z5MFI5.js +2 -0
- package/dist/cdn/{CKGWDI7B.js → WF4C6JB4.js} +1 -1
- package/dist/cdn/WQHAEQUK.js +2 -0
- package/dist/cdn/XIZVB6UV.js +2 -0
- package/dist/cdn/XMMFL5H3.js +2 -0
- package/dist/cdn/{EB5MDEWF.js → XZBAXCY4.js} +1 -1
- package/dist/cdn/{MFGUTQRR.js → YEG4ZKJV.js} +1 -1
- package/dist/cdn/YPJIALGM.js +2 -0
- package/dist/cdn/{KDCSDIUQ.js → ZCI3WQ2I.js} +1 -1
- package/dist/cdn/ZJMMAZFG.js +2 -0
- package/dist/cdn/assets/layer-replace/t9n/messages.en.json +1 -0
- package/dist/cdn/index.js +1 -1
- package/dist/cdn/main.css +1 -1
- package/dist/chunks/sharedCacheDirective.js +74 -0
- package/dist/chunks/toolbar.js +1 -1
- package/dist/components/arcgis-histogram/customElement.d.ts +8 -0
- package/dist/components/arcgis-histogram/customElement.js +103 -98
- package/dist/components/arcgis-html-content/customElement.d.ts +42 -0
- package/dist/components/arcgis-html-content/customElement.js +71 -0
- package/dist/components/arcgis-html-content/index.d.ts +1 -0
- package/dist/components/arcgis-html-content/index.js +1 -0
- package/dist/components/arcgis-label-input/customElement.js +1 -1
- package/dist/components/arcgis-layer-replace/customElement.d.ts +437 -0
- package/dist/components/arcgis-layer-replace/customElement.js +376 -0
- package/dist/components/arcgis-layer-replace/index.d.ts +1 -0
- package/dist/components/arcgis-layer-replace/index.js +7 -0
- package/dist/components/arcgis-slider/customElement.js +522 -443
- package/dist/components/arcgis-slider-field/customElement.d.ts +43 -41
- package/dist/components/arcgis-slider-field/customElement.js +45 -39
- package/dist/components/arcgis-slider-histogram-range/customElement.d.ts +21 -19
- package/dist/components/arcgis-slider-histogram-range/customElement.js +28 -22
- package/dist/components/arcgis-ticks/customElement.js +8 -8
- package/dist/components/arcgis-toolbar-item/customElement.js +1 -1
- package/dist/components/arcgis-toolbar-stack/customElement.js +48 -114
- package/dist/components/arcgis-value-picker/customElement.d.ts +8 -1
- package/dist/components/arcgis-value-picker/customElement.js +25 -21
- package/dist/components/arcgis-value-picker/index.js +1 -1
- package/dist/components/arcgis-value-picker-combobox/customElement.js +4 -4
- package/dist/components/arcgis-value-picker-label/customElement.d.ts +6 -0
- package/dist/components/arcgis-value-picker-label/customElement.js +6 -6
- package/dist/components/arcgis-value-picker-slider/customElement.js +18 -18
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.css-custom-data.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/index.d.ts +15 -0
- package/dist/index.js +8 -5
- package/dist/loader.js +9 -7
- package/dist/types/lumina.d.ts +16 -5
- package/dist/types/preact.d.ts +18 -5
- package/dist/types/react.d.ts +20 -5
- package/dist/types/stencil.d.ts +16 -5
- package/dist/utils/sharedCacheDirective.d.ts +68 -0
- package/package.json +6 -6
- package/dist/cdn/5EA7SGHX.js +0 -2
- package/dist/cdn/7TCQ52FG.js +0 -2
- package/dist/cdn/ATLXGXTH.js +0 -2
- package/dist/cdn/BCN6LPOG.js +0 -4
- package/dist/cdn/DR2THZQU.js +0 -8208
- package/dist/cdn/EM4OQXFS.js +0 -2
- package/dist/cdn/GDRW3MIZ.js +0 -2
- package/dist/cdn/LLATF73T.js +0 -2
- package/dist/cdn/M2J3GPM4.js +0 -2
- package/dist/cdn/PJCRMKAM.js +0 -2
- package/dist/cdn/QCUF7B3I.js +0 -2
- package/dist/cdn/S4XOD4YS.js +0 -2
- package/dist/cdn/UIBTY5FF.js +0 -2
- package/dist/cdn/WQW7S2RI.js +0 -2
- package/dist/cdn/XUPA27AW.js +0 -2
- package/dist/cdn/XX2ZCFWI.js +0 -2
- package/dist/cdn/ZCVP2N2O.js +0 -2
- package/dist/cdn/ZZ4YJXPK.js +0 -2
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
+
import { render as m, nothing as u } from "lit";
|
|
3
|
+
import { AsyncDirective as l } from "lit/async-directive.js";
|
|
4
|
+
import { PartType as p } from "lit/directive.js";
|
|
5
|
+
import { getCommittedValue as a, clearPart as v, insertPart as o, setCommittedValue as h } from "lit/directive-helpers.js";
|
|
6
|
+
import { directive as f } from "@arcgis/lumina";
|
|
7
|
+
class S {
|
|
8
|
+
constructor(e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set()) {
|
|
9
|
+
this.cachedParts = e, this.directives = t;
|
|
10
|
+
}
|
|
11
|
+
moveAllToCache() {
|
|
12
|
+
for (const e of this.directives)
|
|
13
|
+
e.moveToCache();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
class C extends l {
|
|
17
|
+
#r;
|
|
18
|
+
#t;
|
|
19
|
+
#e;
|
|
20
|
+
constructor(e) {
|
|
21
|
+
if (super(e), e.type !== p.CHILD)
|
|
22
|
+
throw new Error("sharedCache() can only be used in child expressions");
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @param _store Shared store backing this and other caching directives with the shared cache
|
|
26
|
+
* @param _key Uniquely identifies the element being rendered
|
|
27
|
+
* @param value The content to render
|
|
28
|
+
*/
|
|
29
|
+
render(e, t, i) {
|
|
30
|
+
return [i];
|
|
31
|
+
}
|
|
32
|
+
update(e, [t, i, s]) {
|
|
33
|
+
this.#e !== t && (this.#e && this.#e.directives.delete(this), t.directives.add(this), this.#e = t), this.#r = e, this.#t = i;
|
|
34
|
+
const r = t.cachedParts.get(i), c = r ? a(r).pop() : void 0;
|
|
35
|
+
return c && (v(e), o(e, void 0, c), h(e, [c])), this.render(t, i, s);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* During the update phase, a toolbar may need to be pulled from the cache in a situation
|
|
39
|
+
* where it was still on the page from the previous render.
|
|
40
|
+
*
|
|
41
|
+
* To work around this problem, during parent component render phase a pre-caching
|
|
42
|
+
* step moves all cacheable elements into the cache. This is the method called by
|
|
43
|
+
* that pre-caching step.
|
|
44
|
+
*
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
47
|
+
moveToCache() {
|
|
48
|
+
const e = this.#r, t = this.#e;
|
|
49
|
+
if (!e || !t)
|
|
50
|
+
return;
|
|
51
|
+
const s = a(e).pop();
|
|
52
|
+
if (!s)
|
|
53
|
+
return;
|
|
54
|
+
let r = t.cachedParts.get(this.#t);
|
|
55
|
+
if (!r) {
|
|
56
|
+
const n = document.createDocumentFragment();
|
|
57
|
+
r = m(u, n), t.cachedParts.set(this.#t, r);
|
|
58
|
+
}
|
|
59
|
+
if (a(r).length > 0)
|
|
60
|
+
throw new Error("sharedCache() keys must be unique");
|
|
61
|
+
h(r, [s]), o(r, void 0, s);
|
|
62
|
+
}
|
|
63
|
+
disconnected() {
|
|
64
|
+
this.#e?.directives.delete(this);
|
|
65
|
+
}
|
|
66
|
+
reconnected() {
|
|
67
|
+
this.#e?.directives.add(this);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const D = f(C);
|
|
71
|
+
export {
|
|
72
|
+
S,
|
|
73
|
+
D as s
|
|
74
|
+
};
|
package/dist/chunks/toolbar.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
2
|
import { css as a } from "lit";
|
|
3
|
-
const r = a`:host([toolbar-kind="floating"]){.ruler{opacity:0;pointer-events:none;position:absolute;visibility:hidden;flex-direction:column;height:min(100cqh - var(--arcgis-internal-attribution-space-top) - 2 * var(--calcite-space-lg),100vh - 2 * var(--calcite-space-lg));width:min(100cqw - 2 * var(--calcite-space-lg),100vw - 2 * var(--calcite-space-lg))}}:host([toolbar-kind="docked"]){.ruler{visibility:hidden;height:0;display:block;position:absolute;top:0;left:0;right:0;width:100%;height:100%}}`, t = a`:host{--arcgis-internal-toolbar-action-kind-color: var(--calcite-action-text-color);--arcgis-internal-toolbar-action-kind-color-hover: var(--calcite-action-text-color-press);--arcgis-internal-toolbar-action-kind-color-press: var(--calcite-action-text-color-press);--arcgis-internal-toolbar-action-kind-foreground-color: var(--calcite-color-text-inverse);--arcgis-internal-toolbar-action-transparent-background-color: var(--calcite-color-transparent);--arcgis-internal-toolbar-action-transparent-background-color-hover: var(--calcite-color-transparent-hover);--arcgis-internal-toolbar-action-transparent-background-color-press: var(--calcite-color-transparent-press)}calcite-action{--calcite-action-text-color: var(--arcgis-internal-toolbar-action-kind-color);--calcite-action-text-color-press: var(--arcgis-internal-toolbar-action-kind-color-press);--calcite-color-focus: var(--arcgis-internal-toolbar-action-kind-color);--calcite-action-indicator-color: var(--arcgis-internal-toolbar-action-kind-color)}calcite-action:is([data-appearance=solid]){--calcite-offset-invert-focus: 1}calcite-action[data-appearance=outline]{--calcite-action-background-color: var(--arcgis-internal-toolbar-action-transparent-background-color);--calcite-action-background-color-hover: var(--arcgis-internal-toolbar-action-transparent-background-color-hover);--calcite-action-background-color-press: var(--arcgis-internal-toolbar-action-transparent-background-color-press);--calcite-action-text-color: var(--arcgis-internal-toolbar-action-kind-color);--calcite-action-text-color-press: var(--arcgis-internal-toolbar-action-kind-color-press);box-shadow:inset 0 0 0 var(--calcite-border-width-sm, 1px) var(--arcgis-internal-toolbar-action-kind-color)}calcite-action[data-appearance=outline]:hover{box-shadow:inset 0 0 0 var(--calcite-border-width-sm, 1px) var(--arcgis-internal-toolbar-action-kind-color-hover)}calcite-action[data-appearance=outline]:active,calcite-action[data-appearance=outline][active]{--calcite-action-background-color: var(--arcgis-internal-toolbar-action-transparent-background-color-press);box-shadow:inset 0 0 0 var(--calcite-border-width-sm, 1px) var(--arcgis-internal-toolbar-action-kind-color-press)}calcite-action[data-appearance=solid]{--calcite-action-background-color: var(--arcgis-internal-toolbar-action-kind-color);--calcite-action-background-color-hover: var(--arcgis-internal-toolbar-action-kind-color-hover);--calcite-action-background-color-press: var(--arcgis-internal-toolbar-action-kind-color-press);--calcite-action-text-color: var(--arcgis-internal-toolbar-action-kind-foreground-color);--calcite-action-text-color-press: var(--arcgis-internal-toolbar-action-kind-foreground-color);--calcite-action-indicator-color: var(--arcgis-internal-toolbar-action-kind-foreground-color)}calcite-action:is([data-appearance=outline],[data-appearance=solid]):not([data-kind]){--arcgis-internal-toolbar-action-kind-color: var(--calcite-color-inverse);--arcgis-internal-toolbar-action-kind-color-hover: var(--calcite-color-inverse-hover);--arcgis-internal-toolbar-action-kind-color-press: var(--calcite-color-inverse-press)}calcite-action:not([data-kind]){--calcite-action-indicator-color: var(--calcite-color-brand)}calcite-action[data-kind=brand]{--arcgis-internal-toolbar-action-kind-color: var(--calcite-color-brand);--arcgis-internal-toolbar-action-kind-color-hover: var(--calcite-color-brand-hover);--arcgis-internal-toolbar-action-kind-color-press: var(--calcite-color-brand-press);--calcite-action-indicator-color: var(--calcite-color-text-1);&[data-appearance=solid]{--calcite-action-indicator-color: var(--calcite-color-text-inverse)}}calcite-action[data-kind=danger]{--arcgis-internal-toolbar-action-kind-color: var(--calcite-color-status-danger);--arcgis-internal-toolbar-action-kind-color-hover: var(--calcite-color-status-danger-hover);--arcgis-internal-toolbar-action-kind-color-press: var(--calcite-color-status-danger-press)}calcite-action[data-kind=info]{--arcgis-internal-toolbar-action-kind-color: var(--calcite-color-status-info);--arcgis-internal-toolbar-action-kind-color-hover: var(--calcite-color-status-info-hover);--arcgis-internal-toolbar-action-kind-color-press: var(--calcite-color-status-info-press)}calcite-action[data-kind=success]{--arcgis-internal-toolbar-action-kind-color: var(--calcite-color-status-success);--arcgis-internal-toolbar-action-kind-color-hover: var(--calcite-color-status-success-hover);--arcgis-internal-toolbar-action-kind-color-press: var(--calcite-color-status-success-press)}calcite-action[data-kind=warning]{--arcgis-internal-toolbar-action-kind-color: var(--calcite-color-status-warning);--arcgis-internal-toolbar-action-kind-color-hover: var(--calcite-color-status-warning-hover);--arcgis-internal-toolbar-action-kind-color-press: var(--calcite-color-status-warning-press)}`, c = a`:host([layout="horizontal"]){.split-anchor{min-width:24px;max-width:24px;&[scale=m]{--calcite-internal-action-spacing: .25rem}&[scale=l]{--calcite-internal-action-spacing: 0rem}}.split-host:has(.split-menu){>calcite-action{border-radius:var(--calcite-action-corner-radius, 2px);border-top-right-radius:0;border-bottom-right-radius:0}.split-anchor{border-radius:var(--calcite-action-corner-radius, 2px);border-bottom-left-radius:0;border-top-left-radius:0}>calcite-action:dir(rtl){border-radius:var(--calcite-action-corner-radius, 2px);border-top-left-radius:0;border-bottom-left-radius:0}.split-anchor:dir(rtl){border-radius:var(--calcite-action-corner-radius, 2px);border-bottom-right-radius:0;border-top-right-radius:0}.split-anchor:dir(ltr){margin-left:calc(0px - var(--calcite-internal-action-bar-gap));margin-right:calc(0px - var(--calcite-internal-action-bar-padding))}.split-anchor:dir(rtl){margin-right:calc(0px - var(--calcite-internal-action-bar-gap));margin-left:calc(0px - var(--calcite-internal-action-bar-padding))}}}:host([layout="vertical"]){.split-anchor{--calcite-internal-action-min-height: unset;min-height:24px;max-height:24px}.split-host:has(.split-menu){>calcite-action{border-radius:var(--calcite-action-corner-radius, 2px);border-bottom-left-radius:0;border-bottom-right-radius:0}.split-anchor{border-radius:var(--calcite-action-corner-radius, 2px);border-top-right-radius:0;border-top-left-radius:0;margin-top:calc(0px - var(--calcite-internal-action-bar-gap));margin-bottom:calc(0px - var(--calcite-internal-action-bar-padding))}}}.split-host:has(.split-menu):hover,.split-host:has(calcite-action-menu[open]),.split-host:has(calcite-dropdown[open]){.split-anchor,>calcite-action{background-color:var(--calcite-action-background-color-hover, var(--calcite-color-transparent-hover))}}.split-host{display:contents;cursor:pointer}`, i = a`:host{max-inline-size:100%;max-block-size:100%;min-inline-size:0;min-block-size:0
|
|
3
|
+
const r = a`:host([toolbar-kind="floating"]){.ruler{opacity:0;pointer-events:none;position:absolute;visibility:hidden;flex-direction:column;height:min(100cqh - var(--arcgis-internal-attribution-space-top) - 2 * var(--calcite-space-lg),100vh - 2 * var(--calcite-space-lg));width:min(100cqw - 2 * var(--calcite-space-lg),100vw - 2 * var(--calcite-space-lg))}}:host([toolbar-kind="docked"]){.ruler{visibility:hidden;height:0;display:block;position:absolute;top:0;left:0;right:0;width:100%;height:100%}}`, t = a`:host{--arcgis-internal-toolbar-action-kind-color: var(--calcite-action-text-color);--arcgis-internal-toolbar-action-kind-color-hover: var(--calcite-action-text-color-press);--arcgis-internal-toolbar-action-kind-color-press: var(--calcite-action-text-color-press);--arcgis-internal-toolbar-action-kind-foreground-color: var(--calcite-color-text-inverse);--arcgis-internal-toolbar-action-transparent-background-color: var(--calcite-color-transparent);--arcgis-internal-toolbar-action-transparent-background-color-hover: var(--calcite-color-transparent-hover);--arcgis-internal-toolbar-action-transparent-background-color-press: var(--calcite-color-transparent-press)}calcite-action{--calcite-action-text-color: var(--arcgis-internal-toolbar-action-kind-color);--calcite-action-text-color-press: var(--arcgis-internal-toolbar-action-kind-color-press);--calcite-color-focus: var(--arcgis-internal-toolbar-action-kind-color);--calcite-action-indicator-color: var(--arcgis-internal-toolbar-action-kind-color)}calcite-action:is([data-appearance=solid]){--calcite-offset-invert-focus: 1}calcite-action[data-appearance=outline]{--calcite-action-background-color: var(--arcgis-internal-toolbar-action-transparent-background-color);--calcite-action-background-color-hover: var(--arcgis-internal-toolbar-action-transparent-background-color-hover);--calcite-action-background-color-press: var(--arcgis-internal-toolbar-action-transparent-background-color-press);--calcite-action-text-color: var(--arcgis-internal-toolbar-action-kind-color);--calcite-action-text-color-press: var(--arcgis-internal-toolbar-action-kind-color-press);box-shadow:inset 0 0 0 var(--calcite-border-width-sm, 1px) var(--arcgis-internal-toolbar-action-kind-color)}calcite-action[data-appearance=outline]:hover{box-shadow:inset 0 0 0 var(--calcite-border-width-sm, 1px) var(--arcgis-internal-toolbar-action-kind-color-hover)}calcite-action[data-appearance=outline]:active,calcite-action[data-appearance=outline][active]{--calcite-action-background-color: var(--arcgis-internal-toolbar-action-transparent-background-color-press);box-shadow:inset 0 0 0 var(--calcite-border-width-sm, 1px) var(--arcgis-internal-toolbar-action-kind-color-press)}calcite-action[data-appearance=solid]{--calcite-action-background-color: var(--arcgis-internal-toolbar-action-kind-color);--calcite-action-background-color-hover: var(--arcgis-internal-toolbar-action-kind-color-hover);--calcite-action-background-color-press: var(--arcgis-internal-toolbar-action-kind-color-press);--calcite-action-text-color: var(--arcgis-internal-toolbar-action-kind-foreground-color);--calcite-action-text-color-press: var(--arcgis-internal-toolbar-action-kind-foreground-color);--calcite-action-indicator-color: var(--arcgis-internal-toolbar-action-kind-foreground-color)}calcite-action:is([data-appearance=outline],[data-appearance=solid]):not([data-kind]){--arcgis-internal-toolbar-action-kind-color: var(--calcite-color-inverse);--arcgis-internal-toolbar-action-kind-color-hover: var(--calcite-color-inverse-hover);--arcgis-internal-toolbar-action-kind-color-press: var(--calcite-color-inverse-press)}calcite-action:not([data-kind]){--calcite-action-indicator-color: var(--calcite-color-brand)}calcite-action[data-kind=brand]{--arcgis-internal-toolbar-action-kind-color: var(--calcite-color-brand);--arcgis-internal-toolbar-action-kind-color-hover: var(--calcite-color-brand-hover);--arcgis-internal-toolbar-action-kind-color-press: var(--calcite-color-brand-press);--calcite-action-indicator-color: var(--calcite-color-text-1);&[data-appearance=solid]{--calcite-action-indicator-color: var(--calcite-color-text-inverse)}}calcite-action[data-kind=danger]{--arcgis-internal-toolbar-action-kind-color: var(--calcite-color-status-danger);--arcgis-internal-toolbar-action-kind-color-hover: var(--calcite-color-status-danger-hover);--arcgis-internal-toolbar-action-kind-color-press: var(--calcite-color-status-danger-press)}calcite-action[data-kind=info]{--arcgis-internal-toolbar-action-kind-color: var(--calcite-color-status-info);--arcgis-internal-toolbar-action-kind-color-hover: var(--calcite-color-status-info-hover);--arcgis-internal-toolbar-action-kind-color-press: var(--calcite-color-status-info-press)}calcite-action[data-kind=success]{--arcgis-internal-toolbar-action-kind-color: var(--calcite-color-status-success);--arcgis-internal-toolbar-action-kind-color-hover: var(--calcite-color-status-success-hover);--arcgis-internal-toolbar-action-kind-color-press: var(--calcite-color-status-success-press)}calcite-action[data-kind=warning]{--arcgis-internal-toolbar-action-kind-color: var(--calcite-color-status-warning);--arcgis-internal-toolbar-action-kind-color-hover: var(--calcite-color-status-warning-hover);--arcgis-internal-toolbar-action-kind-color-press: var(--calcite-color-status-warning-press)}`, c = a`:host([layout="horizontal"]){.split-anchor{min-width:24px;max-width:24px;&[scale=m]{--calcite-internal-action-spacing: .25rem}&[scale=l]{--calcite-internal-action-spacing: 0rem}}.split-host:has(.split-menu){>calcite-action{border-radius:var(--calcite-action-corner-radius, 2px);border-top-right-radius:0;border-bottom-right-radius:0}.split-anchor{border-radius:var(--calcite-action-corner-radius, 2px);border-bottom-left-radius:0;border-top-left-radius:0}>calcite-action:dir(rtl){border-radius:var(--calcite-action-corner-radius, 2px);border-top-left-radius:0;border-bottom-left-radius:0}.split-anchor:dir(rtl){border-radius:var(--calcite-action-corner-radius, 2px);border-bottom-right-radius:0;border-top-right-radius:0}.split-anchor:dir(ltr){margin-left:calc(0px - var(--calcite-internal-action-bar-gap));margin-right:calc(0px - var(--calcite-internal-action-bar-padding))}.split-anchor:dir(rtl){margin-right:calc(0px - var(--calcite-internal-action-bar-gap));margin-left:calc(0px - var(--calcite-internal-action-bar-padding))}}}:host([layout="vertical"]){.split-anchor{--calcite-internal-action-min-height: unset;min-height:24px;max-height:24px}.split-host:has(.split-menu){>calcite-action{border-radius:var(--calcite-action-corner-radius, 2px);border-bottom-left-radius:0;border-bottom-right-radius:0}.split-anchor{border-radius:var(--calcite-action-corner-radius, 2px);border-top-right-radius:0;border-top-left-radius:0;margin-top:calc(0px - var(--calcite-internal-action-bar-gap));margin-bottom:calc(0px - var(--calcite-internal-action-bar-padding))}}}.split-host:has(.split-menu):hover,.split-host:has(calcite-action-menu[open]),.split-host:has(calcite-dropdown[open]){.split-anchor,>calcite-action{background-color:var(--calcite-action-background-color-hover, var(--calcite-color-transparent-hover))}}.split-host{display:contents;cursor:pointer}`, i = a`:host{max-inline-size:100%;max-block-size:100%;min-inline-size:0;min-block-size:0}calcite-action-bar{-webkit-user-select:none;user-select:none;pointer-events:auto}:host([toolbar-kind="docked"][layout="horizontal"]){calcite-action-bar{min-width:100%}}:host([toolbar-kind="docked"][layout="vertical"]){min-height:100%;calcite-action-bar{min-height:100%}}calcite-tooltip.calcite-mode-dark{color-scheme:dark}:host([toolbar-kind="floating"][layout="vertical"]) .toolbar-shadow-wrapper{overflow-y:auto}:host([toolbar-kind="floating"][layout="horizontal"]) .toolbar-shadow-wrapper{overflow-x:auto}.toolbar-grid-wrapper{display:grid;max-inline-size:100%;max-block-size:100%;min-inline-size:0;min-block-size:0}:host([layout="horizontal"]) .toolbar-grid-wrapper{grid-template-columns:minmax(0,1fr)}:host([layout="vertical"]) .toolbar-grid-wrapper{grid-template-rows:minmax(0,1fr)}:host([toolbar-kind="floating"]) .toolbar-shadow-wrapper{box-shadow:var(--calcite-shadow-md);background-color:var(--calcite-action-bar-background-color, var(--calcite-color-surface-2));border-radius:var(--calcite-action-bar-corner-radius, var(--calcite-corner-radius-sm));min-inline-size:0;min-block-size:0}`;
|
|
4
4
|
export {
|
|
5
5
|
r as a,
|
|
6
6
|
t as b,
|
|
@@ -263,6 +263,14 @@ export abstract class ArcgisHistogram extends LitElement {
|
|
|
263
263
|
* ```
|
|
264
264
|
*/
|
|
265
265
|
accessor min: number | undefined;
|
|
266
|
+
/**
|
|
267
|
+
* When `true`, the histogram will display bins from high to low. If [layout](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-histogram/#layout) is `"vertical"`, histogram bars
|
|
268
|
+
* will grow from right to left instead.
|
|
269
|
+
*
|
|
270
|
+
* @default false
|
|
271
|
+
* @see [layout](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-histogram/#layout)
|
|
272
|
+
*/
|
|
273
|
+
accessor mirrored: boolean;
|
|
266
274
|
/**
|
|
267
275
|
* The statistical standard deviation of the data in the histogram. You would typically
|
|
268
276
|
* get this value from the `stddev` property of
|
|
@@ -1,202 +1,207 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import { c as
|
|
3
|
-
import { u as
|
|
4
|
-
import { substitute as
|
|
5
|
-
import { LitElement as
|
|
6
|
-
import { css as O, html as
|
|
2
|
+
import { c as k } from "../../chunks/runtime.js";
|
|
3
|
+
import { u as E } from "../../chunks/useT9n.js";
|
|
4
|
+
import { substitute as F } from "@arcgis/core/intl.js";
|
|
5
|
+
import { LitElement as I, nothing as u, safeStyleMap as w, safeClassMap as z } from "@arcgis/lumina";
|
|
6
|
+
import { css as O, html as D, svg as d } from "lit";
|
|
7
7
|
import { a as R } from "../../chunks/locale.js";
|
|
8
|
-
const
|
|
9
|
-
function
|
|
10
|
-
const [
|
|
11
|
-
if (!t ||
|
|
8
|
+
const S = O`:host{display:block;--arcgis-histogram-bar-color: var(--calcite-color-border-1);--arcgis-histogram-stop-color: color-mix(in srgb, var(--calcite-color-brand) 80%, transparent)}.content{display:block;direction:ltr;width:100%;height:100%}.svg{display:block;width:100%;height:100%;overflow:visible}.data-line{stroke:#888;stroke-width:1px;shape-rendering:crispEdges}.average-data-line{stroke-width:1px;shape-rendering:crispEdges;stroke:#444}.label,.data-line-symbol{font-size:12px;stroke:#fff;stroke-width:2px;paint-order:stroke;unicode-bidi:plaintext}.data-line-symbol{font-family:"Georgia, serif",sans-serif;font-style:italic}`;
|
|
9
|
+
function B(t, r, n, e, i, s) {
|
|
10
|
+
const [a, o] = i;
|
|
11
|
+
if (!t || o === 0 || a === 0 || n == null || r == null)
|
|
12
12
|
return null;
|
|
13
|
-
const
|
|
13
|
+
const l = n - r, h = (t.length > 1 ? t[t.length - 1].maxValue - t[0].minValue : 0) / l, [g, p] = e === "vertical" ? [o * h, a] : [o, a * h], $ = t ? t.map((m) => m.count) : [], f = Math.max(...$);
|
|
14
14
|
return t.map((m) => {
|
|
15
|
-
const [b, v] = e === "vertical" ? [
|
|
16
|
-
|
|
15
|
+
const [b, v] = e === "vertical" ? [g / t.length, f !== 0 ? m.count / f * p : 0] : [f !== 0 ? m.count / f * g : 0, p / t.length], { maxValue: _ } = m, y = n - _;
|
|
16
|
+
let [x, M] = e === "vertical" ? [0, y * (o / l)] : [a - v - y * (a / l), o - b];
|
|
17
|
+
return s && (x = a - x - v), [x, M, v, b];
|
|
17
18
|
});
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
-
if (e === void 0 ||
|
|
20
|
+
function N(t, r, n, e, i, s) {
|
|
21
|
+
if (e === void 0 || i === void 0)
|
|
21
22
|
return [];
|
|
22
23
|
const a = [];
|
|
23
24
|
return t != null && a.push({
|
|
24
25
|
value: t,
|
|
25
26
|
symbol: "x̄",
|
|
26
27
|
lineClass: "average-data-line"
|
|
27
|
-
}),
|
|
28
|
-
...
|
|
29
|
-
), s && a.push(...s), a.filter(({ value: o }) => o >= e && o <=
|
|
28
|
+
}), r != null && e != null && i != null && a.push(
|
|
29
|
+
...Y(e, i, r, n, t)
|
|
30
|
+
), s && a.push(...s), a.filter(({ value: o }) => o >= e && o <= i);
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
+
function P(t, r, n, e, i, s) {
|
|
32
33
|
if (n == null)
|
|
33
34
|
return [0, 0, 0, 0];
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
let a = Math.round((i - n) / e * 100) / 100;
|
|
36
|
+
s && r === "horizontal" && (a = 1 - a);
|
|
37
|
+
const [o, l] = t;
|
|
38
|
+
if (r === "vertical") {
|
|
39
|
+
let h = l - a * l || 1;
|
|
40
|
+
return h = Math.round(h) + 0.5, [0, "100%", h, h];
|
|
38
41
|
}
|
|
39
|
-
let c =
|
|
42
|
+
let c = a * o || 1;
|
|
40
43
|
return c = Math.round(c) + 0.5, [c, c, "100%", 0];
|
|
41
44
|
}
|
|
42
|
-
function
|
|
45
|
+
function T(t, r, n, e, i, s) {
|
|
43
46
|
if (n == null)
|
|
44
47
|
return [0, 0];
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
let a = Math.round((i - n) / e * 100) / 100;
|
|
49
|
+
s && r === "horizontal" && (a = 1 - a);
|
|
50
|
+
const [o, l] = t;
|
|
51
|
+
return s && r === "vertical" ? [0, l - a * l] : r === "vertical" ? [o, l - a * l] : [0, a * o];
|
|
47
52
|
}
|
|
48
|
-
function
|
|
53
|
+
function A(t, r, n) {
|
|
49
54
|
if (!t || t.length === 0)
|
|
50
55
|
return null;
|
|
51
|
-
if (
|
|
52
|
-
const e = t.map((
|
|
53
|
-
...
|
|
54
|
-
color:
|
|
56
|
+
if (L(t)) {
|
|
57
|
+
const e = t.map((i) => ({
|
|
58
|
+
...i,
|
|
59
|
+
color: V(i.color ?? n)
|
|
55
60
|
}));
|
|
56
61
|
return e.unshift({
|
|
57
|
-
color:
|
|
62
|
+
color: r,
|
|
58
63
|
minValue: Number.NEGATIVE_INFINITY,
|
|
59
64
|
maxValue: e[0].minValue
|
|
60
65
|
}), e.push({
|
|
61
|
-
color:
|
|
66
|
+
color: r,
|
|
62
67
|
minValue: e[e.length - 1].maxValue,
|
|
63
68
|
maxValue: Number.POSITIVE_INFINITY
|
|
64
69
|
}), e;
|
|
65
70
|
} else
|
|
66
71
|
return t.map((e) => ({
|
|
67
72
|
...e,
|
|
68
|
-
color:
|
|
73
|
+
color: V(e.color ?? n)
|
|
69
74
|
}));
|
|
70
75
|
}
|
|
71
|
-
function
|
|
76
|
+
function H(t, r, n, e) {
|
|
72
77
|
if (!t || t.length === 0)
|
|
73
78
|
return n;
|
|
74
|
-
if (
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
79
|
+
if (L(t)) {
|
|
80
|
+
const i = W(t, r);
|
|
81
|
+
if (i.length === 0)
|
|
77
82
|
return n;
|
|
78
83
|
if (e) {
|
|
79
|
-
const { color: s = n, weight: a } =
|
|
80
|
-
return `color-mix(in srgb, ${s} ${a /
|
|
84
|
+
const { color: s = n, weight: a } = i[0], { color: o = n, weight: l } = i[1] ?? i[0], c = a + l;
|
|
85
|
+
return `color-mix(in srgb, ${s} ${a / c * 100}%, ${o} ${l / c * 100}%)`;
|
|
81
86
|
}
|
|
82
|
-
return
|
|
87
|
+
return i[0].color ?? n;
|
|
83
88
|
}
|
|
84
|
-
return
|
|
89
|
+
return G(t, r);
|
|
85
90
|
}
|
|
86
|
-
function
|
|
91
|
+
function W(t, r) {
|
|
87
92
|
const n = [];
|
|
88
93
|
for (const e of t) {
|
|
89
|
-
const
|
|
90
|
-
|
|
94
|
+
const i = Math.max(0, Math.min(r.maxValue, e.maxValue) - Math.max(r.minValue, e.minValue));
|
|
95
|
+
i > 0 && n.push({ color: e.color, weight: i });
|
|
91
96
|
}
|
|
92
|
-
return n.sort((e,
|
|
97
|
+
return n.sort((e, i) => i.weight - e.weight);
|
|
93
98
|
}
|
|
94
|
-
function
|
|
95
|
-
const n = (
|
|
99
|
+
function G(t, r) {
|
|
100
|
+
const n = (r.maxValue - r.minValue) / 2 + r.minValue;
|
|
96
101
|
if (n > t[t.length - 1].value)
|
|
97
102
|
return t[t.length - 1].color;
|
|
98
103
|
for (let e = 0; e < t.length - 1; e++) {
|
|
99
|
-
const
|
|
100
|
-
if (n <=
|
|
101
|
-
return
|
|
104
|
+
const i = t[e], s = t[e + 1];
|
|
105
|
+
if (n <= i.value)
|
|
106
|
+
return i.color;
|
|
102
107
|
if (n < s.value) {
|
|
103
|
-
const a = (n -
|
|
104
|
-
return `color-mix(in srgb, ${
|
|
108
|
+
const a = (n - i.value) / (s.value - i.value) * 100;
|
|
109
|
+
return `color-mix(in srgb, ${i.color}, ${s.color} ${a}%)`;
|
|
105
110
|
}
|
|
106
111
|
}
|
|
107
112
|
return t[t.length - 1].color;
|
|
108
113
|
}
|
|
109
|
-
function
|
|
114
|
+
function L(t) {
|
|
110
115
|
return t[0] != null && "minValue" in t[0];
|
|
111
116
|
}
|
|
112
|
-
function
|
|
117
|
+
function V(t) {
|
|
113
118
|
if (typeof t == "string")
|
|
114
119
|
return t;
|
|
115
120
|
if (Array.isArray(t))
|
|
116
121
|
return `rgba(${t[0]}, ${t[1]}, ${t[2]}, ${t[3] ?? 1})`;
|
|
117
|
-
const { r
|
|
118
|
-
return `rgba(${
|
|
122
|
+
const { r, g: n, b: e, a: i = 1 } = t;
|
|
123
|
+
return `rgba(${r}, ${n}, ${e}, ${i})`;
|
|
119
124
|
}
|
|
120
|
-
function
|
|
121
|
-
const s = 0.06 * (
|
|
122
|
-
return
|
|
123
|
-
const
|
|
125
|
+
function Y(t, r, n, e, i) {
|
|
126
|
+
const s = 0.06 * (r - t);
|
|
127
|
+
return U(n, e, i).map((a, o, l) => {
|
|
128
|
+
const c = l.length / 2, h = a > i ? "+" : "-", g = o >= c ? o - c + 1 : c - o;
|
|
124
129
|
return {
|
|
125
|
-
symbol: `${
|
|
130
|
+
symbol: `${h}${g === 1 ? "" : g}σ`,
|
|
126
131
|
value: a
|
|
127
132
|
};
|
|
128
|
-
}).filter(({ value: a }) => Math.abs(
|
|
133
|
+
}).filter(({ value: a }) => Math.abs(i - a) > s);
|
|
129
134
|
}
|
|
130
|
-
function
|
|
135
|
+
function U(t, r, n) {
|
|
131
136
|
if (n == null || t == null)
|
|
132
137
|
return [];
|
|
133
|
-
const e =
|
|
138
|
+
const e = r, i = [];
|
|
134
139
|
for (let s = e * -1; s <= e; s++)
|
|
135
|
-
s !== 0 &&
|
|
136
|
-
return
|
|
140
|
+
s !== 0 && i.push(n + s * t);
|
|
141
|
+
return i;
|
|
137
142
|
}
|
|
138
|
-
const
|
|
139
|
-
class
|
|
143
|
+
const C = "var(--arcgis-histogram-bar-color)", j = "var(--arcgis-histogram-stop-color)";
|
|
144
|
+
class q extends I {
|
|
140
145
|
constructor() {
|
|
141
|
-
super(...arguments), this._messages =
|
|
142
|
-
const e = (
|
|
143
|
-
return this.labelFormatter?.(
|
|
146
|
+
super(...arguments), this._messages = E(), this._normalizedStops = null, this.#t = (r, n) => {
|
|
147
|
+
const e = (i) => R(this._messages._lang, this._numberFormatterOptions).format(i);
|
|
148
|
+
return this.labelFormatter?.(r, n, e) ?? e(r);
|
|
144
149
|
}, this._numberFormatterOptions = {
|
|
145
150
|
maximumFractionDigits: 2
|
|
146
|
-
}, this.containerDimensions = [0, 0], this.icon = "graph-histogram", this.layout = "horizontal", this.colorBlendingEnabled = !1, this.standardDeviationCount = 1;
|
|
151
|
+
}, this.containerDimensions = [0, 0], this.icon = "graph-histogram", this.layout = "horizontal", this.mirrored = !1, this.colorBlendingEnabled = !1, this.standardDeviationCount = 1;
|
|
147
152
|
}
|
|
148
153
|
static {
|
|
149
|
-
this.properties = { containerDimensions: 16, colorStops: 0, icon: 3, labelFormatter: 0, average: 11, messageOverrides: 0, standardDeviation: 11, bins: 0, dataLines: 0, label: 1, layout: 3, max: 11, min: 11, colorBlendingEnabled: 5, standardDeviationCount: 9 };
|
|
154
|
+
this.properties = { containerDimensions: 16, colorStops: 0, icon: 3, labelFormatter: 0, average: 11, messageOverrides: 0, standardDeviation: 11, bins: 0, dataLines: 0, label: 1, layout: 3, max: 11, min: 11, mirrored: 7, colorBlendingEnabled: 5, standardDeviationCount: 9 };
|
|
150
155
|
}
|
|
151
156
|
static {
|
|
152
|
-
this.styles =
|
|
157
|
+
this.styles = S;
|
|
153
158
|
}
|
|
154
159
|
#t;
|
|
155
160
|
loaded() {
|
|
156
|
-
const
|
|
157
|
-
for (const s of
|
|
161
|
+
const r = new ResizeObserver((i) => {
|
|
162
|
+
for (const s of i) {
|
|
158
163
|
const { width: a, height: o } = s.contentRect;
|
|
159
164
|
this.containerDimensions = [a, o];
|
|
160
165
|
}
|
|
161
166
|
}), { width: n, height: e } = this.el.getBoundingClientRect();
|
|
162
|
-
this.containerDimensions = [n, e],
|
|
167
|
+
this.containerDimensions = [n, e], r.observe(this.el);
|
|
163
168
|
}
|
|
164
|
-
willUpdate(
|
|
165
|
-
|
|
169
|
+
willUpdate(r) {
|
|
170
|
+
r.has("colorStops") && (this._normalizedStops = A(this.colorStops, C, j));
|
|
166
171
|
}
|
|
167
172
|
render() {
|
|
168
|
-
const { label:
|
|
169
|
-
return
|
|
173
|
+
const { label: r } = this;
|
|
174
|
+
return D`<div role=img .ariaLabel=${r ?? void 0} class="content">${this._renderContent()}</div>`;
|
|
170
175
|
}
|
|
171
176
|
_renderContent() {
|
|
172
|
-
const { containerDimensions: [
|
|
173
|
-
d`<defs><clipPath id=${e}><rect height=${n ??
|
|
174
|
-
d`<g style=${
|
|
177
|
+
const { containerDimensions: [r, n] } = this, e = "bg-fill", i = r ? [
|
|
178
|
+
d`<defs><clipPath id=${e}><rect height=${n ?? u} width=${r ?? u} x=0 y=0 /></clipPath></defs>`,
|
|
179
|
+
d`<g style=${w({ clipPath: `url(#${e})` })}><g>${this._renderBars()}</g></g>`,
|
|
175
180
|
d`<g>${this._renderLines()}</g>`
|
|
176
181
|
] : [];
|
|
177
|
-
return
|
|
182
|
+
return D`<svg class="svg" xmlns=http://www.w3.org/2000/svg>${i}</svg>`;
|
|
178
183
|
}
|
|
179
184
|
_renderBars() {
|
|
180
|
-
const { bins:
|
|
181
|
-
return !e || !
|
|
182
|
-
const [a, o,
|
|
183
|
-
return d`<rect style=${
|
|
184
|
-
fill:
|
|
185
|
-
})} .ariaLabel=${g} data-index=${s ??
|
|
185
|
+
const { bins: r, _messages: n } = this, e = B(this.bins, this.min, this.max, this.layout, this.containerDimensions, this.mirrored);
|
|
186
|
+
return !e || !r ? null : e.map((i, s) => {
|
|
187
|
+
const [a, o, l, c] = i, h = r[s], g = n?.barLabel ? F(n.barLabel, h) : "";
|
|
188
|
+
return d`<rect style=${w({
|
|
189
|
+
fill: H(this._normalizedStops, h, C, this.colorBlendingEnabled)
|
|
190
|
+
})} .ariaLabel=${g} data-index=${s ?? u} height=${c ?? u} role=img shape-rendering=crispEdges stroke-width=0 width=${l ?? u} x=${a ?? u} y=${o ?? u} />`;
|
|
186
191
|
});
|
|
187
192
|
}
|
|
188
193
|
_renderLines() {
|
|
189
|
-
return
|
|
194
|
+
return N(this.average, this.standardDeviation, this.standardDeviationCount, this.min, this.max, this.dataLines)?.map((n) => J({ dataLine: n, containerDimensions: this.containerDimensions, layout: this.layout, min: this.min, max: this.max, labelFormatter: this.#t, mirrored: this.mirrored }));
|
|
190
195
|
}
|
|
191
196
|
}
|
|
192
|
-
const
|
|
193
|
-
const { containerDimensions:
|
|
197
|
+
const J = (t) => {
|
|
198
|
+
const { containerDimensions: r, layout: n, min: e, max: i, dataLine: s, labelFormatter: a, mirrored: o } = t, l = i != null && e != null ? i - e : 0, [c, h, g, p] = P(r, n, e, l, s.value, o), [$, f] = T(r, n, e, l, s.value, o), m = "symbol" in s ? [
|
|
194
199
|
d`<tspan class="data-line-symbol">${s.symbol}</tspan>`,
|
|
195
200
|
d`<tspan>${a(s.value, s.lineClass === "average-data-line" ? "average" : "standard-deviation")}</tspan>`
|
|
196
201
|
] : s.label, b = "lineClass" in s && s.lineClass ? s.lineClass : "data-line";
|
|
197
|
-
return d`<g><title>${s.value}</title><line class=${
|
|
202
|
+
return d`<g><title>${s.value}</title><line class=${z(b)} shape-rendering=crispEdges x1=${c ?? u} x2=${h ?? u} y1=${g ?? u} y2=${p ?? u} /><text class="label" text-anchor=${o && n === "vertical" ? "start" : "end"} transform=${(n === "horizontal" ? "rotate(270)" : void 0) ?? u} x=${$ ?? u} y=${f - 2}>${m}</text></g>`;
|
|
198
203
|
};
|
|
199
|
-
|
|
204
|
+
k("arcgis-histogram", q);
|
|
200
205
|
export {
|
|
201
|
-
|
|
206
|
+
q as ArcgisHistogram
|
|
202
207
|
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/// <reference path="../../index.d.ts" />
|
|
2
|
+
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Component to render html content. The content will be sanitized before rendering to prevent XSS attack.
|
|
6
|
+
* The default sanitizer will remove all tags not in the whitelist and also remove the content in script tag.
|
|
7
|
+
* The default sanitizer will allow certain classes for img and figure tags to support html content generated from CKEditor, but it can be customized by passing in sanitizerOptions.
|
|
8
|
+
* More info about the default whitelist of arcgis-html-sanitizer can be found at https://github.com/Esri/arcgis-html-sanitizer/blob/master/src/index.ts
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export abstract class ArcgisHtmlContent extends LitElement {
|
|
13
|
+
/**
|
|
14
|
+
* Html fragment to be rendered in the component. It will be sanitized before rendering.
|
|
15
|
+
* The default sanitizer will remove all tags not in the whitelist and also remove the content in script tag.
|
|
16
|
+
* The default sanitizer will allow certain classes for img and figure tags to support html content generated from CKEditor, but it can be customized by passing in sanitizerOptions.
|
|
17
|
+
*
|
|
18
|
+
* @default ""
|
|
19
|
+
*/
|
|
20
|
+
accessor content: string;
|
|
21
|
+
/**
|
|
22
|
+
* The options to create the sanitizer. It can be used to customize the sanitizer behavior, for example, allowing some tags or attributes that are not in the default whitelist.
|
|
23
|
+
* For more details of the options, please refer to the XSS.IFilterXSSOptions documentation.
|
|
24
|
+
*/
|
|
25
|
+
accessor sanitizerOptions: IFilterXSSOptions | undefined;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** @internal */
|
|
29
|
+
export type IFilterXSSOptions = {
|
|
30
|
+
onTagAttr?: OnTagAttrHandler;
|
|
31
|
+
stripIgnoreTag?: boolean;
|
|
32
|
+
stripIgnoreTagBody?: string[] | boolean;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @param tag
|
|
37
|
+
* @param name
|
|
38
|
+
* @param value
|
|
39
|
+
* @param isWhiteAttr
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
export type OnTagAttrHandler = (tag: string, name: string, value: string, isWhiteAttr: boolean) => string | void;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
+
import { c as s } from "../../chunks/runtime.js";
|
|
3
|
+
import { LitElement as g } from "@arcgis/lumina";
|
|
4
|
+
import c from "@esri/arcgis-html-sanitizer";
|
|
5
|
+
import { unsafeHTML as d } from "lit/directives/unsafe-html.js";
|
|
6
|
+
import { css as m } from "lit";
|
|
7
|
+
const p = m`:host{--arcgis-internal-content-image-spacing: 1.5em;--arcgis-internal-content-inline-image-spacing: calc(var(--arcgis-internal-content-image-spacing) / 2);width:100%;*{overflow-wrap:anywhere}}ol,ul{margin:1.12em 0;padding-block:0;padding-inline-start:var(--calcite-spacing-10)}ol li,ul li{border:none;height:initial}h1,h2,h3,h4,h5,h6,p{margin:0}a{color:var(--calcite-color-text-link);text-decoration:none;&:hover{text-decoration:underline}}video,img{max-width:100%;height:auto}table .ck-table-resized{table-layout:fixed}.table table{overflow:hidden}.table td,.table th{position:relative}.table{margin:.9em auto;display:table}.table table{border-collapse:collapse;border-spacing:0;width:100%;height:100%;border:1px double hsl(0,0%,70%)}.table table td,.table table th{min-width:2em;padding:.4em;border:1px solid hsl(0,0%,75%)}.table th{font-weight:700;background:#0000000d}.table>figcaption{display:table-caption;caption-side:top;word-break:break-word;text-align:center;color:#333;background-color:#f7f7f7;padding:.6em;font-size:.75em;outline-offset:-1px}ol{list-style-type:decimal}ol ol{list-style-type:lower-latin}ol ol ol{list-style-type:lower-roman}ol ol ol ol{list-style-type:upper-latin}ol ol ol ol ol{list-style-type:upper-roman}ul{list-style-type:disc}ul ul{list-style-type:circle}ul ul ul,ul ul ul ul{list-style-type:square}.image{display:table;clear:both;text-align:center;margin:.9em auto;min-width:50px}.image img{display:block;margin:0 auto;max-width:100%;min-width:100%;height:auto}.image-inline{display:inline-flex;max-width:100%;align-items:flex-start}.image-inline picture{display:flex}.image-inline picture,.image-inline img{flex-grow:1;flex-shrink:1;max-width:100%}.image_resized{height:auto}.image_resized{max-width:100%;display:block;box-sizing:border-box}.image_resized img{width:100%}.image_resized>figcaption{display:block}.image>figcaption{display:table-caption;caption-side:bottom;word-break:break-word;color:#333;background-color:#f7f7f7;padding:.6em;font-size:.75em;outline-offset:-1px}.image-style-block-align-left,.image-style-block-align-right{max-width:calc(100% - var(--arcgis-user-content-image-style-spacing))}.image-style-align-left,.image-style-align-right{clear:none}.image-style-align-left{float:left;margin-right:var(--arcgis-user-content-image-style-spacing)}.image-style-align-center{margin-left:auto;margin-right:auto}.image-style-align-right{float:right;margin-left:var(--arcgis-user-content-image-style-spacing)}.image-style-block-align-right{margin-right:0;margin-left:auto}.image-style-block-align-left{margin-left:0;margin-right:auto}p+.image-style-align-left,p+.image-style-align-right{margin-top:0}.image-inline.image-style-align-left,.image-inline.image-style-align-right{margin-top:var(--arcgis-user-content-inline-image-style-spacing);margin-bottom:var(--arcgis-user-content-inline-image-style-spacing)}.image-inline.image-style-align-left{margin-right:var(--arcgis-user-content-inline-image-style-spacing)}.image-inline.image-style-align-right{margin-left:var(--arcgis-user-content-inline-image-style-spacing)}blockquote{overflow:hidden;padding-right:1.5em;padding-left:1.5em;margin-left:0;margin-right:0;font-style:italic;border-left:solid 5px hsl(0,0%,80%)}[dir=rtl] blockquote{border-left:0;border-right:solid 5px hsl(0,0%,80%)}code{background-color:#c7c7c74d;padding:.15em;border-radius:2px}hr{margin:15px 0;height:4px;background:#dedede;border:0}pre{padding:1em;color:#353535;background:#c7c7c74d;border:1px solid hsl(0,0%,77%);border-radius:2px;text-align:left;direction:ltr;tab-size:4;white-space:pre-wrap;font-style:normal;min-width:200px}pre code{background:unset;padding:0;border-radius:0}`, h = /^(?:table|image|image-inline|image_resized|image-style(?:-block)?-align-(?:left|right)|image-style-align-center)$/u;
|
|
8
|
+
function n(a) {
|
|
9
|
+
return a.split(" ").every((t) => h.test(t));
|
|
10
|
+
}
|
|
11
|
+
function u(a) {
|
|
12
|
+
return a.startsWith("//");
|
|
13
|
+
}
|
|
14
|
+
class b extends g {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments), this.sanitizer = this.#t(), this.content = "";
|
|
17
|
+
}
|
|
18
|
+
static {
|
|
19
|
+
this.properties = { sanitizer: 16, content: 1, sanitizerOptions: 0 };
|
|
20
|
+
}
|
|
21
|
+
static {
|
|
22
|
+
this.styles = p;
|
|
23
|
+
}
|
|
24
|
+
willUpdate(e) {
|
|
25
|
+
e.has("sanitizerOptions") && (this.sanitizer = this.#t());
|
|
26
|
+
}
|
|
27
|
+
#t() {
|
|
28
|
+
const e = {
|
|
29
|
+
allowedProtocols: [],
|
|
30
|
+
customOnTagAttr: this.sanitizerOptions?.onTagAttr
|
|
31
|
+
}, t = new c({
|
|
32
|
+
stripIgnoreTag: !0,
|
|
33
|
+
// remove all tags not in the whitelist, only keep plain text
|
|
34
|
+
stripIgnoreTagBody: ["script"],
|
|
35
|
+
// not only remove script tag, but also remove the content in it
|
|
36
|
+
whiteList: {},
|
|
37
|
+
...this.sanitizerOptions ?? {},
|
|
38
|
+
onTagAttr: this.onTagAttr.bind(e)
|
|
39
|
+
}, !0);
|
|
40
|
+
return e.allowedProtocols = t.allowedProtocols ?? [], t;
|
|
41
|
+
}
|
|
42
|
+
onTagAttr(e, t, i, r) {
|
|
43
|
+
if (t.startsWith("on"))
|
|
44
|
+
return "";
|
|
45
|
+
const l = `${t}="${i}"`;
|
|
46
|
+
switch (i = i.trim().toLowerCase(), e) {
|
|
47
|
+
case "img":
|
|
48
|
+
return t === "class" && n(i) ? l : this.customOnTagAttr?.(e, t, i, r);
|
|
49
|
+
case "figure":
|
|
50
|
+
return t === "class" && n(i) ? l : this.customOnTagAttr?.(e, t, i, r);
|
|
51
|
+
case "video":
|
|
52
|
+
case "audio":
|
|
53
|
+
case "source":
|
|
54
|
+
case "iframe": {
|
|
55
|
+
if (i === "/" || i === "#" || i.startsWith("#"))
|
|
56
|
+
return t;
|
|
57
|
+
const o = i.substring(0, i.indexOf(":"));
|
|
58
|
+
return u(i) || this.allowedProtocols.includes(o) ? l : t;
|
|
59
|
+
}
|
|
60
|
+
default:
|
|
61
|
+
return this.customOnTagAttr?.(e, t, i, r);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
render() {
|
|
65
|
+
return d(this.sanitizer.sanitize(this.content));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
s("arcgis-html-content", b);
|
|
69
|
+
export {
|
|
70
|
+
b as ArcgisHtmlContent
|
|
71
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./customElement.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./customElement.js";
|
|
@@ -5,7 +5,7 @@ import { LitElement as u, createEvent as c, safeClassMap as h } from "@arcgis/lu
|
|
|
5
5
|
import { useWatchAttributes as d } from "@arcgis/lumina/controllers";
|
|
6
6
|
import { createRef as s, ref as l } from "lit/directives/ref.js";
|
|
7
7
|
import { css as p, html as a } from "lit";
|
|
8
|
-
const m = p`:host{display:block}:host([hidden]){display:none}.content{display:flex;flex-direction:column}.readOnlyLabel{display:block;font-size:var(--calcite-font-size-sm);font-variant-numeric:tabular-nums;line-height:var(--calcite-font-line-height-sm);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-inline:.5rem;padding-block:3px;border-color:var(--calcite-color-transparent);border-style:solid;border-width:var(--calcite-button-border-size, 1px);color:var(--calcite-color-text-1)}:host(:not([read-only])) .readOnlyLabel{position:absolute;opacity:0}:host([alignment="start"]){.content{align-items:start}.readOnlyLabel{text-align:start}}:host([alignment="end"]){.content{align-items:end}.readOnlyLabel{text-align:end}}:host([alignment="center"]){.content{align-items:center}.readOnlyLabel{text-align:center}}calcite-button{inline-size:100%;--calcite-offset-invert-focus: 1;--calcite-internal-animation-timing-fast: 0}calcite-input-number{inline-size:100%;--calcite-internal-animation-timing-fast: 0}`;
|
|
8
|
+
const m = p`:host{display:block}:host([hidden]){display:none}.content{display:flex;flex-direction:column}.readOnlyLabel{display:block;font-size:var(--calcite-font-size-sm);font-variant-numeric:tabular-nums;line-height:var(--calcite-font-line-height-sm);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-inline:.5rem;padding-block:3px;border-color:var(--calcite-color-transparent);border-style:solid;border-width:var(--calcite-button-border-size, 1px);color:var(--calcite-color-text-1)}:host(:not([read-only])) .readOnlyLabel{position:absolute;opacity:0}:host([alignment="start"]){.content{align-items:start}.readOnlyLabel{text-align:start}}:host([alignment="end"]){.content{align-items:end}.readOnlyLabel{text-align:end}}:host([alignment="center"]){.content{align-items:center}.readOnlyLabel{text-align:center}}calcite-button{inline-size:100%;--calcite-offset-invert-focus: 1;--calcite-internal-animation-timing-fast: 0}calcite-button:hover{--calcite-button-background-color: var(--calcite-color-surface-4)}calcite-input-number{inline-size:100%;--calcite-internal-animation-timing-fast: 0}`;
|
|
9
9
|
class f extends u {
|
|
10
10
|
constructor() {
|
|
11
11
|
super(), this._buttonRef = s(), this._inputRef = s(), this._labelRef = s(), this._formatOptions = {
|