@funhub/platform 0.1.52 → 0.1.53
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 +0 -13
- package/dist/biz.d.mts +8 -10
- package/dist/biz.mjs +1 -1
- package/dist/components/biz/business/banner/variants/basic-banner/material.d.mts +1 -1
- package/dist/components/biz/business/banner-carousel/material.d.mts +1 -1
- package/dist/components/biz/business/channel-list/material.d.mts +1 -1
- package/dist/components/biz/business/detail/materials/registry.d.mts +7 -6
- package/dist/components/biz/business/detail/materials/runtime-context-provider.mjs +2 -0
- package/dist/components/biz/business/detail/materials/video-detail-actions/client.d.mts +0 -2
- package/dist/components/biz/business/detail/materials/video-detail-actions/client.mjs +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-actions/material.d.mts +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-actions/schema.d.mts +1 -5
- package/dist/components/biz/business/detail/materials/video-detail-info/client.d.mts +0 -4
- package/dist/components/biz/business/detail/materials/video-detail-info/client.mjs +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-info/material.d.mts +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-info/schema.d.mts +1 -7
- package/dist/components/biz/business/detail/materials/video-detail-info-title/client.d.mts +0 -1
- package/dist/components/biz/business/detail/materials/video-detail-info-title/client.mjs +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-info-title/material.d.mts +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-info-title/schema.d.mts +1 -4
- package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/client.d.mts +0 -3
- package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/client.mjs +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/material.d.mts +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/schema.d.mts +1 -6
- package/dist/components/biz/business/detail/materials/video-detail-player/client.d.mts +0 -3
- package/dist/components/biz/business/detail/materials/video-detail-player/client.mjs +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-player/material.d.mts +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-player/schema.d.mts +1 -6
- package/dist/components/biz/business/detail/materials/video-detail-recommend/client.d.mts +1 -2
- package/dist/components/biz/business/detail/materials/video-detail-recommend/client.mjs +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-recommend/material.d.mts +2 -1
- package/dist/components/biz/business/detail/materials/video-detail-recommend/schema.d.mts +2 -3
- package/dist/components/biz/business/detail/materials/video-detail-recommend/schema.mjs +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-recommend/utils.mjs +1 -1
- package/dist/components/biz/business/floating-ball/material.d.mts +1 -1
- package/dist/components/biz/business/header-search/header-avatar-icon/material.d.mts +1 -1
- package/dist/components/biz/business/header-search/header-avatar-logo-search/material.d.mts +1 -1
- package/dist/components/biz/business/header-search/header-avatar-logo-search-icon/material.d.mts +1 -1
- package/dist/components/biz/business/header-search/header-logo-search/material.d.mts +1 -1
- package/dist/components/biz/business/header-search/header-search/material.d.mts +1 -1
- package/dist/components/biz/business/home-recommend/index.d.mts +4 -6
- package/dist/components/biz/business/home-recommend/shared/home-recommend-base.mjs +1 -1
- package/dist/components/biz/business/home-recommend/shared/home-recommend-default-config.mjs +2 -0
- package/dist/components/biz/business/home-recommend/shared/home-recommend-feed-mode.mjs +2 -0
- package/dist/components/biz/business/home-recommend/shared/home-recommend-preview.mjs +1 -1
- package/dist/components/biz/business/home-recommend/shared/home-recommend-server-data.mjs +2 -0
- package/dist/components/biz/business/home-recommend/shared/home-recommend-video-detail.mjs +2 -0
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/index.d.mts +2 -3
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/index.mjs +1 -1
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/inspector-schema.d.mts +35 -1
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/inspector-schema.mjs +1 -1
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/material.d.mts +29 -3
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/material.mjs +1 -1
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/runtime/prefetch-client.d.mts +27 -0
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/runtime/prefetch-client.mjs +2 -0
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/schema/index.mjs +1 -1
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/server.d.mts +3 -6
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/server.mjs +1 -1
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/index.d.mts +2 -3
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/index.mjs +1 -1
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/inspector-schema.d.mts +30 -2
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/inspector-schema.mjs +1 -1
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/material.d.mts +26 -4
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/material.mjs +1 -1
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/runtime/prefetch-client.d.mts +27 -0
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/runtime/prefetch-client.mjs +2 -0
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/schema/index.mjs +1 -1
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/server.d.mts +3 -6
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/server.mjs +1 -1
- package/dist/components/biz/business/index.d.mts +11 -13
- package/dist/components/biz/business/large-feature-grid/card-item.mjs +1 -1
- package/dist/components/biz/business/large-feature-grid/material.d.mts +2 -2
- package/dist/components/biz/business/marquee/material.d.mts +1 -1
- package/dist/components/biz/business/profile/profile-header/material.d.mts +2 -2
- package/dist/components/biz/business/profile/profile-header/user-profile-avatar.mjs +1 -1
- package/dist/components/biz/business/profile/profile-header/user-profile-cover-background.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/material.d.mts +1 -1
- package/dist/components/biz/business/search-history/material.d.mts +1 -1
- package/dist/components/biz/business/search-input/material.d.mts +1 -1
- package/dist/components/biz/business/shortcut-grid/material.d.mts +1 -1
- package/dist/components/biz/business/tab-bar/material.d.mts +2 -2
- package/dist/components/biz/business/tab-bar/schema.d.mts +1 -1
- package/dist/components/biz/business/text-recommend/material.d.mts +1 -1
- package/dist/components/biz/business/video-horizontal-list/material.d.mts +1 -1
- package/dist/components/biz/example/button/material.d.mts +1 -1
- package/dist/components/biz/example/button/material.mjs +1 -1
- package/dist/components/biz/utils/transformers/data.mjs +1 -1
- package/dist/components/common/cards/mini-three-card.mjs +1 -1
- package/dist/components/pages/(follow)/_components/follow-button/index.mjs +1 -1
- package/dist/components/pages/login/password.mjs +1 -1
- package/dist/components/pages/login/register.mjs +1 -1
- package/dist/components/pages/login/reset-password.mjs +1 -1
- package/dist/components/pages/login/verify.mjs +1 -1
- package/dist/components/pages/search-result/page-client.mjs +1 -1
- package/dist/components/pages/search-result/search-all.mjs +1 -1
- package/dist/components/pages/search-result/search-tab.mjs +1 -1
- package/dist/components/pages/search-result/search-user.mjs +1 -1
- package/dist/components/pages/search-result/search-video.mjs +1 -1
- package/dist/components/pages/settings/_components/reset-password-drawer.mjs +1 -1
- package/dist/components/pages/settings/_components/settings.mjs +1 -1
- package/dist/components/pages/video-detail/video-detail-client.mjs +1 -1
- package/dist/components/ui/badge.d.mts +1 -1
- package/dist/components/ui/button.d.mts +1 -1
- package/dist/components/ui/image.d.mts +4 -4
- package/dist/i18n/locales/en.mjs +1 -1
- package/dist/i18n/locales/zh-CN.mjs +1 -1
- package/dist/service/content-batch-get-video-detail.d.mts +21 -0
- package/dist/service/content-batch-get-video-detail.mjs +2 -0
- package/dist/service.d.mts +2 -1
- package/dist/service.mjs +1 -1
- package/dist/utils/schema/index.d.mts +1 -1
- package/dist/utils/schema/material.d.mts +9 -7
- package/dist/utils/schema/utils.d.mts +3 -13
- package/dist/utils/schema/utils.mjs +1 -1
- package/dist/utils.d.mts +2 -3
- package/dist/utils.mjs +1 -1
- package/package.json +2 -7
- package/bin/index.mjs +0 -323
- package/dist/assets/images/user/default_avatar.mjs +0 -2
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/defaults/default-props.d.mts +0 -10
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/defaults/default-props.mjs +0 -2
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/runtime/client.d.mts +0 -20
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/runtime/client.mjs +0 -2
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/schema/props.schema.mjs +0 -2
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/defaults/default-props.d.mts +0 -8
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/defaults/default-props.mjs +0 -2
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/runtime/client.d.mts +0 -20
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/runtime/client.mjs +0 -2
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/schema/props.schema.mjs +0 -2
- package/dist/utils/password-validator.d.mts +0 -28
- package/dist/utils/password-validator.mjs +0 -2
- package/templates/base/_meta.json +0 -4
- package/templates/base/template/README.md.template +0 -32
- package/templates/base/template/__dot__gitignore +0 -6
- package/templates/base/template/app/[locale]/layout.tsx.template +0 -36
- package/templates/base/template/app/[locale]/page.tsx.template +0 -24
- package/templates/base/template/app/globals.css +0 -26
- package/templates/base/template/app/layout.tsx.template +0 -38
- package/templates/base/template/eslint.config.mjs.template +0 -68
- package/templates/base/template/i18n/request.ts.template +0 -3
- package/templates/base/template/next-env.d.ts.template +0 -4
- package/templates/base/template/next.config.ts.template +0 -21
- package/templates/base/template/package.json.template +0 -37
- package/templates/base/template/postcss.config.js.template +0 -18
- package/templates/base/template/proxy.ts.template +0 -18
- package/templates/base/template/tailwind.config.cjs.template +0 -13
- package/templates/base/template/tsconfig.json.template +0 -43
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { BaseComponentProps } from "../../../../../utils/types/component.mjs";
|
|
3
|
-
import "../../../../../utils/index.mjs";
|
|
4
|
-
import { MaterialComponentMode } from "../../../../../../../utils/schema/schema.mjs";
|
|
5
|
-
import "../../../../../../../utils/schema/index.mjs";
|
|
6
|
-
import { HomeRecommendData } from "../../../types.mjs";
|
|
7
|
-
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
8
|
-
|
|
9
|
-
//#region components/biz/business/home-recommend/variants/home-recommend-waterfall/runtime/client.d.ts
|
|
10
|
-
/**
|
|
11
|
-
* 首页推荐瀑布流布局。
|
|
12
|
-
*/
|
|
13
|
-
declare function HomeRecommendWaterfallClient({
|
|
14
|
-
mode,
|
|
15
|
-
...props
|
|
16
|
-
}: BaseComponentProps<HomeRecommendData> & {
|
|
17
|
-
mode?: MaterialComponentMode;
|
|
18
|
-
}): react_jsx_runtime0.JSX.Element;
|
|
19
|
-
//#endregion
|
|
20
|
-
export { HomeRecommendWaterfallClient };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
"use client";import e from"../../../shared/home-recommend-base.mjs";import{buildHomeRecommendEditorPreviewData as t}from"../../../shared/home-recommend-preview.mjs";import{useMemo as n}from"react";import{jsx as r}from"react/jsx-runtime";function i({mode:i=`renderer`,...a}){let o=i===`editor`,s=a.props||{},c=n(()=>o?t({variant:`waterfall`,schemaTitle:s.title,enableInfinite:s.enableInfinite,data:a.data}):a.data,[o,a.data,s.enableInfinite,s.title]);return r(`div`,{className:o?`pointer-events-none`:void 0,children:r(e,{variant:`waterfall`,mode:i,...a,data:c})})}export{i as default};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region utils/password-validator.d.ts
|
|
3
|
-
declare const PASSWORD_MIN_LENGTH = 8;
|
|
4
|
-
declare const PASSWORD_MAX_LENGTH = 32;
|
|
5
|
-
declare const PASSWORD_ALLOWED_SPECIAL_CHARS = "!@#$%^&*+-=()[]{}_,.:;<>\"'`";
|
|
6
|
-
type PasswordValidationType = 'none' | 'too-short' | 'too-long' | 'need-two-types' | 'invalid-char' | 'not-match';
|
|
7
|
-
interface PasswordValidationResult {
|
|
8
|
-
type: PasswordValidationType;
|
|
9
|
-
invalidChar: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* 获取密码校验错误文案。
|
|
13
|
-
*/
|
|
14
|
-
declare function getPasswordValidationErrorText(result: PasswordValidationResult): string;
|
|
15
|
-
/**
|
|
16
|
-
* 计算密码包含的字符类型数量(字母/数字/符号)。
|
|
17
|
-
*/
|
|
18
|
-
declare function getPasswordCharacterTypeCount(value: string): number;
|
|
19
|
-
/**
|
|
20
|
-
* 查找首个非法字符。
|
|
21
|
-
*/
|
|
22
|
-
declare function getFirstInvalidPasswordChar(value: string): string;
|
|
23
|
-
/**
|
|
24
|
-
* 密码双字段校验。
|
|
25
|
-
*/
|
|
26
|
-
declare function validatePasswordPair(password: string, confirmPassword: string): PasswordValidationResult;
|
|
27
|
-
//#endregion
|
|
28
|
-
export { PASSWORD_ALLOWED_SPECIAL_CHARS, PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, PasswordValidationResult, PasswordValidationType, getFirstInvalidPasswordChar, getPasswordCharacterTypeCount, getPasswordValidationErrorText, validatePasswordPair };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
const e=8,t=32,n=`!@#$%^&*+-=()[]{}_,.:;<>"'\``;function r(e){switch(e.type){case`too-short`:return`密码至少 8 位`;case`too-long`:return`密码不能超过 32 位`;case`need-two-types`:return`密码需包含字母、数字或符号中的至少两种`;case`invalid-char`:return`密码包含不支持的字符 "${e.invalidChar}"`;case`not-match`:return`两次输入的密码不一致`;default:return``}}function i(e){let t=!1,r=!1,i=!1;for(let a of e){if(/[A-Z]/i.test(a)){t=!0;continue}if(/\d/.test(a)){r=!0;continue}n.includes(a)&&(i=!0)}return Number(t)+Number(r)+Number(i)}function a(e){for(let t of e)if(!/[A-Z]/i.test(t)&&!/\d/.test(t)&&!n.includes(t))return t;return``}function o(e,t){if(e.length===0||t.length===0)return{type:`none`,invalidChar:``};if(e.length<8)return{type:`too-short`,invalidChar:``};if(e.length>32)return{type:`too-long`,invalidChar:``};if(i(e)<2)return{type:`need-two-types`,invalidChar:``};let n=a(e);return n?{type:`invalid-char`,invalidChar:n}:e===t?{type:`none`,invalidChar:``}:{type:`not-match`,invalidChar:``}}export{n as PASSWORD_ALLOWED_SPECIAL_CHARS,t as PASSWORD_MAX_LENGTH,e as PASSWORD_MIN_LENGTH,a as getFirstInvalidPasswordChar,i as getPasswordCharacterTypeCount,r as getPasswordValidationErrorText,o as validatePasswordPair};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# {{PROJECT_NAME}}
|
|
2
|
-
|
|
3
|
-
基于 `@funhub/platform` 初始化的 Next.js Starter。
|
|
4
|
-
|
|
5
|
-
## 开始使用
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
pnpm install
|
|
9
|
-
pnpm dev
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
## 可用命令
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
pnpm dev
|
|
16
|
-
pnpm build
|
|
17
|
-
pnpm start
|
|
18
|
-
pnpm lint
|
|
19
|
-
pnpm typecheck
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## 目录说明
|
|
23
|
-
|
|
24
|
-
- `app/`: Next App Router 路由
|
|
25
|
-
- `i18n/`: next-intl 请求配置
|
|
26
|
-
- `proxy.ts`: 国际化路由中间件
|
|
27
|
-
|
|
28
|
-
## 依赖说明
|
|
29
|
-
|
|
30
|
-
- `@funhub/platform`: SDK 主包
|
|
31
|
-
- `@funhub/platform/config/tailwind`: Tailwind 预设与内容扫描配置
|
|
32
|
-
- `@funhub/platform/theme.css`: 平台主题变量
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import { FunhubProvider, LocaleSync } from '@funhub/platform/components/common';
|
|
3
|
-
import { defaultLocale, getMessages, isValidLocale, locales } from '@funhub/platform/i18n';
|
|
4
|
-
import { setRequestLocale } from 'next-intl/server';
|
|
5
|
-
|
|
6
|
-
interface LocaleLayoutProps {
|
|
7
|
-
children: ReactNode
|
|
8
|
-
params: Promise<{ locale: string }>
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* 预生成支持的语言参数。
|
|
13
|
-
*/
|
|
14
|
-
export function generateStaticParams() {
|
|
15
|
-
return locales.map(item => ({ locale: item.code }));
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* 语言布局负责注入平台 Provider 与国际化上下文。
|
|
20
|
-
*/
|
|
21
|
-
export default async function LocaleLayout({ children, params }: LocaleLayoutProps) {
|
|
22
|
-
const { locale } = await params;
|
|
23
|
-
const validLocale = isValidLocale(locale) ? locale : defaultLocale;
|
|
24
|
-
|
|
25
|
-
setRequestLocale(validLocale);
|
|
26
|
-
const messages = getMessages(validLocale);
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<>
|
|
30
|
-
<LocaleSync locale={validLocale} />
|
|
31
|
-
<FunhubProvider intl={{ locale: validLocale, messages }}>
|
|
32
|
-
{children}
|
|
33
|
-
</FunhubProvider>
|
|
34
|
-
</>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Button } from '@funhub/platform/components/biz';
|
|
2
|
-
import { DebugLocaleSwitcher } from '@funhub/platform/components/common';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Starter 首页,展示平台组件已接入成功。
|
|
6
|
-
*/
|
|
7
|
-
export default function HomePage() {
|
|
8
|
-
return (
|
|
9
|
-
<main className='min-h-screen bg-bg1 px-6 py-10 text-text1'>
|
|
10
|
-
<section className='mx-auto flex max-w-xl flex-col gap-4 rounded-3xl bg-bg2 p-6 shadow-sm'>
|
|
11
|
-
<span className='text-sm text-text3'>@funhub/platform starter</span>
|
|
12
|
-
<h1 className='text-2xl font-semibold'>{'{{PROJECT_NAME}}'}</h1>
|
|
13
|
-
<p className='text-sm leading-6 text-text2'>
|
|
14
|
-
这个项目已经接入平台主题、Tailwind 预设、next-intl 和 FunhubProvider,
|
|
15
|
-
你可以直接开始组合页面组件、业务组件或物料渲染能力。
|
|
16
|
-
</p>
|
|
17
|
-
<div className='flex flex-wrap gap-3 pt-2'>
|
|
18
|
-
<Button text='平台按钮已就绪' variant='red' disabled={false} />
|
|
19
|
-
<DebugLocaleSwitcher />
|
|
20
|
-
</div>
|
|
21
|
-
</section>
|
|
22
|
-
</main>
|
|
23
|
-
);
|
|
24
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
@tailwind base;
|
|
2
|
-
@tailwind components;
|
|
3
|
-
@tailwind utilities;
|
|
4
|
-
|
|
5
|
-
html {
|
|
6
|
-
font-size: 16px;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
body {
|
|
10
|
-
font-family: var(--font-sans), Arial, Helvetica, sans-serif;
|
|
11
|
-
-webkit-text-size-adjust: 100%;
|
|
12
|
-
-moz-text-size-adjust: 100%;
|
|
13
|
-
-ms-text-size-adjust: 100%;
|
|
14
|
-
text-size-adjust: 100%;
|
|
15
|
-
background: var(--color-bg1);
|
|
16
|
-
color: var(--color-text1);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
* {
|
|
20
|
-
box-sizing: border-box;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
a {
|
|
24
|
-
color: inherit;
|
|
25
|
-
text-decoration: none;
|
|
26
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { Metadata, Viewport } from 'next';
|
|
2
|
-
import { ThemeSync } from '@funhub/platform/components/common';
|
|
3
|
-
import { defaultLocale } from '@funhub/platform/i18n';
|
|
4
|
-
import '@funhub/platform/theme.css';
|
|
5
|
-
import './globals.css';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Starter 应用默认 viewport 配置。
|
|
9
|
-
*/
|
|
10
|
-
export const viewport: Viewport = {
|
|
11
|
-
width: 'device-width',
|
|
12
|
-
initialScale: 1,
|
|
13
|
-
viewportFit: 'cover',
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Starter 应用的站点元信息。
|
|
18
|
-
*/
|
|
19
|
-
export const metadata: Metadata = {
|
|
20
|
-
title: '{{PROJECT_NAME}}',
|
|
21
|
-
description: 'A starter app powered by @funhub/platform',
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* 根布局负责挂载主题和全局样式。
|
|
26
|
-
*/
|
|
27
|
-
export default function RootLayout({ children }: Readonly<{ children: React.ReactNode }>) {
|
|
28
|
-
const theme = 'dark';
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<html lang={defaultLocale} className={theme} data-prefers-color-scheme={theme}>
|
|
32
|
-
<body suppressHydrationWarning>
|
|
33
|
-
<ThemeSync defaultTheme={theme} />
|
|
34
|
-
{children}
|
|
35
|
-
</body>
|
|
36
|
-
</html>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { antfu } from '@antfu/eslint-config';
|
|
2
|
-
|
|
3
|
-
export function react(options = {}) {
|
|
4
|
-
return antfu({
|
|
5
|
-
react: true,
|
|
6
|
-
ignores: [
|
|
7
|
-
'**/*.md',
|
|
8
|
-
'.next/**',
|
|
9
|
-
'out/**',
|
|
10
|
-
'build/**',
|
|
11
|
-
'public',
|
|
12
|
-
'next-env.d.ts',
|
|
13
|
-
...(options.ignores || []),
|
|
14
|
-
],
|
|
15
|
-
rules: {
|
|
16
|
-
'react-hooks/exhaustive-deps': 'error',
|
|
17
|
-
'eslint-comments/no-unlimited-disable': 'off',
|
|
18
|
-
'no-redeclare': 'off',
|
|
19
|
-
'jsdoc/require-returns-description': 'off',
|
|
20
|
-
'@typescript-eslint/no-redeclare': 'off',
|
|
21
|
-
'style/quotes': ['warn', 'single'],
|
|
22
|
-
'style/jsx-quotes': ['warn', 'prefer-single'],
|
|
23
|
-
'node/prefer-global/process': 'off',
|
|
24
|
-
'style/semi': ['warn', 'always'],
|
|
25
|
-
'package-json/valid-package-def': 'off',
|
|
26
|
-
'@eslint-react/no-missing-key': 'warn',
|
|
27
|
-
'no-restricted-syntax': 'off',
|
|
28
|
-
'react-hooks-extra/no-direct-set-state-in-use-effect': 'off',
|
|
29
|
-
'import/no-anonymous-default-export': 'off',
|
|
30
|
-
'eqeqeq': 'warn',
|
|
31
|
-
'ts/no-use-before-define': ['warn', { functions: false, variables: false }],
|
|
32
|
-
'no-use-before-define': ['warn', { functions: false, variables: false }],
|
|
33
|
-
'no-console': 'warn',
|
|
34
|
-
'unicorn/prefer-math-trunc': 'off',
|
|
35
|
-
'unicorn/prefer-dom-node-remove': 'off',
|
|
36
|
-
'@typescript-eslint/no-unsafe-function-type': 'off',
|
|
37
|
-
'no-empty': 'off',
|
|
38
|
-
'@typescript-eslint/no-empty-object-type': 'warn',
|
|
39
|
-
'unicorn/prefer-query-selector': 0,
|
|
40
|
-
'regexp/no-super-linear-backtracking': 0,
|
|
41
|
-
'regexp/no-useless-assertions': 0,
|
|
42
|
-
'unicorn/no-new-array': 0,
|
|
43
|
-
'@typescript-eslint/method-signature-style': 0,
|
|
44
|
-
'unicorn/prefer-code-point': 'warn',
|
|
45
|
-
'unicorn/no-object-as-default-parameter': 'warn',
|
|
46
|
-
'unused-imports/no-unused-vars': 'warn',
|
|
47
|
-
'@eslint-react/no-unstable-default-props': 'warn',
|
|
48
|
-
'unicorn/prefer-regexp-test': 'warn',
|
|
49
|
-
'no-unsafe-optional-chaining': 'warn',
|
|
50
|
-
'unicorn/prefer-logical-operator-over-ternary': 'warn',
|
|
51
|
-
'arrow-body-style': 0,
|
|
52
|
-
'unicorn/no-array-callback-reference': 0,
|
|
53
|
-
'prefer-regex-literals': 0,
|
|
54
|
-
'regexp/optimal-quantifier-concatenation': 'warn',
|
|
55
|
-
'unicorn/prefer-string-slice': 0,
|
|
56
|
-
'array-callback-return': 0,
|
|
57
|
-
'regexp/no-unused-capturing-group': 1,
|
|
58
|
-
'unicorn/no-anonymous-default-export': 0,
|
|
59
|
-
'unicorn/no-magic-array-flat-depth': 1,
|
|
60
|
-
'react-refresh/only-export-components': 0,
|
|
61
|
-
'react/no-array-index-key': 0,
|
|
62
|
-
'package-json/valid-name': 0,
|
|
63
|
-
...(options.rules || {}),
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export default react();
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { NextConfig } from 'next';
|
|
2
|
-
import createNextIntlPlugin from 'next-intl/plugin';
|
|
3
|
-
|
|
4
|
-
const withNextIntl = createNextIntlPlugin('./i18n/request.ts');
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Starter 应用的 Next 配置。
|
|
8
|
-
*/
|
|
9
|
-
const nextConfig: NextConfig = {
|
|
10
|
-
transpilePackages: ['@funhub/platform'],
|
|
11
|
-
images: {
|
|
12
|
-
remotePatterns: [
|
|
13
|
-
{
|
|
14
|
-
protocol: 'https',
|
|
15
|
-
hostname: '*',
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export default withNextIntl(nextConfig);
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "{{PACKAGE_NAME}}",
|
|
3
|
-
"version": "0.1.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"scripts": {
|
|
6
|
-
"dev": "next dev",
|
|
7
|
-
"build": "next build",
|
|
8
|
-
"start": "next start",
|
|
9
|
-
"lint": "eslint .",
|
|
10
|
-
"fix": "eslint . --fix",
|
|
11
|
-
"typecheck": "tsc --noEmit"
|
|
12
|
-
},
|
|
13
|
-
"dependencies": {
|
|
14
|
-
"@funhub/platform": "{{PLATFORM_VERSION}}",
|
|
15
|
-
"@tanstack/react-query": "^5.90.16",
|
|
16
|
-
"next": "16.1.6",
|
|
17
|
-
"next-intl": "^4.8.2",
|
|
18
|
-
"react": "19.2.0",
|
|
19
|
-
"react-dom": "19.2.0"
|
|
20
|
-
},
|
|
21
|
-
"devDependencies": {
|
|
22
|
-
"@antfu/eslint-config": "^7.4.3",
|
|
23
|
-
"@eslint-react/eslint-plugin": "^2.12.4",
|
|
24
|
-
"@types/node": "^20.19.17",
|
|
25
|
-
"@types/react": "^19.2.2",
|
|
26
|
-
"@types/react-dom": "^19.2.2",
|
|
27
|
-
"autoprefixer": "^10.4.23",
|
|
28
|
-
"eslint": "^10.0.0",
|
|
29
|
-
"eslint-plugin-react-hooks": "^7.0.1",
|
|
30
|
-
"eslint-plugin-react-refresh": "^0.5.0",
|
|
31
|
-
"postcss": "^8.5.6",
|
|
32
|
-
"postcss-nesting": "^13.0.2",
|
|
33
|
-
"postcss-px-to-viewport-8-plugin": "^1.2.5",
|
|
34
|
-
"tailwindcss": "^3.4.19",
|
|
35
|
-
"typescript": "^5.9.2"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
plugins: {
|
|
3
|
-
'postcss-nesting': {},
|
|
4
|
-
'tailwindcss': {},
|
|
5
|
-
'autoprefixer': {},
|
|
6
|
-
'postcss-px-to-viewport-8-plugin': {
|
|
7
|
-
unitToConvert: 'px',
|
|
8
|
-
viewportUnit: 'vw',
|
|
9
|
-
unitPrecision: 6,
|
|
10
|
-
fontViewportUnit: 'vw',
|
|
11
|
-
selectorBlackList: [],
|
|
12
|
-
minPixelValue: 1,
|
|
13
|
-
mediaQuery: false,
|
|
14
|
-
replace: true,
|
|
15
|
-
viewportWidth: 430,
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { NextRequest } from 'next/server';
|
|
2
|
-
import { routing } from '@funhub/platform/i18n';
|
|
3
|
-
import createMiddleware from 'next-intl/middleware';
|
|
4
|
-
|
|
5
|
-
const handleI18nRouting = createMiddleware(routing);
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* 处理 Starter 应用的国际化路由。
|
|
9
|
-
* @param {NextRequest} request
|
|
10
|
-
*/
|
|
11
|
-
export default async function middleware(request: NextRequest) {
|
|
12
|
-
const response = handleI18nRouting(request);
|
|
13
|
-
return response;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const config = {
|
|
17
|
-
matcher: '/((?!api|trpc|_next|_vercel|.*\\..*).*)',
|
|
18
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/** @type {import('tailwindcss').Config} */
|
|
2
|
-
const {
|
|
3
|
-
platformTailwindPreset,
|
|
4
|
-
withPlatformTailwindContent,
|
|
5
|
-
} = require('@funhub/platform/config/tailwind');
|
|
6
|
-
|
|
7
|
-
module.exports = {
|
|
8
|
-
content: withPlatformTailwindContent([
|
|
9
|
-
'./app/**/*.{js,ts,jsx,tsx}',
|
|
10
|
-
'./components/**/*.{js,ts,jsx,tsx}',
|
|
11
|
-
]),
|
|
12
|
-
presets: [platformTailwindPreset],
|
|
13
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"incremental": true,
|
|
4
|
-
"target": "ES2017",
|
|
5
|
-
"jsx": "react-jsx",
|
|
6
|
-
"lib": [
|
|
7
|
-
"dom",
|
|
8
|
-
"dom.iterable",
|
|
9
|
-
"esnext"
|
|
10
|
-
],
|
|
11
|
-
"module": "esnext",
|
|
12
|
-
"moduleResolution": "bundler",
|
|
13
|
-
"paths": {
|
|
14
|
-
"@/*": [
|
|
15
|
-
"./*"
|
|
16
|
-
]
|
|
17
|
-
},
|
|
18
|
-
"resolveJsonModule": true,
|
|
19
|
-
"allowJs": true,
|
|
20
|
-
"strict": true,
|
|
21
|
-
"noEmit": true,
|
|
22
|
-
"esModuleInterop": true,
|
|
23
|
-
"forceConsistentCasingInFileNames": true,
|
|
24
|
-
"isolatedModules": true,
|
|
25
|
-
"skipLibCheck": true,
|
|
26
|
-
"plugins": [
|
|
27
|
-
{
|
|
28
|
-
"name": "next"
|
|
29
|
-
}
|
|
30
|
-
]
|
|
31
|
-
},
|
|
32
|
-
"include": [
|
|
33
|
-
"next-env.d.ts",
|
|
34
|
-
"**/*.ts",
|
|
35
|
-
"**/*.tsx",
|
|
36
|
-
".next/types/**/*.ts",
|
|
37
|
-
".next/dev/types/**/*.ts",
|
|
38
|
-
"**/*.mts"
|
|
39
|
-
],
|
|
40
|
-
"exclude": [
|
|
41
|
-
"node_modules"
|
|
42
|
-
]
|
|
43
|
-
}
|