@funhub/platform 0.1.121 → 0.1.123
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{mergeStyles as e}from"../../utils/styles/helpers.mjs";import{Box as t}from"../../../ui/box.mjs";import n from"../../../ui/link.mjs";import{urlPrefix as r}from"../../../../constants/url-prefix.mjs";import{useSticky as i}from"../../../../hooks/use-sticky.mjs";import a from"../../../../assets/icons/filter_dark.mjs";import o,{loadHiddenChannelIdsFromStorage as s}from"./channel-filter-dialog.mjs";import{defaultProps as c}from"./default-props.mjs";import{clsx as l}from"clsx";import{useEffect as u,useMemo as d,useState as f}from"react";import{Fragment as p,jsx as m,jsxs as h}from"react/jsx-runtime";import{usePathname as g}from"next/navigation";const _={};function v(e,t){let n=`${r.DOMAIN}/`,i=t.indexOf(n),a=i!==-1,o=a?t.slice(i+n.length).split(`/`)[0]:void 0;return e.isDefault?a&&o?`${r.DOMAIN}/${o}`:`/`:a&&o?`${r.DOMAIN}/${o}/${encodeURIComponent(e.name)}`:`${r.CHANNEL}/${encodeURIComponent(e.name)}`}function y(r){let{mode:y=`renderer`,styles:b,events:x,...S}=r,C=g()??`/`,w=y===`editor`,T=S||_,E={...c,...T},[D,O]=f(!1),{isSticky:k,ref:A}=i(),[j,M]=f(!1),[N,P]=f(E.list),F=d(()=>E.list.find(e=>e.isDefault)?.name??null,[E.list]),I=d(()=>E.currentChannelId??F,[E.currentChannelId,F]);u(()=>{let e=s();P(e?.length?E.list.filter(t=>!e.includes(t.name)):E.list)},[E.list]);let L=e=>{P(e)},R=(e,t)=>{x?.onChannelChange?.(e,t)},z=b?e(b,{}):void 0;return u(()=>{let e=()=>{let e=window.scrollY??document.documentElement.scrollTop??0,t=window.innerHeight,n=document.documentElement.scrollHeight;M(e+t>=n-1)};return window.addEventListener(`scroll`,e,{passive:!0}),e(),()=>{window.removeEventListener(`scroll`,e)}},[]),h(p,{children:[k&&m(t,{className:`w-full h-11`}),m(t,{as:`nav`,ref:A,className:l(`w-full transition-all duration-200`,w&&`pointer-events-none`,!E.isFullfeed&&k&&`fixed top-0 left-0 right-0 z-50`,!E.isFullfeed&&!k&&j&&`fixed bottom-0 left-0 right-0 z-50`,E.isFullfeed&&`fixed top-[54px] left-0 z-10 w-full`,!E.isFullfeed&&`bg-bg1`),style:z,children:h(t,{className:`relative flex items-center h-[44px]`,children:[m(t,{className:`flex-1 overflow-x-auto overflow-y-hidden [&::-webkit-scrollbar]:hidden`,style:{scrollbarWidth:`none`,msOverflowStyle:`none`,WebkitOverflowScrolling:`touch`},children:m(t,{className:`flex items-center h-full pl-4 pr-4 gap-4`,children:N.map((e,t)=>{let r=I===e.name||I===null&&t===0;return m(n,{href:v(e,C),className:l(`whitespace-nowrap cursor-pointer transition-all duration-200`,`flex items-center justify-center h-11`,`${r?`text-xl`:`text-base`}`),style:{fontWeight:r?`bold`:`normal`,color:r?`var(--color-theme5)`:`var(--color-text2)`},onClick:()=>R(e,t),children:e.name},e.name||`channel-${t}`)})})}),r.modifiable?m(t,{className:`flex items-center gap-[12px] px-[8px]`,children:m(t,{className:`flex items-center justify-center cursor-pointer w-7 h-8`,onClick:()=>{O(!0),x?.onFilterClick?.()},children:m(a,{className:`w-5 h-5`,style:{color:`var(--color-text1)`}})})}):null]})}),m(o,{open:D,onOpenChange:O,channels:E.list,currentChannelId:I,onChannelClick:R,onChannelsChange:L})]})}export{y as default};
|
|
2
|
+
"use client";import{mergeStyles as e}from"../../utils/styles/helpers.mjs";import{Box as t}from"../../../ui/box.mjs";import n from"../../../ui/link.mjs";import{urlPrefix as r}from"../../../../constants/url-prefix.mjs";import{useSticky as i}from"../../../../hooks/use-sticky.mjs";import a from"../../../../assets/icons/filter_dark.mjs";import o,{loadHiddenChannelIdsFromStorage as s}from"./channel-filter-dialog.mjs";import{defaultProps as c}from"./default-props.mjs";import{clsx as l}from"clsx";import{useEffect as u,useMemo as d,useState as f}from"react";import{Fragment as p,jsx as m,jsxs as h}from"react/jsx-runtime";import{usePathname as g}from"next/navigation";const _={};function v(e,t){let n=`${r.DOMAIN}/`,i=t.indexOf(n),a=i!==-1,o=a?t.slice(i+n.length).split(`/`)[0]:void 0;return e.isDefault?a&&o?`${r.DOMAIN}/${o}`:`/`:a&&o?`${r.DOMAIN}/${o}/${encodeURIComponent(e.name)}`:`${r.CHANNEL}/${encodeURIComponent(e.name)}`}function y(r){let{mode:y=`renderer`,styles:b,events:x,...S}=r,C=g()??`/`,w=y===`editor`,T=S||_,E={...c,...T},[D,O]=f(!1),{isSticky:k,ref:A}=i(),[j,M]=f(!1),[N,P]=f(E.list),F=d(()=>E.list.find(e=>e.isDefault)?.name??null,[E.list]),I=d(()=>E.currentChannelId??F,[E.currentChannelId,F]);u(()=>{let e=s();P(e?.length?E.list.filter(t=>!e.includes(t.name)):E.list)},[E.list]);let L=e=>{P(e)},R=(e,t)=>{x?.onChannelChange?.(e,t)},z=b?e(b,{}):void 0;return u(()=>{let e=()=>{let e=window.scrollY??document.documentElement.scrollTop??0,t=window.innerHeight,n=document.documentElement.scrollHeight;M(e+t>=n-1)};return window.addEventListener(`scroll`,e,{passive:!0}),e(),()=>{window.removeEventListener(`scroll`,e)}},[]),h(p,{children:[k&&m(t,{className:`w-full h-11`}),m(t,{as:`nav`,ref:A,className:l(`w-full transition-all duration-200`,w&&`pointer-events-none`,!E.isFullfeed&&k&&`fixed top-0 left-0 right-0 z-50`,!E.isFullfeed&&!k&&j&&`fixed bottom-0 left-0 right-0 z-50`,E.isFullfeed&&`fixed top-[54px] left-0 z-10 w-full`,!E.isFullfeed&&`bg-bg1`),style:z,children:h(t,{className:`relative flex items-center h-[44px]`,children:[m(t,{className:`flex-1 overflow-x-auto overflow-y-hidden [&::-webkit-scrollbar]:hidden`,style:{scrollbarWidth:`none`,msOverflowStyle:`none`,WebkitOverflowScrolling:`touch`},children:m(t,{className:`flex items-center h-full pl-4 pr-4 gap-4`,children:N.map((e,t)=>{let r=I===e.name||I===null&&t===0;return m(n,{href:v(e,C),webviewNavMode:`spa`,className:l(`whitespace-nowrap cursor-pointer transition-all duration-200`,`flex items-center justify-center h-11`,`${r?`text-xl`:`text-base`}`),style:{fontWeight:r?`bold`:`normal`,color:r?`var(--color-theme5)`:`var(--color-text2)`},onClick:()=>R(e,t),children:e.name},e.name||`channel-${t}`)})})}),r.modifiable?m(t,{className:`flex items-center gap-[12px] px-[8px]`,children:m(t,{className:`flex items-center justify-center cursor-pointer w-7 h-8`,onClick:()=>{O(!0),x?.onFilterClick?.()},children:m(a,{className:`w-5 h-5`,style:{color:`var(--color-text1)`}})})}):null]})}),m(o,{open:D,onOpenChange:O,channels:E.list,currentChannelId:I,onChannelClick:R,onChannelsChange:L})]})}export{y as default};
|
|
@@ -6,7 +6,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
|
|
|
6
6
|
//#region components/ui/badge.d.ts
|
|
7
7
|
/** badgeVariants 工具定义。 */
|
|
8
8
|
declare const badgeVariants: (props?: ({
|
|
9
|
-
variant?: "
|
|
9
|
+
variant?: "default" | "link" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
|
|
10
10
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
11
11
|
/** Badge 组件。 */
|
|
12
12
|
declare function Badge({
|
|
@@ -7,8 +7,8 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
|
|
|
7
7
|
//#region components/ui/button.d.ts
|
|
8
8
|
/** buttonVariants 工具定义。 */
|
|
9
9
|
declare const buttonVariants: (props?: ({
|
|
10
|
-
variant?: "
|
|
11
|
-
size?: "default" | "
|
|
10
|
+
variant?: "default" | "link" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
|
|
11
|
+
size?: "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
12
12
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
13
13
|
/** Button 组件属性。 */
|
|
14
14
|
type ButtonProps = Button.Props & VariantProps<typeof buttonVariants> & {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{useCallback as e,useEffect as t,useRef as n,useState as r}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";import{useTranslations as o}from"next-intl";const s=()=>a(`span`,{className:`inline-flex gap-1 ml-1`,children:[i(`span`,{className:`w-1 h-1 bg-current rounded-full animate-pulse`}),i(`span`,{className:`w-1 h-1 bg-current rounded-full animate-pulse animation-delay-200`}),i(`span`,{className:`w-1 h-1 bg-current rounded-full animate-pulse animation-delay-400`})]});function c({loadMore:c,hasMore:
|
|
2
|
+
"use client";import{useCallback as e,useEffect as t,useRef as n,useState as r}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";import{useTranslations as o}from"next-intl";const s=()=>a(`span`,{className:`inline-flex gap-1 ml-1`,children:[i(`span`,{className:`w-1 h-1 bg-current rounded-full animate-pulse`}),i(`span`,{className:`w-1 h-1 bg-current rounded-full animate-pulse animation-delay-200`}),i(`span`,{className:`w-1 h-1 bg-current rounded-full animate-pulse animation-delay-400`})]});function c(e){let t=window.getComputedStyle(e);return/auto|scroll|overlay/.test(t.overflowY)}function l(e){let t=e?.parentElement??null;for(;t;){if(c(t))return t;t=t.parentElement}return null}function u(e){return e?e.scrollTop:window.scrollY??document.documentElement.scrollTop??0}function d({loadMore:c,hasMore:d,threshold:f=0,loadingText:p,emptyText:m,noMoreText:h,failedText:g,children:_,className:v=``,disabled:y=!1,initialLoad:b=!1}){let x=o(`components.ui`),[S,C]=r(!1),[w,T]=r(!1),[E,D]=r(!1),O=n(null),k=n(null),A=n(!1),j=n(!1),M=n(-1),N=p??x(`infiniteScroll.loading`),P=g??x(`infiniteScroll.failed`),F=m??h??x(`infiniteScroll.noMore`),I=d!==!1,L=e(async(e,t)=>{if(!(y||A.current||!t&&!I)){A.current=!0,T(!0),D(!0),e&&C(!1);try{await c(e)}catch{C(!0)}finally{A.current=!1,T(!1)}}},[I,y,c]),R=e(async(e=!1)=>{await L(e,!1)},[L]);t(()=>{!b||j.current||(j.current=!0,L(!1,!0))},[L,b]),t(()=>{let e=O.current;if(!e||y)return;let t=l(e);k.current=t;let n=new IntersectionObserver(e=>{let t=e[0];if(t&&t.isIntersecting&&!A.current&&I){let e=u(k.current);if(e<=M.current)return;M.current=e,C(!1),R(!1)}},{root:t,rootMargin:`0px 0px ${f}px 0px`,threshold:0});return n.observe(e),()=>{k.current=null,n.disconnect()}},[y,R,I,f]);let z=()=>{C(!1),R(!0)};return y?i(`div`,{className:v,children:_}):a(`div`,{className:v,children:[_,a(`div`,{children:[i(`div`,{ref:O,className:`h-[10px]`,"aria-hidden":`true`}),I&&!S&&w&&a(`div`,{className:`flex items-center justify-center text-[12px] h-8.5`,children:[i(`span`,{className:`text-text2 mr-2`,children:N}),i(s,{})]}),S&&i(`div`,{className:`text-center text-theme5 cursor-pointer`,onClick:z,children:P}),d===!1&&!S&&i(`div`,{className:`text-center text-text3 pt-1.5 pb-3 border-text1/5 border-b`,children:F})]})]})}export{d as InfiniteScroll};
|