injast-core 1.0.80 → 1.0.82

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.
@@ -2,33 +2,93 @@
2
2
 
3
3
  ## Base Spacing
4
4
 
5
- The theme sets Material UI spacing to 4px increments.
5
+ The theme sets Material UI spacing to 4px increments. Use numeric `sx` values so spacing stays on this scale.
6
6
 
7
- | Value | Pixel equivalent |
8
- |---:|---:|
9
- | `1` | 4px |
10
- | `2` | 8px |
11
- | `3` | 12px |
12
- | `4` | 16px |
13
- | `6` | 24px |
14
- | `8` | 32px |
7
+ | `sx` value | Pixel equivalent | Common use |
8
+ |---:|---:|---|
9
+ | `0.5` | 2px | Hairline label/icon nudge only |
10
+ | `1` | 4px | Tiny icon or table-cell gap |
11
+ | `1.5` | 6px | Compact chip vertical padding |
12
+ | `2` | 8px | Tight internal gap, button/icon spacing |
13
+ | `3` | 12px | Field group gap, chip horizontal padding |
14
+ | `3.5` | 14px | Mobile side padding used by drawers/toasts |
15
+ | `4` | 16px | Default section padding and content gap |
16
+ | `5` | 20px | Dense page block spacing |
17
+ | `6` | 24px | Major section gap and drawer vertical rhythm |
18
+ | `8` | 32px | Large page break only |
15
19
 
16
- Use `sx` spacing props such as `p`, `px`, `py`, `m`, `gap`, `rowGap`, and `columnGap`.
20
+ Use `p`, `px`, `py`, `m`, `mx`, `my`, `gap`, `rowGap`, and `columnGap` instead of arbitrary CSS margins.
21
+
22
+ ## App Shell
23
+
24
+ Use this for generated mobile-first app screens:
25
+
26
+ ```tsx
27
+ <Box
28
+ sx={{
29
+ maxWidth: 520,
30
+ mx: "auto",
31
+ minHeight: "100dvh",
32
+ bgcolor: "neutral.50",
33
+ }}
34
+ >
35
+ {children}
36
+ </Box>
37
+ ```
38
+
39
+ Equivalent CSS:
40
+
41
+ ```css
42
+ max-width: 520px;
43
+ margin-inline: auto;
44
+ ```
45
+
46
+ Rules:
47
+
48
+ - Center the shell with `mx: "auto"` or `margin-inline: auto`.
49
+ - Keep the shell full width below 520px.
50
+ - Use `minHeight: "100dvh"` for app-like screens.
51
+ - Apply page padding inside the shell, not on `body`.
52
+ - Use wider layouts only for data-heavy desktop dashboards, large tables, or split-pane workflows.
53
+
54
+ ## Page Padding and Gaps
55
+
56
+ | Context | Recommended spacing |
57
+ |---|---|
58
+ | Mobile page side padding | `px: 4` (16px) |
59
+ | Dense page side padding | `px: 3.5` (14px) |
60
+ | Page top/bottom padding | `py: 4` to `py: 6` (16px to 24px) |
61
+ | Major sections | `gap: 4` to `gap: 6` (16px to 24px) |
62
+ | Related form fields | `gap: 3` to `gap: 4` (12px to 16px) |
63
+ | Label/helper text to field | `gap: 1` to `gap: 2` (4px to 8px) |
64
+ | Inline icon to label | `gap: 2` (8px) |
65
+ | Toolbar actions | `gap: 2` to `gap: 3` (8px to 12px) |
66
+ | Modal content blocks | `gap: 4` (16px) |
67
+ | Drawer content | `px: 3.5`, `py: 6` (14px, 24px) |
17
68
 
18
69
  ## Component Sizing
19
70
 
20
- - Default form controls and medium buttons are 48px tall.
21
- - Large buttons are 56px tall.
22
- - Small buttons and dense controls are 40px tall.
23
- - Extra small buttons are 32px tall.
24
- - Standard field radius is 8px.
25
- - Button radius is 8px or 12px depending on size.
26
- - Modal paper radius is 12px.
27
-
28
- ## Layout Rules
29
-
30
- - Use `Box`, `Container`, and `Grid` for spacing and layout.
31
- - Use 16px to 24px gaps between major sections.
32
- - Use 8px to 12px gaps inside compact controls and field groups.
33
- - Keep repeated cards and table rows stable in height.
34
- - Avoid nested cards unless the inner card is a true repeated item or modal content.
71
+ | Component or pattern | Size |
72
+ |---|---:|
73
+ | Default text fields | 48px height |
74
+ | `Button` `L` | 56px height, 12px radius |
75
+ | `Button` `M` | 48px height, 12px radius |
76
+ | `Button` `S` | 40px height, 8px radius |
77
+ | `Button` `XS` | 32px height, 8px radius |
78
+ | Small IconButton target | 32px minimum |
79
+ | Standard icon action target | 40px to 48px |
80
+ | OTP input cell | 54px by 54px |
81
+ | Checkbox icon | 24px by default |
82
+ | Toggle small | 48px by 26px |
83
+ | Toggle medium | 59px by 32px |
84
+ | Progress bar default | 20px height |
85
+ | Modal paper radius | 12px |
86
+ | Text field radius | 8px |
87
+
88
+ ## Density Rules
89
+
90
+ - Keep default forms at 48px control height.
91
+ - Use 40px controls only in dense toolbars, tables, or secondary rows.
92
+ - Use 32px controls only for compact inline actions or modal footer secondary actions.
93
+ - Keep repeated rows stable in height; do not let hover states or labels shift layout.
94
+ - Avoid nested cards. Use spacing, headings, and dividers before adding another framed surface.
@@ -2,32 +2,55 @@
2
2
 
3
3
  ## Fonts
4
4
 
5
- Load `injast-core/fonts.css` once. The theme uses:
5
+ Load `injast-core/fonts.css` once. The package includes Persian-friendly fonts:
6
6
 
7
- - `IRANYekanX` for standard Persian UI text
8
- - `IRANYekanXFaNum` where Persian numerals are preferred
7
+ - `IRANYekanX` for standard Persian UI text.
8
+ - `IRANYekanXFaNum` where Persian numerals are preferred.
9
9
 
10
- ## Scale
10
+ `SPAThemeProvider` uses `IRANYekanXFaNum` by default. `ThemeProvider` uses `IRANYekanX` by default. Do not replace the font family in generated screens unless the user explicitly asks.
11
11
 
12
- Use the theme typography scale through components. Important roles:
12
+ ## Theme Scale
13
13
 
14
- | Role | Size | Weight | Use for |
14
+ Use `Typography` from `injast-core` and theme typography variants.
15
+
16
+ | Variant | Size | Weight | Use for |
15
17
  |---|---:|---:|---|
16
- | `display1` | 32px | 700 | Rare page-level display headings |
17
- | `display2` | 24px | 700 | Page headings |
18
- | `display3` | 20px | 700 | Section headings |
18
+ | `display1` | 32px | 700 | Rare top-level display heading |
19
+ | `display2` | 24px | 700 | Main page heading in roomy screens |
20
+ | `display3` | 20px | 700 | Section title or modal title |
19
21
  | `h1` | 18px | 500 | Dense page title |
20
- | `h2` | 16px | 500 | Panel heading |
21
- | `h3` | 14px | 500 | Small heading |
22
+ | `h2` | 16px | 500 | Panel, drawer, and modal heading |
23
+ | `h3` | 14px | 500 | Small section heading |
24
+ | `title1` | 16px | 500 | Card title or list group title |
25
+ | `title2` | 14px | 500 | Compact card/list title |
26
+ | `title3` | 12px | 500 | Small title or table metadata |
27
+ | `title4` | 10px | 500 | Very compact label title |
28
+ | `input1` | 16px | 500 | Large input text |
29
+ | `input2` | 14px | 500 | Default input text |
30
+ | `input3` | 12px | 500 | Compact input text |
31
+ | `button1` | 16px | 700 | Large and medium button text |
32
+ | `button2` | 14px | 700 | Small button text |
33
+ | `button3` | 12px | 700 | Extra small button text |
22
34
  | `body1` | 14px | 500 | Default body text |
23
- | `body2` | 12px | 500 | Secondary text |
24
- | `label1` | 12px | 400 | Captions and field metadata |
35
+ | `body2` | 12px | 500 | Secondary body text and metadata |
36
+ | `label1` | 12px | 400 | Captions, helper text, field metadata |
25
37
  | `label2` | 10px | 400 | Compact labels only |
26
38
 
27
- ## Rules
39
+ ## Usage Rules
28
40
 
29
- - Use `Typography` from `injast-core` for text hierarchy.
30
- - Do not use oversized hero text inside app screens.
31
- - Use concise labels in buttons and form controls.
32
- - Keep numeric content readable; use Persian number formatting utilities when appropriate.
41
+ - Use `display1`, `display2`, and `display3` sparingly. App screens should not look like landing pages.
42
+ - Use `h1` or `display3` for most mobile page titles.
43
+ - Use `h2` for drawer and modal titles.
44
+ - Use `body1` for readable content and form helper paragraphs.
45
+ - Use `body2`, `label1`, and `label2` only for secondary metadata.
46
+ - Use concise Persian labels for buttons and fields. Avoid long button text that wraps.
47
+ - Keep numeric content readable and use Persian number utilities when values are shown to users.
33
48
  - Do not set negative letter spacing.
49
+ - Do not scale font size with viewport width.
50
+ - Do not place hero-scale text inside cards, tables, drawers, or modals.
51
+
52
+ ## Alignment
53
+
54
+ - Persian and RTL text should be right-aligned by default.
55
+ - Numeric codes, OTP digits, card numbers, and Latin-only values can use `dir="ltr"` and centered or left alignment when needed.
56
+ - Keep table headers and body cells right-aligned unless the column is numeric, currency, or an action column.
@@ -0,0 +1,141 @@
1
+ # Runtime, Hooks, Utilities, and Services
2
+
3
+ Use this file before adding API clients, error handling, toast calls, date conversion, query strings, logging, Sentry, WebView bridge behavior, or shared hooks.
4
+
5
+ ## Hooks
6
+
7
+ Import hooks from `injast-core/hooks` or from the package root when available.
8
+
9
+ ```tsx
10
+ import { useErrorHandler, useMessage } from "injast-core/hooks";
11
+ ```
12
+
13
+ | Hook | Use for |
14
+ |---|---|
15
+ | `useMessage` | Showing app-level toast messages through `MessageProvider` |
16
+ | `useErrorHandler` | Converting API errors into toast messages and form field errors |
17
+ | `useWebOtpListener` | Listening for Web OTP when the environment supports it |
18
+ | `useTheme` | Reading the active Material UI theme |
19
+ | `useColorScheme` | Reading or controlling MUI color scheme state |
20
+ | `useLocalStorage` | Local storage-backed state from `@wojtekmaj/react-hooks` |
21
+ | `useWindowHeight`, `useWindowWidth` | Responsive measurements when CSS/container queries are not enough |
22
+
23
+ Rules:
24
+
25
+ - `useMessage` and `useErrorHandler` require `MessageProvider` above the component tree.
26
+ - Use `useErrorHandler` in forms and service-driven screens instead of writing one-off toast parsing.
27
+ - When using React Hook Form, pass its `setError` as the field handler to `handleError`.
28
+ - Keep generated hooks client-side when they depend on `window`, `document`, `navigator`, local storage, or Web OTP.
29
+
30
+ ## Error Handling Pattern
31
+
32
+ ```tsx
33
+ const { handleError } = useErrorHandler<FormValues>();
34
+
35
+ try {
36
+ await submitForm(values);
37
+ } catch (error) {
38
+ handleError(error, setError);
39
+ }
40
+ ```
41
+
42
+ `useErrorHandler` shows string errors as an error toast. If the API returns field errors, it can pass each field error to the provided field handler.
43
+
44
+ ## Messages
45
+
46
+ Use `useMessage` for deliberate app messages:
47
+
48
+ ```tsx
49
+ const { showMessage } = useMessage();
50
+
51
+ showMessage("با موفقیت ثبت شد", "success");
52
+ ```
53
+
54
+ Valid severities are `success`, `info`, `warning`, and `error`. Keep messages concise and Persian when the app content is Persian.
55
+
56
+ ## API Requests
57
+
58
+ Use `createApiRequest` from `injast-core/libs` for Axios clients. It wraps `axios`:
59
+
60
+ ```tsx
61
+ import { createApiRequest } from "injast-core/libs";
62
+
63
+ export const apiRequest = createApiRequest({
64
+ baseURL: process.env.NEXT_PUBLIC_API_URL,
65
+ });
66
+ ```
67
+
68
+ Rules:
69
+
70
+ - Keep one shared API client per API base.
71
+ - Use request/response interceptors through the helper arguments when auth, redirects, or response normalization are needed.
72
+ - The helper defaults to JSON headers and `withCredentials: true`.
73
+ - In browser clients, it reads auth tokens from local storage unless `disableAuthHeader` is set.
74
+ - Do not create unrelated raw Axios instances when `createApiRequest` fits the app.
75
+
76
+ ## Query Strings
77
+
78
+ Use `createQueryParams` from `injast-core/utils` instead of hand-building query strings.
79
+
80
+ ```tsx
81
+ import { createQueryParams } from "injast-core/utils";
82
+
83
+ const endpoint = `/chats/messages?${createQueryParams({ category, page })}`;
84
+ ```
85
+
86
+ `createQueryParams` skips empty values and URL-encodes values. Do not pass nested objects to it.
87
+
88
+ ## Dates and Persian Formatting
89
+
90
+ Use the package utilities for Jalali/Gregorian conversion and Persian display:
91
+
92
+ | Utility | Use for |
93
+ |---|---|
94
+ | `gregorianToJalali` | Convert `YYYY-MM-DD` Gregorian values for display |
95
+ | `jalaliToGregorian` | Convert `YYYY/MM/DD` Jalali values before API submission |
96
+ | `shortDateFormat` | Compact Persian date display |
97
+ | `longDateFormat` | Persian date plus time display |
98
+ | `longFormatInWords` | Human-readable Persian date wording |
99
+ | `getPersianYMD` | Extract Persian calendar year/month/day from a `Date` |
100
+ | `jalaliToDateUTC` | Build UTC dates from Jalali year/month/day |
101
+ | `formatPersianNumber` | Display numbers in Persian format |
102
+ | `toLatinDigits` | Normalize Persian/Arabic digits before validation or API submission |
103
+ | `convertRialToToman` | Currency conversion for Iranian money displays |
104
+
105
+ Rules:
106
+
107
+ - Do not hand-roll Jalali conversion, Persian digit conversion, or query-string serialization.
108
+ - Store API values in the format the API expects; convert at the UI boundary.
109
+ - Use `toLatinDigits` before validating numeric user input when Persian digits are allowed.
110
+ - `formatPersianNumber` returns an empty string for non-finite input.
111
+ - `convertRialToToman` should be used before display only when the product copy expects Toman rather than Rial.
112
+
113
+ `coreFaIR` is the exported MUI Persian locale option, re-exported from MUI `faIR`. Use it in `SPAThemeProvider` theme options:
114
+
115
+ ```tsx
116
+ const options = {
117
+ ...coreFaIR,
118
+ };
119
+ ```
120
+
121
+ ## App and WebView Helpers
122
+
123
+ | Utility | Use for |
124
+ |---|---|
125
+ | `getClaims` | Reading decoded auth claims when the app stores compatible tokens |
126
+ | `checkUser` | User/auth guard checks in app flows |
127
+ | `postToParent` | Posting events from embedded or WebView contexts |
128
+ | `delay` | Small async waits in controlled UI flows |
129
+ | `styled` | Injast-styled helper for components that need styled wrappers |
130
+
131
+ Use WebView bridge helpers only in client components and only after checking the host environment.
132
+
133
+ ## Logging and Observability
134
+
135
+ Use `createLogger` from `injast-core/libs` for optional prefixed logging and iOS WebView console bridging.
136
+
137
+ Use `initSentry` and `Sentry` from `injast-core/libs` only when the app is configured for Sentry. These helpers wrap `@sentry/react`. Do not initialize Sentry in generated prototypes unless the user asks for observability setup or the app already has DSN/environment configuration.
138
+
139
+ ## Constants
140
+
141
+ Use `defaultColors` from `injast-core/constants` or the package root for palette values. Use `stepConnectorClasses` only when customizing Stepper connector styling; otherwise rely on the Stepper defaults.
@@ -16,6 +16,16 @@ injast
16
16
 
17
17
  Then select the public unscoped package `injast-core`. If exact search for `injast-core` returns unrelated `core` packages first, use `injast` as the search term. Do not search for or install `@alimohammadiwork/injast-core` or `@make-kits/injast-core-make-kit` for this public package path.
18
18
 
19
+ ## Figma MCP
20
+
21
+ For design-driven implementation, use the Figma MCP server and fetch both structured design context and a screenshot before writing code. The local MCP endpoint is:
22
+
23
+ ```text
24
+ http://127.0.0.1:3845/mcp
25
+ ```
26
+
27
+ Translate the MCP output into Injast Core patterns, RTL layout, Persian copy, and the Gold reference app structure. Do not keep generic generated React, Tailwind classes, raw controls, or decorative mobile OS status bars from the design payload.
28
+
19
29
  ## Required Imports
20
30
 
21
31
  Import the font stylesheet once near the app root:
@@ -24,10 +34,54 @@ Import the font stylesheet once near the app root:
24
34
  import "injast-core/fonts.css";
25
35
  ```
26
36
 
27
- For Vite, React SPA, and Figma Make, wrap the app with `SPAThemeProvider`:
37
+ Use root imports for normal Make output:
38
+
39
+ ```tsx
40
+ import {
41
+ Button,
42
+ MessageProvider,
43
+ SPAThemeProvider,
44
+ ThemeProvider,
45
+ coreFaIR,
46
+ defaultColors,
47
+ } from "injast-core";
48
+ ```
49
+
50
+ Use `iconsax-react` for generated app icons:
51
+
52
+ ```tsx
53
+ import { Add, Calendar, CloseCircle, SearchNormal1 } from "iconsax-react";
54
+ ```
55
+
56
+ Do not import icons from Lucide, Heroicons, Font Awesome, inline SVG files, or `@mui/icons-material` in generated app screens.
57
+
58
+ ## App Colors
59
+
60
+ Every provider requires `appColors.primary` and `appColors.secondary`:
61
+
62
+ ```tsx
63
+ const appColors = {
64
+ primary: {
65
+ main: "#1DBF98",
66
+ light: "#1DBF98",
67
+ dark: "#179D76",
68
+ contrastText: "#ffffff",
69
+ },
70
+ secondary: {
71
+ main: "#4F545E",
72
+ light: "#91969F",
73
+ dark: "#242933",
74
+ contrastText: "#ffffff",
75
+ },
76
+ };
77
+ ```
78
+
79
+ ## Figma Make and React SPA Provider
80
+
81
+ For Vite, React SPA, and Figma Make, wrap the app with `SPAThemeProvider`, pass RTL direction, apply Persian locale options, and include `MessageProvider` inside the theme:
28
82
 
29
83
  ```tsx
30
- import { SPAThemeProvider, coreFaIR, defaultColors } from "injast-core";
84
+ import { MessageProvider, SPAThemeProvider, coreFaIR } from "injast-core";
31
85
  import "injast-core/fonts.css";
32
86
 
33
87
  const appColors = {
@@ -45,23 +99,117 @@ const appColors = {
45
99
  },
46
100
  };
47
101
 
102
+ const options = {
103
+ ...coreFaIR,
104
+ };
105
+
48
106
  export function AppProviders({ children }: { children: React.ReactNode }) {
49
107
  return (
50
- <SPAThemeProvider
51
- dir="rtl"
52
- appColors={appColors}
53
- themeOptions={{ ...coreFaIR }}
54
- >
55
- {children}
108
+ <SPAThemeProvider dir="rtl" appColors={appColors} themeOptions={options}>
109
+ <MessageProvider>{children}</MessageProvider>
56
110
  </SPAThemeProvider>
57
111
  );
58
112
  }
59
113
  ```
60
114
 
61
- Use `ThemeProvider` only when a project specifically needs the alternate provider API:
115
+ ## Next.js Provider
116
+
117
+ For Next.js client layouts or app providers, use `ThemeProvider`. Keep `MessageProvider` inside the theme provider and `Suspense` inside `MessageProvider`:
118
+
119
+ ```tsx
120
+ "use client";
121
+
122
+ import { MessageProvider, ThemeProvider } from "injast-core";
123
+ import "injast-core/fonts.css";
124
+ import { Suspense } from "react";
125
+
126
+ const appColors = {
127
+ primary: {
128
+ main: "#1DBF98",
129
+ light: "#1DBF98",
130
+ dark: "#179D76",
131
+ contrastText: "#ffffff",
132
+ },
133
+ secondary: {
134
+ main: "#4F545E",
135
+ light: "#91969F",
136
+ dark: "#242933",
137
+ contrastText: "#ffffff",
138
+ },
139
+ };
140
+
141
+ export function Providers({ children }: { children: React.ReactNode }) {
142
+ return (
143
+ <ThemeProvider dir="rtl" appColors={appColors}>
144
+ <MessageProvider>
145
+ <Suspense>{children}</Suspense>
146
+ </MessageProvider>
147
+ </ThemeProvider>
148
+ );
149
+ }
150
+ ```
151
+
152
+ If an existing Next.js app keeps `Suspense` around the whole provider component, keep `ThemeProvider` and `MessageProvider` together and do not split toast/message consumers outside `MessageProvider`.
153
+
154
+ ## Next.js Viewport
155
+
156
+ For mobile app-like products, lock the viewport scale in `app/layout.tsx` or the relevant Next.js layout module:
62
157
 
63
158
  ```tsx
64
- import { ThemeProvider } from "injast-core";
159
+ import type { Viewport } from "next";
160
+
161
+ export const viewport: Viewport = {
162
+ width: "device-width",
163
+ initialScale: 1.0,
164
+ maximumScale: 1.0,
165
+ userScalable: false,
166
+ };
167
+ ```
168
+
169
+ ## App Shell
170
+
171
+ Generated mobile-first app roots should use a centered shell. In Next.js App Router, the root layout can apply the shell directly to `<body>`:
172
+
173
+ ```tsx
174
+ import { defaultColors } from "injast-core";
175
+
176
+ export default function RootLayout({ children }: { children: React.ReactNode }) {
177
+ return (
178
+ <html lang="fa" dir="rtl">
179
+ <body
180
+ style={{
181
+ backgroundColor: defaultColors.neutral[100],
182
+ maxWidth: "520px",
183
+ marginInline: "auto",
184
+ }}
185
+ >
186
+ <Providers>{children}</Providers>
187
+ </body>
188
+ </html>
189
+ );
190
+ }
191
+ ```
192
+
193
+ Inside generated pages, use the same centered constraint with Injast layout primitives:
194
+
195
+ ```tsx
196
+ <Box
197
+ sx={{
198
+ maxWidth: 520,
199
+ mx: "auto",
200
+ minHeight: "100dvh",
201
+ bgcolor: "neutral.50",
202
+ }}
203
+ >
204
+ {children}
205
+ </Box>
206
+ ```
207
+
208
+ Equivalent CSS is allowed for the outer shell:
209
+
210
+ ```css
211
+ max-width: 520px;
212
+ margin-inline: auto;
65
213
  ```
66
214
 
67
215
  ## Import Patterns
@@ -78,12 +226,19 @@ Subpath imports are valid for focused files:
78
226
  import { Button, TextField } from "injast-core/components";
79
227
  import { defaultColors } from "injast-core/constants";
80
228
  import { createApiRequest } from "injast-core/libs";
81
- import { formatPersianNumber } from "injast-core/utils";
229
+ import { useErrorHandler, useMessage } from "injast-core/hooks";
230
+ import { createQueryParams, formatPersianNumber } from "injast-core/utils";
82
231
  ```
83
232
 
233
+ Read `guidelines/runtime.md` before using hooks, API helpers, date helpers, Persian-number utilities, local storage/window hooks, Sentry, logger helpers, or WebView bridge helpers.
234
+
84
235
  ## Build Assumptions
85
236
 
86
237
  - The package is ESM and Vite-compatible.
87
238
  - React 18 is the default target for Figma Make. React 19 is also allowed by the package peer dependency range for non-Figma consumers.
88
239
  - CSS imports from dependencies must be allowed because `MobileDatePicker` imports `react-multi-date-picker` CSS.
89
240
  - Do not add custom Tailwind setup for Injast Core. Styling comes from Material UI theme, component `sx` props, and package CSS.
241
+ - Do not change package exports, public component APIs, or provider APIs in generated examples.
242
+ - Injast Core wraps Material UI (`@mui/material`), Emotion (`@emotion/react`, `@emotion/cache`, `@emotion/styled`), and RTL Stylis (`stylis`, `stylis-plugin-rtl`). Do not install or configure separate theme/cache providers unless the host app already owns that setup.
243
+ - Use package exports only: root, `components`, `providers`, `hooks`, `libs`, `utils`, `context`, `constants`, `types`, and `fonts.css`.
244
+ - Build generated examples as wired app flows. Connect navigation, drawer/modal open and close behavior, and submit/confirm actions with local state when no backend exists.
@@ -0,0 +1,60 @@
1
+ # Types
2
+
3
+ Import shared types from `injast-core/types` only when they improve type safety in app code. Do not copy package type definitions into generated apps.
4
+
5
+ ```tsx
6
+ import type { AppColors, ApiResponse, SelectChangeEvent } from "injast-core/types";
7
+ ```
8
+
9
+ ## Theme and Color Types
10
+
11
+ | Type | Use for |
12
+ |---|---|
13
+ | `ColorShades` | A palette object with `main`, `light`, `dark`, optional numbered shades, and optional `contrastText` |
14
+ | `AppColors` | The required `primary` and `secondary` object passed to `ThemeProvider` and `SPAThemeProvider` |
15
+ | `DefaultColors` | The full built-in semantic palette shape |
16
+ | `CorePalette` | Combined app and default palette shape |
17
+
18
+ Use `AppColors` when defining reusable `appColors` constants.
19
+
20
+ ## API and Error Types
21
+
22
+ | Type | Use for |
23
+ |---|---|
24
+ | `QueryParamsObj` | Flat query-string objects accepted by query helpers |
25
+ | `ApiResponse<T>` | Standard API response shape with `meta` and `data` |
26
+ | `ErrorFields` | Field-level API validation errors |
27
+ | `ErrorData` | API error payload consumed by `useErrorHandler` |
28
+
29
+ Use these types with service modules and form submit handlers. Keep API data models in the app domain when they are app-specific.
30
+
31
+ ## MUI and DataGrid Types
32
+
33
+ | Type | Use for |
34
+ |---|---|
35
+ | `SelectChangeEvent<T>` | Typed MUI select change events |
36
+ | `MRT_ColumnDef`, `MRT_RowData`, `MRT_TableOptions`, `MRT_TableInstance`, `MRT_Row` | Common `DataGrid` and Material React Table types |
37
+ | Other `MRT_*` re-exports | Advanced DataGrid customization only |
38
+
39
+ Prefer importing common DataGrid types directly from `injast-core` when the root export provides them:
40
+
41
+ ```tsx
42
+ import { DataGrid, type MRT_ColumnDef } from "injast-core";
43
+ ```
44
+
45
+ ## Window and WebView Types
46
+
47
+ | Type | Use for |
48
+ |---|---|
49
+ | `DeviceInfo` | Device metadata received from native hosts |
50
+ | `AndroidPageName` | Native Android navigation targets |
51
+ | `PermissionsArray` | Native permission code arrays |
52
+ | `IframeMessages` | Messages posted to or from iframe/webview contexts |
53
+
54
+ Use these only in client-side integration code. Check that `window`, `window.webkit`, or `window.injast_android_app` exists before calling native bridge methods.
55
+
56
+ ## Typography Module Types
57
+
58
+ The package augments MUI typography variants for `display1`, `display2`, `display3`, `title1` through `title4`, `input1` through `input3`, `button1` through `button3`, `body1`, `body2`, `label1`, and `label2`.
59
+
60
+ Use these variants through `Typography`; do not redeclare the module augmentation in generated apps.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "injast-core",
3
- "version": "1.0.80",
3
+ "version": "1.0.82",
4
4
  "description": "Reusable Injast React and Material UI components, providers, hooks, utilities, and design tokens.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -9,6 +9,7 @@
9
9
  "files": [
10
10
  "dist",
11
11
  "guidelines",
12
+ "skills",
12
13
  "README.md",
13
14
  "LICENSE"
14
15
  ],