You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
9.2 KiB
21 lines
9.2 KiB
// All material copyright Esri, All Rights Reserved, unless otherwise specified. |
|
// See https://js.arcgis.com/4.30/esri/copyright.txt for details. |
|
//>>built |
|
define(["exports","./guid","./componentsUtils"],function(k,Q,C){function x(f,e){function c(a){if(a){var b;(b=a.closest(e))||(a=a.getRootNode().host||null,b=c(a));a=b}else a=null;return a}return c(f)}function R(f,e){return D(f,e)}function D(f,e){if(f){var c=e(f);if(void 0!==c)return c;({parentNode:f}=f);return D(f instanceof ShadowRoot?f.host:f,e)}}async function E(f){if(f)return"function"===typeof f?.setFocus?f.setFocus():f.focus()}function F(f){if(f)return G(f,H)[0]??f}function I(f,e){return f?Array.from(f.children|| |
|
[]).filter(c=>c?.matches(e)):[]}function S(f,e,c){e=":not([slot])"===e?I(f,":not([slot])"):Array.from(f.querySelectorAll(e));e=c&&!1===c.direct?e:e.filter(b=>b.parentElement===f);e=c?.matches?e.filter(b=>b?.matches(c.matches)):e;const a=c?.selector;return a?e.map(b=>Array.from(b.querySelectorAll(a))).reduce((b,d)=>[...b,...d],[]).filter(b=>!!b):e}function T(f,e,c){e=":not([slot])"===e?I(f,":not([slot])")[0]||null:f.querySelector(e);e=c&&!1===c.direct?e:e?.parentElement===f?e:null;e=c?.matches?e?.matches(c.matches)? |
|
e:null:e;return(f=c?.selector)?e?.querySelector(f):e}function U(f){return f.target.assignedNodes({flatten:!0}).filter(e=>e.nodeType===Node.TEXT_NODE).map(e=>e.textContent).join("").trim()}function J(f){return!!K(f).length}function K(f){return f.target.assignedElements({flatten:!0})}var L='input:not([inert]) select:not([inert]) textarea:not([inert]) a[href]:not([inert]) button:not([inert]) [tabindex]:not(slot):not([inert]) audio[controls]:not([inert]) video[controls]:not([inert]) [contenteditable]:not([contenteditable\x3d"false"]):not([inert]) details\x3esummary:first-of-type:not([inert]) details:not([inert])'.split(" "), |
|
t=L.join(","),M="undefined"===typeof Element,q=M?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,u=!M&&Element.prototype.getRootNode?function(f){var e;return null===f||void 0===f?void 0:null===(e=f.getRootNode)||void 0===e?void 0:e.call(f)}:function(f){return null===f||void 0===f?void 0:f.ownerDocument},v=function a(e,c){var b;void 0===c&&(c=!0);var d=null===e||void 0===e?void 0:null===(b=e.getAttribute)||void 0===b?void 0:b.call(e, |
|
"inert");return""===d||"true"===d||c&&e&&a(e.parentNode)},N=function(e,c,a){if(v(e))return[];var b=Array.prototype.slice.apply(e.querySelectorAll(t));c&&q.call(e,t)&&b.unshift(e);return b=b.filter(a)},O=function d(c,a,b){for(var g=[],l=Array.from(c);l.length;){var h=l.shift();if(!v(h,!1))if("SLOT"===h.tagName){var m=h.assignedElements();m=d(m.length?m:h.children,!0,b);b.flatten?g.push.apply(g,m):g.push({scopeParent:h,candidates:m})}else{q.call(h,t)&&b.filter(h)&&(a||!c.includes(h))&&g.push(h);m=h.shadowRoot|| |
|
"function"===typeof b.getShadowRoot&&b.getShadowRoot(h);var n=!v(m,!1)&&(!b.shadowRootFilter||b.shadowRootFilter(h));m&&n?(m=d(!0===m?h.children:m.children,!0,b),b.flatten?g.push.apply(g,m):g.push({scopeParent:h,candidates:m})):l.unshift.apply(l,h.children)}}return g},y=function(c){if(!c)throw Error("No node provided");if(0>c.tabIndex){var a;if(!(a=/^(AUDIO|VIDEO|DETAILS)$/.test(c.tagName))){var b;a=null===c||void 0===c?void 0:null===(b=c.getAttribute)||void 0===b?void 0:b.call(c,"contenteditable"); |
|
a=""===a||"true"===a}if(a&&isNaN(parseInt(c.getAttribute("tabindex"),10)))return 0}return c.tabIndex},V=function(c,a){return c.tabIndex===a.tabIndex?c.documentOrder-a.documentOrder:c.tabIndex-a.tabIndex},W=function(c){return"DETAILS"===c.tagName&&Array.prototype.slice.apply(c.children).some(function(a){return"SUMMARY"===a.tagName})},X=function(c,a){for(var b=0;b<c.length;b++)if(c[b].checked&&c[b].form===a)return c[b]},Y=function(c){if(!c.name)return!0;var a=c.form||u(c),b=function(g){return a.querySelectorAll('input[type\x3d"radio"][name\x3d"'+ |
|
g+'"]')};if("undefined"!==typeof window&&"undefined"!==typeof window.CSS&&"function"===typeof window.CSS.escape)var d=b(window.CSS.escape(c.name));else try{d=b(c.name)}catch(g){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",g.message),!1}b=X(d,c.form);return!b||b===c},P=function(c){c=c.getBoundingClientRect();var a=c.height;return 0===c.width&&0===a},Z=function(c,a){var b=a.displayCheck; |
|
a=a.getShadowRoot;if("hidden"===getComputedStyle(c).visibility)return!0;var d=q.call(c,"details\x3esummary:first-of-type")?c.parentElement:c;if(q.call(d,"details:not([open]) *"))return!0;if(!b||"full"===b||"legacy-full"===b){if("function"===typeof a){for(d=c;c;){var g=c.parentElement,l=u(c);if(g&&!g.shadowRoot&&!0===a(g))return P(c);c=c.assignedSlot?c.assignedSlot:g||l===c.ownerDocument?g:l.host}c=d}a=c;var h;d=a&&u(a);g=null===(h=d)||void 0===h?void 0:h.host;h=!1;if(d&&d!==a){var m,n,p;for(h=!!(null!== |
|
(m=g)&&void 0!==m&&null!==(n=m.ownerDocument)&&void 0!==n&&n.contains(g)||null!==a&&void 0!==a&&null!==(p=a.ownerDocument)&&void 0!==p&&p.contains(a));!h&&g;){var r,z,A;d=u(g);g=null===(r=d)||void 0===r?void 0:r.host;h=!(null===(z=g)||void 0===z||null===(A=z.ownerDocument)||void 0===A||!A.contains(g))}}if(h)return!c.getClientRects().length;if("legacy-full"!==b)return!0}else if("non-zero-area"===b)return P(c);return!1},w=function(c,a){var b;(b=a.disabled||v(a))||(b="INPUT"===a.tagName&&"hidden"=== |
|
a.type);if(!(c=b||Z(a,c)||W(a)))a:{if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(a.tagName))for(c=a.parentElement;c;){if("FIELDSET"===c.tagName&&c.disabled){for(b=0;b<c.children.length;b++){var d=c.children.item(b);if("LEGEND"===d.tagName){c=q.call(c,"fieldset[disabled] *")?!0:!d.contains(a);break a}}c=!0;break a}c=c.parentElement}c=!1}return c?!1:!0},B=function(c,a){return"INPUT"===a.tagName&&"radio"===a.type&&!Y(a)||0>y(a)||!w(c,a)?!1:!0},aa=function(c){c=parseInt(c.getAttribute("tabindex"),10);return isNaN(c)|| |
|
0<=c?!0:!1},ba=function b(a){var d=[],g=[];a.forEach(function(l,h){var m=!!l.scopeParent,n=m?l.scopeParent:l;var p=y(n);p=0>p&&m&&isNaN(parseInt(n.getAttribute("tabindex"),10))?0:p;var r=m?b(l.candidates):n;0===p?m?d.push.apply(d,r):d.push(n):g.push({documentOrder:h,tabIndex:p,item:l,isScope:m,content:r})});return g.sort(V).reduce(function(l,h){h.isScope?l.push.apply(l,h.content):l.push(h.content);return l},[]).concat(d)},G=function(a,b){b=b||{};a=b.getShadowRoot?O([a],b.includeContainer,{filter:B.bind(null, |
|
b),flatten:!1,getShadowRoot:b.getShadowRoot,shadowRootFilter:aa}):N(a,b.includeContainer,B.bind(null,b));return ba(a)},ca=L.concat("iframe").join(",");const H={getShadowRoot:!0};k.closestElementCrossShadowBoundary=x;k.containsCrossShadowBoundary=function(a,b){return!!R(b,d=>d===a?!0:void 0)};k.ensureId=function(a){return a?a.id=a.id||`${a.tagName.toLowerCase()}-${Q.guid()}`:""};k.filterDirectChildren=function(a,b){return Array.from(a.children).filter(d=>d.matches(b))};k.focusElement=E;k.focusElementInGroup= |
|
(a,b,d,g=!0)=>{b=a.indexOf(b);const l=b===a.length-1;g&&(d="previous"===d&&0===b?"last":"next"===d&&l?"first":d);a="previous"===d?a[b-1]||a[g?a.length-1:b]:"next"===d?a[b+1]||a[g?0:b]:"last"===d?a[a.length-1]:a[0];E(a);return a};k.focusFirstTabbable=function(a){F(a)?.focus()};k.focusable=function(a,b){b=b||{};return b.getShadowRoot?O([a],b.includeContainer,{filter:w.bind(null,b),flatten:!0,getShadowRoot:b.getShadowRoot}):N(a,b.includeContainer,w.bind(null,b))};k.getElementDir=function(a){return(a= |
|
x(a,"[dir]"))?a.getAttribute("dir"):"ltr"};k.getElementWidth=function(a){return a?parseFloat(getComputedStyle(a).inlineSize):0};k.getFirstTabbable=F;k.getModeName=function(a){return x(a,`.${C.CSS_UTILITY.darkMode}, .${C.CSS_UTILITY.lightMode}`)?.classList.contains("calcite-mode-dark")?"dark":"light"};k.getShadowRootNode=function(a){a=a.getRootNode();return"host"in a?a:null};k.getSlotted=function(a,b,d){b&&!Array.isArray(b)&&"string"!==typeof b&&(d=b,b=null);b=b?Array.isArray(b)?b.map(g=>`[slot="${g}"]`).join(","): |
|
`[slot="${b}"]`:":not([slot])";return d?.all?S(a,b,d):T(a,b,d)};k.getTabIndex=y;k.getTextWidth=function(a,b){if(!a)return 0;const d=document.createElement("canvas").getContext("2d");d.font=b;return d.measureText(a).width};k.intersects=function(a,b){return!(b.left>a.right||b.right<a.left||b.top>a.bottom||b.bottom<a.top)};k.isBefore=function(a,b){if(a.parentNode!==b.parentNode)return!1;const d=Array.from(a.parentNode.children);return d.indexOf(a)<d.indexOf(b)};k.isFocusable=function(a,b){b=b||{};if(!a)throw Error("No node provided"); |
|
return!1===q.call(a,ca)?!1:w(b,a)};k.isKeyboardTriggeredClick=function(a){return 0===a.detail};k.isPrimaryPointerButton=function(a){return!(!a.isPrimary||0!==a.button)};k.isTabbable=function(a,b){b=b||{};if(!a)throw Error("No node provided");return!1===q.call(a,t)?!1:B(b,a)};k.nodeListToArray=function(a){return Array.isArray(a)?a:Array.from(a)};k.queryElementRoots=function(a,{selector:b,id:d}){function g(l){if(!l)return null;l.assignedSlot&&(l=l.assignedSlot);var h=l.getRootNode();l=d?"getElementById"in |
|
h?h.getElementById(d):null:b?h.querySelector(b):null;h=h.host||null;return l?l:h?g(h):null}return g(a)};k.setRequestedIcon=function(a,b,d){if("string"===typeof b&&""!==b)return b;if(""===b)return a[d]};k.slotChangeGetAssignedElements=K;k.slotChangeHasAssignedElement=J;k.slotChangeHasContent=function(a){return J(a)||!!U(a)};k.tabbable=G;k.tabbableOptions=H;k.toAriaBoolean=function(a){return(!!a).toString()}}); |