@flipova/foundation 1.12.1 → 1.14.0
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/CHANGELOG.md +9 -4
- package/LICENSE +21 -21
- package/README.md +215 -197
- package/dist/chunk-2XORADW6.js +24552 -0
- package/dist/chunk-2XORADW6.js.map +1 -0
- package/dist/chunk-52BHHF5M.js +46 -0
- package/dist/chunk-52BHHF5M.js.map +1 -0
- package/dist/{chunk-MLFQD3PV.mjs → chunk-5647JY7Z.mjs} +4 -4
- package/dist/chunk-5647JY7Z.mjs.map +1 -0
- package/dist/{chunk-O7UP2OZR.js → chunk-7QFZMGL6.js} +1971 -93
- package/dist/chunk-7QFZMGL6.js.map +1 -0
- package/dist/{chunk-4KNPSB67.js → chunk-ASZEP37D.js} +2 -2
- package/dist/chunk-ASZEP37D.js.map +1 -0
- package/dist/chunk-BH5SU2JQ.mjs +8282 -0
- package/dist/chunk-BH5SU2JQ.mjs.map +1 -0
- package/dist/{chunk-ETR75HWU.mjs → chunk-BO65GO53.mjs} +3 -3
- package/dist/chunk-BO65GO53.mjs.map +1 -0
- package/dist/{chunk-DJP3T7OD.mjs → chunk-BSVXX52E.mjs} +2 -2
- package/dist/chunk-BSVXX52E.mjs.map +1 -0
- package/dist/chunk-EDTAMUO2.js +8310 -0
- package/dist/chunk-EDTAMUO2.js.map +1 -0
- package/dist/chunk-M3YLASM2.js +428 -0
- package/dist/chunk-M3YLASM2.js.map +1 -0
- package/dist/{chunk-4NPMHFKO.mjs → chunk-RQXQK3ZO.mjs} +1971 -94
- package/dist/chunk-RQXQK3ZO.mjs.map +1 -0
- package/dist/chunk-SR25V4EA.mjs +40 -0
- package/dist/chunk-SR25V4EA.mjs.map +1 -0
- package/dist/{chunk-KOKOIY5E.js → chunk-UB34WFEQ.js} +18 -18
- package/dist/chunk-UB34WFEQ.js.map +1 -0
- package/dist/chunk-ZBRWXKDF.mjs +24431 -0
- package/dist/chunk-ZBRWXKDF.mjs.map +1 -0
- package/dist/cli/ds.d.mts +1 -0
- package/dist/cli/ds.d.ts +1 -0
- package/dist/cli/ds.js +602 -0
- package/dist/cli/ds.js.map +1 -0
- package/dist/cli/ds.mjs +579 -0
- package/dist/cli/ds.mjs.map +1 -0
- package/dist/cli/flipova.d.mts +1 -0
- package/dist/cli/flipova.d.ts +1 -0
- package/dist/cli/flipova.js +161 -0
- package/dist/cli/flipova.js.map +1 -0
- package/dist/cli/flipova.mjs +154 -0
- package/dist/cli/flipova.mjs.map +1 -0
- package/dist/config/index.d.mts +12 -12
- package/dist/config/index.d.ts +12 -12
- package/dist/config/index.js +6 -6
- package/dist/config/index.mjs +1 -1
- package/dist/createTheme-DQeX3s0I.d.mts +78 -0
- package/dist/createTheme-Y4jfz4-u.d.ts +78 -0
- package/dist/{index-CpBqkIpd.d.mts → index-CuaJA3gM.d.mts} +10 -10
- package/dist/{index-CpBqkIpd.d.ts → index-CuaJA3gM.d.ts} +10 -10
- package/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +258 -254
- package/dist/index.mjs +5 -5
- package/dist/registry/index.d.mts +470 -3
- package/dist/registry/index.d.ts +470 -3
- package/dist/registry/index.js +100 -96
- package/dist/registry/index.mjs +1 -1
- package/dist/theme/index.d.mts +4 -88
- package/dist/theme/index.d.ts +4 -88
- package/dist/theme/index.js +6 -6
- package/dist/theme/index.mjs +1 -1
- package/dist/tokens/index.js +10 -10
- package/dist/tokens/index.mjs +1 -1
- package/dist/types/index.d.mts +23 -21
- package/dist/types/index.d.ts +23 -21
- package/dist/ui/index.d.mts +241 -83
- package/dist/ui/index.d.ts +241 -83
- package/dist/ui/index.js +182 -182
- package/dist/ui/index.mjs +2 -2
- package/dist/web/index.d.mts +316 -0
- package/dist/web/index.d.ts +316 -0
- package/dist/web/index.js +1331 -31004
- package/dist/web/index.js.map +1 -1
- package/dist/web/index.mjs +1245 -30791
- package/dist/web/index.mjs.map +1 -1
- package/package.json +41 -21
- package/dist/chunk-4KNPSB67.js.map +0 -1
- package/dist/chunk-4NPMHFKO.mjs.map +0 -1
- package/dist/chunk-DJP3T7OD.mjs.map +0 -1
- package/dist/chunk-ETR75HWU.mjs.map +0 -1
- package/dist/chunk-KGMGD6GU.js +0 -7024
- package/dist/chunk-KGMGD6GU.js.map +0 -1
- package/dist/chunk-KOKOIY5E.js.map +0 -1
- package/dist/chunk-MLFQD3PV.mjs.map +0 -1
- package/dist/chunk-O7UP2OZR.js.map +0 -1
- package/dist/chunk-RMLLGNWR.js +0 -428
- package/dist/chunk-RMLLGNWR.js.map +0 -1
- package/dist/chunk-XTYE5PNQ.mjs +0 -6900
- package/dist/chunk-XTYE5PNQ.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 1.
|
|
3
|
+
## 1.14.0
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 33523d8: Add comprehensive guide and documentation for integrating Flipova Foundation design tokens and theming system with external React Web component libraries (shadcn/ui, Radix UI, Material UI, Tailwind CSS).
|
|
8
|
+
|
|
9
|
+
## 1.13.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
6
12
|
|
|
7
|
-
-
|
|
8
|
-
- e1eb3b3: Cleanup web export configuration and documentation - remove studio references, finalize web import system, organize documentation
|
|
13
|
+
- 7b2dc77: Redesign documentation portal with Apple-style aesthetic, translate codebase comments to English, reorganize sidebar, and add comprehensive guides.
|
|
9
14
|
|
|
10
15
|
## 1.12.0
|
|
11
16
|
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Flipova
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Flipova
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,197 +1,215 @@
|
|
|
1
|
-
# @flipova/foundation
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/@flipova/foundation)
|
|
4
|
-
[](https://opensource.org/licenses/MIT)
|
|
5
|
-
|
|
6
|
-
A unified, platform-agnostic design system and UI foundation for building identical experiences across **React Native** (iOS, Android) and **React Web**.
|
|
7
|
-
|
|
8
|
-
Flipova Foundation provides design tokens, a declarative theming engine, layout primitives, and beautifully crafted UI components from a single shared codebase. By abstracting the platform dependencies, Flipova ensures that web and mobile projects can seamlessly share 100% of their UI layer.
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
## Features
|
|
13
|
-
|
|
14
|
-
- **Write Once, Run Anywhere**: Isomorphic components that map to native primitives on mobile (`View`, `Text`, `ScrollView`) and highly-optimized HTML semantics on the web.
|
|
15
|
-
- **Zero-Config Web Support**: The web entry point (`@flipova/foundation/web`) is completely free of heavy native dependencies, enabling rapid bundling for SSR and SSG environments like Next.js and Vite.
|
|
16
|
-
- **Declarative Layouts**: Build complex UI using intuitive layout primitives (`Box`, `Stack`, `Inline`, `Center`).
|
|
17
|
-
- **Dynamic Theming**: First-class support for dark/light modes, dynamic color schemes, and custom design tokens.
|
|
18
|
-
- **Interactive CLI Tools**: Includes `flipova` and `flipova-ds` to instantly scaffold projects, manage design system registries, and handle themes natively from the terminal.
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## Installation
|
|
23
|
-
|
|
24
|
-
Flipova Foundation is published on both the **npm public registry** and **GitHub Packages**. It is designed to adapt its dependency graph depending on your target environment.
|
|
25
|
-
|
|
26
|
-
### For React Web Projects
|
|
27
|
-
|
|
28
|
-
The web version is extremely lightweight. It installs only what is necessary for DOM-based environments, completely bypassing React Native abstractions.
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
npm install @flipova/foundation
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### For React Native / Expo Projects
|
|
35
|
-
|
|
36
|
-
For native environments, Flipova leverages your existing Expo and React Native ecosystem. Install the package alongside its optional native peer dependencies:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
npm install @flipova/foundation
|
|
40
|
-
|
|
41
|
-
# Install required native peer dependencies
|
|
42
|
-
npx expo install react-native-screens react-native-safe-area-context react-native-gesture-handler react-native-reanimated expo-linear-gradient expo-haptics @expo/vector-icons lucide-react-native
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
---
|
|
46
|
-
|
|
47
|
-
## Architecture & Modules
|
|
48
|
-
|
|
49
|
-
The package is deeply modularized so you only import what you need. Importing from specific sub-modules guarantees that bundlers will tree-shake platform-incompatible code.
|
|
50
|
-
|
|
51
|
-
| Module Entry Point | Description | Supported Platforms |
|
|
52
|
-
| :--- | :--- | :--- |
|
|
53
|
-
| **`@flipova/foundation`** | Core UI components, interactive controls, and layout blocks. | Native |
|
|
54
|
-
| **`@flipova/foundation/web`** | DOM-based implementations of primitives, components, and layouts. | Web |
|
|
55
|
-
| **`@flipova/foundation/layout`**| Layout hooks (`useBreakpoint`, `useSafeArea`), and declarative registries. | Native |
|
|
56
|
-
| **`@flipova/foundation/tokens`**| Core design tokens (spacing, radii, colors, typography). | Native & Web |
|
|
57
|
-
| **`@flipova/foundation/theme`** | Theme system, ThemeProvider context, and ColorScheme utilities. | Native & Web |
|
|
58
|
-
| **`@flipova/foundation/config`**| Configuration engine (`defineConfig`, `FoundationProvider`). | Native & Web |
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
## Core Concepts & Usage
|
|
63
|
-
|
|
64
|
-
### 1. Project Initialization
|
|
65
|
-
|
|
66
|
-
To initialize Flipova Foundation in a new or existing project, run the scaffolding CLI. This command interactively sets up `flipova.config.ts`, creates required directories, and installs peer dependencies if necessary.
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
npx flipova
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### 2. Initialization and Theming
|
|
73
|
-
|
|
74
|
-
Whether you are on the Web or Native, initializing the design system requires a Provider.
|
|
75
|
-
|
|
76
|
-
**React Native (App.tsx):**
|
|
77
|
-
```tsx
|
|
78
|
-
import { FoundationProvider, defineConfig } from "@flipova/foundation/config";
|
|
79
|
-
import { Box, Button } from "@flipova/foundation";
|
|
80
|
-
|
|
81
|
-
const config = defineConfig({
|
|
82
|
-
defaultTheme: "light",
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
export default function App() {
|
|
86
|
-
return (
|
|
87
|
-
<FoundationProvider config={config}>
|
|
88
|
-
<Box padding="xl" backgroundColor="background">
|
|
89
|
-
<Button label="Welcome to Flipova" variant="primary" />
|
|
90
|
-
</Box>
|
|
91
|
-
</FoundationProvider>
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
**React Web (App.tsx):**
|
|
97
|
-
```tsx
|
|
98
|
-
import { ThemeProvider } from "@flipova/foundation/theme";
|
|
99
|
-
import { Box } from "@flipova/foundation/web";
|
|
100
|
-
|
|
101
|
-
export default function App() {
|
|
102
|
-
return (
|
|
103
|
-
<ThemeProvider defaultTheme="light">
|
|
104
|
-
<Box padding="xl" backgroundColor="background">
|
|
105
|
-
<h1>Web Experience</h1>
|
|
106
|
-
</Box>
|
|
107
|
-
</ThemeProvider>
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
### 3. Advanced Theming
|
|
113
|
-
|
|
114
|
-
The `ThemeProvider` allows you to customize the default tokens and color schemes. You can override specific variables or introduce completely new themes (e.g., "neon" or "high-contrast").
|
|
115
|
-
|
|
116
|
-
```tsx
|
|
117
|
-
import { ThemeProvider, ColorScheme } from "@flipova/foundation/theme";
|
|
118
|
-
|
|
119
|
-
const customNeonTheme: ColorScheme = {
|
|
120
|
-
background: "#000000",
|
|
121
|
-
foreground: "#39ff14",
|
|
122
|
-
card: "#111111",
|
|
123
|
-
border: "#333333",
|
|
124
|
-
primary: "#ff00ff",
|
|
125
|
-
muted: "#555555",
|
|
126
|
-
success: "#00ff00",
|
|
127
|
-
error: "#ff0000",
|
|
128
|
-
// ... (other required tokens)
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
export default function App() {
|
|
132
|
-
return (
|
|
133
|
-
<ThemeProvider
|
|
134
|
-
defaultTheme="neon"
|
|
135
|
-
customThemes={{ neon: customNeonTheme }}
|
|
136
|
-
>
|
|
137
|
-
{/* Your app */}
|
|
138
|
-
</ThemeProvider>
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
### 4. Layout Primitives
|
|
144
|
-
|
|
145
|
-
Flipova strongly discourages inline styling. Instead, all structural layouts should be composed using foundational primitives. This guarantees identical spacing and alignment across web and mobile.
|
|
146
|
-
|
|
147
|
-
- **`Box`**: The lowest-level building block. Supports padding, margins, borders, and background tokens.
|
|
148
|
-
- **`Stack`**: A vertical flex container with configurable `gap` spacing.
|
|
149
|
-
- **`Inline`**: A horizontal flex container with configurable `gap` spacing and wrapping capabilities.
|
|
150
|
-
- **`Center`**: Utility primitive to vertically and horizontally align its children.
|
|
151
|
-
|
|
152
|
-
**Example: Building a User Card**
|
|
153
|
-
```tsx
|
|
154
|
-
import { Box, Inline, Stack } from "@flipova/foundation/web";
|
|
155
|
-
import { Avatar, Text, Button } from "@flipova/foundation/web";
|
|
156
|
-
|
|
157
|
-
export function UserCard() {
|
|
158
|
-
return (
|
|
159
|
-
<Box padding="lg" borderRadius="md" backgroundColor="surface">
|
|
160
|
-
<Inline gap="md" align="center">
|
|
161
|
-
<Avatar src="https://example.com/avatar.png" size="lg" />
|
|
162
|
-
<Stack gap="xs" flex={1}>
|
|
163
|
-
<Text variant="heading">John Doe</Text>
|
|
164
|
-
<Text variant="body" color="muted">Software Engineer</Text>
|
|
165
|
-
</Stack>
|
|
166
|
-
<Button label="Follow" variant="secondary" />
|
|
167
|
-
</Inline>
|
|
168
|
-
</Box>
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
### 5. Managing the Design System
|
|
175
|
-
|
|
176
|
-
Flipova Foundation provides a powerful interactive CLI to manage your design system directly from the terminal.
|
|
177
|
-
|
|
178
|
-
```bash
|
|
179
|
-
npx flipova-ds
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
The interactive menu allows you to:
|
|
183
|
-
- **Manage Themes**: Add or remove custom themes. It automatically registers them.
|
|
184
|
-
- **Manage the Registry**: Browse, add, or remove UI primitives, components, or layout definitions.
|
|
185
|
-
- **Generate Tokens**: Recompile TypeScript definitions from your `tokens.yaml` and `themes.yaml` sources.
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
1
|
+
# @flipova/foundation
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@flipova/foundation)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
A unified, platform-agnostic design system and UI foundation for building identical experiences across **React Native** (iOS, Android) and **React Web**.
|
|
7
|
+
|
|
8
|
+
Flipova Foundation provides design tokens, a declarative theming engine, layout primitives, and beautifully crafted UI components from a single shared codebase. By abstracting the platform dependencies, Flipova ensures that web and mobile projects can seamlessly share 100% of their UI layer.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
- **Write Once, Run Anywhere**: Isomorphic components that map to native primitives on mobile (`View`, `Text`, `ScrollView`) and highly-optimized HTML semantics on the web.
|
|
15
|
+
- **Zero-Config Web Support**: The web entry point (`@flipova/foundation/web`) is completely free of heavy native dependencies, enabling rapid bundling for SSR and SSG environments like Next.js and Vite.
|
|
16
|
+
- **Declarative Layouts**: Build complex UI using intuitive layout primitives (`Box`, `Stack`, `Inline`, `Center`).
|
|
17
|
+
- **Dynamic Theming**: First-class support for dark/light modes, dynamic color schemes, and custom design tokens.
|
|
18
|
+
- **Interactive CLI Tools**: Includes `flipova` and `flipova-ds` to instantly scaffold projects, manage design system registries, and handle themes natively from the terminal.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
Flipova Foundation is published on both the **npm public registry** and **GitHub Packages**. It is designed to adapt its dependency graph depending on your target environment.
|
|
25
|
+
|
|
26
|
+
### For React Web Projects
|
|
27
|
+
|
|
28
|
+
The web version is extremely lightweight. It installs only what is necessary for DOM-based environments, completely bypassing React Native abstractions.
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install @flipova/foundation
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### For React Native / Expo Projects
|
|
35
|
+
|
|
36
|
+
For native environments, Flipova leverages your existing Expo and React Native ecosystem. Install the package alongside its optional native peer dependencies:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm install @flipova/foundation
|
|
40
|
+
|
|
41
|
+
# Install required native peer dependencies
|
|
42
|
+
npx expo install react-native-screens react-native-safe-area-context react-native-gesture-handler react-native-reanimated expo-linear-gradient expo-haptics @expo/vector-icons lucide-react-native
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Architecture & Modules
|
|
48
|
+
|
|
49
|
+
The package is deeply modularized so you only import what you need. Importing from specific sub-modules guarantees that bundlers will tree-shake platform-incompatible code.
|
|
50
|
+
|
|
51
|
+
| Module Entry Point | Description | Supported Platforms |
|
|
52
|
+
| :--- | :--- | :--- |
|
|
53
|
+
| **`@flipova/foundation`** | Core UI components, interactive controls, and layout blocks. | Native |
|
|
54
|
+
| **`@flipova/foundation/web`** | DOM-based implementations of primitives, components, and layouts. | Web |
|
|
55
|
+
| **`@flipova/foundation/layout`**| Layout hooks (`useBreakpoint`, `useSafeArea`), and declarative registries. | Native |
|
|
56
|
+
| **`@flipova/foundation/tokens`**| Core design tokens (spacing, radii, colors, typography). | Native & Web |
|
|
57
|
+
| **`@flipova/foundation/theme`** | Theme system, ThemeProvider context, and ColorScheme utilities. | Native & Web |
|
|
58
|
+
| **`@flipova/foundation/config`**| Configuration engine (`defineConfig`, `FoundationProvider`). | Native & Web |
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Core Concepts & Usage
|
|
63
|
+
|
|
64
|
+
### 1. Project Initialization
|
|
65
|
+
|
|
66
|
+
To initialize Flipova Foundation in a new or existing project, run the scaffolding CLI. This command interactively sets up `flipova.config.ts`, creates required directories, and installs peer dependencies if necessary.
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npx flipova
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 2. Initialization and Theming
|
|
73
|
+
|
|
74
|
+
Whether you are on the Web or Native, initializing the design system requires a Provider.
|
|
75
|
+
|
|
76
|
+
**React Native (App.tsx):**
|
|
77
|
+
```tsx
|
|
78
|
+
import { FoundationProvider, defineConfig } from "@flipova/foundation/config";
|
|
79
|
+
import { Box, Button } from "@flipova/foundation";
|
|
80
|
+
|
|
81
|
+
const config = defineConfig({
|
|
82
|
+
defaultTheme: "light",
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export default function App() {
|
|
86
|
+
return (
|
|
87
|
+
<FoundationProvider config={config}>
|
|
88
|
+
<Box padding="xl" backgroundColor="background">
|
|
89
|
+
<Button label="Welcome to Flipova" variant="primary" />
|
|
90
|
+
</Box>
|
|
91
|
+
</FoundationProvider>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**React Web (App.tsx):**
|
|
97
|
+
```tsx
|
|
98
|
+
import { ThemeProvider } from "@flipova/foundation/theme";
|
|
99
|
+
import { Box } from "@flipova/foundation/web";
|
|
100
|
+
|
|
101
|
+
export default function App() {
|
|
102
|
+
return (
|
|
103
|
+
<ThemeProvider defaultTheme="light">
|
|
104
|
+
<Box padding="xl" backgroundColor="background">
|
|
105
|
+
<h1>Web Experience</h1>
|
|
106
|
+
</Box>
|
|
107
|
+
</ThemeProvider>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 3. Advanced Theming
|
|
113
|
+
|
|
114
|
+
The `ThemeProvider` allows you to customize the default tokens and color schemes. You can override specific variables or introduce completely new themes (e.g., "neon" or "high-contrast").
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
import { ThemeProvider, ColorScheme } from "@flipova/foundation/theme";
|
|
118
|
+
|
|
119
|
+
const customNeonTheme: ColorScheme = {
|
|
120
|
+
background: "#000000",
|
|
121
|
+
foreground: "#39ff14",
|
|
122
|
+
card: "#111111",
|
|
123
|
+
border: "#333333",
|
|
124
|
+
primary: "#ff00ff",
|
|
125
|
+
muted: "#555555",
|
|
126
|
+
success: "#00ff00",
|
|
127
|
+
error: "#ff0000",
|
|
128
|
+
// ... (other required tokens)
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export default function App() {
|
|
132
|
+
return (
|
|
133
|
+
<ThemeProvider
|
|
134
|
+
defaultTheme="neon"
|
|
135
|
+
customThemes={{ neon: customNeonTheme }}
|
|
136
|
+
>
|
|
137
|
+
{/* Your app */}
|
|
138
|
+
</ThemeProvider>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### 4. Layout Primitives
|
|
144
|
+
|
|
145
|
+
Flipova strongly discourages inline styling. Instead, all structural layouts should be composed using foundational primitives. This guarantees identical spacing and alignment across web and mobile.
|
|
146
|
+
|
|
147
|
+
- **`Box`**: The lowest-level building block. Supports padding, margins, borders, and background tokens.
|
|
148
|
+
- **`Stack`**: A vertical flex container with configurable `gap` spacing.
|
|
149
|
+
- **`Inline`**: A horizontal flex container with configurable `gap` spacing and wrapping capabilities.
|
|
150
|
+
- **`Center`**: Utility primitive to vertically and horizontally align its children.
|
|
151
|
+
|
|
152
|
+
**Example: Building a User Card**
|
|
153
|
+
```tsx
|
|
154
|
+
import { Box, Inline, Stack } from "@flipova/foundation/web";
|
|
155
|
+
import { Avatar, Text, Button } from "@flipova/foundation/web";
|
|
156
|
+
|
|
157
|
+
export function UserCard() {
|
|
158
|
+
return (
|
|
159
|
+
<Box padding="lg" borderRadius="md" backgroundColor="surface">
|
|
160
|
+
<Inline gap="md" align="center">
|
|
161
|
+
<Avatar src="https://example.com/avatar.png" size="lg" />
|
|
162
|
+
<Stack gap="xs" flex={1}>
|
|
163
|
+
<Text variant="heading">John Doe</Text>
|
|
164
|
+
<Text variant="body" color="muted">Software Engineer</Text>
|
|
165
|
+
</Stack>
|
|
166
|
+
<Button label="Follow" variant="secondary" />
|
|
167
|
+
</Inline>
|
|
168
|
+
</Box>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
### 5. Managing the Design System
|
|
175
|
+
|
|
176
|
+
Flipova Foundation provides a powerful interactive CLI to manage your design system directly from the terminal.
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
npx flipova-ds
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
The interactive menu allows you to:
|
|
183
|
+
- **Manage Themes**: Add or remove custom themes. It automatically registers them.
|
|
184
|
+
- **Manage the Registry**: Browse, add, or remove UI primitives, components, or layout definitions.
|
|
185
|
+
- **Generate Tokens**: Recompile TypeScript definitions from your `tokens.yaml` and `themes.yaml` sources.
|
|
186
|
+
- **Generate Documentation**: Build a 1-to-1 mirror MDX documentation site straight from `.meta.yaml` and TSDoc sources.
|
|
187
|
+
|
|
188
|
+
Whenever you make manual changes to `themes.yaml`, `tokens.yaml`, or registry metadata files, running `npx flipova-ds` allows you to rapidly regenerate the type definitions (`generated.ts`).
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Documentation Portal
|
|
193
|
+
|
|
194
|
+
Flipova Foundation includes a built-in Docusaurus documentation portal located in `docs/`:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
# Start local Docusaurus development server
|
|
198
|
+
npm run docs:dev
|
|
199
|
+
|
|
200
|
+
# Build static production site into docs/build
|
|
201
|
+
npm run docs:build
|
|
202
|
+
|
|
203
|
+
# Preview production build locally
|
|
204
|
+
npm run docs:preview
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## Contributing
|
|
210
|
+
|
|
211
|
+
We welcome contributions to the Flipova Foundation! Please refer to the `CONTRIBUTING.md` file in the root of the repository for detailed instructions on the development workflow, branching strategies, and instructions for adding new components.
|
|
212
|
+
|
|
213
|
+
## License
|
|
214
|
+
|
|
215
|
+
MIT © Flipova
|