UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 2.64 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import e from"../../core/ArrayPool.js";import{handlesGroup as t,makeHandle as n}from"../../core/handleUtils.js";import"../../core/has.js";import"../../core/Logger.js";import{signalFromSignalOrOptions as o}from"../../core/promiseUtils.js";import{watch as r,syncAndInitial as i}from"../../core/reactiveUtils.js";import{waitAnimationFrame as s}from"../../core/scheduling.js";import{clearVNodeCache as c}from"./vnodeCache.js";var a,u,f=function(e){if("WebkitTransition"in e.style)a="webkitTransitionEnd",u="webkitAnimationEnd";else{if(!("transition"in e.style))throw new Error("Your browser is not supported!");a="transitionend",u="animationend"}},d=function(e){a||f(e)},l=function(e,t){return void 0===t&&(t=e+"-active"),function(n){d(n);var o=!1,r=function(i){o||(o=!0,n.removeEventListener(a,r),n.removeEventListener(u,r),n.classList.remove(e),n.classList.remove(t))};n.classList.add(e),n.addEventListener(a,r),n.addEventListener(u,r),requestAnimationFrame((function(){n.classList.add(t)}))}},m=function(e,t){return void 0===t&&(t=e+"-active"),function(n,o){d(n);var r=!1,i=function(e){r||(r=!0,n.removeEventListener(a,i),n.removeEventListener(u,i),o())};n.classList.add(e),n.addEventListener(a,i),n.addEventListener(u,i),requestAnimationFrame((function(){n.classList.add(t)}))}};function v(...t){const n=e.acquire();for(let e=0;e<t.length;e++){const o=t[e],r=typeof o;if("string"===r)n.push(o);else if(Array.isArray(o))n.push.apply(n,o);else if("object"===r)for(const e in o)o[e]&&n.push(e)}const o=n.join(" ");return e.release(n),o}const p=(()=>{const e=new Map,o=new ResizeObserver((t=>{c();for(const n of t)e.get(n.target)?.(n)})),s=(t,r,i)=>(e.set(t,r),o.observe(t,i),n((()=>{o.unobserve(t),e.delete(t)})));return(e,o,c)=>{let a=null;return t([r((()=>"function"==typeof e?e():e),(e=>{a?.remove(),e&&(a=s(e,o,c))}),i),n((()=>a?.remove()))])}})();function L(e){const t=e?.closest("[dir]");return null!==t&&t instanceof HTMLElement&&"rtl"===t.dir||"rtl"===document.dir}function E(e,t){return("enter"===e?l:m)(t)}function h(e){const t="data-node-ref";this[e.getAttribute(t)]=null}function y(e){const t="data-node-ref";this[e.getAttribute(t)]=e}function b(e){return"Enter"===e||" "===e}async function j(e,t){await s(o(t));const n="function"==typeof e?e():e;n&&("setFocus"in n&&"function"==typeof n.setFocus?await n.setFocus():n instanceof HTMLElement&&n.focus())}export{v as classes,E as cssTransition,h as discardNode,b as isActivationKey,L as isRTL,p as onResize,j as setFocus,y as storeNode};