@alixex/ranui-cdn 0.0.0-stage → 1.0.0
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/README.md +32 -2
- package/dist/IIFE-LICENSES.md +2415 -0
- package/dist/iife/attachments.iife.js +1 -0
- package/dist/iife/button.iife.js +111 -0
- package/dist/iife/card.iife.js +1 -0
- package/dist/iife/checkbox.iife.js +1 -0
- package/dist/iife/colorpicker.iife.js +111 -0
- package/dist/iife/content.iife.js +1 -0
- package/dist/iife/conversation.iife.js +1 -0
- package/dist/iife/disclosure-row.iife.js +1 -0
- package/dist/iife/dropdown.iife.js +1 -0
- package/dist/iife/fan-gallery.iife.js +1 -0
- package/dist/iife/glass.iife.js +290 -0
- package/dist/iife/icon.iife.js +111 -0
- package/dist/iife/image.iife.js +1 -0
- package/dist/iife/input.iife.js +111 -0
- package/dist/iife/link.iife.js +1 -0
- package/dist/iife/loading.iife.js +1 -0
- package/dist/iife/markdown.iife.js +4048 -0
- package/dist/iife/math.iife.js +206 -0
- package/dist/iife/menubar.iife.js +70 -0
- package/dist/iife/mermaid.iife.js +3700 -0
- package/dist/iife/message.iife.js +111 -0
- package/dist/iife/modal.iife.js +111 -0
- package/dist/iife/player.iife.js +175 -0
- package/dist/iife/popover.iife.js +1 -0
- package/dist/iife/progress.iife.js +1 -0
- package/dist/iife/radar.iife.js +1 -0
- package/dist/iife/reasoning.iife.js +3 -0
- package/dist/iife/route.iife.js +1 -0
- package/dist/iife/router.iife.js +1 -0
- package/dist/iife/scratch.iife.js +1 -0
- package/dist/iife/section.iife.js +1 -0
- package/dist/iife/select.iife.js +111 -0
- package/dist/iife/skeleton.iife.js +1 -0
- package/dist/iife/state-dot.iife.js +1 -0
- package/dist/iife/surface-switch.iife.js +111 -0
- package/dist/iife/tab.iife.js +111 -0
- package/dist/iife/tabpane.iife.js +1 -0
- package/dist/iife/theme-switch.iife.js +111 -0
- package/dist/iife/token-meter.iife.js +2 -0
- package/dist/iife/tool-card.iife.js +4 -0
- package/dist/iife/voice-button.iife.js +1 -0
- package/dist/index.iife.js +47 -0
- package/package.json +30 -3
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var ranui_menubar=(function(e){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var t=`:host{display:var(--ran-menubar-display, inline-flex);align-items:var(--ran-menubar-align-items, center);gap:var(--ran-menubar-gap, var(--ran-space-2, 8px));flex:var(--ran-menubar-flex, none);box-sizing:border-box}.ran-menubar,.ran-menubar>slot{display:contents}`,n=typeof document>`u`,r=/["'&<>]/;function i(e){let t=``+e,n=r.exec(t);if(!n)return t;let i,a=``,o=0,s=0;for(o=n.index;o<t.length;o++){switch(t.charCodeAt(o)){case 34:i=`"`;break;case 38:i=`&`;break;case 39:i=`'`;break;case 60:i=`<`;break;case 62:i=`>`;break;default:continue}s!==o&&(a+=t.substring(s,o)),s=o+1,a+=i}return s===o?a:a+t.substring(s,o)}var a=class{ac=null;get signal(){return this.ac??=new AbortController,this.ac.signal}on(e,t,n,r){return e.addEventListener(t,n,{...r,signal:this.signal}),this}delegate(e,t,n,r,i){return e.addEventListener(n,n=>{let i=n.target?.closest(t);i&&e.contains(i)&&r(n,i)},{...i,signal:this.signal}),this}abort(){this.ac?.abort(),this.ac=null}},o=new Map,s=`data-adopted-style`,c=(e,t,n)=>{if(typeof CSSStyleSheet>`u`)return!1;try{if(!n.has(t)){let e=new CSSStyleSheet;e.replaceSync(t),n.set(t,e)}let r=n.get(t);return e.adoptedStyleSheets.includes(r)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,r]),!0}catch{return!1}},l=(e,t,n=s)=>{if(t){if(typeof document>`u`){let n=e.adoptedStyleSheets;Array.isArray(n)&&!n.includes(t)&&n.push(t);return}if(!c(e,t,o)&&!e.querySelector(`style[${n}]`)){let r=document.createElement(`style`);r.setAttribute(n,``),r.textContent=t,e.appendChild(r)}}},u=0,d=1,f=2,p=null,m=null,h=0,g=new Set,_=!1;function v(e,t){let n=t?.equals??Object.is,r={value:e,observers:new Set};return[()=>(ee(r),r.value),e=>{let t=typeof e==`function`?e(r.value):e;if(!n(r.value,t)){r.value=t;for(let e of r.observers)T(e,f);h===0&&E()}}]}function y(e){let t=C(e,!0);return w(t),O(t),()=>A(t)}function b(e){let t=p;p=null;try{return e()}finally{p=t}}function x(e){let t={owned:[],cleanups:[],owner:m},n=m,r=p;m=t,p=null;try{return e(()=>te(t))}finally{m=n,p=r}}function S(e){m&&m.cleanups.push(e)}function C(e,t,n){return{fn:e,sources:new Set,isEffect:t,running:!1,disposed:!1,state:f,observers:new Set,value:void 0,equals:n??Object.is,owned:[],cleanups:[],owner:m}}function w(e){m&&m.owned.push(e)}function ee(e){p&&(p.sources.add(e),e.observers.add(p))}function T(e,t){if(e.disposed||e.state>=t)return;let n=e.state===u;if(e.state=t,e.isEffect)g.add(e);else if(n)for(let t of e.observers)T(t,d)}function E(){if(!(h>0||_)){_=!0;try{for(;g.size>0;){let e=[...g];g.clear();for(let t of e)t.disposed||D(t)}}finally{_=!1}}}function D(e){if(!(e.disposed||e.state===u)){if(e.state===d)for(let t of e.sources)`fn`in t&&D(t);e.state===f&&O(e),e.state=u}}function O(e){if(e.running)throw Error(`ranview reactivity: cyclic dependency detected (a computation triggered itself).`);k(e);let t=p,n=m;p=e,m=e,e.running=!0,e.state=u;try{let t=e.fn();if(e.isEffect)typeof t==`function`&&e.cleanups.push(t);else{let n=e.value;if(e.value=t,e.observers.size>0&&!e.equals(n,t))for(let t of e.observers)T(t,f)}}finally{e.running=!1,p=t,m=n}}function k(e){for(let t of e.owned)A(t);e.owned.length=0;for(let t of e.cleanups)t();e.cleanups.length=0;for(let t of e.sources)t.observers.delete(e);e.sources.clear()}function A(e){e.disposed||(e.disposed=!0,k(e),e.observers.clear())}function te(e){for(let t of e.owned)A(t);e.owned.length=0;for(let t of e.cleanups)t();e.cleanups.length=0}function j(e){return i(e)}var M=e=>typeof e!=`string`&&`tagName`in e&&`childrenList`in e,N=`.#[`;function P(e){let t=[],n=0,r=/^[a-zA-Z][\w-]*/.exec(e);for(r!==null&&(t.push(r[0]),n=r[0].length);n<e.length;){let r=e[n];if(r===`[`){let r=e.indexOf(`]`,n+1);if(r===-1)return null;t.push(e.slice(n,r+1)),n=r+1;continue}if(r!==`.`&&r!==`#`)return null;let i=n+1;for(;i<e.length&&!N.includes(e[i]);)i+=1;if(i===n+1)return null;t.push(e.slice(n,i)),n=i}return t.length>0?t:null}var F=(e,t)=>{let n=t;if(n.startsWith(`.`))return e.classList.contains(n.slice(1));if(n.startsWith(`#`))return e.getAttribute(`id`)===n.slice(1);if(n.startsWith(`[`)&&n.endsWith(`]`)){let[t,r]=n.slice(1,-1).trim().split(`=`),i=(t||``).trim();if(!i)return!1;if(r==null)return e.hasAttribute(i);let a=r.trim().replace(/^['"]|['"]$/g,``);return e.getAttribute(i)===a}return e.tagName===n.toLowerCase()},ne=(e,t)=>{let n=t.trim();if(!n)return!1;let r=P(n);return r!==null&&r.every(t=>F(e,t))},I=(e,t,n)=>{for(let r of e)M(r)&&(ne(r,t)&&n.push(r),I(r.childrenList,t,n))};function L(e,t,n){if(n==null)return e.push(t),t;let r=e.indexOf(n);return r===-1?e.push(t):e.splice(r,0,t),t}var R=class{childrenList=[];appendChild(e){return this.childrenList.push(e),e}insertBefore(e,t){return L(this.childrenList,e,t)}serialize(){return this.childrenList.map(e=>typeof e==`string`?i(e):e.serialize()).join(``)}querySelector(e){let t=this.querySelectorAll(e);return t.length>0?t[0]:null}querySelectorAll(e){let t=[];return I(this.childrenList,e,t),t}},re=new Map,ie=class{tagName;attributes=new Map;_inlineStyles=null;get inlineStyles(){return this._inlineStyles??re}childrenList=[];shadowRoot=null;_textContent=null;get textContent(){return this._textContent}set textContent(e){this._textContent=e}content;eventListeners=null;_style=null;_classList=null;get style(){return this._style??={setProperty:(e,t)=>{let n=e.startsWith(`--`)?e:e.replace(/([A-Z])/g,`-$1`).toLowerCase();(this._inlineStyles??=new Map).set(n,t)},removeProperty:e=>this._inlineStyles?.delete(e)??!1}}get classList(){return this._classList??={add:(...e)=>{let t=this.attributes.get(`class`)||``,n=new Set([...t.split(` `).filter(Boolean),...e]);this.attributes.set(`class`,Array.from(n).join(` `))},remove:(...e)=>{let t=(this.attributes.get(`class`)||``).split(` `).filter(t=>!e.includes(t));this.attributes.set(`class`,t.join(` `))},toggle:e=>{this.classList.contains(e)?this.classList.remove(e):this.classList.add(e)},contains:e=>(this.attributes.get(`class`)||``).split(` `).includes(e)}}_innerHTML=``;get innerHTML(){return this._textContent===null?this._innerHTML:i(this._textContent)}set innerHTML(e){this._innerHTML=e,this._textContent=null,this.tagName===`template`&&this.content&&(this.content.childrenList=[e])}constructor(e=`div`){this.tagName=e.toLowerCase(),this.tagName===`template`&&(this.content=new R)}get hidden(){return this.hasAttribute(`hidden`)}set hidden(e){e?this.setAttribute(`hidden`,``):this.removeAttribute(`hidden`)}setAttribute(e,t){this.attributes.set(e,t)}getAttribute(e){return this.attributes.get(e)||null}removeAttribute(e){this.attributes.delete(e)}hasAttribute(e){return this.attributes.has(e)}appendChild(e){return this.childrenList.push(e),e}insertBefore(e,t){return L(this.childrenList,e,t)}attachShadow(e){return this.shadowRoot=new ae(this,e),this.shadowRoot}querySelector(e){let t=this.querySelectorAll(e);return t.length>0?t[0]:null}querySelectorAll(e){let t=[];return I(this.childrenList,e,t),t}addEventListener(e,t){let n=this.eventListeners??=new Map,r=n.get(e)||new Set;r.add(t),n.set(e,r)}removeEventListener(e,t){let n=this.eventListeners?.get(e);n&&(n.delete(t),n.size===0&&this.eventListeners?.delete(e))}dispatchEvent(e){let t=this.eventListeners?.get(e.type);if(!t||t.size===0)return!0;for(let n of t)typeof n==`function`?n.call(this,e):n.handleEvent(e);return!e.defaultPrevented}serialize(e){typeof this._preSerialize==`function`&&this._preSerialize();let t=e||this._ssrTag||this.tagName;this.shadowRoot&&!this.hasAttribute(`data-ran-dsd`)&&this.setAttribute(`data-ran-dsd`,``);let n=Array.from(this.attributes.entries()).map(([e,t])=>` ${e}="${j(t)}"`).join(``),r=this._inlineStyles?Array.from(this._inlineStyles.entries()).map(([e,t])=>`${e}:${t}`).join(`;`):``,a=r?` style="${j(r)}"`:``,o=``;return this.shadowRoot&&(o+=this.shadowRoot.serialize()),this.textContent===null?this._innerHTML?o+=this._innerHTML:o+=this.childrenList.map(e=>typeof e==`string`?i(e):(e instanceof R,e.serialize())).join(``):o+=i(this.textContent),[`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`].includes(t)&&!o?`<${t}${n}${a} />`:`<${t}${n}${a}>${o}</${t}>`}},ae=class{host;options;childrenList=[];adoptedStyleSheets=[];constructor(e,t){this.host=e,this.options=t}get children(){return this.childrenList.filter(e=>typeof e!=`string`&&!(e instanceof R))}appendChild(e){return this.childrenList.push(e),e}insertBefore(e,t){return L(this.childrenList,e,t)}replaceChildren(...e){this.childrenList=e.filter(e=>e!=null)}querySelector(e){let t=this.querySelectorAll(e);return t.length>0?t[0]:null}querySelectorAll(e){let t=[];return I(this.childrenList,e,t),t}serialize(){return`<template shadowrootmode="${this.options.mode}"${this.options.delegatesFocus?` shadowrootdelegatesfocus`:``}>${this.adoptedStyleSheets.map(e=>`<style>${String(e).replace(/<\/style/gi,`<\\/style`)}</style>`).join(``)}${this.childrenList.map(e=>typeof e==`string`?i(e):(e instanceof R,e.serialize())).join(``)}</template>`}},z={bind(e,t){t(typeof e==`function`?e():e)},append(e,t){for(let r of t){if(r==null)continue;if(Array.isArray(r)){z.append(e,r);continue}if(typeof r==`function`){z.append(e,[r()]);continue}if(typeof r==`object`&&(`__ranFor`in r||`__ranIndex`in r))throw TypeError(`Import For and Index from the static entry when using static builders`);let t=r instanceof B?r.build():typeof r==`string`&&!n?document.createTextNode(r):r;e.appendChild(t)}}},oe=`http://www.w3.org/2000/svg`,se=new Set(`svg.circle.clipPath.defs.desc.ellipse.feBlend.feColorMatrix.feComposite.feDropShadow.feFlood.feGaussianBlur.feMerge.feMergeNode.feOffset.filter.foreignObject.g.image.line.linearGradient.marker.mask.path.pattern.polygon.polyline.radialGradient.rect.stop.switch.symbol.text.textPath.tspan.use`.split(`.`)),B=class{runtime;el;constructor(e,t,r=z){this.runtime=r;let i=t??(se.has(e)?`http://www.w3.org/2000/svg`:void 0);this.el=n?new ie(e):i?document.createElementNS(i,e):document.createElement(e)}id(e){return this.el.setAttribute(`id`,e),this}bind(e,t){this.runtime.bind(e,t)}class(e){return this.bind(e,e=>{n?this.el.attributes.set(`class`,e):this.el.setAttribute(`class`,e)}),this}addClass(...e){return e.forEach(e=>this.el.classList.add(e)),this}removeClass(...e){return e.forEach(e=>this.el.classList.remove(e)),this}attr(e,t){return this.bind(t,t=>this.el.setAttribute(e,t)),this}attrs(e){return Object.entries(e).forEach(([e,t])=>{t!=null&&this.el.setAttribute(e,String(t))}),this}boolAttr(e,t,n=``){return this.bind(t,t=>{t?this.el.setAttribute(e,n):this.el.removeAttribute(e)}),this}part(e){return this.attr(`part`,e)}data(e,t){return this.attr(`data-${e}`,t)}style(e,t){return typeof e==`string`?this.bind(t??``,t=>this.el.style.setProperty(e,t)):Object.entries(e).forEach(([e,t])=>this.el.style.setProperty(e,t)),this}cssVar(e,t){let n=e.startsWith(`--`)?e:`--${e}`;return this.style(n,t)}aria(e,t){return this.attr(`aria-${e}`,t)}role(e){return this.attr(`role`,e)}tabIndex(e){return this.attr(`tabindex`,String(e))}label(e){return this.aria(`label`,e)}labelledBy(e){return this.aria(`labelledby`,e)}describedBy(e){return this.aria(`describedby`,e)}ariaHidden(e=!0){return this.aria(`hidden`,String(e))}on(e,t,n){return this.el.addEventListener(e,t,n),this}listen(e,t,n,r){return e.on(this.el,t,n,r),this}delegate(e,t,n,r,i){return e.delegate(this.el,t,n,r,i),this}children(...e){return this.runtime.append(this.el,e),this}replaceChildren(...e){if(n){let e=this.el;e.childrenList=[]}else this.el.replaceChildren();return this.children(...e)}text(e){return this.bind(e,e=>{this.el.textContent=e}),this}unsafeHtml(e){return this.bind(e,e=>{this.el.innerHTML=e}),this}ref(e){return e.current=this.el,this}shadow(e={mode:`closed`}){let t=this.el.attachShadow(e);return new ce(this.el,t,e,this.runtime)}build(){return this.el}serialize(){if(n)return this.el.serialize();let e=document.createElement(`div`);return e.appendChild(this.el.cloneNode(!0)),e.innerHTML}},ce=class{runtime;root;hostEl;constructor(e,t,n,r=z){this.runtime=r,this.hostEl=e,this.root=t}children(...e){return this.runtime.append(this.root,e),this}adoptSheet(...e){return this.root.adoptedStyleSheets=[...this.root.adoptedStyleSheets,...e],this}css(e){if(n)return this.root.adoptedStyleSheets.push(e),this;if(typeof CSSStyleSheet<`u`)try{let t=new CSSStyleSheet;return t.replaceSync(e),this.root.adoptedStyleSheets=[...this.root.adoptedStyleSheets,t],this}catch{}let t=document.createElement(`style`);return t.textContent=e,this.root.appendChild(t),this}done(){return{host:this.hostEl,shadow:this.root}}serialize(){return n?this.root.serialize():this.root.innerHTML}},V=e=>e.reduce((e,t)=>Array.isArray(t)?e.concat(V(t)):e.concat(t),[]),H=e=>e==null?null:e instanceof B?e.build():typeof e==`string`?n?e:document.createTextNode(e):e,le=(e,t)=>{if(n){W(e,[t()]);return}let r=document.createComment(``),i=document.createComment(``);e.appendChild(r),e.appendChild(i);let a=null,o=()=>{a?.(),a=null;let e=r.nextSibling;for(;e&&e!==i;){let t=e.nextSibling;e.parentNode?.removeChild(e),e=t}};y(()=>{let e=t();o();let n=document.createDocumentFragment();a=x(t=>(W(n,[e]),t)),i.parentNode?.insertBefore(n,i)}),S(()=>a?.())},ue=`__ranFor`,de=e=>typeof e==`object`&&!!e&&e[ue]===!0,fe=(e,t,n)=>{let[r,i]=v(t),a=null,o=x(t=>{let i=H(n(e,r));return a=typeof i==`string`?document.createTextNode(i):i,t});return{node:a,index:i,dispose:o}},U=(e,t)=>{let n=e.parentNode;if(!n)return;let r=e;for(let e of t)r.nextSibling!==e&&n.insertBefore(e,r.nextSibling),r=e},pe=(e,t)=>{if(n){(t.each()??[]).forEach((n,r)=>{let i=H(t.render(n,()=>r));i!=null&&e.appendChild(i)});return}let r=document.createComment(``);e.appendChild(r);let i=new Map;S(()=>{for(let e of i.values())e.dispose();i.clear()}),y(()=>{let e=t.each()??[],n=new Map,a=[];e.forEach((e,r)=>{let o=t.key(e,r);if(n.has(o)){ve()&&console.error(`[ranview For] duplicate key "${String(o)}" — keys must be unique; ignoring the duplicate item.`);return}let s=i.get(o);s?(i.delete(o),s.index(r)):s=fe(e,r,t.render),n.set(o,s),s.node&&a.push(s.node)});for(let e of i.values())e.node?.parentNode?.removeChild(e.node),e.dispose();U(r,a),i=n})},me=`__ranIndex`,he=e=>typeof e==`object`&&!!e&&e[me]===!0,ge=(e,t,n)=>{let[r,i]=v(e),a=null,o=x(e=>{let i=H(n(r,t));return a=typeof i==`string`?document.createTextNode(i):i,e});return{node:a,setItem:i,dispose:o}},_e=(e,t)=>{if(n){(t.each()??[]).forEach((n,r)=>{let i=H(t.render(()=>n,r));i!=null&&e.appendChild(i)});return}let r=document.createComment(``);e.appendChild(r);let i=[];S(()=>{for(let e of i)e.dispose();i=[]}),y(()=>{let e=t.each()??[];for(let n=0;n<e.length;n++)n<i.length?i[n].setItem(e[n]):i.push(ge(e[n],n,t.render));for(let t=i.length-1;t>=e.length;t--){let{node:e}=i[t];e?.parentNode?.removeChild(e),i[t].dispose(),i.pop()}U(r,i.map(e=>e.node).filter(e=>e!=null))})},W=(e,t)=>{n?b(()=>G(e,t)):G(e,t)},G=(e,t)=>{V(t).forEach(t=>{if(de(t)){pe(e,t);return}if(he(t)){_e(e,t);return}if(typeof t==`function`){le(e,t);return}let n=H(t);n!=null&&e.appendChild(n)})},ve=()=>!1,ye={bind(e,t){typeof e==`function`?n?b(()=>t(e())):y(()=>t(e())):t(e)},append:W},be=class extends B{constructor(e,t){super(e,t,ye)}};function xe(e){let t=t=>new e(t);return{View:t,Div:()=>t(`div`),Svg:t=>new e(t,oe),Span:()=>t(`span`),Slot:()=>t(`slot`),ButtonBuilder:()=>t(`button`),InputBuilder:()=>t(`input`),Style:()=>t(`style`),Label:()=>t(`label`),Ul:()=>t(`ul`),Li:()=>t(`li`),Section:()=>t(`section`),Article:()=>t(`article`),Nav:()=>t(`nav`),Header:()=>t(`header`),Footer:()=>t(`footer`),Main:()=>t(`main`),DeclarativeShadow:(e=`open`,n=!1)=>{let r=t(`template`);return r.attr(`shadowrootmode`,e),n&&r.attr(`shadowrootdelegatesfocus`,``),r}}}var{View:Se,Div:Ce,Svg:we,Span:Te,Slot:Ee,ButtonBuilder:De,InputBuilder:Oe,Style:ke,Label:Ae,Ul:je,Li:Me,Section:Ne,Article:Pe,Nav:Fe,Header:Ie,Footer:Le,Main:Re,DeclarativeShadow:ze}=xe(be),Be=new Map;function Ve(e,t){n?(Be.set(e,t),t.prototype._ssrTag=e):customElements.get(e)||customElements.define(e,t)}var He=typeof document<`u`?HTMLElement:ie,Ue=`data-ranui`,K=`data-ranui-sheet`,q=(e,t)=>{if(typeof document>`u`&&t){let n=e.adoptedStyleSheets;Array.isArray(n)&&!n.includes(t)&&n.push(t)}l(e,t,Ue)},J=new WeakMap,Y=new Map,We=e=>{if(typeof CSSStyleSheet>`u`)return;let t=Y.get(e);if(!t)try{let n=new CSSStyleSheet;n.replaceSync(e),t={sheet:n,users:0},Y.set(e,t)}catch{return}return t.users++,t.sheet},Ge=e=>{let t=Y.get(e);t&&--t.users===0&&Y.delete(e)},Ke=(e,t)=>{if(typeof document>`u`)return;let n=J.get(e);if((n?.text??``)===t||(n?.sheet?(e.adoptedStyleSheets=e.adoptedStyleSheets.filter(e=>e!==n.sheet),Ge(n.text)):n&&e.querySelector(`style[${K}]`)?.remove(),J.delete(e),!t))return;let r=We(t);if(r)try{e.adoptedStyleSheets=[...e.adoptedStyleSheets,r]}catch{Ge(t),r=void 0}if(!r){let n=document.createElement(`style`);n.setAttribute(K,``),n.textContent=t,e.appendChild(n)}J.set(e,{text:t,sheet:r})},qe=new WeakMap,Je=new WeakMap,Ye=`@media (prefers-reduced-motion: reduce){*,*::before,*::after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important;scroll-behavior:auto !important}}`,Xe=`:host([hidden]){display:none}`,Ze=new Map,Qe=e=>{let t=Ze.get(e);if(t!==void 0)return t;let n=`${Xe}\n${Ye}`,r=e?`${e}\n${n}`:n;return Ze.set(e,r),r},$e=e=>{let t=Je.get(e);if(t)return t;try{let t=e.attachInternals;if(typeof t!=`function`)return;let n=t.call(e);return Je.set(e,n),n}catch{return}},et=(e,t=``,n={mode:`closed`},r)=>{let i=r??$e(e),a=e.shadowRoot||qe.get(e)||i?.shadowRoot||e.attachShadow(n);return qe.set(e,a),q(a,Qe(t)),a},tt=e=>{for(let t of e.children)if(t.tagName!==`STYLE`)return t;return null},nt=(e,t,...n)=>{e.replaceChildren(...n),q(e,Qe(t))},rt=(e,t,n)=>{let r=tt(e);if(r&&n.bind(r))return;let i=n.build();nt(e,t,...Array.isArray(i)?i:[i])},it=(e,t,n=``)=>e.getAttribute(t)??n,at=(e,t,n,r={})=>{r.removeEmpty&&!n?e.removeAttribute(t):e.setAttribute(t,n??``)},ot=(e,t,n,r,i)=>{n===`sheet`&&r!==i&&Ke(t,e.getAttribute(`sheet`)||``)},st=`r-dropdown.ran-chrome-menu`,X=`data-ran-menubar-viewport`,ct=`ran-menubar-viewport-style`,Z=`ran-menubar-viewport`,lt=180,ut=280,dt=`cubic-bezier(0.22, 1, 0.36, 1)`,ft=16,pt=()=>typeof window<`u`&&window.matchMedia(`(hover: hover) and (pointer: fine)`).matches,mt=()=>typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,ht=(e,t,n)=>{if(typeof document>`u`)return;let r=`
|
|
2
|
+
html[${X}] ${e}{opacity:0!important;pointer-events:none!important}
|
|
3
|
+
.${Z}{position:fixed;inset:0;z-index:1200;pointer-events:none}
|
|
4
|
+
.${Z}__shell{
|
|
5
|
+
position:fixed;top:0;left:0;box-sizing:border-box;pointer-events:auto;
|
|
6
|
+
padding:4px;overflow:hidden;
|
|
7
|
+
background:var(--ran-color-bg-elevated,#fff);
|
|
8
|
+
border:1px solid var(--ran-color-border,#e4e4e8);
|
|
9
|
+
border-radius:var(--ran-radius-md,12px);
|
|
10
|
+
box-shadow:var(--ran-shadow-menu,var(--ran-shadow-elevated,0 8px 24px rgba(0,0,0,.12)));
|
|
11
|
+
transform:translate3d(var(--ran-menubar-x,0px),var(--ran-menubar-y,0px),0);
|
|
12
|
+
width:var(--ran-menubar-w,0px);height:var(--ran-menubar-h,0px);
|
|
13
|
+
opacity:var(--ran-menubar-opacity,0);
|
|
14
|
+
transition:
|
|
15
|
+
transform ${t}ms ${n},
|
|
16
|
+
width ${t}ms ${n},
|
|
17
|
+
height ${t}ms ${n},
|
|
18
|
+
opacity ${Math.min(180,t)}ms linear;
|
|
19
|
+
}
|
|
20
|
+
:root[data-ran-surface=glass] .${Z}__shell{
|
|
21
|
+
background:var(--ran-surface-glass-bg,rgba(255,255,255,.72));
|
|
22
|
+
border-color:var(--ran-surface-glass-border,rgba(255,255,255,.45));
|
|
23
|
+
backdrop-filter:blur(var(--ran-surface-glass-blur,16px));
|
|
24
|
+
-webkit-backdrop-filter:blur(var(--ran-surface-glass-blur,16px));
|
|
25
|
+
}
|
|
26
|
+
.${Z}__clip{position:relative;width:100%;height:100%;overflow:hidden}
|
|
27
|
+
.${Z}__layer{position:absolute;inset:0;display:flex;flex-direction:column;gap:0;opacity:1}
|
|
28
|
+
.${Z}__layer[data-motion=from-start]{animation:ran-menubar-from-start ${t}ms ${n} both}
|
|
29
|
+
.${Z}__layer[data-motion=from-end]{animation:ran-menubar-from-end ${t}ms ${n} both}
|
|
30
|
+
/* Incoming only — outgoing is removed, so opacity here cannot stack two menus. */
|
|
31
|
+
@keyframes ran-menubar-from-start{from{opacity:0;transform:translateX(-${ft}px)}to{opacity:1;transform:translateX(0)}}
|
|
32
|
+
@keyframes ran-menubar-from-end{from{opacity:0;transform:translateX(${ft}px)}to{opacity:1;transform:translateX(0)}}
|
|
33
|
+
/* One wash slides between rows — same motion as docs .sb__hover / r-select glass fill. */
|
|
34
|
+
.${Z}__hover{
|
|
35
|
+
position:absolute;top:0;left:0;z-index:0;width:0;height:0;
|
|
36
|
+
border-radius:var(--ran-radius-sm,8px);
|
|
37
|
+
background:var(--ran-color-bg-hover,var(--ran-color-fill-secondary,rgba(0,0,0,.06)));
|
|
38
|
+
opacity:0;pointer-events:none;
|
|
39
|
+
/* Transform/size only — never ease opacity (open/hop must not read as a late fill). */
|
|
40
|
+
transition:
|
|
41
|
+
transform ${t}ms ${n},
|
|
42
|
+
width ${t}ms ${n},
|
|
43
|
+
height ${t}ms ${n};
|
|
44
|
+
}
|
|
45
|
+
:root[data-ran-surface=glass] .${Z}__hover{
|
|
46
|
+
background:var(--ran-surface-glass-hover,color-mix(in srgb,var(--ran-gray-1000,#111113) 8%,transparent));
|
|
47
|
+
}
|
|
48
|
+
.${Z}__hover[data-instant]{transition:none}
|
|
49
|
+
.${Z}__option{
|
|
50
|
+
appearance:none;border:0;background:transparent;margin:0;cursor:pointer;text-align:start;
|
|
51
|
+
position:relative;z-index:1;
|
|
52
|
+
display:block;width:100%;min-width:100%;box-sizing:border-box;align-self:stretch;
|
|
53
|
+
padding:6px 12px;border-radius:var(--ran-radius-sm,8px);
|
|
54
|
+
color:var(--ran-color-text,rgba(0,0,0,.88));
|
|
55
|
+
font:inherit;font-size:var(--ran-text-label-1,14px);font-weight:var(--ran-text-label-weight,500);
|
|
56
|
+
line-height:1.4;white-space:nowrap;
|
|
57
|
+
}
|
|
58
|
+
.${Z}__option:hover,.${Z}__option:focus-visible{outline:none}
|
|
59
|
+
/* Selection is weight, not a second fill — the sliding wash owns the transient cue. */
|
|
60
|
+
.${Z}[data-hover-fill] .${Z}__option:hover,
|
|
61
|
+
.${Z}[data-hover-fill] .${Z}__option:focus-visible,
|
|
62
|
+
.${Z}[data-hover-fill] .${Z}__option[aria-selected=true]{
|
|
63
|
+
background:transparent;
|
|
64
|
+
}
|
|
65
|
+
.${Z}__option[aria-selected=true]{font-weight:600}
|
|
66
|
+
@media (prefers-reduced-motion:reduce){
|
|
67
|
+
.${Z}__shell{transition:none}
|
|
68
|
+
.${Z}__hover{transition:none}
|
|
69
|
+
.${Z}__layer[data-motion]{animation:none}
|
|
70
|
+
}`,i=document.getElementById(ct);if(i){i.textContent=r;return}let a=document.createElement(`style`);a.id=ct,a.textContent=r,document.head.appendChild(a)},gt=e=>{if(e.hasAttribute(`data-ran-menubar-item`))return!0;let t=e.tagName;return t===`R-SELECT`||t===`R-THEME-SWITCH`||t===`R-SURFACE-SWITCH`||`open`in e},_t=e=>{let t=[];for(let n of e.querySelectorAll(`*`))gt(n)&&(t.some(e=>e.contains(n))||t.push(n));return t},vt=e=>{let t=[];for(let n of document.querySelectorAll(e))getComputedStyle(n).display!==`none`&&n.getClientRects().length!==0&&t.push(n);return t},yt=e=>{let t=[...e.querySelectorAll(`r-dropdown-item`)].map(e=>({value:e.getAttribute(`value`)||``,label:(e.textContent||``).replace(/\s+/g,` `).trim(),active:e.getAttribute(`aria-selected`)===`true`||e.hasAttribute(`selected`)}));if(!t.length||t.every(e=>!e.label))return null;let n=e.getBoundingClientRect();return n.width<1||n.height<1?null:{items:t,width:n.width,height:n.height}},Q=new Set([`system`,`light`,`dark`]),bt=new Set([`solid`,`glass`]),xt=(e,t)=>{let n=t.items.map(e=>e.value).filter(Boolean);if(!n.length)return!1;let r=e.tagName;if(r===`R-THEME-SWITCH`)return n.every(e=>Q.has(e));if(r===`R-SURFACE-SWITCH`)return n.every(e=>bt.has(e));let i=[...e.querySelectorAll(`:scope > r-option`)].map(e=>e.getAttribute(`value`)||``).filter(Boolean);return i.length?n.every(e=>i.includes(e)):!n.some(e=>Q.has(e)||bt.has(e))&&n.every(e=>e.startsWith(`/`)||/^https?:/i.test(e))},St=(e,t)=>{let n=vt(e);for(let e=n.length-1;e>=0;--e){let r=yt(n[e]);if(r&&(!t||xt(t,r)))return r}return null},Ct=e=>{let{root:t,panelSelector:n=st,leaveDelay:r=lt,duration:i=ut,easing:a=dt}=e;if(!pt())return()=>void 0;ht(n,i,a);let o=()=>typeof e.items==`function`?e.items():e.items?e.items:_t(t),s=!1,c=null,l,u=0,d=[],f=document.createElement(`div`);f.className=Z,f.setAttribute(`aria-hidden`,`true`),f.setAttribute(`data-hover-fill`,``);let p=document.createElement(`div`);p.className=`${Z}__shell`,p.setAttribute(`role`,`listbox`);let m=document.createElement(`span`);m.className=`${Z}__hover`,m.setAttribute(`aria-hidden`,`true`);let h=document.createElement(`div`);h.className=`${Z}__clip`,h.appendChild(m),p.appendChild(h),f.appendChild(p),document.body.appendChild(f),d.push(()=>f.remove());let g=null,_,v=0,y=()=>{m.parentNode!==h&&h.prepend(m)},b=e=>{y();let t=h.getBoundingClientRect(),n=e.getBoundingClientRect(),r=parseFloat(p.style.getPropertyValue(`--ran-menubar-w`))||0,i=getComputedStyle(p),a=(parseFloat(i.borderLeftWidth)||0)+(parseFloat(i.borderRightWidth)||0),o=r>0?Math.max(0,r-8-a):0,s=Math.max(h.clientWidth,n.width,o);m.toggleAttribute(`data-instant`,g===null),m.style.transform=`translate(0px, ${n.top-t.top}px)`,m.style.width=`${s}px`,m.style.height=`${n.height}px`,m.style.opacity=`1`,g=e},x=()=>{m.style.opacity=`0`,g=null},S=e=>{let t=0;for(let n of e.children)n instanceof HTMLElement&&(n===m||n.classList.contains(`${Z}__hover`)||(t+=n.offsetHeight));return t},C=(e,t,n,r,i,a,o=!0)=>{a&&(p.style.transition=`none`),p.style.setProperty(`--ran-menubar-x`,`${Math.round(e)}px`),p.style.setProperty(`--ran-menubar-y`,`${Math.round(t)}px`),p.style.setProperty(`--ran-menubar-w`,`${Math.ceil(n)}px`),p.style.setProperty(`--ran-menubar-h`,`${Math.ceil(r)}px`),p.style.setProperty(`--ran-menubar-opacity`,String(i)),a&&o&&(p.offsetWidth,p.style.transition=``)},w=()=>{p.offsetWidth,p.style.transition=``},ee=(e,t,n,r,i,a,o)=>{y(),C(t,n,r,Math.max(S(e)+8,9),i,!0,!1);let s=S(e)+8,c=Math.max(r,e.scrollWidth+8);C(t,n,c,s,i,a,!1),o?.(),a?w():p.style.transition=``},T=e=>{window.clearTimeout(_),v+=1;let t=e.querySelector(`.${Z}__option[aria-selected="true"]`);t?.isConnected?b(t):x()},E=()=>{v+=1,document.documentElement.removeAttribute(X),C(0,0,0,0,0,!0),x(),h.replaceChildren(),f.setAttribute(`aria-hidden`,`true`)},D=(e,t,n)=>{let r=document.createElement(`div`);r.className=`${Z}__layer`,t&&!mt()&&r.setAttribute(`data-motion`,t);for(let t of e.items){let e=document.createElement(`button`);e.type=`button`,e.className=`${Z}__option`,e.setAttribute(`role`,`option`),e.setAttribute(`aria-selected`,t.active?`true`:`false`),e.dataset.value=t.value,e.textContent=t.label,e.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),n(t.value)}),r.appendChild(e)}return r},O=(e,t,n,r)=>{let a=e.getBoundingClientRect(),o=a.left,u=a.bottom+4,d=t.width;document.documentElement.setAttribute(X,r||`open`),f.setAttribute(`aria-hidden`,`false`);let v=t=>{let n=e.querySelectorAll?.(`r-option`),r=n?[...n].find(e=>e.getAttribute(`value`)===t):void 0,i=e;r&&typeof i.selectOptionElement==`function`?i.selectOptionElement(r,!0):`value`in e?e.value=t:e.setAttribute(`value`,t),window.clearTimeout(l),A(null),s=!1,c=null,E()};if(!n||mt()){let e=D(t,null,v);h.replaceChildren(m,e),ee(e,o,u,d,1,!0,()=>{g=null,T(e)});return}let b=D(t,r===`right`?`from-end`:`from-start`,v);for(let e of h.querySelectorAll(`.${Z}__layer`))e.remove();y(),h.appendChild(b),b.offsetHeight;let x=S(b)+8,w=Math.max(d,b.scrollWidth+8);C(o,u,w,x,1,!1),g=null,T(b);let O=()=>{let e=S(b)+8,t=Math.max(w,b.scrollWidth+8);C(o,u,t,e,1,!0),g=null,T(b)},k=e=>{e.target===p&&(e.propertyName===`transform`||e.propertyName===`width`||e.propertyName===`height`)&&(p.removeEventListener(`transitionend`,k),O())};p.addEventListener(`transitionend`,k),window.clearTimeout(_),_=window.setTimeout(()=>{p.removeEventListener(`transitionend`,k),O()},i+50)},k=(e,t)=>{e.open!==t&&(e.open=t)},A=e=>{for(let t of o())t!==e&&k(t,!1)},te=(e,t,r,i)=>{let a=o=>{if(i!==u||c!==e)return;let s=St(n,e);if(s)O(e,s,t,r);else{if(o<24){requestAnimationFrame(()=>a(o+1));return}document.documentElement.removeAttribute(X)}};requestAnimationFrame(()=>a(0))},j=e=>{if(window.clearTimeout(l),c===e&&s)return;let t=s&&c!==null&&c!==e,n=null;if(t&&c){let t=c.getBoundingClientRect().left;n=e.getBoundingClientRect().left>=t?`right`:`left`}s=!0,c=e;let r=++u;t&&document.documentElement.setAttribute(X,n||`pending`),A(e),k(e,!0),te(e,t,n,r)},M=()=>{window.clearTimeout(l),l=window.setTimeout(()=>{t.matches(`:hover`)||f.matches(`:hover`)||(A(null),s=!1,c=null,E())},r)},N=e=>{j(e.currentTarget)};for(let e of o())e.addEventListener(`pointerenter`,N),d.push(()=>e.removeEventListener(`pointerenter`,N));f.addEventListener(`pointerenter`,()=>window.clearTimeout(l)),f.addEventListener(`pointerleave`,e=>{let n=e.relatedTarget;n&&t.contains(n)||M()}),p.addEventListener(`pointerover`,e=>{let t=e.target?.closest?.(`.${Z}__option`);t&&!t.closest(`[data-leaving]`)&&t!==g&&b(t)}),p.addEventListener(`focusin`,e=>{let t=e.target?.closest?.(`.${Z}__option`);t&&!t.closest(`[data-leaving]`)&&b(t)});let P=e=>{e.relatedTarget?.closest?.(`.${Z}`)||M()};t.addEventListener(`pointerleave`,P),d.push(()=>t.removeEventListener(`pointerleave`,P));let F=e=>{e.key===`Escape`&&(A(null),s=!1,c=null,E())};return document.addEventListener(`keydown`,F),d.push(()=>document.removeEventListener(`keydown`,F)),()=>{window.clearTimeout(l),E();for(let e of d)e()}},$=class extends He{static get observedAttributes(){return[`panel-selector`,`leave-delay`,`duration`,`sheet`]}_events=new a;_shadowDom;_slot;_dispose=null;constructor(){super(),this._shadowDom=et(this,t),rt(this._shadowDom,t,{bind:e=>{let t=e.children.item(0);return t?.tagName?.toLowerCase()===`slot`&&(this._slot=t,!0)},build:()=>(this._slot=Ee().build(),Se(`div`).class(`ran-menubar`).attr(`part`,`root`).children(this._slot).build())})}get sheet(){return it(this,`sheet`)}set sheet(e){at(this,`sheet`,e)}get panelSelector(){return it(this,`panel-selector`)||`r-dropdown.ran-chrome-menu`}set panelSelector(e){at(this,`panel-selector`,e,{removeEmpty:!0})}get leaveDelay(){let e=this.getAttribute(`leave-delay`),t=e==null||e===``?NaN:Number(e);return Number.isFinite(t)?t:180}set leaveDelay(e){this.setAttribute(`leave-delay`,String(e))}get duration(){let e=this.getAttribute(`duration`),t=e==null||e===``?NaN:Number(e);return Number.isFinite(t)?t:280}set duration(e){this.setAttribute(`duration`,String(e))}_options=()=>({root:this,panelSelector:this.panelSelector,leaveDelay:this.leaveDelay,duration:this.duration,items:()=>this._items()});_items=()=>{let e=[];for(let t of this.querySelectorAll(`r-select, r-theme-switch, r-surface-switch, [data-ran-menubar-item]`))e.some(e=>e.contains(t))||e.push(t);return e};_remount=()=>{this._dispose?.(),this._dispose=null,this.isConnected&&(this._dispose=Ct(this._options()))};handlerExternalCss=()=>{ot(this,this._shadowDom,`sheet`,null,this.sheet)};connectedCallback(){this.handlerExternalCss(),this._remount(),this._events.on(this._slot,`slotchange`,this._remount)}disconnectedCallback(){this._events.abort(),this._dispose?.(),this._dispose=null}attributeChangedCallback(e,t,n){t!==n&&(e===`sheet`?this.handlerExternalCss():this.isConnected&&this._remount())}};return Ve(`r-menubar`,$),e.Menubar=$,e.default=$,e.mountMenubarHandoff=Ct,e})({});
|