@machinerd/js-module 0.5.3 → 0.6.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 +10 -101
- package/dist/common-CQWUs1nE.cjs +1 -0
- package/dist/common-DbEp6YNc.mjs +1 -0
- package/dist/file-5mweNdAM.cjs +1 -0
- package/dist/file-DShNxIW4.mjs +1 -0
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.cts +1 -1
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/hooks--O5RcEJq.cjs +1 -0
- package/dist/hooks-C9rXWkfW.mjs +1 -0
- package/dist/{index-ComhjQ-q.d.cts → index-BFHrNSKP.d.mts} +4 -4
- package/dist/{index-ByfkW7VU.d.mts → index-BQHtVz_S.d.cts} +4 -4
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/providers/index.cjs +1 -1
- package/dist/providers/index.d.cts +3 -3
- package/dist/providers/index.d.mts +3 -3
- package/dist/providers/index.mjs +1 -1
- package/dist/{providers-5JCPezAS.mjs → providers-zftmvT1z.mjs} +1 -1
- package/dist/skeleton-6QtpIO7l.mjs +1 -0
- package/dist/skeleton-DBha34Cx.cjs +1 -0
- package/dist/styles/index.css +6 -25
- package/dist/ui/carousel/index.cjs +1 -0
- package/dist/ui/carousel/index.d.cts +95 -0
- package/dist/ui/carousel/index.d.mts +95 -0
- package/dist/ui/carousel/index.mjs +1 -0
- package/dist/ui/dialog/index.cjs +1 -0
- package/dist/ui/dialog/index.d.cts +30 -0
- package/dist/ui/dialog/index.d.mts +30 -0
- package/dist/ui/dialog/index.mjs +1 -0
- package/dist/ui/image/index.cjs +1 -0
- package/dist/ui/image/index.d.cts +45 -0
- package/dist/ui/image/index.d.mts +45 -0
- package/dist/ui/image/index.mjs +1 -0
- package/dist/ui/index.cjs +1 -1
- package/dist/ui/index.d.cts +9 -9
- package/dist/ui/index.d.mts +9 -9
- package/dist/ui/index.mjs +1 -1
- package/dist/ui/sheet/index.cjs +1 -0
- package/dist/ui/sheet/index.d.cts +28 -0
- package/dist/ui/sheet/index.d.mts +28 -0
- package/dist/ui/sheet/index.mjs +1 -0
- package/dist/ui/tooltip/index.cjs +1 -0
- package/dist/ui/tooltip/index.d.cts +16 -0
- package/dist/ui/tooltip/index.d.mts +16 -0
- package/dist/ui/tooltip/index.mjs +1 -0
- package/dist/use-subset-image-DhX5WmYG.cjs +1 -0
- package/dist/use-subset-image-DvV5Mlkc.mjs +1 -0
- package/dist/util/browser.cjs +1 -0
- package/dist/util/browser.d.cts +16 -0
- package/dist/util/browser.d.mts +16 -0
- package/dist/util/browser.mjs +1 -0
- package/dist/util/common.cjs +1 -0
- package/dist/util/common.d.cts +56 -0
- package/dist/util/common.d.mts +56 -0
- package/dist/util/common.mjs +1 -0
- package/dist/util/date.cjs +1 -0
- package/dist/util/date.d.cts +4 -0
- package/dist/util/date.d.mts +6 -0
- package/dist/util/date.mjs +1 -0
- package/dist/util/file.cjs +1 -0
- package/dist/util/file.d.cts +15 -0
- package/dist/util/file.d.mts +15 -0
- package/dist/util/file.mjs +1 -0
- package/dist/util/format.cjs +1 -0
- package/dist/util/format.d.cts +6 -0
- package/dist/util/format.d.mts +6 -0
- package/dist/util/format.mjs +1 -0
- package/dist/util/generator.cjs +1 -0
- package/dist/util/generator.d.cts +18 -0
- package/dist/util/generator.d.mts +18 -0
- package/dist/util/generator.mjs +1 -0
- package/dist/util/phone.cjs +1 -0
- package/dist/util/phone.d.cts +22 -0
- package/dist/util/phone.d.mts +22 -0
- package/dist/util/phone.mjs +1 -0
- package/package.json +48 -8
- package/dist/hooks-DBo6LQrH.mjs +0 -1
- package/dist/hooks-DqgWx1Fa.cjs +0 -1
- package/dist/skeleton-S6S1ZnCy.mjs +0 -1
- package/dist/skeleton-g6yXh6D9.cjs +0 -1
- package/dist/ui-client/index.cjs +0 -1
- package/dist/ui-client/index.d.cts +0 -192
- package/dist/ui-client/index.d.mts +0 -192
- package/dist/ui-client/index.mjs +0 -1
- package/dist/util/index.cjs +0 -1
- package/dist/util/index.d.cts +0 -129
- package/dist/util/index.d.mts +0 -130
- package/dist/util/index.mjs +0 -1
- package/dist/util-o7fjt7iK.cjs +0 -1
- package/dist/util-zXJA6Gnc.mjs +0 -1
- /package/dist/{index-CH1uVFqx.d.cts → index-B3fFA21M.d.mts} +0 -0
- /package/dist/{index-D6Jzsxc-.d.mts → index-CeiAF-WU.d.cts} +0 -0
- /package/dist/{providers-BNK8Fisc.cjs → providers-CkXkdYcB.cjs} +0 -0
- /package/dist/{src-C_FmOyer.mjs → src-CukOR3K2.mjs} +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as react0 from "react";
|
|
2
|
+
import { HTMLAttributes } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/ui/tooltip/tooltip-container.d.ts
|
|
5
|
+
type SubPlacement = 'start' | 'end';
|
|
6
|
+
type MainPlacement = 'top' | 'bottom';
|
|
7
|
+
type TooltipPlacement = MainPlacement | `${MainPlacement}-${SubPlacement}`;
|
|
8
|
+
interface TooltipContainerProps extends HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
content: string;
|
|
11
|
+
placement?: TooltipPlacement;
|
|
12
|
+
defaultOpen?: boolean;
|
|
13
|
+
}
|
|
14
|
+
declare const TooltipContainer: react0.ForwardRefExoticComponent<TooltipContainerProps & react0.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { TooltipContainer as Tooltip, type TooltipContainerProps as TooltipProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import"../../src-CukOR3K2.mjs";import{n as e}from"../../common-DbEp6YNc.mjs";import"../../file-DShNxIW4.mjs";import{i as t}from"../../hooks-C9rXWkfW.mjs";import"../../providers-zftmvT1z.mjs";import"../../use-subset-image-DvV5Mlkc.mjs";import n from"clsx";import{forwardRef as r,useCallback as i,useEffect as a,useMemo as o,useRef as s,useState as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import{cva as d}from"class-variance-authority";import{createPortal as f}from"react-dom";function p({children:e,setOpen:t}){return l(`div`,{"data-komc":!0,className:n(`komc:inline-flex komc:shrink-0 komc:justify-center`,`komc:items-center komc:outline-none`),onMouseLeave:()=>t(!1),onMouseOver:()=>t(!0),onFocus:()=>t(!0),onBlur:()=>t(!1),onClick:()=>t(!0),children:e})}const m=d(e(`komc:z-99 komc:w-max komc:max-w-70 komc:p-2 komc:rounded-md`,`komc:break-all komc:transition-opacity komc:duration-300 komc:bg-white`,`komc:drop-shadow-[0px_0.5px_3px_rgba(0,0,0,0.2)] komc:text-xs`),{variants:{portal:{true:`komc:fixed`,false:`komc:absolute`},placement:{top:``,bottom:``,"top-start":``,"top-end":``,"bottom-start":``,"bottom-end":``}},compoundVariants:[{portal:!0,placement:`top`,className:`komc:-translate-y-2`},{portal:!0,placement:`bottom`,className:`komc:translate-y-2`},{portal:!0,placement:`top-start`,className:`komc:-translate-y-2`},{portal:!0,placement:`top-end`,className:`komc:-translate-y-2`},{portal:!0,placement:`bottom-start`,className:`komc:translate-y-2`},{portal:!0,placement:`bottom-end`,className:`komc:translate-y-2`},{portal:!1,placement:`top`,className:`komc:bottom-full komc:left-1/2 komc:-translate-x-1/2`},{portal:!1,placement:`bottom`,className:`komc:top-full komc:left-1/2 komc:-translate-x-1/2`},{portal:!1,placement:`top-start`,className:`komc:bottom-full komc:left-0`},{portal:!1,placement:`top-end`,className:`komc:bottom-full komc:right-0`},{portal:!1,placement:`bottom-start`,className:`komc:top-full komc:left-0`},{portal:!1,placement:`bottom-end`,className:`komc:top-full komc:right-0`}],defaultVariants:{placement:`top`,portal:!1}});var h=r(({portal:e,children:t,className:n,placement:r,...i},a)=>l(`div`,{ref:a,"data-komc":!0,role:`tooltip`,className:m({portal:e,placement:r,className:n}),...i,children:t}));const g=d(e(`komc:absolute komc:w-2 komc:h-2 komc:bg-inherit`,`komc:transition-opacity komc:duration-300`),{variants:{placement:{top:e(`komc:top-full komc:-mt-1 komc:left-1/2`),bottom:e(`komc:bottom-full komc:-mb-1 komc:left-1/2`),"top-start":e(`komc:top-full komc:-mt-1 komc:left-5`),"top-end":e(`komc:top-full komc:-mt-1 komc:right-5`),"bottom-start":e(`komc:bottom-full komc:-mb-1 komc:left-5`),"bottom-end":e(`komc:bottom-full komc:-mb-1 komc:right-5`)}},defaultVariants:{placement:`top`}});var _=({placement:e,className:t,offset:n,style:r,...i})=>{let a=o(()=>{switch(e){case`top`:case`top-start`:case`top-end`:return`rotate(45deg)`;case`bottom`:case`bottom-start`:case`bottom-end`:return`rotate(225deg)`;default:return`rotate(45deg)`}},[e]);return l(`div`,{className:g({placement:e,className:t}),style:{transform:`translate(${n?.x}px, ${n?.y}px) ${a}`},...i})};const v=(e,t)=>{let[,n]=e.split(`-`);return n?`${t}-${n}`:t};function y({placement:e,className:t,content:r,open:o,hiddenRef:s,containerRef:d}){let[p,m]=c(!1),[g,y]=c(e),[b,x]=c({top:0,left:0}),[S,C]=c({x:0,y:0});a(()=>{m(!0)},[]);let w=i(()=>{let t=d.current,n=s.current;if(!t||!n)return;let r=t.getBoundingClientRect(),i=n.getBoundingClientRect(),a=e,[o]=a.split(`-`),c=r.top,l=window.innerHeight-r.bottom;o===`bottom`&&l<i.height&&c>=i.height?a=v(a,`top`):o===`top`&&c<i.height&&l>=i.height&&(a=v(a,`bottom`)),y(a);let[u,f]=a.split(`-`),p=r.top,m=r.left+r.width/2-i.width/2;switch(u){case`top`:p-=i.height;break;case`bottom`:p+=r.height;break}switch(f){case`start`:m+=i.width/2-24;break;case`end`:m-=i.width/2-24;break}let h=m,g=window.innerWidth;h+i.width>g-4&&(h=g-i.width-4),h<4&&(h=4),x({top:p,left:h}),C({x:m-h,y:0})},[e,d,s]);return a(()=>{if(!p||!o)return;console.log(`updateLayout`);let e=!1,t=0,n=0,r=!1;w();let i=()=>{r||=(t=requestAnimationFrame(()=>{e||w(),r=!1}),!0)};window.addEventListener(`scroll`,i,{passive:!0}),window.addEventListener(`resize`,i);let a=0,s=0,c=``,l=()=>{if(e||a>=180)return;let t=d.current;if(t){let e=t.getBoundingClientRect(),n=`${e.top.toFixed(4)},${e.left.toFixed(4)},${e.width.toFixed(4)},${e.height.toFixed(4)}`;n===c?s+=1:(s=0,c=n,w())}s<2&&(a+=1,n=requestAnimationFrame(l))};return n=requestAnimationFrame(l),()=>{e=!0,cancelAnimationFrame(t),cancelAnimationFrame(n),window.removeEventListener(`scroll`,i),window.removeEventListener(`resize`,i)}},[p,o,w,d]),p?f(u(h,{portal:!0,"data-komc":!0,placement:g,className:n(t,o?`komc:visible komc:opacity-100`:`komc:opacity-0 komc:invisible`),style:{...b},children:[l(`span`,{children:r}),l(_,{placement:g,offset:S})]}),document.body):null}var b=r(({children:e,content:r,defaultOpen:i=!1,className:a,placement:o=`top`},d)=>{let[f,m]=c(i),g=s(null),_=s(null);return t({ref:g,setOpen:m}),u(`div`,{ref:g,"data-komc":!0,className:`komc:flex komc:shrink-0 komc:relative komc:overflow-hidden komc:w-fit komc:h-fit`,children:[l(p,{setOpen:m,children:e}),l(y,{placement:o,className:a,open:f,content:r,hiddenRef:_,containerRef:g}),l(h,{ref:_,role:`presentation`,"aria-hidden":`true`,placement:o,className:n(`komc:opacity-0 komc:invisible`,a),children:l(`span`,{children:r})})]})});export{b as Tooltip};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./file-5mweNdAM.cjs`),n=require(`./providers-CkXkdYcB.cjs`);let r=require(`react`);const i=[12,120,240,300,406,512,612,768,960,1024,1280,1440,1560,1920,2560,3840];function a({ref:e,src:a,forceLoad:o=!1,folder:s=`media`,fallbackSrc:c,origin:l,originalWidth:u,loading:d=`lazy`,...f}){let p=n.n(),[m,h]=(0,r.useState)(0),[g,_]=(0,r.useState)(o||!a),[v,y]=(0,r.useState)(!a),b=(0,r.useRef)(null),x=(0,r.useRef)(null),S=(0,r.useCallback)(t=>{b.current=t,typeof e==`function`?e(t):e&&(e.current=t)},[e]),C=(0,r.useCallback)((e,t)=>{let n=e.startsWith(`/`)?e.slice(1):e;return t===`static`?p.cdnStatic(n):p.cdnMedia(n)},[p]),w=(0,r.useMemo)(()=>i.filter(e=>e<=u),[u]),T=(0,r.useMemo)(()=>t.i(a)?a:C(a,s),[C,a,s]),E=(0,r.useMemo)(()=>{if(l||!t.a(a)||w.length===0)return;let{filenameWithoutExtension:e,directory:n}=t.o(a,s);if(f.width){let t=w.find(e=>e>=f.width)??w[w.length-1],r=t*2,i=w.find(e=>e>=r)??w[w.length-1];return`${C(`${n}/subsets/w${t}/${e}.webp`,s)} 1x,${C(`${n}/subsets/w${i}/${e}.webp`,s)} 2x`}let r=``;for(let t of w)r+=`${C(`${n}/subsets/w${t}/${e}.webp`,s)} ${t}w, `;return r.trim()},[w,C,s,l,a,f.width]),D=(0,r.useCallback)((e,n)=>{let{filenameWithoutExtension:r,directory:i}=t.o(e,n);return`${C(`${i}/subsets/origin/${r}.webp`,n)}`},[C]),O=(0,r.useMemo)(()=>{if(a)return`${D(a,s)} 1x`},[a,s,D]),k=(0,r.useCallback)(e=>{h(t=>t>=2?(e&&(x.current=e),3):t+1)},[]),A=(()=>{if(m===0)return E;if(m===1)return O}),j=m>=3?c:T,M=m===0?f.sizes:void 0,N=m>0?`eager`:d;(0,r.useEffect)(()=>{m<3||y(!0)},[m]),(0,r.useEffect)(()=>{let e=b.current;if(!e||v)return;if(e.complete&&e.naturalWidth===0&&e.getAttribute(`src`)){k();return}if(e.complete&&e.naturalWidth>0){_(!0);return}let t=()=>{e.naturalWidth>0&&_(!0)};return e.addEventListener(`load`,t),()=>e.removeEventListener(`load`,t)},[v,m,k]);let{fill:P,...F}=f;return{ref:S,isLoad:g,isError:v,imageProps:{...F,src:j,srcSet:A(),sizes:M,loading:N,onError:v?void 0:k}}}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return i}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,i as t,o as n}from"./file-DShNxIW4.mjs";import{n as r}from"./providers-zftmvT1z.mjs";import{useCallback as i,useEffect as a,useMemo as o,useRef as s,useState as c}from"react";const l=[12,120,240,300,406,512,612,768,960,1024,1280,1440,1560,1920,2560,3840];function u({ref:u,src:d,forceLoad:f=!1,folder:p=`media`,fallbackSrc:m,origin:h,originalWidth:g,loading:_=`lazy`,...v}){let y=r(),[b,x]=c(0),[S,C]=c(f||!d),[w,T]=c(!d),E=s(null),D=s(null),O=i(e=>{E.current=e,typeof u==`function`?u(e):u&&(u.current=e)},[u]),k=i((e,t)=>{let n=e.startsWith(`/`)?e.slice(1):e;return t===`static`?y.cdnStatic(n):y.cdnMedia(n)},[y]),A=o(()=>l.filter(e=>e<=g),[g]),j=o(()=>t(d)?d:k(d,p),[k,d,p]),M=o(()=>{if(h||!e(d)||A.length===0)return;let{filenameWithoutExtension:t,directory:r}=n(d,p);if(v.width){let e=A.find(e=>e>=v.width)??A[A.length-1],n=e*2,i=A.find(e=>e>=n)??A[A.length-1];return`${k(`${r}/subsets/w${e}/${t}.webp`,p)} 1x,${k(`${r}/subsets/w${i}/${t}.webp`,p)} 2x`}let i=``;for(let e of A)i+=`${k(`${r}/subsets/w${e}/${t}.webp`,p)} ${e}w, `;return i.trim()},[A,k,p,h,d,v.width]),N=i((e,t)=>{let{filenameWithoutExtension:r,directory:i}=n(e,t);return`${k(`${i}/subsets/origin/${r}.webp`,t)}`},[k]),P=o(()=>{if(d)return`${N(d,p)} 1x`},[d,p,N]),F=i(e=>{x(t=>t>=2?(e&&(D.current=e),3):t+1)},[]),I=(()=>{if(b===0)return M;if(b===1)return P}),L=b>=3?m:j,R=b===0?v.sizes:void 0,z=b>0?`eager`:_;a(()=>{b<3||T(!0)},[b]),a(()=>{let e=E.current;if(!e||w)return;if(e.complete&&e.naturalWidth===0&&e.getAttribute(`src`)){F();return}if(e.complete&&e.naturalWidth>0){C(!0);return}let t=()=>{e.naturalWidth>0&&C(!0)};return e.addEventListener(`load`,t),()=>e.removeEventListener(`load`,t)},[w,b,F]);let{fill:B,...V}=v;return{ref:O,isLoad:S,isError:w,imageProps:{...V,src:L,srcSet:I(),sizes:R,loading:z,onError:w?void 0:F}}}export{u as n,l as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`../chunk-Bmb41Sf3.cjs`);let t=require(`js-cookie`);t=e.t(t);let n=require(`lodash-es`);const r=e=>t.default.get(e),i=(e,n,r)=>t.default.set(e,n,r),a=()=>typeof window>`u`?[]:JSON.parse(localStorage.getItem(`search-history`)||`[]`),o=e=>{let t=(0,n.uniq)([e,...a()]).slice(0,10);return localStorage.setItem(`search-history`,JSON.stringify(t)),t},s=e=>{let t=a();return t.splice(e,1),localStorage.setItem(`search-history`,JSON.stringify(t)),t},c=()=>{localStorage.setItem(`search-history`,JSON.stringify([]))},l=e=>e.endsWith(`/search`),u=e=>l(e)?e:`${e}/search`.replace(`//`,`/`),d=e=>e.replace(`/search`,``).replace(`//`,`/`),f=(e,t)=>{let n=new URLSearchParams(e);return n.delete(t),Object.fromEntries(n)},p=e=>{if(!e)return``;try{let t=new URL(e);if(t.hostname===`youtu.be`)return t.pathname.slice(1).split(`?`)[0];let n=t.searchParams.get(`v`);if(n)return n;let r=t.pathname.match(/\/(?:embed|shorts|v)\/([^/?]+)/);if(r)return r[1]}catch{let t=e.match(/(?:v=|youtu\.be\/|embed\/|shorts\/)([^&?/\s]{11})/);if(t)return t[1]}return``};exports.appendSearchPath=u,exports.clearQueryByKey=f,exports.clearSearchPath=d,exports.deleteAllSearchHistory=c,exports.deleteSearchHistory=s,exports.getCookie=r,exports.getSearchHistory=a,exports.getYoutubeVideoId=p,exports.insertSearchHistory=o,exports.isSearchPage=l,exports.setCookies=i;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/util/browser.d.ts
|
|
2
|
+
declare const getCookie: (key: string) => string | undefined;
|
|
3
|
+
declare const setCookies: (key: string, value: string, options?: Cookies.CookieAttributes) => string | undefined;
|
|
4
|
+
declare const getSearchHistory: () => string[];
|
|
5
|
+
declare const insertSearchHistory: (item: string) => string[];
|
|
6
|
+
declare const deleteSearchHistory: (index: number) => string[];
|
|
7
|
+
declare const deleteAllSearchHistory: () => void;
|
|
8
|
+
declare const isSearchPage: (pathname: string) => boolean;
|
|
9
|
+
declare const appendSearchPath: (pathname: string) => string;
|
|
10
|
+
declare const clearSearchPath: (pathname: string) => string;
|
|
11
|
+
declare const clearQueryByKey: (query: Record<string, any>, key: string) => {
|
|
12
|
+
[k: string]: string;
|
|
13
|
+
};
|
|
14
|
+
declare const getYoutubeVideoId: (youtubeURL?: string | null) => string;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { appendSearchPath, clearQueryByKey, clearSearchPath, deleteAllSearchHistory, deleteSearchHistory, getCookie, getSearchHistory, getYoutubeVideoId, insertSearchHistory, isSearchPage, setCookies };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/util/browser.d.ts
|
|
2
|
+
declare const getCookie: (key: string) => string | undefined;
|
|
3
|
+
declare const setCookies: (key: string, value: string, options?: Cookies.CookieAttributes) => string | undefined;
|
|
4
|
+
declare const getSearchHistory: () => string[];
|
|
5
|
+
declare const insertSearchHistory: (item: string) => string[];
|
|
6
|
+
declare const deleteSearchHistory: (index: number) => string[];
|
|
7
|
+
declare const deleteAllSearchHistory: () => void;
|
|
8
|
+
declare const isSearchPage: (pathname: string) => boolean;
|
|
9
|
+
declare const appendSearchPath: (pathname: string) => string;
|
|
10
|
+
declare const clearSearchPath: (pathname: string) => string;
|
|
11
|
+
declare const clearQueryByKey: (query: Record<string, any>, key: string) => {
|
|
12
|
+
[k: string]: string;
|
|
13
|
+
};
|
|
14
|
+
declare const getYoutubeVideoId: (youtubeURL?: string | null) => string;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { appendSearchPath, clearQueryByKey, clearSearchPath, deleteAllSearchHistory, deleteSearchHistory, getCookie, getSearchHistory, getYoutubeVideoId, insertSearchHistory, isSearchPage, setCookies };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"js-cookie";import{uniq as t}from"lodash-es";const n=t=>e.get(t),r=(t,n,r)=>e.set(t,n,r),i=()=>typeof window>`u`?[]:JSON.parse(localStorage.getItem(`search-history`)||`[]`),a=e=>{let n=t([e,...i()]).slice(0,10);return localStorage.setItem(`search-history`,JSON.stringify(n)),n},o=e=>{let t=i();return t.splice(e,1),localStorage.setItem(`search-history`,JSON.stringify(t)),t},s=()=>{localStorage.setItem(`search-history`,JSON.stringify([]))},c=e=>e.endsWith(`/search`),l=e=>c(e)?e:`${e}/search`.replace(`//`,`/`),u=e=>e.replace(`/search`,``).replace(`//`,`/`),d=(e,t)=>{let n=new URLSearchParams(e);return n.delete(t),Object.fromEntries(n)},f=e=>{if(!e)return``;try{let t=new URL(e);if(t.hostname===`youtu.be`)return t.pathname.slice(1).split(`?`)[0];let n=t.searchParams.get(`v`);if(n)return n;let r=t.pathname.match(/\/(?:embed|shorts|v)\/([^/?]+)/);if(r)return r[1]}catch{let t=e.match(/(?:v=|youtu\.be\/|embed\/|shorts\/)([^&?/\s]{11})/);if(t)return t[1]}return``};export{l as appendSearchPath,d as clearQueryByKey,u as clearSearchPath,s as deleteAllSearchHistory,o as deleteSearchHistory,n as getCookie,i as getSearchHistory,f as getYoutubeVideoId,a as insertSearchHistory,c as isSearchPage,r as setCookies};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`../common-CQWUs1nE.cjs`);exports.calcPageCount=e.t,exports.cn=e.n,exports.comparePriorityAsc=e.r,exports.composeKey=e.i,exports.existLeastOne=e.a,exports.getFirstLocationAddress=e.o,exports.getFullAddress=e.s,exports.getI18nKey=e.c,exports.getI18nValue=e.l,exports.getI18nValues=e.u,exports.getModelName=e.d,exports.link=e.f,exports.loadExLib=e.p,exports.parseQuery=e.m,exports.productSlugify=e.h,exports.selectItemByWeight=e.g,exports.shuffle=e._,exports.sleep=e.v,exports.slugify=e.y,exports.withoutProperties=e.b,exports.withoutProperty=e.x;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//#region src/util/common.d.ts
|
|
2
|
+
declare const link: (param: Record<string, string>, deleteKeys?: string[]) => string;
|
|
3
|
+
declare const calcPageCount: (total: number, perPage: number) => number;
|
|
4
|
+
declare const shuffle: <T>(arr: T[]) => T[];
|
|
5
|
+
declare const loadExLib: (callback: () => void) => void;
|
|
6
|
+
declare const slugify: (base: string | number, ...args: Array<string | undefined>) => string;
|
|
7
|
+
interface Product<I extends I18n = I18n> {
|
|
8
|
+
id: number;
|
|
9
|
+
stockNo?: string[];
|
|
10
|
+
series?: Series<I> | null;
|
|
11
|
+
i18n: I[];
|
|
12
|
+
}
|
|
13
|
+
interface Series<I extends I18n = I18n> {
|
|
14
|
+
i18n: I[];
|
|
15
|
+
}
|
|
16
|
+
interface I18n {
|
|
17
|
+
name?: string | null;
|
|
18
|
+
locale: string;
|
|
19
|
+
priority: number;
|
|
20
|
+
}
|
|
21
|
+
declare const productSlugify: (product: Product) => string;
|
|
22
|
+
declare const getModelName: (modelName: string[]) => string;
|
|
23
|
+
declare const getI18nValues: <T extends {
|
|
24
|
+
locale: string;
|
|
25
|
+
priority: number;
|
|
26
|
+
}, K extends keyof T>(locale: string | undefined, values: T[], key: K) => T[K];
|
|
27
|
+
declare const getI18nValue: <T extends {
|
|
28
|
+
locale: string;
|
|
29
|
+
priority: number;
|
|
30
|
+
[key: string]: string | number | null | undefined;
|
|
31
|
+
}>(locale?: string, values?: T[], key?: keyof T) => string;
|
|
32
|
+
declare const comparePriorityAsc: <T extends {
|
|
33
|
+
priority: number;
|
|
34
|
+
}>(a: T, b: T) => 0 | 1 | -1;
|
|
35
|
+
declare const parseQuery: <T, F = T>(q: string | string[] | undefined | null, conv: (v: string) => T, fallback: F) => T | F;
|
|
36
|
+
declare const withoutProperty: <T, K extends keyof T>(obj: T, property: K) => Omit<T, K>;
|
|
37
|
+
declare const withoutProperties: <T extends Record<string, unknown>>(obj: T, properties: Array<keyof T>) => T;
|
|
38
|
+
declare const existLeastOne: <T>(a: T[], b: T[]) => boolean;
|
|
39
|
+
declare const getI18nKey: (key: string) => string | undefined;
|
|
40
|
+
declare const composeKey: (prefix?: Array<string | number> | string, ...keys: Array<string | number>) => string;
|
|
41
|
+
interface Location<I extends LocationI18n = LocationI18n> {
|
|
42
|
+
i18n: I[];
|
|
43
|
+
}
|
|
44
|
+
interface LocationI18n extends I18n {
|
|
45
|
+
address1?: string | null;
|
|
46
|
+
address2?: string | null;
|
|
47
|
+
}
|
|
48
|
+
declare const getFirstLocationAddress: (locale: string | undefined, locations: Location[]) => string;
|
|
49
|
+
declare const getFullAddress: (locale: string | undefined, values: LocationI18n[]) => string;
|
|
50
|
+
declare const selectItemByWeight: <T extends {
|
|
51
|
+
weight: number;
|
|
52
|
+
}>(itemsWithWeights: T[]) => T;
|
|
53
|
+
declare const sleep: (ms: number) => Promise<unknown>;
|
|
54
|
+
declare const cn: (...classes: Array<string | false | null | undefined>) => string;
|
|
55
|
+
//#endregion
|
|
56
|
+
export { calcPageCount, cn, comparePriorityAsc, composeKey, existLeastOne, getFirstLocationAddress, getFullAddress, getI18nKey, getI18nValue, getI18nValues, getModelName, link, loadExLib, parseQuery, productSlugify, selectItemByWeight, shuffle, sleep, slugify, withoutProperties, withoutProperty };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//#region src/util/common.d.ts
|
|
2
|
+
declare const link: (param: Record<string, string>, deleteKeys?: string[]) => string;
|
|
3
|
+
declare const calcPageCount: (total: number, perPage: number) => number;
|
|
4
|
+
declare const shuffle: <T>(arr: T[]) => T[];
|
|
5
|
+
declare const loadExLib: (callback: () => void) => void;
|
|
6
|
+
declare const slugify: (base: string | number, ...args: Array<string | undefined>) => string;
|
|
7
|
+
interface Product<I extends I18n = I18n> {
|
|
8
|
+
id: number;
|
|
9
|
+
stockNo?: string[];
|
|
10
|
+
series?: Series<I> | null;
|
|
11
|
+
i18n: I[];
|
|
12
|
+
}
|
|
13
|
+
interface Series<I extends I18n = I18n> {
|
|
14
|
+
i18n: I[];
|
|
15
|
+
}
|
|
16
|
+
interface I18n {
|
|
17
|
+
name?: string | null;
|
|
18
|
+
locale: string;
|
|
19
|
+
priority: number;
|
|
20
|
+
}
|
|
21
|
+
declare const productSlugify: (product: Product) => string;
|
|
22
|
+
declare const getModelName: (modelName: string[]) => string;
|
|
23
|
+
declare const getI18nValues: <T extends {
|
|
24
|
+
locale: string;
|
|
25
|
+
priority: number;
|
|
26
|
+
}, K extends keyof T>(locale: string | undefined, values: T[], key: K) => T[K];
|
|
27
|
+
declare const getI18nValue: <T extends {
|
|
28
|
+
locale: string;
|
|
29
|
+
priority: number;
|
|
30
|
+
[key: string]: string | number | null | undefined;
|
|
31
|
+
}>(locale?: string, values?: T[], key?: keyof T) => string;
|
|
32
|
+
declare const comparePriorityAsc: <T extends {
|
|
33
|
+
priority: number;
|
|
34
|
+
}>(a: T, b: T) => 0 | 1 | -1;
|
|
35
|
+
declare const parseQuery: <T, F = T>(q: string | string[] | undefined | null, conv: (v: string) => T, fallback: F) => T | F;
|
|
36
|
+
declare const withoutProperty: <T, K extends keyof T>(obj: T, property: K) => Omit<T, K>;
|
|
37
|
+
declare const withoutProperties: <T extends Record<string, unknown>>(obj: T, properties: Array<keyof T>) => T;
|
|
38
|
+
declare const existLeastOne: <T>(a: T[], b: T[]) => boolean;
|
|
39
|
+
declare const getI18nKey: (key: string) => string | undefined;
|
|
40
|
+
declare const composeKey: (prefix?: Array<string | number> | string, ...keys: Array<string | number>) => string;
|
|
41
|
+
interface Location<I extends LocationI18n = LocationI18n> {
|
|
42
|
+
i18n: I[];
|
|
43
|
+
}
|
|
44
|
+
interface LocationI18n extends I18n {
|
|
45
|
+
address1?: string | null;
|
|
46
|
+
address2?: string | null;
|
|
47
|
+
}
|
|
48
|
+
declare const getFirstLocationAddress: (locale: string | undefined, locations: Location[]) => string;
|
|
49
|
+
declare const getFullAddress: (locale: string | undefined, values: LocationI18n[]) => string;
|
|
50
|
+
declare const selectItemByWeight: <T extends {
|
|
51
|
+
weight: number;
|
|
52
|
+
}>(itemsWithWeights: T[]) => T;
|
|
53
|
+
declare const sleep: (ms: number) => Promise<unknown>;
|
|
54
|
+
declare const cn: (...classes: Array<string | false | null | undefined>) => string;
|
|
55
|
+
//#endregion
|
|
56
|
+
export { calcPageCount, cn, comparePriorityAsc, composeKey, existLeastOne, getFirstLocationAddress, getFullAddress, getI18nKey, getI18nValue, getI18nValues, getModelName, link, loadExLib, parseQuery, productSlugify, selectItemByWeight, shuffle, sleep, slugify, withoutProperties, withoutProperty };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e,a as t,b as n,c as r,d as i,f as a,g as o,h as s,i as c,l,m as u,n as d,o as f,p,r as m,s as h,t as g,u as _,v,x as y,y as b}from"../common-DbEp6YNc.mjs";export{g as calcPageCount,d as cn,m as comparePriorityAsc,c as composeKey,t as existLeastOne,f as getFirstLocationAddress,h as getFullAddress,r as getI18nKey,l as getI18nValue,_ as getI18nValues,i as getModelName,a as link,p as loadExLib,u as parseQuery,s as productSlugify,o as selectItemByWeight,e as shuffle,v as sleep,b as slugify,n as withoutProperties,y as withoutProperty};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`../chunk-Bmb41Sf3.cjs`);let t=require(`dayjs`);t=e.t(t),require(`dayjs/locale/ko.js`);let n=require(`dayjs/plugin/relativeTime.js`);n=e.t(n),t.default.extend(n.default);const r=(e,n=`YYYY-MM-DD`,r=`en`)=>{let i=(0,t.default)(e).locale(r);return(0,t.default)().diff(i,`hour`)<12?i.fromNow():i.format(n)};exports.displayDatetime=r;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"dayjs";import"dayjs/locale/ko.js";import t from"dayjs/plugin/relativeTime.js";e.extend(t);const n=(t,n=`YYYY-MM-DD`,r=`en`)=>{let i=e(t).locale(r);return e().diff(i,`hour`)<12?i.fromNow():i.format(n)};export{n as displayDatetime};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`../file-5mweNdAM.cjs`);exports.formatBytes=e.t,exports.getFileExtension=e.n,exports.getFilename=e.r,exports.isExternalSrc=e.i,exports.isSrcSetCompatible=e.a,exports.parsePath=e.o;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/util/file.d.ts
|
|
2
|
+
declare function formatBytes(bytes: number, decimals?: number): string;
|
|
3
|
+
declare const getFilename: (s: string) => string;
|
|
4
|
+
declare const getFileExtension: (s: string) => string | undefined;
|
|
5
|
+
interface PathInfo {
|
|
6
|
+
directory: string;
|
|
7
|
+
filename: string;
|
|
8
|
+
extension: string;
|
|
9
|
+
filenameWithoutExtension: string;
|
|
10
|
+
}
|
|
11
|
+
declare const parsePath: (filepath: string, folder?: string) => PathInfo;
|
|
12
|
+
declare const isExternalSrc: (src: string) => boolean;
|
|
13
|
+
declare const isSrcSetCompatible: (src: string) => boolean;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { formatBytes, getFileExtension, getFilename, isExternalSrc, isSrcSetCompatible, parsePath };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/util/file.d.ts
|
|
2
|
+
declare function formatBytes(bytes: number, decimals?: number): string;
|
|
3
|
+
declare const getFilename: (s: string) => string;
|
|
4
|
+
declare const getFileExtension: (s: string) => string | undefined;
|
|
5
|
+
interface PathInfo {
|
|
6
|
+
directory: string;
|
|
7
|
+
filename: string;
|
|
8
|
+
extension: string;
|
|
9
|
+
filenameWithoutExtension: string;
|
|
10
|
+
}
|
|
11
|
+
declare const parsePath: (filepath: string, folder?: string) => PathInfo;
|
|
12
|
+
declare const isExternalSrc: (src: string) => boolean;
|
|
13
|
+
declare const isSrcSetCompatible: (src: string) => boolean;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { formatBytes, getFileExtension, getFilename, isExternalSrc, isSrcSetCompatible, parsePath };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,i as t,n,o as r,r as i,t as a}from"../file-DShNxIW4.mjs";export{a as formatBytes,n as getFileExtension,i as getFilename,t as isExternalSrc,e as isSrcSetCompatible,r as parsePath};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=(e,t=`en-US`,n)=>new Intl.NumberFormat(t,{notation:`compact`,maximumFractionDigits:1,...n}).format(e),t=(e,t,n=`+`)=>e>t?`${t}${n}`:String(e),n=e=>e?.toLocaleString(`ko-KR`)||`0`;exports.formatCompactNumber=e,exports.formatExceedNumber=t,exports.formatKoNumber=n;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region src/util/format.d.ts
|
|
2
|
+
declare const formatCompactNumber: (number: number, locale?: string, options?: Intl.NumberFormatOptions) => string;
|
|
3
|
+
declare const formatExceedNumber: (number: number, threshold: number, suffix?: string) => string;
|
|
4
|
+
declare const formatKoNumber: (number?: number | string | null) => string;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { formatCompactNumber, formatExceedNumber, formatKoNumber };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region src/util/format.d.ts
|
|
2
|
+
declare const formatCompactNumber: (number: number, locale?: string, options?: Intl.NumberFormatOptions) => string;
|
|
3
|
+
declare const formatExceedNumber: (number: number, threshold: number, suffix?: string) => string;
|
|
4
|
+
declare const formatKoNumber: (number?: number | string | null) => string;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { formatCompactNumber, formatExceedNumber, formatKoNumber };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=(e,t=`en-US`,n)=>new Intl.NumberFormat(t,{notation:`compact`,maximumFractionDigits:1,...n}).format(e),t=(e,t,n=`+`)=>e>t?`${t}${n}`:String(e),n=e=>e?.toLocaleString(`ko-KR`)||`0`;export{e as formatCompactNumber,t as formatExceedNumber,n as formatKoNumber};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`../chunk-Bmb41Sf3.cjs`);let t=require(`nanoid`);const n=(e,t)=>{let n=[];for(let r=e;r<t;r++)n.push(r);return n},r=(e,t,r=1)=>{let i=[],a=n(e,t);for(;i.length<r;){let t=Math.ceil(e),n=Math.floor(a.length),r=Math.floor(Math.random()*(n-t))+t,o=a.splice(r,1);i.push(o[0])}return[...i]},i=()=>(0,t.customAlphabet)(`0123456789abcdefghijklmnopqrstuvwxyz`,5)(),a=e=>{for(let t=0;t<e;t++)console.log(i())},o=(e,t,n)=>{let r=Math.floor((t-1)/n),i=r*n+1;return{current:r,start:i,end:Math.min(i+n-1,e)}},s=(e,t,n)=>{let{start:r,end:i}=o(e,t,n),a=r-1<1?1:r-1,s=i+1>e?e:i+1,c=Array.from({length:i-r+1},(e,t)=>r+t);return{prev:a,next:s,isPrev:a!==1,isNext:i<e,items:c}};exports.genNanoID=i,exports.generatePage=o,exports.generatePageGroup=s,exports.printNanoID=a,exports.randomNum=r;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/util/generator.d.ts
|
|
2
|
+
declare const randomNum: (min: number, max: number, count?: number) => number[];
|
|
3
|
+
declare const genNanoID: () => string;
|
|
4
|
+
declare const printNanoID: (cnt: number) => void;
|
|
5
|
+
declare const generatePage: (count: number, page: number, pagePerView: number) => {
|
|
6
|
+
current: number;
|
|
7
|
+
start: number;
|
|
8
|
+
end: number;
|
|
9
|
+
};
|
|
10
|
+
declare const generatePageGroup: (count: number, page: number, pagePerView: number) => {
|
|
11
|
+
prev: number;
|
|
12
|
+
next: number;
|
|
13
|
+
isPrev: boolean;
|
|
14
|
+
isNext: boolean;
|
|
15
|
+
items: number[];
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { genNanoID, generatePage, generatePageGroup, printNanoID, randomNum };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/util/generator.d.ts
|
|
2
|
+
declare const randomNum: (min: number, max: number, count?: number) => number[];
|
|
3
|
+
declare const genNanoID: () => string;
|
|
4
|
+
declare const printNanoID: (cnt: number) => void;
|
|
5
|
+
declare const generatePage: (count: number, page: number, pagePerView: number) => {
|
|
6
|
+
current: number;
|
|
7
|
+
start: number;
|
|
8
|
+
end: number;
|
|
9
|
+
};
|
|
10
|
+
declare const generatePageGroup: (count: number, page: number, pagePerView: number) => {
|
|
11
|
+
prev: number;
|
|
12
|
+
next: number;
|
|
13
|
+
isPrev: boolean;
|
|
14
|
+
isNext: boolean;
|
|
15
|
+
items: number[];
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { genNanoID, generatePage, generatePageGroup, printNanoID, randomNum };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{customAlphabet as e}from"nanoid";const t=(e,t)=>{let n=[];for(let r=e;r<t;r++)n.push(r);return n},n=(e,n,r=1)=>{let i=[],a=t(e,n);for(;i.length<r;){let t=Math.ceil(e),n=Math.floor(a.length),r=Math.floor(Math.random()*(n-t))+t,o=a.splice(r,1);i.push(o[0])}return[...i]},r=()=>e(`0123456789abcdefghijklmnopqrstuvwxyz`,5)(),i=e=>{for(let t=0;t<e;t++)console.log(r())},a=(e,t,n)=>{let r=Math.floor((t-1)/n),i=r*n+1;return{current:r,start:i,end:Math.min(i+n-1,e)}},o=(e,t,n)=>{let{start:r,end:i}=a(e,t,n),o=r-1<1?1:r-1,s=i+1>e?e:i+1,c=Array.from({length:i-r+1},(e,t)=>r+t);return{prev:o,next:s,isPrev:o!==1,isNext:i<e,items:c}};export{r as genNanoID,a as generatePage,o as generatePageGroup,i as printNanoID,n as randomNum};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`../chunk-Bmb41Sf3.cjs`);let t=require(`google-libphonenumber`);t=e.t(t);const{PhoneNumberUtil:n,PhoneNumberFormat:r}=t.default,i=n.getInstance(),a=(e,t,n)=>t?e===`ko`&&n&&n!==`82`||e!==`ko`&&n?`+${n}-${t.replace(/^0/,``)}`:t:`-`,o=({phone:e,alpha2Code:t,callingCode:n,format:o=`RFC3966`,locale:s=`en`})=>{if(!e?.trim())return``;try{let n=i.parse(e,t);return i.format(n,r[o])}catch{return a(s,e,n)}};exports.formatI18nNumber=o,exports.recomposeI18nNumber=a;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import lib from "google-libphonenumber";
|
|
2
|
+
|
|
3
|
+
//#region src/util/phone.d.ts
|
|
4
|
+
declare const PhoneNumberFormat: typeof lib.PhoneNumberFormat;
|
|
5
|
+
type PhoneFormatType = 'international' | 'national' | 'rfc3966';
|
|
6
|
+
declare const recomposeI18nNumber: (locale: string, number?: string | null, i18nNumber?: string | null) => string;
|
|
7
|
+
interface I18nNumberProps {
|
|
8
|
+
phone?: string | null;
|
|
9
|
+
alpha2Code?: string;
|
|
10
|
+
callingCode?: string;
|
|
11
|
+
format?: keyof typeof PhoneNumberFormat;
|
|
12
|
+
locale?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const formatI18nNumber: ({
|
|
15
|
+
phone,
|
|
16
|
+
alpha2Code,
|
|
17
|
+
callingCode,
|
|
18
|
+
format,
|
|
19
|
+
locale
|
|
20
|
+
}: I18nNumberProps) => string;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { I18nNumberProps, PhoneFormatType, formatI18nNumber, recomposeI18nNumber };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import lib from "google-libphonenumber";
|
|
2
|
+
|
|
3
|
+
//#region src/util/phone.d.ts
|
|
4
|
+
declare const PhoneNumberFormat: typeof lib.PhoneNumberFormat;
|
|
5
|
+
type PhoneFormatType = 'international' | 'national' | 'rfc3966';
|
|
6
|
+
declare const recomposeI18nNumber: (locale: string, number?: string | null, i18nNumber?: string | null) => string;
|
|
7
|
+
interface I18nNumberProps {
|
|
8
|
+
phone?: string | null;
|
|
9
|
+
alpha2Code?: string;
|
|
10
|
+
callingCode?: string;
|
|
11
|
+
format?: keyof typeof PhoneNumberFormat;
|
|
12
|
+
locale?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const formatI18nNumber: ({
|
|
15
|
+
phone,
|
|
16
|
+
alpha2Code,
|
|
17
|
+
callingCode,
|
|
18
|
+
format,
|
|
19
|
+
locale
|
|
20
|
+
}: I18nNumberProps) => string;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { I18nNumberProps, PhoneFormatType, formatI18nNumber, recomposeI18nNumber };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"google-libphonenumber";const{PhoneNumberUtil:t,PhoneNumberFormat:n}=e,r=t.getInstance(),i=(e,t,n)=>t?e===`ko`&&n&&n!==`82`||e!==`ko`&&n?`+${n}-${t.replace(/^0/,``)}`:t:`-`,a=({phone:e,alpha2Code:t,callingCode:a,format:o=`RFC3966`,locale:s=`en`})=>{if(!e?.trim())return``;try{let i=r.parse(e,t);return r.format(i,n[o])}catch{return i(s,e,a)}};export{a as formatI18nNumber,i as recomposeI18nNumber};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@machinerd/js-module",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
@@ -12,17 +12,57 @@
|
|
|
12
12
|
"import": "./dist/index.mjs",
|
|
13
13
|
"require": "./dist/index.cjs"
|
|
14
14
|
},
|
|
15
|
-
"./util": {
|
|
16
|
-
"import": "./dist/util/
|
|
17
|
-
"require": "./dist/util/
|
|
15
|
+
"./util/browser": {
|
|
16
|
+
"import": "./dist/util/browser.mjs",
|
|
17
|
+
"require": "./dist/util/browser.cjs"
|
|
18
18
|
},
|
|
19
|
-
"./
|
|
19
|
+
"./util/common": {
|
|
20
|
+
"import": "./dist/util/common.mjs",
|
|
21
|
+
"require": "./dist/util/common.cjs"
|
|
22
|
+
},
|
|
23
|
+
"./util/date": {
|
|
24
|
+
"import": "./dist/util/date.mjs",
|
|
25
|
+
"require": "./dist/util/date.cjs"
|
|
26
|
+
},
|
|
27
|
+
"./util/file": {
|
|
28
|
+
"import": "./dist/util/file.mjs",
|
|
29
|
+
"require": "./dist/util/file.cjs"
|
|
30
|
+
},
|
|
31
|
+
"./util/format": {
|
|
32
|
+
"import": "./dist/util/format.mjs",
|
|
33
|
+
"require": "./dist/util/format.cjs"
|
|
34
|
+
},
|
|
35
|
+
"./util/generator": {
|
|
36
|
+
"import": "./dist/util/generator.mjs",
|
|
37
|
+
"require": "./dist/util/generator.cjs"
|
|
38
|
+
},
|
|
39
|
+
"./util/phone": {
|
|
40
|
+
"import": "./dist/util/phone.mjs",
|
|
41
|
+
"require": "./dist/util/phone.cjs"
|
|
42
|
+
},
|
|
43
|
+
"./ui/common": {
|
|
20
44
|
"import": "./dist/ui/index.mjs",
|
|
21
45
|
"require": "./dist/ui/index.cjs"
|
|
22
46
|
},
|
|
23
|
-
"./ui
|
|
24
|
-
"import": "./dist/ui
|
|
25
|
-
"require": "./dist/ui
|
|
47
|
+
"./ui/carousel": {
|
|
48
|
+
"import": "./dist/ui/carousel/index.mjs",
|
|
49
|
+
"require": "./dist/ui/carousel/index.cjs"
|
|
50
|
+
},
|
|
51
|
+
"./ui/dialog": {
|
|
52
|
+
"import": "./dist/ui/dialog/index.mjs",
|
|
53
|
+
"require": "./dist/ui/dialog/index.cjs"
|
|
54
|
+
},
|
|
55
|
+
"./ui/image": {
|
|
56
|
+
"import": "./dist/ui/image/index.mjs",
|
|
57
|
+
"require": "./dist/ui/image/index.cjs"
|
|
58
|
+
},
|
|
59
|
+
"./ui/sheet": {
|
|
60
|
+
"import": "./dist/ui/sheet/index.mjs",
|
|
61
|
+
"require": "./dist/ui/sheet/index.cjs"
|
|
62
|
+
},
|
|
63
|
+
"./ui/tooltip": {
|
|
64
|
+
"import": "./dist/ui/tooltip/index.mjs",
|
|
65
|
+
"require": "./dist/ui/tooltip/index.cjs"
|
|
26
66
|
},
|
|
27
67
|
"./hooks": {
|
|
28
68
|
"import": "./dist/hooks/index.mjs",
|
package/dist/hooks-DBo6LQrH.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as e,h as t,m as n}from"./util-zXJA6Gnc.mjs";import{n as r}from"./providers-5JCPezAS.mjs";import{throttle as i}from"lodash-es";import{useCallback as a,useEffect as o,useMemo as s,useRef as c,useState as l}from"react";function u(e,t){let[n,r]=l(!1);return o(()=>{let i;return e&&!n?r(!0):!e&&n&&(i=setTimeout(()=>r(!1),t)),()=>clearTimeout(i)},[e,t,n]),n}function d(e=1){let t=c(null),[n,r]=l(!1),[i,a]=l(0),[o,s]=l(0),u=c(!1);return{ref:t,onMouseDown:e=>{t.current&&(r(!0),u.current=!1,a(e.pageX-t.current.offsetLeft),s(t.current.scrollLeft))},onMouseLeave:()=>r(!1),onMouseUp:()=>r(!1),onMouseMove:r=>{if(!n||!t.current)return;r.preventDefault();let a=(r.pageX-t.current.offsetLeft-i)*e;Math.abs(a)>10&&(u.current=!0),t.current.scrollLeft=o-a},onClickCapture:e=>{u.current&&(e.stopPropagation(),e.preventDefault())}}}function f({ref:e,setOpen:t}){let n=a(n=>{e.current?.contains(n.target)||t(!1)},[e,t]);o(()=>(document.addEventListener(`mousedown`,n),document.addEventListener(`touchstart`,n),()=>{document.removeEventListener(`mousedown`,n),document.removeEventListener(`touchstart`,n)}),[n])}const p=[`mouse`,`touch`];function m({open:e,type:t=p}){let n=a(e=>{e.preventDefault()},[]),r=a(e=>{e.preventDefault()},[]);o(()=>{let i=e&&t.includes(`mouse`),a=e&&t.includes(`touch`);return i?(document.body.classList.add(`overflow-hidden`),document.addEventListener(`wheel`,r,{passive:!1})):(document.body.classList.remove(`overflow-hidden`),document.removeEventListener(`wheel`,r)),a?document.addEventListener(`touchmove`,n,{passive:!1}):document.removeEventListener(`touchmove`,n),()=>{document.body.classList.remove(`overflow-hidden`),document.removeEventListener(`touchmove`,n),document.removeEventListener(`wheel`,r)}},[e,t,n,r])}function h({enabled:e=!0,behavior:t=`smooth`}={}){let[n,r]=l(!1),i=c(null),s=a(()=>{window.scrollTo({top:0,behavior:t})},[t]);return o(()=>{let t=i.current;if(!t||!e){r(!1);return}let n=new IntersectionObserver(e=>{let t=e[0];t&&r(!t.isIntersecting)},{root:null,rootMargin:`0px`,threshold:0});return n.observe(t),()=>n.disconnect()},[e]),{isVisible:n,handleScrolToTop:s,ref:i}}const g=[12,120,240,300,406,512,612,768,960,1024,1280,1440,1560,1920,2560,3840];function _({ref:i,src:u,forceLoad:d=!1,folder:f=`media`,fallbackSrc:p,origin:m,originalWidth:h,loading:_=`lazy`,...v}){let y=r(),[b,x]=l(0),[S,C]=l(d||!u),[w,T]=l(!u),E=c(null),D=c(null),O=a(e=>{E.current=e,typeof i==`function`?i(e):i&&(i.current=e)},[i]),k=a((e,t)=>{let n=e.startsWith(`/`)?e.slice(1):e;return t===`static`?y.cdnStatic(n):y.cdnMedia(n)},[y]),A=s(()=>g.filter(e=>e<=h),[h]),j=s(()=>n(u)?u:k(u,f),[k,u,f]),M=s(()=>{if(m||!t(u)||A.length===0)return;let{filenameWithoutExtension:n,directory:r}=e(u,f);if(v.width){let e=A.find(e=>e>=v.width)??A[A.length-1],t=e*2,i=A.find(e=>e>=t)??A[A.length-1];return`${k(`${r}/subsets/w${e}/${n}.webp`,f)} 1x,${k(`${r}/subsets/w${i}/${n}.webp`,f)} 2x`}let i=``;for(let e of A)i+=`${k(`${r}/subsets/w${e}/${n}.webp`,f)} ${e}w, `;return i.trim()},[A,k,f,m,u,v.width]),N=a((t,n)=>{let{filenameWithoutExtension:r,directory:i}=e(t,n);return`${k(`${i}/subsets/origin/${r}.webp`,n)}`},[k]),P=s(()=>{if(u)return`${N(u,f)} 1x`},[u,f,N]),F=a(e=>{x(t=>t>=2?(e&&(D.current=e),3):t+1)},[]),I=(()=>{if(b===0)return M;if(b===1)return P}),L=b>=3?p:j,R=b===0?v.sizes:void 0,z=b>0?`eager`:_;o(()=>{b<3||T(!0)},[b]),o(()=>{let e=E.current;if(!e||w)return;if(e.complete&&e.naturalWidth===0&&e.getAttribute(`src`)){F();return}if(e.complete&&e.naturalWidth>0){C(!0);return}let t=()=>{e.naturalWidth>0&&C(!0)};return e.addEventListener(`load`,t),()=>e.removeEventListener(`load`,t)},[w,b,F]);let{fill:B,...V}=v;return{ref:O,isLoad:S,isError:w,imageProps:{...V,src:L,srcSet:I(),sizes:R,loading:z,onError:w?void 0:F}}}function v(e=1280){let[t,n]=l(e);return o(()=>{let e=i(()=>{let e=window.innerWidth;n(e)},200);return window.addEventListener(`resize`,e),e(),()=>window.removeEventListener(`resize`,e)},[]),{windowSize:t}}export{m as a,u as c,h as i,g as n,f as o,_ as r,d as s,v as t};
|
package/dist/hooks-DqgWx1Fa.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./util-o7fjt7iK.cjs`),n=require(`./providers-BNK8Fisc.cjs`);let r=require(`lodash-es`),i=require(`react`);function a(e,t){let[n,r]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{let i;return e&&!n?r(!0):!e&&n&&(i=setTimeout(()=>r(!1),t)),()=>clearTimeout(i)},[e,t,n]),n}function o(e=1){let t=(0,i.useRef)(null),[n,r]=(0,i.useState)(!1),[a,o]=(0,i.useState)(0),[s,c]=(0,i.useState)(0),l=(0,i.useRef)(!1);return{ref:t,onMouseDown:e=>{t.current&&(r(!0),l.current=!1,o(e.pageX-t.current.offsetLeft),c(t.current.scrollLeft))},onMouseLeave:()=>r(!1),onMouseUp:()=>r(!1),onMouseMove:r=>{if(!n||!t.current)return;r.preventDefault();let i=(r.pageX-t.current.offsetLeft-a)*e;Math.abs(i)>10&&(l.current=!0),t.current.scrollLeft=s-i},onClickCapture:e=>{l.current&&(e.stopPropagation(),e.preventDefault())}}}function s({ref:e,setOpen:t}){let n=(0,i.useCallback)(n=>{e.current?.contains(n.target)||t(!1)},[e,t]);(0,i.useEffect)(()=>(document.addEventListener(`mousedown`,n),document.addEventListener(`touchstart`,n),()=>{document.removeEventListener(`mousedown`,n),document.removeEventListener(`touchstart`,n)}),[n])}const c=[`mouse`,`touch`];function l({open:e,type:t=c}){let n=(0,i.useCallback)(e=>{e.preventDefault()},[]),r=(0,i.useCallback)(e=>{e.preventDefault()},[]);(0,i.useEffect)(()=>{let i=e&&t.includes(`mouse`),a=e&&t.includes(`touch`);return i?(document.body.classList.add(`overflow-hidden`),document.addEventListener(`wheel`,r,{passive:!1})):(document.body.classList.remove(`overflow-hidden`),document.removeEventListener(`wheel`,r)),a?document.addEventListener(`touchmove`,n,{passive:!1}):document.removeEventListener(`touchmove`,n),()=>{document.body.classList.remove(`overflow-hidden`),document.removeEventListener(`touchmove`,n),document.removeEventListener(`wheel`,r)}},[e,t,n,r])}function u({enabled:e=!0,behavior:t=`smooth`}={}){let[n,r]=(0,i.useState)(!1),a=(0,i.useRef)(null),o=(0,i.useCallback)(()=>{window.scrollTo({top:0,behavior:t})},[t]);return(0,i.useEffect)(()=>{let t=a.current;if(!t||!e){r(!1);return}let n=new IntersectionObserver(e=>{let t=e[0];t&&r(!t.isIntersecting)},{root:null,rootMargin:`0px`,threshold:0});return n.observe(t),()=>n.disconnect()},[e]),{isVisible:n,handleScrolToTop:o,ref:a}}const d=[12,120,240,300,406,512,612,768,960,1024,1280,1440,1560,1920,2560,3840];function f({ref:e,src:r,forceLoad:a=!1,folder:o=`media`,fallbackSrc:s,origin:c,originalWidth:l,loading:u=`lazy`,...f}){let p=n.n(),[m,h]=(0,i.useState)(0),[g,_]=(0,i.useState)(a||!r),[v,y]=(0,i.useState)(!r),b=(0,i.useRef)(null),x=(0,i.useRef)(null),S=(0,i.useCallback)(t=>{b.current=t,typeof e==`function`?e(t):e&&(e.current=t)},[e]),C=(0,i.useCallback)((e,t)=>{let n=e.startsWith(`/`)?e.slice(1):e;return t===`static`?p.cdnStatic(n):p.cdnMedia(n)},[p]),w=(0,i.useMemo)(()=>d.filter(e=>e<=l),[l]),T=(0,i.useMemo)(()=>t.m(r)?r:C(r,o),[C,r,o]),E=(0,i.useMemo)(()=>{if(c||!t.h(r)||w.length===0)return;let{filenameWithoutExtension:e,directory:n}=t.g(r,o);if(f.width){let t=w.find(e=>e>=f.width)??w[w.length-1],r=t*2,i=w.find(e=>e>=r)??w[w.length-1];return`${C(`${n}/subsets/w${t}/${e}.webp`,o)} 1x,${C(`${n}/subsets/w${i}/${e}.webp`,o)} 2x`}let i=``;for(let t of w)i+=`${C(`${n}/subsets/w${t}/${e}.webp`,o)} ${t}w, `;return i.trim()},[w,C,o,c,r,f.width]),D=(0,i.useCallback)((e,n)=>{let{filenameWithoutExtension:r,directory:i}=t.g(e,n);return`${C(`${i}/subsets/origin/${r}.webp`,n)}`},[C]),O=(0,i.useMemo)(()=>{if(r)return`${D(r,o)} 1x`},[r,o,D]),k=(0,i.useCallback)(e=>{h(t=>t>=2?(e&&(x.current=e),3):t+1)},[]),A=(()=>{if(m===0)return E;if(m===1)return O}),j=m>=3?s:T,M=m===0?f.sizes:void 0,N=m>0?`eager`:u;(0,i.useEffect)(()=>{m<3||y(!0)},[m]),(0,i.useEffect)(()=>{let e=b.current;if(!e||v)return;if(e.complete&&e.naturalWidth===0&&e.getAttribute(`src`)){k();return}if(e.complete&&e.naturalWidth>0){_(!0);return}let t=()=>{e.naturalWidth>0&&_(!0)};return e.addEventListener(`load`,t),()=>e.removeEventListener(`load`,t)},[v,m,k]);let{fill:P,...F}=f;return{ref:S,isLoad:g,isError:v,imageProps:{...F,src:j,srcSet:A(),sizes:M,loading:N,onError:v?void 0:k}}}function p(e=1280){let[t,n]=(0,i.useState)(e);return(0,i.useEffect)(()=>{let e=(0,r.throttle)(()=>{let e=window.innerWidth;n(e)},200);return window.addEventListener(`resize`,e),e(),()=>window.removeEventListener(`resize`,e)},[]),{windowSize:t}}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return p}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{y as e}from"./util-zXJA6Gnc.mjs";import{jsx as t}from"react/jsx-runtime";import{cva as n}from"class-variance-authority";const r=n(e(`komc:w-full komc:animate-pulse komc:bg-gray-200`),{variants:{size:{xs:`komc:h-4`,sm:`komc:h-8`,md:`komc:h-12`,lg:`komc:h-16`,xl:`komc:h-20`,"2xl":`komc:h-24`,"3xl":`komc:h-28`,square:`komc:h-auto komc:aspect-square`,full:`komc:h-full`},rounded:{none:`komc:rounded-none`,sm:`komc:rounded-sm`,md:`komc:rounded-md`,lg:`komc:rounded-lg`,xl:`komc:rounded-xl`,"2xl":`komc:rounded-2xl`,"3xl":`komc:rounded-3xl`,full:`komc:rounded-full`}},defaultVariants:{size:`sm`,rounded:`sm`}});function i({size:e,rounded:n,width:i,height:a,className:o,...s}){let c=i?typeof i==`string`?i:`${i}px`:void 0,l=a?typeof a==`string`?a:`${a}px`:void 0;return t(`div`,{"data-komc":!0,"aria-hidden":`true`,className:r({size:e,rounded:n,className:o}),style:{width:c,height:l},...s})}export{i as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./util-o7fjt7iK.cjs`);let n=require(`react/jsx-runtime`),r=require(`class-variance-authority`);const i=(0,r.cva)(t.y(`komc:w-full komc:animate-pulse komc:bg-gray-200`),{variants:{size:{xs:`komc:h-4`,sm:`komc:h-8`,md:`komc:h-12`,lg:`komc:h-16`,xl:`komc:h-20`,"2xl":`komc:h-24`,"3xl":`komc:h-28`,square:`komc:h-auto komc:aspect-square`,full:`komc:h-full`},rounded:{none:`komc:rounded-none`,sm:`komc:rounded-sm`,md:`komc:rounded-md`,lg:`komc:rounded-lg`,xl:`komc:rounded-xl`,"2xl":`komc:rounded-2xl`,"3xl":`komc:rounded-3xl`,full:`komc:rounded-full`}},defaultVariants:{size:`sm`,rounded:`sm`}});function a({size:e,rounded:t,width:r,height:a,className:o,...s}){let c=r?typeof r==`string`?r:`${r}px`:void 0,l=a?typeof a==`string`?a:`${a}px`:void 0;return(0,n.jsx)(`div`,{"data-komc":!0,"aria-hidden":`true`,className:i({size:e,rounded:t,className:o}),style:{width:c,height:l},...s})}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return a}});
|
package/dist/ui-client/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`../chunk-Bmb41Sf3.cjs`);require(`../src-CjpmdVyv.cjs`);const t=require(`../util-o7fjt7iK.cjs`),n=require(`../skeleton-g6yXh6D9.cjs`),r=require(`../hooks-DqgWx1Fa.cjs`);require(`../providers-BNK8Fisc.cjs`);let i=require(`clsx`);i=e.t(i);let a=require(`react`);a=e.t(a);let o=require(`react/jsx-runtime`),s=require(`class-variance-authority`),c=require(`embla-carousel-react`);c=e.t(c);let l=require(`react-dom`);const u=a.default.createContext(null);function d(){let e=a.default.useContext(u);if(!e)throw Error(`useCarousel must be used within a <Carousel />`);return e}function f({orientation:e=`horizontal`,options:n,setApi:r,plugins:i,className:s,children:l,...d}){let[f,p]=(0,c.default)({...n,axis:e===`horizontal`?`x`:`y`},i),[m,h]=(0,a.useState)(!1),[g,_]=(0,a.useState)(!1),[v,y]=(0,a.useState)(0),[b,x]=(0,a.useState)(0),S=(0,a.useCallback)(e=>{e&&(h(e.canScrollPrev()),_(e.canScrollNext()),x(e.selectedScrollSnap()))},[]),C=(0,a.useCallback)(()=>{p?.scrollPrev()},[p]),w=(0,a.useCallback)(()=>{p?.scrollNext()},[p]),T=(0,a.useCallback)(e=>{p?.scrollTo(e)},[p]),E=(0,a.useCallback)(()=>{y(p?.scrollSnapList().length||0)},[p]),D=(0,a.useCallback)(t=>{e===`horizontal`?t.key===`ArrowLeft`?(t.preventDefault(),C()):t.key===`ArrowRight`&&(t.preventDefault(),w()):t.key===`ArrowUp`?(t.preventDefault(),C()):t.key===`ArrowDown`&&(t.preventDefault(),w())},[C,w,e]);return(0,a.useEffect)(()=>{!p||!r||r(p)},[p,r]),(0,a.useEffect)(()=>{if(p)return S(p),E(),p.on(`reInit`,E),p.on(`reInit`,S),p.on(`select`,S),()=>{p?.off(`select`,S)}},[p,S]),(0,o.jsx)(u.Provider,{value:{carouselRef:f,api:p,options:n,orientation:e||(n?.axis===`y`?`vertical`:`horizontal`),scrollPrev:C,scrollNext:w,canScrollPrev:m,canScrollNext:g,scrollTo:T,dots:v,selectedScrollSnap:b},children:(0,o.jsx)(`div`,{"data-komc":!0,role:`region`,"aria-label":`carousel`,"aria-roledescription":`carousel`,tabIndex:0,onKeyDownCapture:D,className:t.y(`komc:relative`,s),...d,children:l})})}function p({className:e,...n}){let{carouselRef:r,orientation:i}=d();return(0,o.jsx)(`div`,{ref:r,"data-komc":!0,className:`komc:h-full komc:overflow-hidden`,children:(0,o.jsx)(`div`,{className:t.y(`komc:flex komc:h-full`,i===`horizontal`?`komc:-ml-4`:`komc:-mt-4 komc:flex-col`,e),...n})})}function m({className:e,...n}){let{orientation:r}=d();return(0,o.jsx)(`div`,{"data-komc":!0,className:t.y(`komc:min-w-0 komc:shrink-0 komc:grow-0 komc:basis-full`,r===`horizontal`?`komc:pl-4`:`komc:pt-4`,e),...n})}function h({children:e,className:t,...n}){let{scrollPrev:r,canScrollPrev:a}=d();return(0,o.jsx)(`button`,{type:`button`,"data-komc":!0,disabled:!a,"aria-label":`previous slide`,className:(0,i.default)(`komc:w-full`,t),onClick:r,...n,children:e})}function g({children:e,className:t,...n}){let{scrollNext:r,canScrollNext:a}=d();return(0,o.jsx)(`button`,{type:`button`,"data-komc":!0,disabled:!a,"aria-label":`next slide`,className:(0,i.default)(`komc:w-full`,t),onClick:r,...n,children:e})}function _({children:e,...t}){let{dots:n,selectedScrollSnap:r,scrollTo:i}=d();return(0,o.jsx)(o.Fragment,{children:Array.from({length:n}).map((n,a)=>(0,o.jsx)(`button`,{type:`button`,"data-komc":!0,"data-selected":r===a,"aria-label":`go to slide ${a+1}`,onClick:()=>i(a),...t,children:e?.(a)},a))})}function v({index:e,children:t,...n}){let{selectedScrollSnap:r,scrollTo:i}=d();return(0,o.jsx)(`button`,{type:`button`,"data-komc":!0,"data-selected":r===e,"aria-label":`go to slide ${e+1}`,onClick:()=>i(e),...n,children:t})}const y=(0,s.cva)(`komc:relative komc:z-10 komc:flex komc:min-h-0 komc:flex-col komc:overflow-hidden komc:w-full komc:max-h-full komc:min-w-0 komc:transition-all komc:duration-300 komc:ease-in-out`,{variants:{padding:{sm:`komc:p-2`,md:`komc:p-4`,lg:`komc:p-6`,none:`komc:p-0`},maxWidth:{sm:`komc:max-w-sm`,md:`komc:max-w-md`,lg:`komc:max-w-lg`,xl:`komc:max-w-xl`,"2xl":`komc:max-w-2xl`,full:`komc:max-w-full`}},defaultVariants:{padding:`sm`,maxWidth:`md`}});function b({closeOnBackdropClick:e=!0,isOpen:t,zIndex:n=1e4,padding:i,maxWidth:s,className:c,onClose:l,children:u,...d}){let f=r.c(t,300),[p,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{if(t&&f){let e=setTimeout(()=>m(!0),10);return()=>clearTimeout(e)}else t||m(!1)},[t,f]);let h=(0,a.useCallback)(e=>{e.key===`Escape`&&l()},[l]),g=(0,a.useCallback)(()=>{e&&l()},[e,l]);return(0,a.useEffect)(()=>(t?(document.addEventListener(`keydown`,h),document.body.style.overflow=`hidden`):document.body.style.overflow=`unset`,()=>{document.removeEventListener(`keydown`,h),document.body.style.overflow=`unset`}),[t,h]),f?(0,o.jsx)(`div`,{"data-komc":!0,className:`komc:fixed komc:inset-0 komc:flex komc:min-h-0 komc:flex-col komc:overflow-hidden`,style:{zIndex:n},children:(0,o.jsxs)(`div`,{className:`komc:relative komc:flex komc:min-h-0 komc:flex-1 komc:w-full komc:items-center komc:justify-center`,children:[(0,o.jsx)(`button`,{type:`button`,"data-state":p?`open`:`closed`,className:`komc:fixed komc:inset-0 komc:z-0 komc:cursor-default komc:bg-black/50 komc:transition-opacity komc:duration-300 komc:ease-in-out komc:data-[state=closed]:opacity-0 komc:data-[state=open]:opacity-100`,onClick:g,"aria-label":`close dialog`}),(0,o.jsx)(`div`,{"data-state":p?`open`:`closed`,className:`${y({padding:i,maxWidth:s,className:c})} komc:data-[state=closed]:opacity-0 komc:data-[state=open]:opacity-100 komc:data-[state=closed]:scale-95 komc:data-[state=open]:scale-100`,role:`dialog`,"aria-modal":`true`,...d,children:u})]})}):null}const x=(0,s.cva)(``,{variants:{fill:{true:`komc:w-full komc:h-full komc:absolute komc:inset-0`,false:``}},defaultVariants:{fill:!1}}),S=(0,a.forwardRef)(({...e},t)=>{let{ref:n,imageProps:i}=r.r({ref:t,...e});return(0,o.jsx)(`img`,{ref:n,...i})}),C=(0,a.forwardRef)(({skeleton:e=!0,layout:t=`stretch`,fallbackSrc:a,className:s,emptyNode:c,emptyNodeClassName:l,skeletonClassName:u,...d},f)=>{let{ref:p,isLoad:m,isError:h,imageProps:g}=r.r({ref:f,fallbackSrc:a,forceLoad:!e,...d}),_=!d.fill&&t===`intrinsic`?{width:`${d.width}px`,height:`${d.height}px`}:void 0,v=(0,i.default)(`komc:flex komc:justify-center komc:items-center komc:relative komc:min-h-0`,!d.fill&&t===`stretch`&&`komc:w-full komc:h-full`);return!a&&h&&c?d.fill?(0,o.jsx)(w,{className:l,children:c}):(0,o.jsx)(`div`,{"data-komc":!0,style:_,className:v,children:(0,o.jsx)(w,{className:l,children:c})}):d.fill?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`img`,{ref:p,...g,className:(0,i.default)(`komc:w-full komc:h-full komc:absolute komc:inset-0`,e&&!m?`komc:invisible`:`komc:visible`,s)}),(0,o.jsx)(`div`,{"data-komc":!0,className:(0,i.default)(`komc:w-full komc:h-full komc:absolute komc:inset-0`,e&&!m?`komc:block`:`komc:hidden`),children:(0,o.jsx)(n.t,{size:`full`,className:u})})]}):(0,o.jsxs)(`div`,{"data-komc":!0,style:_,className:v,children:[(0,o.jsx)(`img`,{ref:p,...g,className:(0,i.default)(x({fill:d.fill,className:s}),e&&!m?`komc:invisible`:`komc:visible`)}),(0,o.jsx)(`div`,{className:(0,i.default)(`komc:w-full komc:h-full komc:absolute komc:inset-0`,e&&!m?`komc:block`:`komc:hidden`),children:(0,o.jsx)(n.t,{size:`full`,className:u})})]})}),w=({children:e,className:t})=>(0,o.jsx)(`div`,{"data-komc":!0,role:`alert`,className:(0,i.default)(`komc:flex komc:justify-center komc:items-center komc:w-full komc:h-full komc:bg-gray-100 komc:absolute komc:inset-0 komc:p-1`,t),children:e});var T=C;const E=(0,s.cva)((0,i.default)(`komc:absolute komc:bg-white komc:flex komc:flex-col komc:shadow-2xl`,`komc:transition-transform komc:duration-300 komc:ease-in-out`),{variants:{direction:{top:`komc:top-0 komc:left-0 komc:right-0 komc:-translate-y-full komc:data-[state=open]:translate-y-0`,bottom:`komc:bottom-0 komc:left-0 komc:right-0 komc:translate-y-full komc:data-[state=open]:translate-y-0`,left:`komc:top-0 komc:bottom-0 komc:left-0 komc:-translate-x-full komc:data-[state=open]:translate-x-0`,right:`komc:top-0 komc:bottom-0 komc:right-0 komc:translate-x-full komc:data-[state=open]:translate-x-0`}}}),D=(0,s.cva)(``,{variants:{size:{full:``,half:``,auto:``},direction:{top:``,bottom:``,left:``,right:``}},compoundVariants:[{size:`full`,direction:`top`,className:`komc:h-full`},{size:`full`,direction:`bottom`,className:`komc:h-full`},{size:`full`,direction:`left`,className:`komc:w-full`},{size:`full`,direction:`right`,className:`komc:w-full`},{size:`half`,direction:`top`,className:`komc:h-[50dvh]`},{size:`half`,direction:`bottom`,className:`komc:h-[50dvh]`},{size:`half`,direction:`left`,className:`komc:w-[50dvw]`},{size:`half`,direction:`right`,className:`komc:w-[50dvw]`},{size:`auto`,direction:`top`,className:`komc:h-auto komc:max-h-[90dvh]`},{size:`auto`,direction:`bottom`,className:`komc:h-auto komc:max-h-[90dvh]`},{size:`auto`,direction:`left`,className:`komc:w-auto komc:max-w-[90dvw]`},{size:`auto`,direction:`right`,className:`komc:w-auto komc:max-w-[90dvw]`}]});function O({isOpen:e,onClose:t,direction:n=`bottom`,size:s=`full`,children:c,className:l,closeOnBackdropClick:u=!0,zIndex:d=1001}){let f=r.c(e,300),[p,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{if(e&&f){let e=setTimeout(()=>m(!0),10);return()=>clearTimeout(e)}else e||m(!1)},[e,f]);let h=(0,a.useCallback)(e=>{e.key===`Escape`&&t()},[t]),g=(0,a.useCallback)(()=>{u&&t()},[u,t]);return(0,a.useEffect)(()=>(e?(document.addEventListener(`keydown`,h),document.body.style.overflow=`hidden`):document.body.style.overflow=`unset`,()=>{document.removeEventListener(`keydown`,h),document.body.style.overflow=`unset`}),[e,h]),f?(0,o.jsxs)(`div`,{className:`komc:fixed komc:inset-0 komc:flex komc:justify-center komc:items-center`,style:{zIndex:d},children:[(0,o.jsx)(`button`,{type:`button`,"data-state":p?`open`:`closed`,className:(0,i.default)(`komc:absolute komc:inset-0 komc:w-full komc:h-full komc:bg-black/40 komc:cursor-default`,`komc:transition-opacity komc:duration-300 komc:ease-in-out`,`komc:opacity-0 komc:data-[state=open]:opacity-100`),onClick:g,"aria-label":`close sheet`}),(0,o.jsx)(`div`,{"data-state":p?`open`:`closed`,className:(0,i.default)(E({direction:n,className:l}),D({direction:n,size:s})),role:`dialog`,"aria-modal":`true`,children:c})]}):null}function k({children:e,setOpen:t}){return(0,o.jsx)(`div`,{"data-komc":!0,className:(0,i.default)(`komc:inline-flex komc:shrink-0 komc:justify-center`,`komc:items-center komc:outline-none`),onMouseLeave:()=>t(!1),onMouseOver:()=>t(!0),onFocus:()=>t(!0),onBlur:()=>t(!1),onClick:()=>t(!0),children:e})}const A=(0,s.cva)(t.y(`komc:z-99 komc:w-max komc:max-w-70 komc:p-2 komc:rounded-md`,`komc:break-all komc:transition-opacity komc:duration-300 komc:bg-white`,`komc:drop-shadow-[0px_0.5px_3px_rgba(0,0,0,0.2)] komc:text-xs`),{variants:{portal:{true:`komc:fixed`,false:`komc:absolute`},placement:{top:``,bottom:``,"top-start":``,"top-end":``,"bottom-start":``,"bottom-end":``}},compoundVariants:[{portal:!0,placement:`top`,className:`komc:-translate-y-2`},{portal:!0,placement:`bottom`,className:`komc:translate-y-2`},{portal:!0,placement:`top-start`,className:`komc:-translate-y-2`},{portal:!0,placement:`top-end`,className:`komc:-translate-y-2`},{portal:!0,placement:`bottom-start`,className:`komc:translate-y-2`},{portal:!0,placement:`bottom-end`,className:`komc:translate-y-2`},{portal:!1,placement:`top`,className:`komc:bottom-full komc:left-1/2 komc:-translate-x-1/2`},{portal:!1,placement:`bottom`,className:`komc:top-full komc:left-1/2 komc:-translate-x-1/2`},{portal:!1,placement:`top-start`,className:`komc:bottom-full komc:left-0`},{portal:!1,placement:`top-end`,className:`komc:bottom-full komc:right-0`},{portal:!1,placement:`bottom-start`,className:`komc:top-full komc:left-0`},{portal:!1,placement:`bottom-end`,className:`komc:top-full komc:right-0`}],defaultVariants:{placement:`top`,portal:!1}}),j=(0,a.forwardRef)(({portal:e,children:t,className:n,placement:r,...i},a)=>(0,o.jsx)(`div`,{ref:a,"data-komc":!0,role:`tooltip`,className:A({portal:e,placement:r,className:n}),...i,children:t}));var M=j;const N=(0,s.cva)(t.y(`komc:absolute komc:w-2 komc:h-2 komc:bg-inherit`,`komc:transition-opacity komc:duration-300`),{variants:{placement:{top:t.y(`komc:top-full komc:-mt-1 komc:left-1/2`),bottom:t.y(`komc:bottom-full komc:-mb-1 komc:left-1/2`),"top-start":t.y(`komc:top-full komc:-mt-1 komc:left-5`),"top-end":t.y(`komc:top-full komc:-mt-1 komc:right-5`),"bottom-start":t.y(`komc:bottom-full komc:-mb-1 komc:left-5`),"bottom-end":t.y(`komc:bottom-full komc:-mb-1 komc:right-5`)}},defaultVariants:{placement:`top`}}),P=({placement:e,className:t,offset:n,style:r,...i})=>{let s=(0,a.useMemo)(()=>{switch(e){case`top`:case`top-start`:case`top-end`:return`rotate(45deg)`;case`bottom`:case`bottom-start`:case`bottom-end`:return`rotate(225deg)`;default:return`rotate(45deg)`}},[e]);return(0,o.jsx)(`div`,{className:N({placement:e,className:t}),style:{transform:`translate(${n?.x}px, ${n?.y}px) ${s}`},...i})};var F=P;const I=24,L=2,R=180,z=(e,t)=>{let[,n]=e.split(`-`);return n?`${t}-${n}`:t};function B({placement:e,className:t,content:n,open:r,hiddenRef:s,containerRef:c}){let[u,d]=(0,a.useState)(!1),[f,p]=(0,a.useState)(e),[m,h]=(0,a.useState)({top:0,left:0}),[g,_]=(0,a.useState)({x:0,y:0});(0,a.useEffect)(()=>{d(!0)},[]);let v=(0,a.useCallback)(()=>{let t=c.current,n=s.current;if(!t||!n)return;let r=t.getBoundingClientRect(),i=n.getBoundingClientRect(),a=e,[o]=a.split(`-`),l=r.top,u=window.innerHeight-r.bottom;o===`bottom`&&u<i.height&&l>=i.height?a=z(a,`top`):o===`top`&&l<i.height&&u>=i.height&&(a=z(a,`bottom`)),p(a);let[d,f]=a.split(`-`),m=r.top,g=r.left+r.width/2-i.width/2;switch(d){case`top`:m-=i.height;break;case`bottom`:m+=r.height;break}switch(f){case`start`:g+=i.width/2-24;break;case`end`:g-=i.width/2-24;break}let v=g,y=window.innerWidth;v+i.width>y-4&&(v=y-i.width-4),v<4&&(v=4),h({top:m,left:v}),_({x:g-v,y:0})},[e,c,s]);return(0,a.useEffect)(()=>{if(!u||!r)return;console.log(`updateLayout`);let e=!1,t=0,n=0,i=!1;v();let a=()=>{i||=(t=requestAnimationFrame(()=>{e||v(),i=!1}),!0)};window.addEventListener(`scroll`,a,{passive:!0}),window.addEventListener(`resize`,a);let o=0,s=0,l=``,d=()=>{if(e||o>=180)return;let t=c.current;if(t){let e=t.getBoundingClientRect(),n=`${e.top.toFixed(4)},${e.left.toFixed(4)},${e.width.toFixed(4)},${e.height.toFixed(4)}`;n===l?s+=1:(s=0,l=n,v())}s<2&&(o+=1,n=requestAnimationFrame(d))};return n=requestAnimationFrame(d),()=>{e=!0,cancelAnimationFrame(t),cancelAnimationFrame(n),window.removeEventListener(`scroll`,a),window.removeEventListener(`resize`,a)}},[u,r,v,c]),u?(0,l.createPortal)((0,o.jsxs)(M,{portal:!0,"data-komc":!0,placement:f,className:(0,i.default)(t,r?`komc:visible komc:opacity-100`:`komc:opacity-0 komc:invisible`),style:{...m},children:[(0,o.jsx)(`span`,{children:n}),(0,o.jsx)(F,{placement:f,offset:g})]}),document.body):null}const V=(0,a.forwardRef)(({children:e,content:t,defaultOpen:n=!1,className:s,placement:c=`top`},l)=>{let[u,d]=(0,a.useState)(n),f=(0,a.useRef)(null),p=(0,a.useRef)(null);return r.o({ref:f,setOpen:d}),(0,o.jsxs)(`div`,{ref:f,"data-komc":!0,className:`komc:flex komc:shrink-0 komc:relative komc:overflow-hidden komc:w-fit komc:h-fit`,children:[(0,o.jsx)(k,{setOpen:d,children:e}),(0,o.jsx)(B,{placement:c,className:s,open:u,content:t,hiddenRef:p,containerRef:f}),(0,o.jsx)(M,{ref:p,role:`presentation`,"aria-hidden":`true`,placement:c,className:(0,i.default)(`komc:opacity-0 komc:invisible`,s),children:(0,o.jsx)(`span`,{children:t})})]})});var H=V;exports.BaseImage=S,exports.Carousel=f,exports.CarouselDot=v,exports.CarouselDots=_,exports.CarouselItem=m,exports.CarouselNext=g,exports.CarouselPrevious=h,exports.CarouselWrapper=p,exports.Dialog=b,exports.EmptyNode=w,exports.Image=T,exports.Sheet=O,exports.Tooltip=H;
|