UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 2.69 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ 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 i,syncAndInitial as r}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"}},l=function(e){a||f(e)},d=function(e,t){return void 0===t&&(t=e+"-active"),function(n){l(n);var o=!1,i=function(r){o||(o=!0,n.removeEventListener(a,i),n.removeEventListener(u,i),n.classList.remove(e),n.classList.remove(t))};n.classList.add(e),n.addEventListener(a,i),n.addEventListener(u,i),requestAnimationFrame(function(){n.classList.add(t)})}},m=function(e,t){return void 0===t&&(t=e+"-active"),function(n,o){l(n);var i=!1,r=function(e){i||(i=!0,n.removeEventListener(a,r),n.removeEventListener(u,r),o())};n.classList.add(e),n.addEventListener(a,r),n.addEventListener(u,r),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],i=typeof o;if("string"===i)n.push(o);else if(Array.isArray(o))n.push.apply(n,o);else if("object"===i)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,i,r)=>(e.set(t,i),o.observe(t,r),n(()=>{o.unobserve(t),e.delete(t)}));return(e,o,c)=>{let a=null;return t([i(()=>"function"==typeof e?e():e,e=>{a?.remove(),e&&(a=s(e,o,c))},r),n(()=>a?.remove())])}})();function L(e){const t=e?.closest("[dir]");return null!==t&&t instanceof HTMLElement&&"rtl"===t.dir||"rtl"===document.dir}function y(e,t){return("enter"===e?d:m)(t)}function E(e){const t="data-node-ref";this[e.getAttribute(t)]=null}function h(e){const t="data-node-ref";this[e.getAttribute(t)]=e}async function w(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())}async function b(e,t){await s(o(t));const n="function"==typeof e?e():e;n&&("selectText"in n&&"function"==typeof n.selectText?await n.selectText():n instanceof HTMLInputElement&&n.select())}export{v as classes,y as cssTransition,E as discardNode,L as isRTL,p as onResize,b as selectText,w as setFocus,h as storeNode};