forma-ui 0.0.5 → 0.0.7
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/dist/Interfaces/dictionary.d.ts +25 -0
- package/dist/Interfaces/dictionary.js +8 -0
- package/dist/Interfaces/global.d.ts +21 -0
- package/dist/Interfaces/global.js +1 -0
- package/dist/Interfaces/meta.d.ts +39 -0
- package/dist/Interfaces/meta.js +8 -0
- package/dist/app/[lang]/stores/LangStore.d.ts +22 -0
- package/dist/app/[lang]/stores/LangStore.js +125 -0
- package/dist/components/icon/icon.d.ts +102 -2
- package/dist/components/icon/icon.js +402 -9
- package/dist/components/ui/Accordion.d.ts +1 -0
- package/dist/components/ui/Accordion.js +15 -6
- package/dist/components/ui/Button.d.ts +0 -0
- package/dist/components/ui/Button.js +1 -1
- package/dist/components/ui/CheckBox.d.ts +0 -0
- package/dist/components/ui/CheckBox.js +0 -0
- package/dist/components/ui/Input.d.ts +11 -10
- package/dist/components/ui/Input.js +175 -3
- package/dist/components/ui/Input.types.d.ts +45 -0
- package/dist/components/ui/Input.types.js +1 -0
- package/dist/components/ui/Modal.d.ts +9 -9
- package/dist/components/ui/Modal.js +51 -6
- package/dist/components/ui/RadioButton.d.ts +0 -0
- package/dist/components/ui/RadioButton.js +0 -0
- package/dist/components/ui/Table.d.ts +0 -0
- package/dist/components/ui/Table.js +0 -0
- package/dist/components/ui/Tabs.d.ts +0 -0
- package/dist/components/ui/Tabs.js +0 -0
- package/dist/configs/language.d.ts +39 -0
- package/dist/configs/language.js +50 -0
- package/dist/configs/metadata.d.ts +69 -0
- package/dist/configs/metadata.js +143 -0
- package/dist/dictionaries/en.json +0 -0
- package/dist/dictionaries/fa.json +0 -0
- package/dist/dictionaries/index.d.ts +0 -0
- package/dist/dictionaries/index.js +0 -0
- package/dist/hooks/useDevice.d.ts +21 -0
- package/dist/hooks/useDevice.js +49 -0
- package/dist/hooks/useTranslation.d.ts +4 -0
- package/dist/hooks/useTranslation.js +34 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.js +11 -1
- package/dist/libs/api/axiosClient.d.ts +9 -0
- package/dist/libs/api/axiosClient.js +34 -0
- package/dist/libs/api/cns.d.ts +16 -0
- package/dist/libs/api/cns.js +29 -0
- package/dist/libs/api/usePostFetch.d.ts +23 -0
- package/dist/libs/api/usePostFetch.js +17 -0
- package/dist/libs/cn.d.ts +1 -0
- package/dist/libs/cn.js +12 -0
- package/dist/libs/cookieUtils.d.ts +10 -0
- package/dist/libs/cookieUtils.js +28 -0
- package/dist/libs/detectComponentResponsive.d.ts +10 -0
- package/dist/libs/detectComponentResponsive.js +24 -0
- package/dist/libs/detectDeviceFromUA.d.ts +8 -0
- package/dist/libs/detectDeviceFromUA.js +14 -0
- package/dist/libs/fonts.d.ts +10 -0
- package/dist/libs/fonts.js +94 -0
- package/dist/libs/metadataHelper.d.ts +17 -0
- package/dist/libs/metadataHelper.js +20 -0
- package/dist/libs/modal/Modal.d.ts +9 -0
- package/dist/libs/modal/Modal.js +41 -0
- package/dist/libs/translation.d.ts +5 -0
- package/dist/libs/translation.js +30 -0
- package/dist/{lib → libs}/utils.d.ts +0 -0
- package/dist/{lib → libs}/utils.js +0 -0
- package/dist/locale/about/en.json +3 -0
- package/dist/locale/about/fa.json +3 -0
- package/dist/locale/coin/en.json +4 -0
- package/dist/locale/coin/fa.json +4 -0
- package/dist/locale/en.d.ts +56 -0
- package/dist/locale/en.js +16 -0
- package/dist/locale/fa.d.ts +59 -0
- package/dist/locale/fa.js +16 -0
- package/dist/locale/global/en.json +12 -0
- package/dist/locale/global/fa.json +16 -0
- package/dist/locale/home/en.json +11 -0
- package/dist/locale/home/fa.json +11 -0
- package/dist/locale/index.d.ts +201 -0
- package/dist/locale/index.js +7 -0
- package/dist/locale/meta/about/en.json +10 -0
- package/dist/locale/meta/about/fa.json +5 -0
- package/dist/locale/meta/en.json +15 -0
- package/dist/locale/meta/fa.json +15 -0
- package/dist/locale/meta/home/en.json +10 -0
- package/dist/locale/meta/home/fa.json +5 -0
- package/dist/middleware.d.ts +14 -0
- package/dist/middleware.js +57 -0
- package/dist/store/appStore.d.ts +1 -1
- package/dist/store/appStore.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/nextImageLoader.d.ts +9 -0
- package/dist/utils/nextImageLoader.js +15 -0
- package/package.json +10 -3
- package/README.md +0 -36
- package/dist/components/PostDetailPage.d.ts +0 -7
- package/dist/components/PostDetailPage.js +0 -47
- package/dist/components/PostPage.d.ts +0 -6
- package/dist/components/PostPage.js +0 -48
- package/dist/config/language.d.ts +0 -11
- package/dist/config/language.js +0 -6
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @Author: Mohammad Felfelani
|
|
3
|
+
* @Email: mfelfelani72@gmail.com
|
|
4
|
+
* @Team:
|
|
5
|
+
* @Date: 2025-10-08 10:05:47
|
|
6
|
+
* @Description:
|
|
7
|
+
*/
|
|
8
|
+
import { ImageLoaderProps } from "next/image";
|
|
9
|
+
export declare const nextImageLoader: ({ src, width, quality }: ImageLoaderProps) => string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @Author: Mohammad Felfelani
|
|
3
|
+
* @Email: mfelfelani72@gmail.com
|
|
4
|
+
* @Team:
|
|
5
|
+
* @Date: 2025-10-08 10:05:47
|
|
6
|
+
* @Description:
|
|
7
|
+
*/
|
|
8
|
+
export const nextImageLoader = ({ src, width, quality }) => {
|
|
9
|
+
const isExternal = src.startsWith("http://") || src.startsWith("https://");
|
|
10
|
+
const basePath = process.env.NODE_ENV === "production"
|
|
11
|
+
? process.env.NEXT_PUBLIC_BASE_PATH || ""
|
|
12
|
+
: "";
|
|
13
|
+
const finalSrc = isExternal ? src : `${basePath}${src}`;
|
|
14
|
+
return `${finalSrc}?w=${width}&q=${quality || 75}`;
|
|
15
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "forma-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -9,23 +9,30 @@
|
|
|
9
9
|
"private": false,
|
|
10
10
|
"scripts": {
|
|
11
11
|
"dev": "next dev --turbopack",
|
|
12
|
-
"build": "npm run build:dist",
|
|
13
12
|
"build:dist": "tsc -p tsconfig.build.json",
|
|
14
|
-
"build:server": "
|
|
13
|
+
"build:server": "next build",
|
|
14
|
+
"build": "npm run build:dist && npm run build:server",
|
|
15
15
|
"start": "next start",
|
|
16
16
|
"lint": "eslint"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
+
"axios": "^1.12.2",
|
|
19
20
|
"clsx": "^2.1.1",
|
|
21
|
+
"critters": "^0.0.25",
|
|
22
|
+
"elastic-apm-node": "^4.14.0",
|
|
23
|
+
"forma-ui": "^0.0.6",
|
|
24
|
+
"js-cookie": "^3.0.5",
|
|
20
25
|
"next": "15.5.4",
|
|
21
26
|
"react": "19.1.0",
|
|
22
27
|
"react-dom": "19.1.0",
|
|
28
|
+
"swr": "^2.3.6",
|
|
23
29
|
"tailwind-merge": "^3.3.1",
|
|
24
30
|
"zustand": "^5.0.8"
|
|
25
31
|
},
|
|
26
32
|
"devDependencies": {
|
|
27
33
|
"@eslint/eslintrc": "^3.3.1",
|
|
28
34
|
"@tailwindcss/postcss": "^4.1.13",
|
|
35
|
+
"@types/js-cookie": "^3.0.6",
|
|
29
36
|
"@types/node": "^20.19.17",
|
|
30
37
|
"@types/react": "^19.1.14",
|
|
31
38
|
"@types/react-dom": "^19.1.9",
|
package/README.md
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
|
|
2
|
-
|
|
3
|
-
## Getting Started
|
|
4
|
-
|
|
5
|
-
First, run the development server:
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm run dev
|
|
9
|
-
# or
|
|
10
|
-
yarn dev
|
|
11
|
-
# or
|
|
12
|
-
pnpm dev
|
|
13
|
-
# or
|
|
14
|
-
bun dev
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
|
18
|
-
|
|
19
|
-
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
|
20
|
-
|
|
21
|
-
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
|
|
22
|
-
|
|
23
|
-
## Learn More
|
|
24
|
-
|
|
25
|
-
To learn more about Next.js, take a look at the following resources:
|
|
26
|
-
|
|
27
|
-
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
|
28
|
-
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
|
29
|
-
|
|
30
|
-
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
|
|
31
|
-
|
|
32
|
-
## Deploy on Vercel
|
|
33
|
-
|
|
34
|
-
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
|
35
|
-
|
|
36
|
-
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useState } from "react";
|
|
4
|
-
import { useAppStore } from "../store/appStore";
|
|
5
|
-
import { getDictionary } from "../dictionaries";
|
|
6
|
-
import { useRouter, usePathname, useSearchParams } from "next/navigation";
|
|
7
|
-
import { languages } from "../config/language";
|
|
8
|
-
export const PostDetailPage = ({ id, lang }) => {
|
|
9
|
-
const storeLang = useAppStore((state) => state.lang);
|
|
10
|
-
const setLang = useAppStore((state) => state.setLang);
|
|
11
|
-
const [dict, setDict] = useState(null);
|
|
12
|
-
const router = useRouter();
|
|
13
|
-
const pathname = usePathname();
|
|
14
|
-
const searchParams = useSearchParams();
|
|
15
|
-
// تعیین زبان: prop اولویت دارد
|
|
16
|
-
const currentLang = lang !== null && lang !== void 0 ? lang : storeLang;
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
let isMounted = true;
|
|
19
|
-
getDictionary(currentLang).then((d) => {
|
|
20
|
-
if (isMounted)
|
|
21
|
-
setDict(d);
|
|
22
|
-
});
|
|
23
|
-
return () => {
|
|
24
|
-
isMounted = false;
|
|
25
|
-
};
|
|
26
|
-
}, [currentLang]);
|
|
27
|
-
const changeLang = (newLang) => {
|
|
28
|
-
if (newLang === currentLang)
|
|
29
|
-
return;
|
|
30
|
-
if (!lang) {
|
|
31
|
-
setLang(newLang);
|
|
32
|
-
const segments = pathname.split("/").slice(1);
|
|
33
|
-
if (segments.length > 0 && Object.keys(languages).includes(segments[0])) {
|
|
34
|
-
segments[0] = newLang;
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
segments.unshift(newLang);
|
|
38
|
-
}
|
|
39
|
-
const newPath = "/" + segments.join("/");
|
|
40
|
-
const search = searchParams.toString();
|
|
41
|
-
router.push(search ? `${newPath}?${search}` : newPath);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
if (!dict)
|
|
45
|
-
return _jsx("div", { children: "Loading..." });
|
|
46
|
-
return (_jsxs("div", { children: [_jsxs("h2", { children: [dict.posts.title, " - ", id] }), _jsx("p", { children: dict.posts.description }), !lang && (_jsxs("div", { children: [_jsx("button", { onClick: () => changeLang("fa"), children: "\u0641\u0627\u0631\u0633\u06CC" }), _jsx("button", { onClick: () => changeLang("en"), children: "English" })] }))] }));
|
|
47
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useState } from "react";
|
|
4
|
-
import { useAppStore } from "../store/appStore";
|
|
5
|
-
import { getDictionary } from "../dictionaries";
|
|
6
|
-
import { useRouter, usePathname, useSearchParams } from "next/navigation";
|
|
7
|
-
import { languages } from "../config/language";
|
|
8
|
-
export const PostsPage = ({ lang }) => {
|
|
9
|
-
const storeLang = useAppStore((state) => state.lang);
|
|
10
|
-
const setLang = useAppStore((state) => state.setLang);
|
|
11
|
-
const [dict, setDict] = useState(null);
|
|
12
|
-
const router = useRouter();
|
|
13
|
-
const pathname = usePathname();
|
|
14
|
-
const searchParams = useSearchParams();
|
|
15
|
-
// تصمیم میگیریم که کدام زبان استفاده شود: اول prop بعد store
|
|
16
|
-
const currentLang = lang !== null && lang !== void 0 ? lang : storeLang;
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
let isMounted = true;
|
|
19
|
-
getDictionary(currentLang).then((d) => {
|
|
20
|
-
if (isMounted)
|
|
21
|
-
setDict(d);
|
|
22
|
-
});
|
|
23
|
-
return () => {
|
|
24
|
-
isMounted = false;
|
|
25
|
-
};
|
|
26
|
-
}, [currentLang]);
|
|
27
|
-
const changeLang = (newLang) => {
|
|
28
|
-
if (newLang === currentLang)
|
|
29
|
-
return;
|
|
30
|
-
// فقط وقتی prop نیست، store و URL را تغییر بده
|
|
31
|
-
if (!lang) {
|
|
32
|
-
setLang(newLang);
|
|
33
|
-
const segments = pathname.split("/").slice(1);
|
|
34
|
-
if (segments.length > 0 && Object.keys(languages).includes(segments[0])) {
|
|
35
|
-
segments[0] = newLang;
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
segments.unshift(newLang);
|
|
39
|
-
}
|
|
40
|
-
const newPath = "/" + segments.join("/");
|
|
41
|
-
const search = searchParams.toString();
|
|
42
|
-
router.push(search ? `${newPath}?${search}` : newPath);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
if (!dict)
|
|
46
|
-
return _jsx("div", { children: "Loading..." });
|
|
47
|
-
return (_jsxs("div", { children: [_jsx("h2", { children: dict.posts.title }), _jsx("p", { children: dict.posts.description }), !lang && (_jsxs("div", { children: [_jsx("button", { onClick: () => changeLang("fa"), children: "\u0641\u0627\u0631\u0633\u06CC" }), _jsx("button", { onClick: () => changeLang("en"), children: "English" })] }))] }));
|
|
48
|
-
};
|