@tempots/ui 0.3.1 → 0.5.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 CHANGED
@@ -1 +1,3 @@
1
1
  # Tempo DOM UI
2
+
3
+ Provides a higher level of components to help fast development with Tempo
package/package.json CHANGED
@@ -1,10 +1,36 @@
1
1
  {
2
2
  "name": "@tempots/ui",
3
- "version": "0.3.1",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
7
7
  "types": "./index.d.ts",
8
+ "description": "Provides a higher level of components to help fast development with Tempo.",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "keywords": [
13
+ "tempo",
14
+ "tempots",
15
+ "ui",
16
+ "framework",
17
+ "typescript",
18
+ "dom",
19
+ "components"
20
+ ],
21
+ "homepage": "https://github.com/fponticelli/tempots",
22
+ "bugs": {
23
+ "url": "https://github.com/fponticelli/tempots/issues"
24
+ },
25
+ "author": {
26
+ "name": "Franco Ponticelli",
27
+ "email": "franco.ponticelli@gmail.com",
28
+ "url": "https://github.com/fponticelli"
29
+ },
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://github.com/fponticelli/tempots.git"
33
+ },
8
34
  "exports": {
9
35
  ".": {
10
36
  "import": "./index.js",
@@ -12,12 +38,11 @@
12
38
  }
13
39
  },
14
40
  "license": "Apache-2.0",
15
- "repository": {
16
- "type": "git",
17
- "url": "git+https://github.com/fponticelli/tempots.git"
18
- },
19
- "bugs": {
20
- "url": "https://github.com/fponticelli/tempots/issues"
41
+ "dependencies": {
42
+ "@floating-ui/dom": "^1.6.7"
21
43
  },
22
- "homepage": "https://github.com/fponticelli/tempots#readme"
44
+ "peerDependencies": {
45
+ "@tempots/dom": "12.0.0",
46
+ "@tempots/std": "0.10.7"
47
+ }
23
48
  }
@@ -1,13 +0,0 @@
1
- import { Child, DOMContext, Value } from '@tempots/dom';
2
-
3
- export type Placement = 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end';
4
- export interface PopOverProps {
5
- open: Value<boolean>;
6
- content: () => Child;
7
- placement?: Placement;
8
- offset?: {
9
- mainAxis?: number;
10
- crossAxis?: number;
11
- };
12
- }
13
- export declare function PopOver({ content, open, placement, offset: { mainAxis, crossAxis }, }: PopOverProps): (ctx: DOMContext) => import('@tempots/dom').Clear;
package/index.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var ge=Object.defineProperty,ye=(t,e,n)=>e in t?ge(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,d=(t,e,n)=>ye(t,typeof e!="symbol"?e+"":e,n);const Wt=Symbol("isSignal"),Et=Symbol("isProp"),Lt=Symbol("isComputed");var $t;$t=Wt;const we=class k{constructor(e,n){d(this,$t,!0),d(this,"_value"),d(this,"_derivatives",[]),d(this,"_onValueListeners",[]),d(this,"_onDisposeListeners",[]),d(this,"get",()=>this._value),d(this,"hasListeners",()=>this._onValueListeners.length>0),d(this,"on",i=>(i(this.get()),this._onValueListeners.push(i),()=>{this._onValueListeners.splice(this._onValueListeners.indexOf(i),1)})),d(this,"_setAndNotify",(i,o)=>{const s=this.equals(this._value,i);s||(this._value=i),(o||!s)&&this._onValueListeners.forEach(r=>r(i))}),d(this,"_disposed",!1),d(this,"isDisposed",()=>this._disposed),d(this,"onDispose",i=>{this._onDisposeListeners.push(i)}),d(this,"dispose",()=>{this._disposed||(this._disposed=!0,this._onDisposeListeners.forEach(i=>i()),this._onDisposeListeners.length=0,this._derivatives.length=0)}),d(this,"map",(i,o=(s,r)=>s===r)=>{const s=new Q(()=>{try{return i(this.get())}catch(r){throw console.error("Error in Signal.map:",r),r}},o);return this.setDerivative(s),s}),d(this,"flatMap",(i,o=(s,r)=>s===r)=>{const s=new Q(()=>{try{return i(this.get()).get()}catch(r){throw console.error("Error in Signal.flatMap:",r),r}},o);return this.setDerivative(s),s}),d(this,"tap",i=>this.map(o=>(i(o),o))),d(this,"at",i=>this.map(o=>o[i])),d(this,"filter",(i,o)=>{let s=o??this.get();const r=new Q(()=>{try{const c=this.get();return s=i(c)?c:s}catch(c){throw console.error("Error in Signal.filter:",c),c}},this.equals);return this.setDerivative(r),r}),d(this,"filterMap",(i,o,s=(r,c)=>r===c)=>{let r=o;const c=new Q(()=>{try{const l=this.get();return r=i(l)??r}catch(l){throw console.error("Error in Signal.filterMap:",l),l}},s);return this.setDerivative(c),c}),d(this,"mapAsync",(i,o,s,r=(c,l)=>c===l)=>{const c=Pt(o,r);let l=0;return c.onDispose(this.on(a=>{const f=++l;try{i(a).then(u=>{f===l&&c.set(u)}).catch(u=>{f===l&&(s!=null?c.set(s(u)):console.error("Unhandled promise rejection in Signal.mapAsync:",u))})}catch(u){throw console.error("Error in Signal.mapAsync:",u),u}})),c}),d(this,"mapMaybe",(i,o)=>this.map(s=>i(s)??o)),d(this,"feedProp",(i,o=!1)=>{const s=this.on(i.set);return i.onDispose(s),o?this.onDispose(i.dispose):this.onDispose(s),i}),d(this,"deriveProp",(i=!0)=>this.feedProp(Pt(this.get()),i)),d(this,"count",()=>{let i=0;return this.map(()=>++i)}),d(this,"setDerivative",i=>{this._derivatives.push(i),i.onDispose(()=>{this._derivatives.splice(this._derivatives.indexOf(i),1)}),i.onDispose(this.on(i.setDirty)),this.onDispose(i.dispose)}),this.equals=n,this._value=e}static ofPromise(e,n,i,o=(s,r)=>s===r){const s=new k(n,o);return e.then(r=>s._setAndNotify(r,!1)).catch(r=>{i!=null?s._setAndNotify(i(r),!1):console.error("Unhandled promise rejection in Signal.ofPromise:",r)}),s}static is(e){return e!=null&&e[Wt]===!0}static wrap(e,n=(i,o)=>i===o){return k.is(e)?e:new k(e,n)}static maybeWrap(e){return e==null?e:k.wrap(e)}static unwrap(e){return k.is(e)?e.get():e}static map(e,n){return k.is(e)?e.map(n):n(e)}get value(){return this._value}};let E=we;const ve=typeof queueMicrotask=="function"?queueMicrotask:t=>Promise.resolve().then(t);var Rt,Dt;class Q extends(Dt=E,Rt=Lt,Dt){constructor(e,n){super(void 0,n),d(this,Rt,!0),d(this,"_isDirty",!1),d(this,"setDirty",()=>{this._isDirty||this._disposed||(this._isDirty=!0,this._derivatives.forEach(i=>i.setDirty()),this.scheduleNotify())}),d(this,"_scheduleCount",0),d(this,"scheduleNotify",()=>{const i=++this._scheduleCount;ve(()=>{this._scheduleCount!==i||this._disposed!==!1||this._isDirty&&(this._isDirty=!1,this._setAndNotify(this._fn(),!1))})}),d(this,"get",()=>(this._isDirty&&(this._isDirty=!1,this._value=this._fn(),this._setAndNotify(this._value,!0)),this._value)),this._fn=e,this.setDirty()}static is(e){return e!=null&&e[Lt]===!0}get value(){return this.get()}}var Ot,Ct;class yt extends(Ct=E,Ot=Et,Ct){constructor(){super(...arguments),d(this,Ot,!0),d(this,"set",e=>{this._setAndNotify(e,!1)}),d(this,"update",e=>{this._setAndNotify(e(this.get()),!1)}),d(this,"reducer",e=>n=>this.update(i=>e(i,n))),d(this,"iso",(e,n,i=(o,s)=>o===s)=>{const o=new yt(e(this.get()),i);return o.onDispose(this.on(s=>o.set(e(s)))),o.on(s=>this._setAndNotify(n(s),!1)),o}),d(this,"atProp",e=>this.iso(n=>n[e],n=>({...this.value,[e]:n})))}static is(e){return e!=null&&e[Et]===!0}get value(){return this.get()}set value(e){this._setAndNotify(e,!1)}}function Pt(t,e=(n,i)=>n===i){return new yt(t,e)}const Ht=new Set(["checked","disabled","hidden","selected"]),It=new Set(["rowSpan","colSpan","tabIndex","valueAsNumber"]),zt=new Set(["valueAsDate"]),jt=new Set(["value","textContent","innerText","innerHTML","outerHTML","className","classList"]),dt=new Map;function Y(t,e){if(dt.has(t))return dt.get(t);{const n=e(t);return dt.set(t,n),n}}function xe(t){return(e,n)=>{n==null?e[t]=null:e[t]=!!n}}function be(t){return(e,n)=>{n==null?e[t]=null:e[t]=Number(n)}}function Ae(t){return(e,n)=>{n==null?e[t]=null:e[t]=n}}function Se(t){return(e,n)=>{n==null?e[t]=null:e[t]=String(n)}}function _e(t){return(e,n)=>{n==null?e.removeAttribute(t):e.setAttribute(t,n)}}function qt(t){return Ht.has(t)?Y(t,xe):It.has(t)?Y(t,be):zt.has(t)?Y(t,Ae):jt.has(t)?Y(t,Se):Y(t,_e)}function Xt(t){return e=>Ht.has(t)?!!e[t]:It.has(t)?Number(e[t]):zt.has(t)?e[t]:jt.has(t)?String(e[t]):e.getAttribute(t)}function J(t){const e=t;e&&e.onblur&&(e.onblur=null),!(!t||t.ownerDocument===void 0)&&t.parentElement&&t.parentElement.removeChild(t)}const Ee=t=>e=>{Gt(e);const n=e.createText(t);return e.appendOrInsert(n),i=>{i&&J(n)}},Le=t=>e=>{Gt(e);const n=e.createText(t.value);e.appendOrInsert(n);const i=t.on(o=>n.data=o);return o=>{i(),o&&J(n)}},Re=(...t)=>e=>{const n=t.map(i=>D(i)(e));return i=>{n.forEach(o=>o(i))}},De=()=>()=>{},Oe=t=>e=>(Kt(e),e.element.classList.add(...t),n=>{n&&e.element.classList.remove(...t)}),Ce=t=>e=>{Kt(e);const n=e.element;let i=[];const o=t.on(s=>{i.forEach(r=>n.classList.remove(r)),i=(s??"").split(" ").filter(r=>r.length>0),n.classList.add(...i)});return s=>{o(),s&&i.forEach(r=>n.classList.remove(r)),i.length=0}},rt=(t,e)=>{const n=qt(t),i=Xt(t);return o=>{Jt(o,t);const s=i(o.element);return n(o.element,e),r=>{r&&n(o.element,s)}}},ct=(t,e)=>{const n=qt(t),i=Xt(t);return o=>{Jt(o,t);const s=i(o.element);return e.on(r=>n(o.element,r)),r=>{r&&n(o.element,s)}}},Pe=new Proxy({},{get:(t,e)=>e==="class"?n=>E.is(n)?Ce(n):Oe((n??"").split(" ").filter(i=>i.length>0)):n=>E.is(n)?ct(e,n):rt(e,n)});new Proxy({},{get:(t,e)=>n=>E.is(n)?ct(`aria-${e}`,n):rt(`aria-${e}`,n)});new Proxy({},{get:(t,e)=>n=>E.is(n)?ct(e,n):rt(e,n)});new Proxy({},{get:(t,e)=>n=>E.is(n)?ct(e,n):rt(e,n)});function D(t){return t==null?De:Array.isArray(t)?Re(...t.map(D)):typeof t=="string"?Ee(t):E.is(t)?Le(t):t}function Yt(t,...e){return n=>{const i=n.createElement(t,void 0);n.isFirstLevel&&K.isSSR()&&Zt(i),n.appendOrInsert(i),n=n.withElement(i);const o=e.map(s=>D(s)(n));return s=>{o.forEach(r=>r(!1)),s&&J(i)}}}function Ut(t,e,...n){return i=>{const o=i.createElement(t,e);i.isFirstLevel&&K.isSSR()&&Zt(o),i.appendOrInsert(o),i=i.withElement(o);const s=n.map(r=>D(r)(i));return r=>{s.forEach(c=>c(!1)),r&&J(o)}}}const Te=new Proxy({},{get:(t,e)=>(...n)=>Yt(e,n.flatMap(D))});new Proxy({},{get:(t,e)=>(...n)=>Yt("input",Pe.type(e),...n)});const Ne="http://www.w3.org/2000/svg";new Proxy({},{get:(t,e)=>(...n)=>Ut(e,Ne,n.flatMap(D))});const Me="http://www.w3.org/1998/Math/MathML";new Proxy({},{get:(t,e)=>(...n)=>Ut(e,Me,n.flatMap(D))});const Tt="data-tempo-attr",ke="data-tempo-class",Fe="data-tempo-node",Ve="data-tempo-text";function Be(t,e){const n=t.getAttribute(e);if(n!=null){const i=t.getAttribute(Tt)??"{}",o={...JSON.parse(i),name:n};t.setAttribute(Tt,JSON.stringify(o))}}function Jt(t,e){K.isSSR()&&t.isFirstLevel&&Be(t.element,e)}function We(t){t.setAttribute(ke,t.className)}function Kt(t){K.isSSR()&&t.isFirstLevel&&We(t.element)}function Zt(t){t.setAttribute(Fe,"")}function $e(t){t.setAttribute(Ve,t.textContent??"")}function Gt(t){K.isSSR()&&t.isFirstLevel&&$e(t.element)}function Qt(){const t=globalThis;return t.__tempoSSR__==null&&(t.__tempoSSR__={isSSR:!1,counter:0}),t.__tempoSSR__}function te(t,e){const n=Qt();n[t]=e}function ee(t){return Qt()[t]}function He(){return ee("isSSR")}function ne(){return ee("counter")}function Ie(){te("counter",(ne()??0)+1)}function ze(){te("counter",(ne()??0)-1)}const K={useDone:t=>(Ie(),D(t(ze))),isSSR:He},je=(t,e)=>n=>(n.element.addEventListener(t,e),i=>{i&&n.element.removeEventListener(t,e)});new Proxy({},{get:(t,e)=>n=>je(e,n)});const tt=(t,e)=>n=>{n=n.makeRef();let i,o;const s=t.map(l=>Object.keys(l)[0]);let r;const c=s.on(l=>{if(l!==r){o==null||o.dispose(),i==null||i(!0),o=t.map(f=>f[l]);const a=e[l](o);i=D(a)(n),r=l}});return l=>{c(),l&&n.reference!=null&&J(n.reference),i==null||i(!0)}},mt={bool:(t,e)=>tt(t.map(n=>n?{true:!0}:{false:!0}),e),field:(t,e,n)=>tt(t.map(i=>({[i[e]]:i})),n),kind:(t,e)=>mt.field(t,"kind",e),tuple:(t,e)=>{const n=t.map(([i,o])=>({[i]:o}));return tt(n,e)},type:(t,e)=>mt.field(t,"type",e),value:(t,e)=>tt(t.map(n=>({[n]:!0})),e)};function qe(t,e){const n=t(e);return()=>n(!0)}const Xe=(t,e)=>n=>{const i=n.document.querySelector(t);if(i===null)throw new Error(`Cannot find element by selector for portal: ${t}`);return qe(D(e),n.withElement(i).withFirstLevel())},Ye=t=>e=>t(e.element)??(()=>{}),Ue=(t,e)=>n=>{const i=n.element,o=i.style.getPropertyValue(t);return i.style.setProperty(t,e),s=>{s&&i.style.setProperty(t,o)}},Je=(t,e)=>n=>{const i=n.element,o=i.style.getPropertyValue(t);return e.on(s=>i.style.setProperty(t,s)),s=>{s&&i.style.setProperty(t,o)}};new Proxy({},{get:(t,e)=>n=>E.is(n)?Je(e,n):Ue(e,n)});const nt=Math.min,F=Math.max,it=Math.round,et=Math.floor,T=t=>({x:t,y:t}),Ke={left:"right",right:"left",bottom:"top",top:"bottom"},Ze={start:"end",end:"start"};function Nt(t,e,n){return F(t,nt(e,n))}function lt(t,e){return typeof t=="function"?t(e):t}function V(t){return t.split("-")[0]}function at(t){return t.split("-")[1]}function ie(t){return t==="x"?"y":"x"}function oe(t){return t==="y"?"height":"width"}function I(t){return["top","bottom"].includes(V(t))?"y":"x"}function se(t){return ie(I(t))}function Ge(t,e,n){n===void 0&&(n=!1);const i=at(t),o=se(t),s=oe(o);let r=o==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(r=ot(r)),[r,ot(r)]}function Qe(t){const e=ot(t);return[gt(t),e,gt(e)]}function gt(t){return t.replace(/start|end/g,e=>Ze[e])}function tn(t,e,n){const i=["left","right"],o=["right","left"],s=["top","bottom"],r=["bottom","top"];switch(t){case"top":case"bottom":return n?e?o:i:e?i:o;case"left":case"right":return e?s:r;default:return[]}}function en(t,e,n,i){const o=at(t);let s=tn(V(t),n==="start",i);return o&&(s=s.map(r=>r+"-"+o),e&&(s=s.concat(s.map(gt)))),s}function ot(t){return t.replace(/left|right|bottom|top/g,e=>Ke[e])}function nn(t){return{top:0,right:0,bottom:0,left:0,...t}}function on(t){return typeof t!="number"?nn(t):{top:t,right:t,bottom:t,left:t}}function st(t){const{x:e,y:n,width:i,height:o}=t;return{width:i,height:o,top:n,left:e,right:e+i,bottom:n+o,x:e,y:n}}function Mt(t,e,n){let{reference:i,floating:o}=t;const s=I(e),r=se(e),c=oe(r),l=V(e),a=s==="y",f=i.x+i.width/2-o.width/2,u=i.y+i.height/2-o.height/2,m=i[c]/2-o[c]/2;let h;switch(l){case"top":h={x:f,y:i.y-o.height};break;case"bottom":h={x:f,y:i.y+i.height};break;case"right":h={x:i.x+i.width,y:u};break;case"left":h={x:i.x-o.width,y:u};break;default:h={x:i.x,y:i.y}}switch(at(e)){case"start":h[r]-=m*(n&&a?-1:1);break;case"end":h[r]+=m*(n&&a?-1:1);break}return h}const sn=async(t,e,n)=>{const{placement:i="bottom",strategy:o="absolute",middleware:s=[],platform:r}=n,c=s.filter(Boolean),l=await(r.isRTL==null?void 0:r.isRTL(e));let a=await r.getElementRects({reference:t,floating:e,strategy:o}),{x:f,y:u}=Mt(a,i,l),m=i,h={},g=0;for(let y=0;y<c.length;y++){const{name:w,fn:p}=c[y],{x:v,y:x,data:A,reset:b}=await p({x:f,y:u,initialPlacement:i,placement:m,strategy:o,middlewareData:h,rects:a,platform:r,elements:{reference:t,floating:e}});f=v??f,u=x??u,h={...h,[w]:{...h[w],...A}},b&&g<=50&&(g++,typeof b=="object"&&(b.placement&&(m=b.placement),b.rects&&(a=b.rects===!0?await r.getElementRects({reference:t,floating:e,strategy:o}):b.rects),{x:f,y:u}=Mt(a,m,l)),y=-1)}return{x:f,y:u,placement:m,strategy:o,middlewareData:h}};async function re(t,e){var n;e===void 0&&(e={});const{x:i,y:o,platform:s,rects:r,elements:c,strategy:l}=t,{boundary:a="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:m=!1,padding:h=0}=lt(e,t),g=on(h),w=c[m?u==="floating"?"reference":"floating":u],p=st(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:a,rootBoundary:f,strategy:l})),v=u==="floating"?{x:i,y:o,width:r.floating.width,height:r.floating.height}:r.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),A=await(s.isElement==null?void 0:s.isElement(x))?await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1}:{x:1,y:1},b=st(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:v,offsetParent:x,strategy:l}):v);return{top:(p.top-b.top+g.top)/A.y,bottom:(b.bottom-p.bottom+g.bottom)/A.y,left:(p.left-b.left+g.left)/A.x,right:(b.right-p.right+g.right)/A.x}}const rn=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,i;const{placement:o,middlewareData:s,rects:r,initialPlacement:c,platform:l,elements:a}=e,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:m,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:y=!0,...w}=lt(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const p=V(o),v=I(c),x=V(c)===c,A=await(l.isRTL==null?void 0:l.isRTL(a.floating)),b=m||(x||!y?[ot(c)]:Qe(c)),W=g!=="none";!m&&W&&b.push(...en(c,y,g,A));const pe=[c,...b],ht=await re(e,w),G=[];let q=((i=s.flip)==null?void 0:i.overflows)||[];if(f&&G.push(ht[p]),u){const M=Ge(o,r,A);G.push(ht[M[0]],ht[M[1]])}if(q=[...q,{placement:o,overflows:G}],!G.every(M=>M<=0)){var bt,At;const M=(((bt=s.flip)==null?void 0:bt.index)||0)+1,_t=pe[M];if(_t)return{data:{index:M,overflows:q},reset:{placement:_t}};let X=(At=q.filter($=>$.overflows[0]<=0).sort(($,C)=>$.overflows[1]-C.overflows[1])[0])==null?void 0:At.placement;if(!X)switch(h){case"bestFit":{var St;const $=(St=q.filter(C=>{if(W){const P=I(C.placement);return P===v||P==="y"}return!0}).map(C=>[C.placement,C.overflows.filter(P=>P>0).reduce((P,me)=>P+me,0)]).sort((C,P)=>C[1]-P[1])[0])==null?void 0:St[0];$&&(X=$);break}case"initialPlacement":X=c;break}if(o!==X)return{reset:{placement:X}}}return{}}}};async function cn(t,e){const{placement:n,platform:i,elements:o}=t,s=await(i.isRTL==null?void 0:i.isRTL(o.floating)),r=V(n),c=at(n),l=I(n)==="y",a=["left","top"].includes(r)?-1:1,f=s&&l?-1:1,u=lt(e,t);let{mainAxis:m,crossAxis:h,alignmentAxis:g}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...u};return c&&typeof g=="number"&&(h=c==="end"?g*-1:g),l?{x:h*f,y:m*a}:{x:m*a,y:h*f}}const ln=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,i;const{x:o,y:s,placement:r,middlewareData:c}=e,l=await cn(e,t);return r===((n=c.offset)==null?void 0:n.placement)&&(i=c.arrow)!=null&&i.alignmentOffset?{}:{x:o+l.x,y:s+l.y,data:{...l,placement:r}}}}},an=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:i,placement:o}=e,{mainAxis:s=!0,crossAxis:r=!1,limiter:c={fn:w=>{let{x:p,y:v}=w;return{x:p,y:v}}},...l}=lt(t,e),a={x:n,y:i},f=await re(e,l),u=I(V(o)),m=ie(u);let h=a[m],g=a[u];if(s){const w=m==="y"?"top":"left",p=m==="y"?"bottom":"right",v=h+f[w],x=h-f[p];h=Nt(v,h,x)}if(r){const w=u==="y"?"top":"left",p=u==="y"?"bottom":"right",v=g+f[w],x=g-f[p];g=Nt(v,g,x)}const y=c.fn({...e,[m]:h,[u]:g});return{...y,data:{x:y.x-n,y:y.y-i}}}}};function j(t){return ce(t)?(t.nodeName||"").toLowerCase():"#document"}function S(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function O(t){var e;return(e=(ce(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function ce(t){return t instanceof Node||t instanceof S(t).Node}function L(t){return t instanceof Element||t instanceof S(t).Element}function R(t){return t instanceof HTMLElement||t instanceof S(t).HTMLElement}function kt(t){return typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof S(t).ShadowRoot}function Z(t){const{overflow:e,overflowX:n,overflowY:i,display:o}=_(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+n)&&!["inline","contents"].includes(o)}function un(t){return["table","td","th"].includes(j(t))}function ut(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function wt(t){const e=vt(),n=_(t);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(i=>(n.willChange||"").includes(i))||["paint","layout","strict","content"].some(i=>(n.contain||"").includes(i))}function fn(t){let e=N(t);for(;R(e)&&!z(e);){if(ut(e))return null;if(wt(e))return e;e=N(e)}return null}function vt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function z(t){return["html","body","#document"].includes(j(t))}function _(t){return S(t).getComputedStyle(t)}function ft(t){return L(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function N(t){if(j(t)==="html")return t;const e=t.assignedSlot||t.parentNode||kt(t)&&t.host||O(t);return kt(e)?e.host:e}function le(t){const e=N(t);return z(e)?t.ownerDocument?t.ownerDocument.body:t.body:R(e)&&Z(e)?e:le(e)}function U(t,e,n){var i;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=le(t),s=o===((i=t.ownerDocument)==null?void 0:i.body),r=S(o);return s?e.concat(r,r.visualViewport||[],Z(o)?o:[],r.frameElement&&n?U(r.frameElement):[]):e.concat(o,U(o,[],n))}function ae(t){const e=_(t);let n=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const o=R(t),s=o?t.offsetWidth:n,r=o?t.offsetHeight:i,c=it(n)!==s||it(i)!==r;return c&&(n=s,i=r),{width:n,height:i,$:c}}function xt(t){return L(t)?t:t.contextElement}function H(t){const e=xt(t);if(!R(e))return T(1);const n=e.getBoundingClientRect(),{width:i,height:o,$:s}=ae(e);let r=(s?it(n.width):n.width)/i,c=(s?it(n.height):n.height)/o;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}const hn=T(0);function ue(t){const e=S(t);return!vt()||!e.visualViewport?hn:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function dn(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==S(t)?!1:e}function B(t,e,n,i){e===void 0&&(e=!1),n===void 0&&(n=!1);const o=t.getBoundingClientRect(),s=xt(t);let r=T(1);e&&(i?L(i)&&(r=H(i)):r=H(t));const c=dn(s,n,i)?ue(s):T(0);let l=(o.left+c.x)/r.x,a=(o.top+c.y)/r.y,f=o.width/r.x,u=o.height/r.y;if(s){const m=S(s),h=i&&L(i)?S(i):i;let g=m,y=g.frameElement;for(;y&&i&&h!==g;){const w=H(y),p=y.getBoundingClientRect(),v=_(y),x=p.left+(y.clientLeft+parseFloat(v.paddingLeft))*w.x,A=p.top+(y.clientTop+parseFloat(v.paddingTop))*w.y;l*=w.x,a*=w.y,f*=w.x,u*=w.y,l+=x,a+=A,g=S(y),y=g.frameElement}}return st({width:f,height:u,x:l,y:a})}function pn(t){let{elements:e,rect:n,offsetParent:i,strategy:o}=t;const s=o==="fixed",r=O(i),c=e?ut(e.floating):!1;if(i===r||c&&s)return n;let l={scrollLeft:0,scrollTop:0},a=T(1);const f=T(0),u=R(i);if((u||!u&&!s)&&((j(i)!=="body"||Z(r))&&(l=ft(i)),R(i))){const m=B(i);a=H(i),f.x=m.x+i.clientLeft,f.y=m.y+i.clientTop}return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-l.scrollLeft*a.x+f.x,y:n.y*a.y-l.scrollTop*a.y+f.y}}function mn(t){return Array.from(t.getClientRects())}function fe(t){return B(O(t)).left+ft(t).scrollLeft}function gn(t){const e=O(t),n=ft(t),i=t.ownerDocument.body,o=F(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),s=F(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let r=-n.scrollLeft+fe(t);const c=-n.scrollTop;return _(i).direction==="rtl"&&(r+=F(e.clientWidth,i.clientWidth)-o),{width:o,height:s,x:r,y:c}}function yn(t,e){const n=S(t),i=O(t),o=n.visualViewport;let s=i.clientWidth,r=i.clientHeight,c=0,l=0;if(o){s=o.width,r=o.height;const a=vt();(!a||a&&e==="fixed")&&(c=o.offsetLeft,l=o.offsetTop)}return{width:s,height:r,x:c,y:l}}function wn(t,e){const n=B(t,!0,e==="fixed"),i=n.top+t.clientTop,o=n.left+t.clientLeft,s=R(t)?H(t):T(1),r=t.clientWidth*s.x,c=t.clientHeight*s.y,l=o*s.x,a=i*s.y;return{width:r,height:c,x:l,y:a}}function Ft(t,e,n){let i;if(e==="viewport")i=yn(t,n);else if(e==="document")i=gn(O(t));else if(L(e))i=wn(e,n);else{const o=ue(t);i={...e,x:e.x-o.x,y:e.y-o.y}}return st(i)}function he(t,e){const n=N(t);return n===e||!L(n)||z(n)?!1:_(n).position==="fixed"||he(n,e)}function vn(t,e){const n=e.get(t);if(n)return n;let i=U(t,[],!1).filter(c=>L(c)&&j(c)!=="body"),o=null;const s=_(t).position==="fixed";let r=s?N(t):t;for(;L(r)&&!z(r);){const c=_(r),l=wt(r);!l&&c.position==="fixed"&&(o=null),(s?!l&&!o:!l&&c.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Z(r)&&!l&&he(t,r))?i=i.filter(f=>f!==r):o=c,r=N(r)}return e.set(t,i),i}function xn(t){let{element:e,boundary:n,rootBoundary:i,strategy:o}=t;const r=[...n==="clippingAncestors"?ut(e)?[]:vn(e,this._c):[].concat(n),i],c=r[0],l=r.reduce((a,f)=>{const u=Ft(e,f,o);return a.top=F(u.top,a.top),a.right=nt(u.right,a.right),a.bottom=nt(u.bottom,a.bottom),a.left=F(u.left,a.left),a},Ft(e,c,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function bn(t){const{width:e,height:n}=ae(t);return{width:e,height:n}}function An(t,e,n){const i=R(e),o=O(e),s=n==="fixed",r=B(t,!0,s,e);let c={scrollLeft:0,scrollTop:0};const l=T(0);if(i||!i&&!s)if((j(e)!=="body"||Z(o))&&(c=ft(e)),i){const u=B(e,!0,s,e);l.x=u.x+e.clientLeft,l.y=u.y+e.clientTop}else o&&(l.x=fe(o));const a=r.left+c.scrollLeft-l.x,f=r.top+c.scrollTop-l.y;return{x:a,y:f,width:r.width,height:r.height}}function pt(t){return _(t).position==="static"}function Vt(t,e){return!R(t)||_(t).position==="fixed"?null:e?e(t):t.offsetParent}function de(t,e){const n=S(t);if(ut(t))return n;if(!R(t)){let o=N(t);for(;o&&!z(o);){if(L(o)&&!pt(o))return o;o=N(o)}return n}let i=Vt(t,e);for(;i&&un(i)&&pt(i);)i=Vt(i,e);return i&&z(i)&&pt(i)&&!wt(i)?n:i||fn(t)||n}const Sn=async function(t){const e=this.getOffsetParent||de,n=this.getDimensions,i=await n(t.floating);return{reference:An(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function _n(t){return _(t).direction==="rtl"}const En={convertOffsetParentRelativeRectToViewportRelativeRect:pn,getDocumentElement:O,getClippingRect:xn,getOffsetParent:de,getElementRects:Sn,getClientRects:mn,getDimensions:bn,getScale:H,isElement:L,isRTL:_n};function Ln(t,e){let n=null,i;const o=O(t);function s(){var c;clearTimeout(i),(c=n)==null||c.disconnect(),n=null}function r(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),s();const{left:a,top:f,width:u,height:m}=t.getBoundingClientRect();if(c||e(),!u||!m)return;const h=et(f),g=et(o.clientWidth-(a+u)),y=et(o.clientHeight-(f+m)),w=et(a),v={rootMargin:-h+"px "+-g+"px "+-y+"px "+-w+"px",threshold:F(0,nt(1,l))||1};let x=!0;function A(b){const W=b[0].intersectionRatio;if(W!==l){if(!x)return r();W?r(!1,W):i=setTimeout(()=>{r(!1,1e-7)},1e3)}x=!1}try{n=new IntersectionObserver(A,{...v,root:o.ownerDocument})}catch{n=new IntersectionObserver(A,v)}n.observe(t)}return r(!0),s}function Rn(t,e,n,i){i===void 0&&(i={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=i,a=xt(t),f=o||s?[...a?U(a):[],...U(e)]:[];f.forEach(p=>{o&&p.addEventListener("scroll",n,{passive:!0}),s&&p.addEventListener("resize",n)});const u=a&&c?Ln(a,n):null;let m=-1,h=null;r&&(h=new ResizeObserver(p=>{let[v]=p;v&&v.target===a&&h&&(h.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var x;(x=h)==null||x.observe(e)})),n()}),a&&!l&&h.observe(a),h.observe(e));let g,y=l?B(t):null;l&&w();function w(){const p=B(t);y&&(p.x!==y.x||p.y!==y.y||p.width!==y.width||p.height!==y.height)&&n(),y=p,g=requestAnimationFrame(w)}return n(),()=>{var p;f.forEach(v=>{o&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),u==null||u(),(p=h)==null||p.disconnect(),h=null,l&&cancelAnimationFrame(g)}}const Dn=ln,On=an,Bt=rn,Cn=(t,e,n)=>{const i=new Map,o={platform:En,...n},s={...o.platform,_c:i};return sn(t,e,{...o,platform:s})};function Pn({content:t,open:e,placement:n,offset:{mainAxis:i,crossAxis:o}={mainAxis:0,crossAxis:0}}){return s=>{const r=s.element,c=E.wrap(e);return mt.bool(c,{true:()=>Xe("body",Te.div(Ye(l=>{const a=l;return a.style.position="absolute",Rn(r,a,()=>{Cn(r,a,{placement:n,strategy:"absolute",middleware:[Bt(),Dn({mainAxis:i,crossAxis:o}),On(),Bt()]}).then(({x:f,y:u})=>{a.style.top=`${u}px`,a.style.left=`${f}px`})})}),t())),false:()=>null})(s)}}exports.PopOver=Pn;
package/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './components/pop-over';