app-studio 0.7.10 → 0.7.12
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 +72 -10
- package/dist/app-studio.cjs.development.js +315 -263
- package/dist/app-studio.cjs.development.js.map +1 -1
- package/dist/app-studio.cjs.production.min.js +1 -1
- package/dist/app-studio.esm.js +315 -263
- package/dist/app-studio.esm.js.map +1 -1
- package/dist/app-studio.umd.development.js +315 -263
- package/dist/app-studio.umd.development.js.map +1 -1
- package/dist/app-studio.umd.production.min.js +1 -1
- package/dist/element/Element.types.d.ts +1 -0
- package/dist/utils/vendorPrefixes.d.ts +12 -2
- package/docs/README.md +2 -1
- package/docs/Styling.md +571 -0
- package/docs/Theming.md +461 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -85,15 +85,76 @@ The `Element` component is the cornerstone of App-Studio. Most other components
|
|
|
85
85
|
* **Animation:** Integrates with the animation system via the `animate` prop.
|
|
86
86
|
* **Theming:** Automatically resolves theme colors (e.g., `color="theme.primary"`).
|
|
87
87
|
|
|
88
|
-
##
|
|
88
|
+
## Styling System
|
|
89
89
|
|
|
90
|
+
App-Studio uses a powerful, declarative styling system with multiple levels:
|
|
91
|
+
|
|
92
|
+
### Utility-First Styling
|
|
90
93
|
App-Studio generates CSS utility classes based on the props you provide to `Element` and its derived components. This approach keeps styles co-located with the component logic and optimizes performance by reusing generated classes.
|
|
91
94
|
|
|
92
|
-
|
|
95
|
+
### State Modifiers
|
|
96
|
+
Control styles for interactive states using underscore-prefixed props:
|
|
97
|
+
- **Interaction**: `_hover`, `_active`, `_focus`, `_visited`
|
|
98
|
+
- **Form**: `_disabled`, `_enabled`, `_checked`, `_invalid`, `_valid`
|
|
99
|
+
- **Children**: `_firstChild`, `_lastChild`, `_onlyChild`
|
|
100
|
+
- **Group/Peer**: `_groupHover`, `_peerHover`, `_peerActive`, `_peerChecked`
|
|
101
|
+
- **Pseudo-elements**: `_before`, `_after`, `_firstLetter`, `_selection`
|
|
102
|
+
|
|
103
|
+
```jsx
|
|
104
|
+
<Element
|
|
105
|
+
backgroundColor="color-blue-500"
|
|
106
|
+
_hover={{ backgroundColor: "color-blue-600" }}
|
|
107
|
+
_disabled={{ opacity: 0.5 }}
|
|
108
|
+
_focus={{ outline: "2px solid color-blue-400" }}
|
|
109
|
+
/>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Media Queries
|
|
113
|
+
Define responsive styles with the `media` prop for different breakpoints:
|
|
114
|
+
```jsx
|
|
115
|
+
<View
|
|
116
|
+
padding={8}
|
|
117
|
+
media={{
|
|
118
|
+
tablet: { padding: 16 },
|
|
119
|
+
desktop: { padding: 24 }
|
|
120
|
+
}}
|
|
121
|
+
/>
|
|
122
|
+
```
|
|
93
123
|
|
|
94
|
-
|
|
124
|
+
## Theming & Colors
|
|
95
125
|
|
|
96
|
-
|
|
126
|
+
Use `ThemeProvider` to define global theme settings, including light/dark mode colors and custom theme tokens (e.g., `primary`, `secondary`). The `useTheme` hook provides access to the current theme mode (`themeMode`), theme configuration (`theme`), a function to switch modes (`setThemeMode`), and the essential `getColor` function to resolve color strings (like `color-blue-500` or `theme-primary`) into actual CSS color values for the current mode.
|
|
127
|
+
|
|
128
|
+
**Color System Features:**
|
|
129
|
+
- **Color Palettes**: 34 palettes with 9 shades each (50, 100, 200...900) - e.g., `color-blue-500`
|
|
130
|
+
- **Singleton Colors**: 30 named colors like `color-white`, `color-gold`, `color-turquoise`
|
|
131
|
+
- **Theme Colors**: Custom theme tokens like `theme-primary`, `theme-secondary`
|
|
132
|
+
- **Alpha Transparency**: Add opacity to any color - `color-blue-500-200` (20% opacity)
|
|
133
|
+
- **Mode-Specific**: Direct access via `light-white` or `dark-blue-500` (ignores current theme mode)
|
|
134
|
+
|
|
135
|
+
You can also directly access specific theme mode colors using the `light-` or `dark-` prefix (e.g., `light-white` or `dark-red-200`), which will always use that specific theme mode's color regardless of the current theme setting.
|
|
136
|
+
|
|
137
|
+
### Color System Hierarchy
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
color-* → Direct color access (current theme mode)
|
|
141
|
+
├─ color-white → Singleton colors
|
|
142
|
+
├─ color-blue-500 → Palette colors with shades
|
|
143
|
+
└─ color-blue-500-200 → Palette colors with alpha (20% opacity)
|
|
144
|
+
|
|
145
|
+
theme-* → Custom theme configuration
|
|
146
|
+
├─ theme-primary → Theme color
|
|
147
|
+
├─ theme-primary-100 → Theme color with alpha (10% opacity)
|
|
148
|
+
└─ theme-button-background → Nested theme path
|
|
149
|
+
|
|
150
|
+
light-* → Always use light mode colors
|
|
151
|
+
├─ light-white
|
|
152
|
+
└─ light-blue-500
|
|
153
|
+
|
|
154
|
+
dark-* → Always use dark mode colors
|
|
155
|
+
├─ dark-white
|
|
156
|
+
└─ dark-red-200
|
|
157
|
+
```
|
|
97
158
|
|
|
98
159
|
## Responsiveness
|
|
99
160
|
|
|
@@ -152,7 +213,7 @@ function MyStyledElement() {
|
|
|
152
213
|
}
|
|
153
214
|
```
|
|
154
215
|
|
|
155
|
-
In addition to global theming via `ThemeProvider`, the `Element` component offers granular control through the `themeMode`, `colors`, and `theme` props. When specified, these props locally override the context provided by `ThemeProvider` for this specific element instance and how its style props (like `backgroundColor="theme
|
|
216
|
+
In addition to global theming via `ThemeProvider`, the `Element` component offers granular control through the `themeMode`, `colors`, and `theme` props. When specified, these props locally override the context provided by `ThemeProvider` for this specific element instance and how its style props (like `backgroundColor="theme-primary"` or `color="color-blue-500"`) resolve color values. `themeMode` forces 'light' or 'dark' mode resolution, `colors` provides a custom `{ main, palette }` object, and `theme` supplies custom token mappings (e.g., `{ primary: 'color-purple-500' }`). This allows creating distinctly styled sections or components without altering the global theme, useful for sidebars, specific UI states, or component variations.
|
|
156
217
|
|
|
157
218
|
**Example (Local Theme Override):**
|
|
158
219
|
|
|
@@ -179,7 +240,7 @@ function LocallyThemedSection() {
|
|
|
179
240
|
theme={localThemeOverride}
|
|
180
241
|
colors={localDarkColorsOverride}
|
|
181
242
|
// Styles below will resolve using the LOCAL dark theme override defined above:
|
|
182
|
-
backgroundColor="theme
|
|
243
|
+
backgroundColor="theme-secondary" // Resolves to 'color-teal-300' via localThemeOverride in dark mode
|
|
183
244
|
borderRadius={8}
|
|
184
245
|
>
|
|
185
246
|
<Text color="color-white"
|
|
@@ -187,7 +248,7 @@ function LocallyThemedSection() {
|
|
|
187
248
|
This section forces dark mode with an orange primary, even if the app is light-
|
|
188
249
|
</Text>
|
|
189
250
|
<Element marginTop={8} padding={10} backgroundColor="color-gray-700"> {/* Uses local dark palette */}
|
|
190
|
-
<Text color="theme
|
|
251
|
+
<Text color="theme-primary">Nested Primary (Orange)</Text> {/* Still uses local override */}
|
|
191
252
|
</Element>
|
|
192
253
|
</Element>
|
|
193
254
|
);
|
|
@@ -259,7 +320,7 @@ function MyText() {
|
|
|
259
320
|
<Text
|
|
260
321
|
fontSize="xl"
|
|
261
322
|
fontWeight="bold"
|
|
262
|
-
color="theme
|
|
323
|
+
color="theme-primary"
|
|
263
324
|
textAlign="center"
|
|
264
325
|
toUpperCase
|
|
265
326
|
>
|
|
@@ -619,7 +680,7 @@ Manages the application's theme, including color palettes, light/dark modes, and
|
|
|
619
680
|
|
|
620
681
|
**Context Values (via `useTheme`)**
|
|
621
682
|
|
|
622
|
-
* `getColor(colorName, mode?)`: Resolves a color string (e.g., `color-blue
|
|
683
|
+
* `getColor(colorName, mode?)`: Resolves a color string (e.g., `color-blue-500`, `theme-primary`, `blackAlpha-500`) to its CSS value for the specified or current theme mode.
|
|
623
684
|
* `theme`: The merged theme configuration object.
|
|
624
685
|
* `themeMode`: The current mode ('light' or 'dark').
|
|
625
686
|
* `setThemeMode(mode)`: Function to change the theme mode.
|
|
@@ -789,7 +850,8 @@ Explore our comprehensive documentation to learn more about App-Studio:
|
|
|
789
850
|
- [Getting Started](docs/README.md) - Quick start guide and core concepts
|
|
790
851
|
- [Components](docs/Components.md) - Detailed documentation of all available components
|
|
791
852
|
- [Hooks](docs/Hooks.md) - Guide to the React hooks provided by App-Studio
|
|
792
|
-
- [Theming](docs/Theming.md) -
|
|
853
|
+
- [Theming](docs/Theming.md) - Color systems, theme colors, palettes, and light/dark modes
|
|
854
|
+
- [Styling](docs/Styling.md) - Advanced guide to state modifiers, pseudo-elements, media queries, and CSS system
|
|
793
855
|
- [Animation](docs/Animation.md) - Creating animations with App-Studio
|
|
794
856
|
- [Responsive Design](docs/Responsive.md) - Building responsive layouts
|
|
795
857
|
- [Design System](docs/Design.md) - Understanding the design system
|