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.
Files changed (101) hide show
  1. package/dist/Interfaces/dictionary.d.ts +25 -0
  2. package/dist/Interfaces/dictionary.js +8 -0
  3. package/dist/Interfaces/global.d.ts +21 -0
  4. package/dist/Interfaces/global.js +1 -0
  5. package/dist/Interfaces/meta.d.ts +39 -0
  6. package/dist/Interfaces/meta.js +8 -0
  7. package/dist/app/[lang]/stores/LangStore.d.ts +22 -0
  8. package/dist/app/[lang]/stores/LangStore.js +125 -0
  9. package/dist/components/icon/icon.d.ts +102 -2
  10. package/dist/components/icon/icon.js +402 -9
  11. package/dist/components/ui/Accordion.d.ts +1 -0
  12. package/dist/components/ui/Accordion.js +15 -6
  13. package/dist/components/ui/Button.d.ts +0 -0
  14. package/dist/components/ui/Button.js +1 -1
  15. package/dist/components/ui/CheckBox.d.ts +0 -0
  16. package/dist/components/ui/CheckBox.js +0 -0
  17. package/dist/components/ui/Input.d.ts +11 -10
  18. package/dist/components/ui/Input.js +175 -3
  19. package/dist/components/ui/Input.types.d.ts +45 -0
  20. package/dist/components/ui/Input.types.js +1 -0
  21. package/dist/components/ui/Modal.d.ts +9 -9
  22. package/dist/components/ui/Modal.js +51 -6
  23. package/dist/components/ui/RadioButton.d.ts +0 -0
  24. package/dist/components/ui/RadioButton.js +0 -0
  25. package/dist/components/ui/Table.d.ts +0 -0
  26. package/dist/components/ui/Table.js +0 -0
  27. package/dist/components/ui/Tabs.d.ts +0 -0
  28. package/dist/components/ui/Tabs.js +0 -0
  29. package/dist/configs/language.d.ts +39 -0
  30. package/dist/configs/language.js +50 -0
  31. package/dist/configs/metadata.d.ts +69 -0
  32. package/dist/configs/metadata.js +143 -0
  33. package/dist/dictionaries/en.json +0 -0
  34. package/dist/dictionaries/fa.json +0 -0
  35. package/dist/dictionaries/index.d.ts +0 -0
  36. package/dist/dictionaries/index.js +0 -0
  37. package/dist/hooks/useDevice.d.ts +21 -0
  38. package/dist/hooks/useDevice.js +49 -0
  39. package/dist/hooks/useTranslation.d.ts +4 -0
  40. package/dist/hooks/useTranslation.js +34 -0
  41. package/dist/index.d.ts +9 -1
  42. package/dist/index.js +11 -1
  43. package/dist/libs/api/axiosClient.d.ts +9 -0
  44. package/dist/libs/api/axiosClient.js +34 -0
  45. package/dist/libs/api/cns.d.ts +16 -0
  46. package/dist/libs/api/cns.js +29 -0
  47. package/dist/libs/api/usePostFetch.d.ts +23 -0
  48. package/dist/libs/api/usePostFetch.js +17 -0
  49. package/dist/libs/cn.d.ts +1 -0
  50. package/dist/libs/cn.js +12 -0
  51. package/dist/libs/cookieUtils.d.ts +10 -0
  52. package/dist/libs/cookieUtils.js +28 -0
  53. package/dist/libs/detectComponentResponsive.d.ts +10 -0
  54. package/dist/libs/detectComponentResponsive.js +24 -0
  55. package/dist/libs/detectDeviceFromUA.d.ts +8 -0
  56. package/dist/libs/detectDeviceFromUA.js +14 -0
  57. package/dist/libs/fonts.d.ts +10 -0
  58. package/dist/libs/fonts.js +94 -0
  59. package/dist/libs/metadataHelper.d.ts +17 -0
  60. package/dist/libs/metadataHelper.js +20 -0
  61. package/dist/libs/modal/Modal.d.ts +9 -0
  62. package/dist/libs/modal/Modal.js +41 -0
  63. package/dist/libs/translation.d.ts +5 -0
  64. package/dist/libs/translation.js +30 -0
  65. package/dist/{lib → libs}/utils.d.ts +0 -0
  66. package/dist/{lib → libs}/utils.js +0 -0
  67. package/dist/locale/about/en.json +3 -0
  68. package/dist/locale/about/fa.json +3 -0
  69. package/dist/locale/coin/en.json +4 -0
  70. package/dist/locale/coin/fa.json +4 -0
  71. package/dist/locale/en.d.ts +56 -0
  72. package/dist/locale/en.js +16 -0
  73. package/dist/locale/fa.d.ts +59 -0
  74. package/dist/locale/fa.js +16 -0
  75. package/dist/locale/global/en.json +12 -0
  76. package/dist/locale/global/fa.json +16 -0
  77. package/dist/locale/home/en.json +11 -0
  78. package/dist/locale/home/fa.json +11 -0
  79. package/dist/locale/index.d.ts +201 -0
  80. package/dist/locale/index.js +7 -0
  81. package/dist/locale/meta/about/en.json +10 -0
  82. package/dist/locale/meta/about/fa.json +5 -0
  83. package/dist/locale/meta/en.json +15 -0
  84. package/dist/locale/meta/fa.json +15 -0
  85. package/dist/locale/meta/home/en.json +10 -0
  86. package/dist/locale/meta/home/fa.json +5 -0
  87. package/dist/middleware.d.ts +14 -0
  88. package/dist/middleware.js +57 -0
  89. package/dist/store/appStore.d.ts +1 -1
  90. package/dist/store/appStore.js +1 -1
  91. package/dist/tsconfig.build.tsbuildinfo +1 -1
  92. package/dist/utils/nextImageLoader.d.ts +9 -0
  93. package/dist/utils/nextImageLoader.js +15 -0
  94. package/package.json +10 -3
  95. package/README.md +0 -36
  96. package/dist/components/PostDetailPage.d.ts +0 -7
  97. package/dist/components/PostDetailPage.js +0 -47
  98. package/dist/components/PostPage.d.ts +0 -6
  99. package/dist/components/PostPage.js +0 -48
  100. package/dist/config/language.d.ts +0 -11
  101. 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.5",
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": "tsc -p tsconfig.server.json",
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,7 +0,0 @@
1
- import { Lang } from "../config/language";
2
- interface PostDetailPageProps {
3
- id: string;
4
- lang?: Lang;
5
- }
6
- export declare const PostDetailPage: ({ id, lang }: PostDetailPageProps) => import("react/jsx-runtime").JSX.Element;
7
- export {};
@@ -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,6 +0,0 @@
1
- import { Lang } from "../config/language";
2
- interface PostsPageProps {
3
- lang?: Lang;
4
- }
5
- export declare const PostsPage: ({ lang }: PostsPageProps) => import("react/jsx-runtime").JSX.Element;
6
- export {};
@@ -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
- };
@@ -1,11 +0,0 @@
1
- export declare const languages: {
2
- readonly en: {
3
- readonly dir: "ltr";
4
- readonly name: "English";
5
- };
6
- readonly fa: {
7
- readonly dir: "rtl";
8
- readonly name: "فارسی";
9
- };
10
- };
11
- export type Lang = keyof typeof languages;
@@ -1,6 +0,0 @@
1
- // src/config/language.ts
2
- export const languages = {
3
- en: { dir: "ltr", name: "English" },
4
- fa: { dir: "rtl", name: "فارسی" },
5
- // زبان‌های دیگر اضافه کنید
6
- };