diff --git a/docs/developing-with-agents/aira-agents/marketplace-agent.md b/docs/developing-with-agents/aira-agents/marketplace-agent.md index 3fc5081..684403c 100644 --- a/docs/developing-with-agents/aira-agents/marketplace-agent.md +++ b/docs/developing-with-agents/aira-agents/marketplace-agent.md @@ -6,7 +6,6 @@ last_update: { author: 'Vivek Raj' } # Marketplace Agent - The **Marketplace Agent** enables developers to discover and install reusable artifacts from the [WaveMaker Marketplace](https://marketplace.wavemaker.ai/) directly into their application projects. It functions as a controlled integration layer between the centralized artifact repository and project codebase. Reusing artifacts helps teams build faster, maintain consistency, and rely on well-tested components. The agent automates the discovery-to-installation workflow while enforcing compatibility checks, version validation, and explicit developer approval. Its scope is limited to artifact acquisition only; configuration, binding, and runtime usage are handled separately. @@ -38,8 +37,8 @@ The Marketplace Agent operates as a **specialized execution agent** within the A **Responsibility boundaries:** -- **WaveMaker Agent** – Determines _when_ a marketplace artifact is needed based on user intent and project context -- **Marketplace Agent** – Handles _how_ that artifact is safely acquired and installed +- **WaveMaker Agent** – Determines *when* a marketplace artifact is needed based on user intent and project context +- **Marketplace Agent** – Handles *how* that artifact is safely acquired and installed - **Other agents** – Configure, bind, and utilize the installed artifact post-installation The Marketplace Agent never decides usage patterns or application behavior. Upon completing installation, control returns to `wm_agent` for downstream orchestration. @@ -183,7 +182,7 @@ The agent does not participate after installation completes. ## Related Documentation - [Prefabs (Web)](#) – Creating and using reusable UI components for web -- [Prefabs (Mobile)](../../user-interfaces/mobile/enterprise-capabilities/prefabs) – Creating and using reusable UI components for mobile +- [Prefabs (Mobile)](../../user-interfaces/mobile/enterprise-capabilities/prefabs/) – Creating and using reusable UI components for mobile - [Connectors Architecture](../../apis-and-services/connectors/architecture) – Understanding connector structure and integration - [Building Connectors](../../apis-and-services/connectors/build-a-connector) – Creating custom external service integrations - [Design Tokens](../../user-interfaces/web/develop/styling-with-design-tokens/design-token-architecture) – Design system fundamentals and styling consistency diff --git a/docs/guide/integration/set-up-wavemaker-project-locally.md b/docs/guide/integration/set-up-wavemaker-project-locally.md index 578ce55..ce1dba3 100644 --- a/docs/guide/integration/set-up-wavemaker-project-locally.md +++ b/docs/guide/integration/set-up-wavemaker-project-locally.md @@ -91,6 +91,6 @@ Treat `pull` the way you'd treat `git pull` before starting work: run it at the ## See Also -- [WMX Components](../../user-interfaces/mobile/enterprise-capabilities/wmx/wmx-components.md) — build custom React Native components that slot into WaveMaker mobile apps +- [WMX components](/docs/user-interfaces/mobile/enterprise-capabilities/wmx/) — build custom React Native components that slot into WaveMaker mobile apps - [WMX Agent](../../developing-with-agents/aira-agents/wmx-agent.md) — generate WMX components with AIRA - [Building Project with Maven](../../build-and-deploy/build/web/package/war/build-war-from-projectzip.md) — generate a deployable WAR from a locally-synced project diff --git a/docs/user-interfaces/mobile/assets/adding-external-plugins.jpg b/docs/user-interfaces/mobile/assets/adding-external-plugins.jpg new file mode 100644 index 0000000..9f552ab Binary files /dev/null and b/docs/user-interfaces/mobile/assets/adding-external-plugins.jpg differ diff --git a/docs/user-interfaces/mobile/assets/auto-layout.jpg b/docs/user-interfaces/mobile/assets/auto-layout.jpg index 4d08d09..a137440 100644 Binary files a/docs/user-interfaces/mobile/assets/auto-layout.jpg and b/docs/user-interfaces/mobile/assets/auto-layout.jpg differ diff --git a/docs/user-interfaces/mobile/assets/logos/css3-logo.png b/docs/user-interfaces/mobile/assets/logos/css3-logo.png new file mode 100644 index 0000000..17fce60 Binary files /dev/null and b/docs/user-interfaces/mobile/assets/logos/css3-logo.png differ diff --git a/docs/user-interfaces/mobile/assets/logos/javascript-logo.png b/docs/user-interfaces/mobile/assets/logos/javascript-logo.png new file mode 100644 index 0000000..59769eb Binary files /dev/null and b/docs/user-interfaces/mobile/assets/logos/javascript-logo.png differ diff --git a/docs/user-interfaces/mobile/assets/logos/json-green-logo.png b/docs/user-interfaces/mobile/assets/logos/json-green-logo.png new file mode 100644 index 0000000..0a270ec Binary files /dev/null and b/docs/user-interfaces/mobile/assets/logos/json-green-logo.png differ diff --git a/docs/user-interfaces/mobile/assets/logos/react-logo.png b/docs/user-interfaces/mobile/assets/logos/react-logo.png new file mode 100644 index 0000000..ea687e4 Binary files /dev/null and b/docs/user-interfaces/mobile/assets/logos/react-logo.png differ diff --git a/docs/user-interfaces/mobile/assets/logos/typescript-logo.png b/docs/user-interfaces/mobile/assets/logos/typescript-logo.png new file mode 100644 index 0000000..6937020 Binary files /dev/null and b/docs/user-interfaces/mobile/assets/logos/typescript-logo.png differ diff --git a/docs/user-interfaces/mobile/assets/mobile-ui-architecture.png b/docs/user-interfaces/mobile/assets/mobile-ui-architecture.png new file mode 100644 index 0000000..e3a9a94 Binary files /dev/null and b/docs/user-interfaces/mobile/assets/mobile-ui-architecture.png differ diff --git a/docs/user-interfaces/mobile/assets/pageuserparam.jpg b/docs/user-interfaces/mobile/assets/pageuserparam.jpg new file mode 100644 index 0000000..8bf5dc9 Binary files /dev/null and b/docs/user-interfaces/mobile/assets/pageuserparam.jpg differ diff --git a/docs/user-interfaces/mobile/assets/pageuserparam.png b/docs/user-interfaces/mobile/assets/pageuserparam.png deleted file mode 100644 index e00ff24..0000000 Binary files a/docs/user-interfaces/mobile/assets/pageuserparam.png and /dev/null differ diff --git a/docs/user-interfaces/mobile/components/mobile-components.mdx b/docs/user-interfaces/mobile/components/mobile-components.mdx index a830c84..1c419fa 100644 --- a/docs/user-interfaces/mobile/components/mobile-components.mdx +++ b/docs/user-interfaces/mobile/components/mobile-components.mdx @@ -4,31 +4,32 @@ hide_table_of_contents: true hide_title: true --- -
-

Mobile Components

- 65 Components -
+

Mobile Components

+ +
+ 65 Components +
-WaveMaker provides prebuilt React Native-based components with advanced capabilities like props, callback events, data binding, and extensive styling support. These ready-to-use components can be seamlessly integrated into your mobile applications using a simple drag-and-drop interface within WaveMaker Studio. +WaveMaker open source component library provides React Native components with properties, events, data binding and design token based styling. Developers drag and drop components onto pages in Studio and configure them visually. :::note Storybook For more details on how to use the components, and try them in an interactive way, please refer to the [Storybook](https://reactnative-components.wavemaker.ai/). diff --git a/docs/user-interfaces/mobile/concepts/overview.md b/docs/user-interfaces/mobile/concepts/overview.md deleted file mode 100644 index 1f3147e..0000000 --- a/docs/user-interfaces/mobile/concepts/overview.md +++ /dev/null @@ -1,577 +0,0 @@ ---- -last_update: { author: "Author Name" } ---- - -# Overview - -Understanding the fundamentals of user interface development. - -## Introduction - -User interfaces are the bridge between users and applications. This section covers the core concepts, patterns, and best practices for building modern, accessible, and performant user interfaces. - -## What is a User Interface? - -A user interface (UI) is the point of interaction between users and a digital product. It encompasses: - -- **Visual Design**: Layout, colors, typography, and imagery -- **Interaction Design**: How users interact with elements -- **Information Architecture**: How content is organized -- **Accessibility**: Ensuring usability for all users -- **Responsiveness**: Adapting to different devices and screen sizes - -## UI Development Fundamentals - -### Component-Based Architecture - -Modern UI development uses a component-based approach where interfaces are built from reusable, self-contained components. - -```jsx -// Example: Button component -const Button = ({ children, onClick, variant = 'primary' }) => { - return ( - - ); -}; - -// Usage - -``` - -### Declarative UI - -Declarative UI describes what the interface should look like based on the current state, rather than imperatively manipulating the DOM. - -```jsx -// Declarative approach -const UserProfile = ({ user }) => { - return ( -
- {user ? ( -

Welcome, {user.name}!

- ) : ( -

Please log in

- )} -
- ); -}; -``` - -### State Management - -State represents data that changes over time. Effective state management is crucial for building interactive UIs. - -```jsx -import { useState } from 'react'; - -const Counter = () => { - const [count, setCount] = useState(0); - - return ( -
-

Count: {count}

- -
- ); -}; -``` - -## Core UI Concepts - -### 1. Composition - -Building complex UIs by combining simpler components. - -```jsx -const Card = ({ children }) => ( -
{children}
-); - -const CardHeader = ({ title }) => ( -
{title}
-); - -const CardBody = ({ children }) => ( -
{children}
-); - -// Composition - - - - - - -``` - -### 2. Props and Data Flow - -Data flows down through components via props, creating a unidirectional data flow. - -```jsx -const ParentComponent = () => { - const userData = { name: 'John', email: 'john@example.com' }; - - return ; -}; - -const UserCard = ({ user }) => { - return ( -
-

{user.name}

-

{user.email}

-
- ); -}; -``` - -### 3. Event Handling - -Responding to user interactions like clicks, input changes, and form submissions. - -```jsx -const LoginForm = () => { - const [email, setEmail] = useState(''); - - const handleSubmit = (event) => { - event.preventDefault(); - console.log('Submitting:', email); - }; - - return ( -
- setEmail(e.target.value)} - /> - -
- ); -}; -``` - -### 4. Conditional Rendering - -Showing different UI based on application state. - -```jsx -const Dashboard = ({ isLoading, data, error }) => { - if (isLoading) { - return ; - } - - if (error) { - return ; - } - - return ; -}; -``` - -### 5. List Rendering - -Displaying collections of data. - -```jsx -const UserList = ({ users }) => { - return ( -
    - {users.map((user) => ( -
  • - {user.name} - {user.email} -
  • - ))} -
- ); -}; -``` - -## Design Principles - -### 1. Consistency - -Maintain consistent patterns, terminology, and visual design throughout the application. - -- Use a design system with reusable components -- Follow established UI patterns -- Apply consistent spacing and typography - -### 2. Feedback - -Provide clear feedback for user actions. - -```jsx -const SubmitButton = ({ isSubmitting }) => { - return ( - - ); -}; -``` - -### 3. Accessibility - -Ensure the UI is usable by everyone, including people with disabilities. - -```jsx -// Good accessibility practices - - - - - We'll never share your email. - -``` - -### 4. Progressive Enhancement - -Build core functionality first, then enhance with additional features. - -```jsx -const ImageWithFallback = ({ src, alt, fallback }) => { - const [error, setError] = useState(false); - - if (error) { - return
{fallback}
; - } - - return ( - {alt} setError(true)} - /> - ); -}; -``` - -### 5. Performance - -Optimize for fast load times and smooth interactions. - -```jsx -import { memo, useMemo } from 'react'; - -// Memoize expensive computations -const ExpensiveComponent = memo(({ data }) => { - const processedData = useMemo(() => { - return data.map(item => expensiveOperation(item)); - }, [data]); - - return
{processedData}
; -}); -``` - -## UI Patterns - -### Container/Presenter Pattern - -Separate business logic from presentation. - -```jsx -// Container (logic) -const UserListContainer = () => { - const [users, setUsers] = useState([]); - const [loading, setLoading] = useState(true); - - useEffect(() => { - fetchUsers().then(data => { - setUsers(data); - setLoading(false); - }); - }, []); - - return ; -}; - -// Presenter (UI) -const UserListPresenter = ({ users, loading }) => { - if (loading) return
Loading...
; - return
    {users.map(user => )}
; -}; -``` - -### Higher-Order Components - -Enhance components with additional functionality. - -```jsx -const withLoading = (Component) => { - return ({ isLoading, ...props }) => { - if (isLoading) { - return ; - } - return ; - }; -}; - -// Usage -const UserProfile = ({ user }) =>
{user.name}
; -const UserProfileWithLoading = withLoading(UserProfile); -``` - -### Render Props - -Share code between components using props with function values. - -```jsx -const DataFetcher = ({ url, render }) => { - const [data, setData] = useState(null); - - useEffect(() => { - fetch(url) - .then(res => res.json()) - .then(setData); - }, [url]); - - return render(data); -}; - -// Usage - } -/> -``` - -## Styling Approaches - -### CSS Modules - -Scoped CSS for components. - -```css -/* Button.module.css */ -.button { - padding: 8px 16px; - border-radius: 4px; - background-color: blue; - color: white; -} -``` - -```jsx -import styles from './Button.module.css'; - -const Button = ({ children }) => ( - -); -``` - -### CSS-in-JS - -Write styles directly in JavaScript. - -```jsx -import styled from 'styled-components'; - -const Button = styled.button` - padding: 8px 16px; - border-radius: 4px; - background-color: ${props => props.primary ? 'blue' : 'gray'}; - color: white; -`; -``` - -### Utility Classes - -Use pre-defined utility classes. - -```jsx -const Button = ({ children, primary }) => ( - -); -``` - -## Testing UI Components - -### Unit Testing - -Test component logic and rendering. - -```jsx -import { render, screen, fireEvent } from '@testing-library/react'; - -test('button increments counter', () => { - render(); - - const button = screen.getByText('Increment'); - fireEvent.click(button); - - expect(screen.getByText('Count: 1')).toBeInTheDocument(); -}); -``` - -### Integration Testing - -Test component interactions. - -```jsx -test('form submission', async () => { - render(); - - const emailInput = screen.getByLabelText('Email'); - const submitButton = screen.getByText('Submit'); - - fireEvent.change(emailInput, { target: { value: 'test@example.com' } }); - fireEvent.click(submitButton); - - await screen.findByText('Success!'); -}); -``` - -## Best Practices - -### 1. Keep Components Small - -Break down complex components into smaller, focused components. - -```jsx -// ✅ Good - Small, focused components -const UserCard = ({ user }) => ( -
- - - -
-); - -// ❌ Bad - One large component with everything -``` - -### 2. Use Meaningful Names - -Choose descriptive names that convey purpose. - -```jsx -// ✅ Good - - - -// ❌ Bad - - -``` - -### 3. Handle Loading and Error States - -Always account for loading and error states. - -```jsx -const DataDisplay = ({ data, loading, error }) => { - if (loading) return ; - if (error) return ; - if (!data) return ; - return ; -}; -``` - -### 4. Optimize Re-renders - -Use React.memo and useMemo to prevent unnecessary re-renders. - -```jsx -import { memo } from 'react'; - -const ExpensiveComponent = memo(({ data }) => { - return
{/* Complex rendering logic */}
; -}); -``` - -### 5. Follow Accessibility Guidelines - -Ensure your UI is accessible to all users. - -```jsx -// Use semantic HTML - - -// Add ARIA labels - - -// Ensure keyboard navigation -
- Interactive Element -
-``` - -## Modern UI Development Tools - -### Build Tools - -- **Vite**: Fast build tool and dev server -- **Webpack**: Module bundler -- **Parcel**: Zero-config bundler - -### Component Libraries - -- **Material-UI**: React components following Material Design -- **Ant Design**: Enterprise-level UI design system -- **Chakra UI**: Accessible component library - -### State Management - -- **Redux**: Predictable state container -- **MobX**: Simple, scalable state management -- **Zustand**: Lightweight state management - -### Styling Libraries - -- **Tailwind CSS**: Utility-first CSS framework -- **Styled Components**: CSS-in-JS library -- **Emotion**: Performant CSS-in-JS library - -## Getting Started - -To begin building user interfaces: - -1. **Learn the Fundamentals**: Understand HTML, CSS, and JavaScript -2. **Choose a Framework**: React, Vue, Angular, or Svelte -3. **Study Design Principles**: Learn about UX and visual design -4. **Practice Component Thinking**: Break UIs into reusable components -5. **Build Projects**: Apply concepts by building real applications -6. **Focus on Accessibility**: Ensure your UIs work for everyone -7. **Optimize Performance**: Learn to build fast, efficient UIs - -## Related Documentation - -- [TechStack](./tech-stack.md) - Technology stack for UI development -- [Create Page, working with Layouts](#) - Page creation -- [Styling with Design Tokens](#) - Design system tokens -- [State Management](#) - Managing application state -- [Responsive Design](#) - Building responsive interfaces diff --git a/docs/user-interfaces/mobile/concepts/overview.mdx b/docs/user-interfaces/mobile/concepts/overview.mdx new file mode 100644 index 0000000..92df30c --- /dev/null +++ b/docs/user-interfaces/mobile/concepts/overview.mdx @@ -0,0 +1,142 @@ +--- +last_update: { author: "Praneeth Reddy" } +--- + +import MobileUiArchitecture from '../assets/mobile-ui-architecture.png' + +# Overview + +WaveMaker Platform provides + +- an open source React Native component library +- a codegen pipeline that transforms WaveMaker Markup into native mobile code and +- a design token system for consistent styling + +which enable mobile app developers to build cross-platform iOS and Android applications on the same WaveMaker platform. When you create an app in Studio, you choose **Web** or **Mobile** as the target device; each choice is a **separate project** with its own pages, services, and generated code. For a mobile project, you design pages visually in Studio and the platform generates a fully functional Expo-based React Native application. + +Platform uses component-based architecture and WaveMaker Markup Language (WML) to represent components within a page, which the codegen pipeline transforms into React Native code targeting Expo. + +## UI Concepts + +Mobile App UI is well separated into layers to define styling, layouts, components and client-side logic, similar to a WaveMaker web project. WaveMaker open source component library provides a comprehensive set of components for building enterprise-grade forms, dashboards, data-driven apps etc. with scalable, secure and modern experience needs. Generated code targets React Native (Expo) for native rendering instead of the browser DOM. + +Diagram of mobile UI layers for design tokens, auto layout, components, variables, actions, and events in a React Native app + +### Design Tokens + +Styling works through design tokens that map to React Native style properties. Each component token references a global token, and the platform resolves them at build time, eliminating manual style overrides for most use cases. + +```json + btn.background=color.primary + btn.font-size=label.large.font-size + + wizard.step.title.color=color.on-surface + accordion.text.color=color.on-surface + + list.item.border-color=color.outline + form.label.font-family=label.large.font-family +``` + +### Auto Layout + +Layouts can be created within a page or components using container Auto Layout, which provides fully customized layouting capability built on top of flex. + +```html + + ... + +``` + +### Components + +Components provide behaviour customization through properties, events for UI event handling and variants to enable look-n-feel customization combined with design tokens. + +```html + + + + + + +``` + +### Variables + +Variables provide integration capabilities enabling components to be bound to REST APIs or other supported data sources. Variables also inherently support managing state within the page context or across the application. + +```json + sv_serviceVariableHireReq: { + owner: "Page", + category: "wm.ServiceVariable", + ... + service: "hirerequisition", + operation: "invoke", + operationId: "hirerequisition_invoke", + operationType: "get", + serviceType: "RestService", + dataSet: [], + isList: true, + maxResults: 20, + startUpdate: true, + autoUpdate: true, + inFlightBehavior: "executeLast", + ... + } +``` + +### Actions + +Actions provide routing capability to transition between pages, dialogs, notifications or messages. + +```json + goToPage_FormComponents : { + name : "goToPage_FormComponents", + owner : "App", + category : "wm.NavigationVariable", + dataBinding : [ ], + operation : "gotoPage", + pageName : "FormComponents", + dataSet : [ ], + pageTransitions : "none" + } +``` + +### Events + +Events in WaveMaker UI framework enable app developers to handle complex UI interactions across components, handle pre/post processing of data from API calls and fully customize application experience. + +With events, developers can write client-side logic using JavaScript to fully customize application behaviour and take control of the user interactions. + +```javascript + Page.button1Tap = function ($event, widget) { + Page.Widgets.select1.dataset = ["min", "max", "same"] + Page.Widgets.switch1.datavalue = "max" + }; + + Page.switch1Change = function ($event, widget, newVal, oldVal) { + console.log('switch change') + Page.Variables.MyService.invoke({ + value: newVal + }) + }; +``` + +## Native mobile application + +Application code generated in React Native adheres to Expo and uses architectural principles from the React Native framework such as components, navigation, state management and native modules. Platform generated code is readable, maintainable and secure for enterprise deployments. + +UI concepts are AI-ready enabling agents to generate application artifacts from the intent, spec or designs provided by app developers. + +## Related Documentation + +- [TechStack](./tech-stack.mdx) - Technology stack for UI development +- [Create a page](../develop/page/index.mdx) and [working with layouts](../develop/working-with-layouts/index.mdx) - Page creation and layout containers +- [Styling with design tokens](../develop/styling-with-design-tokens/index.mdx) - Design system tokens +- [Variables and API integration](../develop/integrating-with-apis/index.md) - Managing application and page state +- [Responsive design with layouts](../develop/working-with-layouts/responsive-design-with-layouts.mdx) - Building responsive interfaces diff --git a/docs/user-interfaces/mobile/concepts/tech-stack.md b/docs/user-interfaces/mobile/concepts/tech-stack.md deleted file mode 100644 index 85016c1..0000000 --- a/docs/user-interfaces/mobile/concepts/tech-stack.md +++ /dev/null @@ -1,756 +0,0 @@ ---- -last_update: { author: "Author Name" } ---- - -# TechStack - -Comprehensive overview of the technology stack for modern user interface development. - -## Overview - -This document covers the essential technologies, frameworks, and tools used in modern UI development. Understanding this tech stack will help you make informed decisions when building user interfaces. - -## Frontend Frameworks - -### React - -React is a JavaScript library for building user interfaces with a component-based architecture. - -**Key Features:** -- Virtual DOM for efficient updates -- Component-based architecture -- Unidirectional data flow -- Rich ecosystem -- JSX syntax - -**Installation:** -```bash -npm create vite@latest my-app -- --template react -cd my-app -npm install -npm run dev -``` - -**Basic Example:** -```jsx -import { useState } from 'react'; - -function App() { - const [count, setCount] = useState(0); - - return ( -
-

Count: {count}

- -
- ); -} - -export default App; -``` - -**When to Use:** -- Large-scale applications -- Need for extensive third-party libraries -- Teams familiar with JavaScript -- SEO-friendly apps (with Next.js) - -### Vue.js - -Progressive JavaScript framework for building user interfaces. - -**Key Features:** -- Template syntax -- Reactive data binding -- Component composition -- Easy learning curve -- Single-file components - -**Installation:** -```bash -npm create vue@latest my-app -cd my-app -npm install -npm run dev -``` - -**Basic Example:** -```vue - - - -``` - -**When to Use:** -- Projects needing gentle learning curve -- Integration with existing projects -- Teams preferring template syntax -- Progressive enhancement - -### Angular - -Full-featured framework for building web applications. - -**Key Features:** -- TypeScript-based -- Two-way data binding -- Dependency injection -- Comprehensive tooling -- RxJS for reactive programming - -**Installation:** -```bash -npm install -g @angular/cli -ng new my-app -cd my-app -ng serve -``` - -**Basic Example:** -```typescript -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-counter', - template: ` -
-

Count: {{ count }}

- -
- ` -}) -export class CounterComponent { - count = 0; - - increment() { - this.count++; - } -} -``` - -**When to Use:** -- Enterprise applications -- Teams using TypeScript -- Need for built-in solutions -- Large, complex projects - -## State Management - -### Redux - -Predictable state container for JavaScript applications. - -**Installation:** -```bash -npm install @reduxjs/toolkit react-redux -``` - -**Example:** -```javascript -import { createSlice, configureStore } from '@reduxjs/toolkit'; - -const counterSlice = createSlice({ - name: 'counter', - initialState: { value: 0 }, - reducers: { - increment: state => { - state.value += 1; - }, - }, -}); - -export const { increment } = counterSlice.actions; - -export const store = configureStore({ - reducer: { - counter: counterSlice.reducer, - }, -}); -``` - -**Use Cases:** -- Complex state logic -- Multiple components sharing state -- Need for time-travel debugging -- Large applications - -### Zustand - -Lightweight state management solution. - -**Installation:** -```bash -npm install zustand -``` - -**Example:** -```javascript -import { create } from 'zustand'; - -const useStore = create((set) => ({ - count: 0, - increment: () => set((state) => ({ count: state.count + 1 })), -})); - -// Usage in component -function Counter() { - const { count, increment } = useStore(); - return ; -} -``` - -**Use Cases:** -- Small to medium applications -- Need for simplicity -- Minimal boilerplate -- Quick prototypes - -### MobX - -Simple, scalable state management through observables. - -**Installation:** -```bash -npm install mobx mobx-react-lite -``` - -**Example:** -```javascript -import { makeAutoObservable } from 'mobx'; -import { observer } from 'mobx-react-lite'; - -class CounterStore { - count = 0; - - constructor() { - makeAutoObservable(this); - } - - increment() { - this.count++; - } -} - -const counterStore = new CounterStore(); - -const Counter = observer(() => ( - -)); -``` - -**Use Cases:** -- Object-oriented programming preference -- Automatic reactivity needed -- Complex domain models -- Teams familiar with OOP - -## Styling Solutions - -### CSS-in-JS - -#### Styled Components - -```bash -npm install styled-components -``` - -```javascript -import styled from 'styled-components'; - -const Button = styled.button` - background-color: ${props => props.primary ? 'blue' : 'gray'}; - color: white; - padding: 8px 16px; - border-radius: 4px; - border: none; - cursor: pointer; - - &:hover { - opacity: 0.8; - } -`; - -// Usage - -``` - -#### Emotion - -```bash -npm install @emotion/react @emotion/styled -``` - -```javascript -import styled from '@emotion/styled'; - -const Button = styled.button` - background-color: blue; - color: white; - padding: 8px 16px; -`; -``` - -### Utility-First CSS - -#### Tailwind CSS - -```bash -npm install -D tailwindcss postcss autoprefixer -npx tailwindcss init -p -``` - -```jsx -const Button = ({ children, primary }) => ( - -); -``` - -### CSS Modules - -```css -/* Button.module.css */ -.button { - background-color: blue; - color: white; - padding: 8px 16px; - border-radius: 4px; -} - -.button:hover { - opacity: 0.8; -} -``` - -```jsx -import styles from './Button.module.css'; - -const Button = ({ children }) => ( - -); -``` - -## UI Component Libraries - -### Material-UI (MUI) - -React components implementing Material Design. - -```bash -npm install @mui/material @emotion/react @emotion/styled -``` - -```jsx -import Button from '@mui/material/Button'; -import TextField from '@mui/material/TextField'; - -function Form() { - return ( -
- - -
- ); -} -``` - -### Ant Design - -Enterprise-level UI design system. - -```bash -npm install antd -``` - -```jsx -import { Button, Input, Form } from 'antd'; - -function LoginForm() { - return ( -
- - - - - - -
- ); -} -``` - -### Chakra UI - -Accessible component library for React. - -```bash -npm install @chakra-ui/react @emotion/react @emotion/styled framer-motion -``` - -```jsx -import { Button, Input, Stack } from '@chakra-ui/react'; - -function Form() { - return ( - - - - - ); -} -``` - -## Build Tools - -### Vite - -Next-generation frontend tooling. - -**Features:** -- Lightning-fast HMR -- Optimized builds -- Built-in TypeScript support -- Plugin ecosystem - -```bash -npm create vite@latest my-app -cd my-app -npm install -npm run dev -``` - -### Webpack - -Module bundler for JavaScript applications. - -```bash -npm install --save-dev webpack webpack-cli webpack-dev-server -``` - -**webpack.config.js:** -```javascript -module.exports = { - entry: './src/index.js', - output: { - path: path.resolve(__dirname, 'dist'), - filename: 'bundle.js', - }, - module: { - rules: [ - { - test: /\.jsx?$/, - use: 'babel-loader', - exclude: /node_modules/, - }, - ], - }, -}; -``` - -## TypeScript - -Typed superset of JavaScript. - -**Installation:** -```bash -npm install --save-dev typescript @types/react @types/react-dom -``` - -**Example:** -```typescript -interface User { - id: string; - name: string; - email: string; -} - -interface UserCardProps { - user: User; - onEdit: (user: User) => void; -} - -const UserCard: React.FC = ({ user, onEdit }) => { - return ( -
-

{user.name}

-

{user.email}

- -
- ); -}; -``` - -## Testing Libraries - -### Jest - -JavaScript testing framework. - -```bash -npm install --save-dev jest @testing-library/react @testing-library/jest-dom -``` - -```javascript -import { render, screen } from '@testing-library/react'; -import Button from './Button'; - -test('renders button with text', () => { - render(); - expect(screen.getByText('Click me')).toBeInTheDocument(); -}); -``` - -### React Testing Library - -Testing utilities for React components. - -```javascript -import { render, screen, fireEvent } from '@testing-library/react'; - -test('button increments counter', () => { - render(); - - const button = screen.getByText('Increment'); - fireEvent.click(button); - - expect(screen.getByText('Count: 1')).toBeInTheDocument(); -}); -``` - -### Cypress - -End-to-end testing framework. - -```bash -npm install --save-dev cypress -``` - -```javascript -describe('Login Flow', () => { - it('should login successfully', () => { - cy.visit('/login'); - cy.get('input[name="email"]').type('user@example.com'); - cy.get('input[name="password"]').type('password'); - cy.get('button[type="submit"]').click(); - cy.url().should('include', '/dashboard'); - }); -}); -``` - -## API Integration - -### Axios - -HTTP client for making API requests. - -```bash -npm install axios -``` - -```javascript -import axios from 'axios'; - -const api = axios.create({ - baseURL: 'https://api.example.com', - timeout: 5000, -}); - -// GET request -const fetchUsers = async () => { - const response = await api.get('/users'); - return response.data; -}; - -// POST request -const createUser = async (userData) => { - const response = await api.post('/users', userData); - return response.data; -}; -``` - -### React Query (TanStack Query) - -Data fetching and caching library. - -```bash -npm install @tanstack/react-query -``` - -```javascript -import { useQuery, useMutation, QueryClient, QueryClientProvider } from '@tanstack/react-query'; - -const queryClient = new QueryClient(); - -function App() { - return ( - - - - ); -} - -function Users() { - const { data, isLoading } = useQuery({ - queryKey: ['users'], - queryFn: () => fetch('/api/users').then(res => res.json()), - }); - - if (isLoading) return
Loading...
; - return
{data.map(user =>
{user.name}
)}
; -} -``` - -## Performance Tools - -### React Developer Tools - -Browser extension for debugging React applications. - -### Lighthouse - -Automated tool for improving web page quality. - -### Web Vitals - -Library for measuring performance metrics. - -```bash -npm install web-vitals -``` - -```javascript -import { getCLS, getFID, getFCP, getLCP, getTTFB } from 'web-vitals'; - -getCLS(console.log); -getFID(console.log); -getFCP(console.log); -getLCP(console.log); -getTTFB(console.log); -``` - -## Recommended Stack Combinations - -### Modern React Stack -- **Framework:** React 18+ -- **Build Tool:** Vite -- **State Management:** Zustand or Redux Toolkit -- **Styling:** Tailwind CSS -- **Component Library:** Material-UI or Chakra UI -- **Data Fetching:** React Query -- **Forms:** React Hook Form -- **Testing:** Jest + React Testing Library - -### Enterprise Stack -- **Framework:** Angular -- **Build Tool:** Angular CLI -- **State Management:** NgRx -- **Styling:** Angular Material -- **Forms:** Reactive Forms -- **Testing:** Jasmine + Karma - -### Lightweight Stack -- **Framework:** Vue 3 -- **Build Tool:** Vite -- **State Management:** Pinia -- **Styling:** CSS Modules + SCSS -- **Component Library:** Naive UI -- **Data Fetching:** Axios -- **Testing:** Vitest - -## Development Tools - -### Package Managers -- **npm:** Default Node.js package manager -- **yarn:** Fast, reliable package manager -- **pnpm:** Efficient disk space usage - -### Version Control -- **Git:** Distributed version control -- **GitHub/GitLab/Bitbucket:** Code hosting platforms - -### Code Editors -- **VS Code:** Most popular code editor -- **WebStorm:** JetBrains IDE for JavaScript - -### Browser DevTools -- Chrome DevTools -- Firefox Developer Tools -- React DevTools -- Redux DevTools - -## Best Practices - -### 1. Choose the Right Tool - -Select tools based on: -- Project requirements -- Team expertise -- Performance needs -- Scalability requirements -- Community support - -### 2. Keep Dependencies Updated - -```bash -npm outdated -npm update -``` - -### 3. Use TypeScript for Large Projects - -TypeScript provides type safety and better developer experience for large codebases. - -### 4. Implement Proper Testing - -Use a combination of unit, integration, and e2e tests. - -### 5. Optimize Bundle Size - -Use code splitting and lazy loading: - -```javascript -import { lazy, Suspense } from 'react'; - -const Dashboard = lazy(() => import('./Dashboard')); - -function App() { - return ( - Loading...}> - - - ); -} -``` - -## Related Documentation - -- [Overview](./overview.md) - UI development fundamentals -- [Create Page, working with Layouts](#) - Page creation -- [State Management](#) - Managing application state -- [Integrating with APIs](#) - API integration diff --git a/docs/user-interfaces/mobile/concepts/tech-stack.mdx b/docs/user-interfaces/mobile/concepts/tech-stack.mdx new file mode 100644 index 0000000..7f06fdf --- /dev/null +++ b/docs/user-interfaces/mobile/concepts/tech-stack.mdx @@ -0,0 +1,27 @@ +--- +last_update: { author: "Praneeth Reddy" } +--- + +import CSS_Logo from '../assets/logos/css3-logo.png'; +import JSON_Logo from '../assets/logos/json-green-logo.png'; +import JS_Logo from '../assets/logos/javascript-logo.png'; +import React_Logo from '../assets/logos/react-logo.png'; + +# Technology Stack + +Mobile applications are generated using React Native with Expo. + +
+ React logo representing the React Native and Expo mobile stack +
+ +For more details about the technology stack, please refer to [Technology Stack](/tech-stack). + +| Artifact | Design time programming language | Code generation approach | Generated artifact | +| ------------------------------ | ------------------------------------------------------------------------------------------- | ------------------------------------------- | -------------------------------------------------------------------------------------------- | +| Page Markup | HTML-like syntax (WML) | React Native JSX compliant with Expo | JavaScript logo for generated page markup artifact | +| Page Code | - | JavaScript code compliant with React Native | JavaScript logo for generated page code artifact | +| Page & App-level Custom Script | JavaScript logo for design-time and generated script | Remains as JavaScript | JavaScript logo for generated script artifact | +| Page & App-level Custom Styles | JSON logo for design-time style definitions | Converted to React Native StyleSheet | JavaScript logo for generated React Native StyleSheet | +| Design Token Overrides | JSON logo for design token override source | Converted to CSS variables | CSS logo for compiled design token CSS output | +| Variable definitions | JSON logo for variable definition source | Converted to JavaScript | JavaScript logo for generated variable definitions | diff --git a/docs/user-interfaces/mobile/develop/actions/index.mdx b/docs/user-interfaces/mobile/develop/actions/index.mdx index d3afe25..6826e22 100644 --- a/docs/user-interfaces/mobile/develop/actions/index.mdx +++ b/docs/user-interfaces/mobile/develop/actions/index.mdx @@ -1,56 +1,67 @@ --- -last_update: { author: "Raj Kumar Reddy Abbadi" } +last_update: { author: "Praneeth Reddy" } --- -# Overview -## Actions in WaveMaker +# Overview -In WaveMaker, Variables and Actions together form the integration layer between the user interface and backend services. While variables are mainly used for data operations (fetching, inserting, updating, deleting, and binding data to widgets), Actions define what the application should do next when something happens. +Variables and **Actions** connect the UI to backend services and navigation. Variables load and bind data. Actions run the next step when something happens: invoke a service, show a message, open a page, or log in. -Actions help you connect UI events (like button clicks) with application logic (like invoking a service, validating data, or navigating to another page), without tightly coupling everything to a single widget. +Actions keep business logic out of widget markup. You wire them from the **Actions** dialog or from a widget **Events** tab (for example **on Tap** or **on Submit**). ```mermaid flowchart TD - A[User Event Click or Submit] --> B[Action Starts] - B --> C[Invoke Variable] - C --> D{Response Received} - - D -->|Success| E[Update UI Widgets and Refresh Data Binding] - E --> F[Success Flow -> Navigate, Close Dialog, Show Message] + A[User tap or submit] --> B[Action runs] + B --> C[Invoke variable or built-in action] + C --> D{Response} - D -->|Error| G[Error Flow Show Error Message] - G --> H[Reset UI State -> Stop Loader, Enable Button] + D -->|Success| E[Update bindings and widgets] + E --> F[Navigate, close dialog, or notify] + D -->|Error| G[Show error message] + G --> H[Reset UI, hide loader] ``` -Actions represent operations performed by the application when an event occurs. These operations can be triggered by: -- User-initiated events (such as clicking a button or submitting a form) -- System-driven events (such as successful completion of a service call) -Actions enable developers to implement business logic, rules, and navigation flows without tightly coupling them to UI components. +## When actions run -## Action Creation +- **User events:** button tap, form submit, list row select +- **System events:** success or error after a variable or action completes -There are two common ways to create an Action: +For event handler naming and UI callbacks, see [Event handling overview](/docs/user-interfaces/mobile/develop/events/). -- From the Actions dialog: You can open the Actions panel and click New Action to create an action directly. -- From a component event: When you select a UI component (like a Button, Form, or DataTable), you can go to its Events tab and choose New Action for an event such as onClick, onSubmit, or onRowSelect +## Create an action -```mermaid +**From the Actions dialog** -flowchart TD - A[Start] --> B{How do you create the Action} +1. Open **Actions** in Studio. +2. Click **New Action**. +3. Pick the action type (navigation, notification, login, and so on). - B -->|Actions dialog| C[Click on Variable and Select Action value from dropdown] - C --> D[Click -> New Action] +**From a widget event** - B -->|Component event| E[Select a component] - E --> F[Open Events tab] - F --> G[Choose event and click New Action] +1. Select the widget. +2. Open the **Events** tab. +3. Choose an event (for example **on Tap**) and click **New Action**. +4. Complete the **New Action** dialog. - D --> H[New Action dialog opens] - G --> H[New Action dialog opens] +```mermaid +flowchart TD + A[Create action] --> B{Entry point} - H --> I[Select required target action] - I --> J[Action created and available for use] + B -->|Actions dialog| C[New Action] + B -->|Widget Events tab| D[Pick event, then New Action] + C --> E[Select action type and configure] + D --> E + E --> F[Action available on Page or App] ``` + +## Action types + +Studio provides navigation, login, logout, timer, and notification actions. Configuration and `invoke()` examples are on [Types of actions](/docs/user-interfaces/mobile/develop/actions/types). + +## Related topics + +- [Types of actions](/docs/user-interfaces/mobile/develop/actions/types) +- [Event handling overview](/docs/user-interfaces/mobile/develop/events/) +- [Variable events](/docs/user-interfaces/mobile/develop/events/variable-events) +- [UI events](/docs/user-interfaces/mobile/develop/events/ui-events) diff --git a/docs/user-interfaces/mobile/develop/actions/types.mdx b/docs/user-interfaces/mobile/develop/actions/types.mdx index 189feb0..8e42bc7 100644 --- a/docs/user-interfaces/mobile/develop/actions/types.mdx +++ b/docs/user-interfaces/mobile/develop/actions/types.mdx @@ -1,73 +1,114 @@ --- -last_update: { author: "Raj Kumar Reddy Abbadi" } +last_update: { author: "Praneeth Reddy" } --- -# Types of Actions -- **Navigation:** action provides navigation capabilities to help in navigating from one page or view to another -- **Login:** action is to authenticate a user at the server. A Login Action is created automatically when you enable Security in your application -- **Logout** action -- **Timer:** action can be used to trigger events repeatedly at timed intervals. -- **Notification:** is an action to show UI notifications in the app in the form of a toaster, alert or a confirmation box +# Types of actions +Studio ships built-in actions for navigation, security, timed callbacks, and user messages. Create them from the **Actions** dialog or from a widget **Events** tab. For how actions fit with variables and events, see [Actions overview](/docs/user-interfaces/mobile/develop/actions/). -## Navigation Action -The Navigation Action in WaveMaker provides built in navigation capabilities that enable movement between pages or views within an application. Navigation actions define how and when page transitions occur in response to events. +| Action | Use for | +| ------------ | -------------------------------------------- | +| Navigation | Open another page or go to the previous page | +| Login | Authenticate against your security provider | +| Logout | End the session | +| Timer | Run logic once or on an interval | +| Notification | Toast, alert, or confirm UI | -#### Properties +## Navigation action -| Property | Description | -| -------- | ----------- | -| Navigation Target | Sets Navigation Target (Previous Page, Page, Tab or Accordion)| -| Page Name | The page name to navigate to | +Navigation actions move the user between screens in the stack. In a **React Native mobile** project, Studio exposes **Page** and **Previous page** as navigation targets. Wire an action to a tap, a variable **on Success** handler, or another event. + +To switch tabs or accordion panes on the same page, use the widget API in script (for example `Page.Widgets.myTabs.select()`) or bind selection in markup instead of a navigation action. + +### Properties + +| Property | Description | +| ----------------- | ---------------------------------------------- | +| Navigation target | **Page** or **Previous page** (mobile) | +| Page name | Target page when navigation target is **Page** | + +### Invoke from script + +Action names follow `goToPage_{PageName}` (or the name Studio generates). Pass route parameters on `invoke` or with `setData` before `invoke`. ```javascript -// Example 1: Navigate to TestPage Page.Actions.goToPage_TestPage.invoke(); -// Example 2: Navigate to TestPage with url params Page.Actions.goToPage_TestPage.invoke({ - data: { - 'param1': "param value", - "param2": "param value 2" - } + data: { + param1: "param value", + param2: "param value 2" + } }); -// Example 3: Navigate to TestPage by setting the input fields -Var nv = Page.Actions.goToPage_TestPage; -nv.setData({ - 'param1': "param value", - "param2": "param value 2" +var nav = Page.Actions.goToPage_TestPage; +nav.setData({ + param1: "param value", + param2: "param value 2" }); -nv.invoke(); +nav.invoke(); ``` ---- -## Login Action -The Login Action in WaveMaker provides a standardized mechanism for user authentication. Automatically created when security is enabled, it integrates with the configured security provider and supports flexible customization through properties and events. By leveraging the Login Action, applications can implement secure, role-based access with minimal configuration. - -The Login Action exposes standard action lifecycle events, These events can be used to implement custom authentication logic, error handling, or navigation behavior.: -- onSuccess -- onError -- onBeforeInvoke - -#### Properties - -| Property | Description | -| -------- | ----------- | -| Use default success handler | If checked, on successful login, the logged in user will be redirected to the Landing Page configured against the user role (refer to Login Configuration under Security for more info). If a custom logic is required, uncheck this property and implement the logic under the onSuccess event of the Action.| -| Update data on input change | If checked, the component will be triggered automatically on the change of input data (as mentioned in the data tab) for the Action. | -| Request data on page load | If checked, 'Page' scoped will be triggered on page load while 'Application' scoped will be triggered on application load. | -| In Flight Behavior | This property determines the behavior when a call is fired through the action with the previous call still pending. Action queues all these calls, waits for the previous call completion and then based on the value of the inFlightBehavior property, decides what to do with all the queued calls: - doNotExecute - all the queued calls will be discarded, - executeAll - all the calls will be triggered one by one, or - executeLast - only the last call is triggered and the rest are discarded, this is the default behavior | -| Spinner Context | This property specifies on which UI widget the spinner should show. Leave empty if no spinner required. | -| Spinner Message | The message to be displayed below the spinner. Leave empty if no message is required below the spinner. Note: If multiple actions are fired then the spinner messages will be displayed as a list below a single spinner. | ---- -## Logout Action -A Logout Action is automatically created when you implement Security in your application. You can edit the Properties and Events of the Logout Action from the Actions dialog. +## Login action ---- -## Timer Action -Timer action can be used to trigger events repeatedly at timed intervals. +Created automatically when you enable **Security**. Calls your configured identity provider and supports role-based landing pages. ---- -## Notification Action -Notification Action is an action to show UI notifications in the app in the form of a toaster, alert or a confirmation box. It provides message capabilities, a way for the app to notify the end users. Based on the operation selected app can notify the user through an Alert/Confirm dialog or a simple toaster message. This action can be useful in cases like error handling, confirm user action, etc. \ No newline at end of file +### Events + +- `onBeforeInvoke` +- `onSuccess` +- `onError` + +Use **on Success** for custom navigation when **Use default success handler** is off. + +### Common properties + +| Property | Description | +| --------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| Use default success handler | When enabled, navigates to the landing page for the user role after login. Disable to handle navigation in **on Success**. | +| Update data on input change | Invokes the action when bound input data changes. | +| Request data on page load | Runs on page load (page scope) or app load (app scope). | +| In flight behavior | `executeLast` (default), `executeAll`, or `doNotExecute` when a call is already in progress. | + +```javascript +App.Actions.loginAction.invoke(); +``` + +## Logout action + +Created when **Security** is enabled. Configure properties and events in the **Actions** dialog, then invoke from a menu item or button: + +```javascript +App.Actions.logoutAction.invoke(); +``` + +## Timer action + +Runs page or app logic after a delay, once or repeatedly. Set **delay** (milliseconds) and **repeating** in Studio. Call `invoke()` to start and `cancel()` to stop. + +```javascript +Page.Actions.myTimer.invoke(); +Page.Actions.myTimer.cancel(); +``` + +## Notification action + +Shows feedback in the app: **toast** messages, **alert** dialogs, or **confirm** dialogs (with OK and Cancel). Use for errors, confirmations, and status updates. + +Configure message text, type (success, error, info), duration, and position in the action properties or when invoking: + +```javascript +Page.Actions.appNotification.invoke({ + message: "Saved successfully", + class: "Success" +}); +``` + +Partial content can be bound for richer toast or dialog bodies. + +## Related topics + +- [Actions overview](/docs/user-interfaces/mobile/develop/actions/) +- [Event handling overview](/docs/user-interfaces/mobile/develop/events/) +- [UI events](/docs/user-interfaces/mobile/develop/events/ui-events) +- [Variable events](/docs/user-interfaces/mobile/develop/events/variable-events) diff --git a/docs/user-interfaces/mobile/develop/create-web-app-project/index.mdx b/docs/user-interfaces/mobile/develop/create-reactnative-app-project/index.mdx similarity index 91% rename from docs/user-interfaces/mobile/develop/create-web-app-project/index.mdx rename to docs/user-interfaces/mobile/develop/create-reactnative-app-project/index.mdx index 35c5ca9..d93948d 100644 --- a/docs/user-interfaces/mobile/develop/create-web-app-project/index.mdx +++ b/docs/user-interfaces/mobile/develop/create-reactnative-app-project/index.mdx @@ -6,8 +6,8 @@ last_update: { author: 'Raj Kumar Reddy Abbadi' } ## WaveMaker Project Workspace -When you create a new application or open an existing one in WaveMaker Studio, you are taken to the Project Workspace. -The Project Workspace is the central area where you design UI, configure services, manage resources, and control project settings. +When you create a **mobile** application (target device **Mobile**) or open an existing mobile project in WaveMaker Studio, you are taken to the Project Workspace. +The Project Workspace is the central area where you design UI, configure services, manage resources, and control project settings. Web applications use a separate Studio project with different export and preview options. ### Project Workspace Overview @@ -63,8 +63,7 @@ The Header provides access to all frequently used actions and global project ope - Export Project - Export - Project Sources as ZIP - - Project as Angular ZIP - - Project as React ZIP + - React Native Zip - Project as WAR (Development | Deployment) - Theme to Team - Publish diff --git a/docs/user-interfaces/mobile/develop/create-web-app-project/project-structure.mdx b/docs/user-interfaces/mobile/develop/create-reactnative-app-project/project-structure.mdx similarity index 68% rename from docs/user-interfaces/mobile/develop/create-web-app-project/project-structure.mdx rename to docs/user-interfaces/mobile/develop/create-reactnative-app-project/project-structure.mdx index 00c3b5c..e9dfced 100644 --- a/docs/user-interfaces/mobile/develop/create-web-app-project/project-structure.mdx +++ b/docs/user-interfaces/mobile/develop/create-reactnative-app-project/project-structure.mdx @@ -1,27 +1,26 @@ --- -last_update: { author: 'Raj Kumar Reddy Abbadi' } +last_update: { author: 'Praneeth Reddy' } --- # Overview -WaveMaker projects follow a standard Maven structure with added directories for Angular web apps and mobile apps. The project is Maven-compliant, inherits from a parent POM, and can generate separate frontend/backend artifacts or a combined WAR. For mobile, React Native projects are generated with a standard Expo-based structure. +WaveMaker projects follow a standard Maven structure with parent POM inheritance. For mobile, the platform generates an Expo-based React Native project. The generated project can be built into APK (Android) or IPA (iOS) using WaveMaker CLI or AppChef. ### Core Structure - - Maven-based with parent POM inheritance: wavemaker-app-parent → wavemaker-app-dependencies → your app’s pom.xml - - Default profiles: development and deployment; custom profiles supported - - Build outputs: - - Combined WAR (frontend + backend) by default - - Separate ui-artifacts.zip (Angular) + project.war when build.ui.mode=angular - - Separate Project as Angular zip - - Separate Project as React zip +- Maven-based with parent POM inheritance: WaveMaker-app-parent → WaveMaker-app-dependencies → your app's pom.xml +- Default profiles: development and deployment; custom profiles supported +- Build outputs: + - Expo-based React Native project (exported as ZIP) + - APK (Android) via WaveMaker CLI or AppChef + - IPA (iOS) via WaveMaker CLI or AppChef -```text +```text project/ ├── src/main/ │ ├── java/ # Java service classes │ ├── resources/ # Configuration files, queries -│ └── webapp/ # Web application root +│ └── webapp/ # UI and app config root (Maven folder name; used in mobile and web projects) │ ├── pages/ # Page markup, scripts, styles │ ├── services/ # Backend service metadata │ ├── app.css # Application-level styles @@ -34,7 +33,7 @@ project/ ### Three-Layer Application Architecture -WaveMaker applications follow a strict three-layer architecture that separates concerns between presentation, data binding, and business logic. +WaveMaker applications follow a strict three-layer architecture that separates concerns between presentation, data binding, and business logic. You create either a **web** or a **mobile** project in Studio—not both in one project. The diagram shows both client types at a platform level; your mobile project uses only the **Mobile UI** branch. ```mermaid flowchart TB @@ -42,7 +41,7 @@ flowchart TB %% UI Layer subgraph UI["UI Layer"] WebUI["Web UI
Angular
React"] - MobileUI["Mobile UI
React Native
Expo 54"] + MobileUI["Mobile UI
React Native
Expo"] end %% Binding Layer @@ -91,4 +90,3 @@ flowchart TB BackendServices --> JavaServices ``` - diff --git a/docs/user-interfaces/mobile/develop/create-reactnative-app-project/reactnative-project-structure.mdx b/docs/user-interfaces/mobile/develop/create-reactnative-app-project/reactnative-project-structure.mdx new file mode 100644 index 0000000..3faf400 --- /dev/null +++ b/docs/user-interfaces/mobile/develop/create-reactnative-app-project/reactnative-project-structure.mdx @@ -0,0 +1,132 @@ +--- +last_update: { author: 'Praneeth Reddy' } +--- + +# Working with Generated React Native Code + +WaveMaker generates an Expo-based React Native project from your **mobile** project's design-time source in Studio (pages, variables, and configuration)—not from a web project. The generated code follows React Native conventions while preserving WaveMaker's runtime engine, data bindings, and page composition model. The generated code is modular, readable and production ready. + +**Key characteristics of the generated React Native code include:** + +- **Component Based Page Architecture:** Each WaveMaker page is generated as a self-contained module under `src/pages/` with the following structure: + - A React Native component file (`PageName.component.js`) that defines the page UI layout + - A page-specific stylesheet (`PageName.style.js`) using React Native StyleSheet + - A script file (`PageName.script.js`) for page behavior and lifecycle hooks + - A variable definition file (`PageName.variables.js`) for page state, service bindings, and data flow + +- **WaveMaker Runtime Integration**: The generated React Native components are bound to the WaveMaker runtime. The runtime layer manages: + - Page lifecycle (initialization, ready state, teardown) + - Two-way data binding between UI components and variables + - Service invocation and response mapping + - Navigation and event wiring + +- **Expo Configuration**: The generated project uses Expo for native module management. `app.json` defines the Expo configuration and `wm_rn_config.json` provides WaveMaker-specific settings including plugin registrations and feature flags. + +### Generated Project Structure + +```text +project-expo-app/ +├── App.js # Application entry point +├── app.json # Expo configuration +├── app.style.js # Application-level styles +├── app.theme.js # Theme configuration +├── package.json # NPM dependencies and scripts +├── babel.config.js # Babel configuration +├── metro.config.js # Metro bundler configuration +├── bootstrap.js # Runtime bootstrap +├── wm_rn_config.json # WaveMaker plugin and feature configuration +├── font.config.js # Custom font configuration +│ +├── assets/ # Static assets (images, fonts, icons) +│ +├── src/ +│ ├── app.variables.js # Application-level variables and service bindings +│ ├── device-permission-service.js +│ ├── device-plugin-service.js +│ ├── pages/ # Generated page modules +│ │ ├── pages-config.js # Page routing configuration +│ │ ├── Main/ +│ │ │ ├── Main.component.js # Page UI layout +│ │ │ ├── Main.script.js # Page logic and event handlers +│ │ │ ├── Main.style.js # Page styles (React Native StyleSheet) +│ │ │ └── Main.variables.js # Page variables and data bindings +│ │ ├── Login/ +│ │ └── ... +│ ├── partials/ # Reusable partial page fragments +│ ├── prefabs/ # Prefab components +│ └── extensions/ # Custom extensions +│ +├── theme/ # Design token theme files +├── scripts/ # Build and utility scripts +└── android/ # Native Android project (generated by prebuild) +``` + +### Page Module Structure + +Each WaveMaker page is generated as a standalone module. UI, logic, state, and styles are split across separate files. + +```mermaid +flowchart TD + A[WaveMaker Page] --> B["PageName.component.js
Page UI Layout"] + A --> C["PageName.style.js
React Native StyleSheet"] + A --> D["PageName.variables.js
Page Variables & Data Bindings"] + A --> E["PageName.script.js
Custom Page Logic & Events"] +``` + +### Studio Markup to Generated Code + +WaveMaker Markup (WML) defined in Studio: + +```html + + + + + + + + + + + + +``` + +Generated React Native code: + +```javascript +const PC_Page_content1 = ({ fragment }) => { + return ( + + + + ); +}; + +export default class MainPage extends BasePage { + constructor(props) { + super(props); + this.name = 'Main'; + this.theme = props.themeToUse || this.appConfig.theme; + this.theme = this.theme.$new('Main-styles', styles); + } + + init() { + const data = getVariables(this.proxy); + this.fragmentVariables = data.Variables; + this.fragmentActions = data.Actions; + addPageScript(this.App, this.proxy); + } + + renderPage() { + const fragment = this.proxy; + return ( + + + + ); + } +} +``` diff --git a/docs/user-interfaces/mobile/develop/create-web-app-project/angular-project-structure.mdx b/docs/user-interfaces/mobile/develop/create-web-app-project/angular-project-structure.mdx deleted file mode 100644 index c039d6b..0000000 --- a/docs/user-interfaces/mobile/develop/create-web-app-project/angular-project-structure.mdx +++ /dev/null @@ -1,142 +0,0 @@ ---- -last_update: { author: 'Raj Kumar Reddy Abbadi' } ---- - -# Working with Generated Angular Code - -WaveMaker allows applications to be exported as a standard Angular project, producing a complete frontend codebase that follows Angular CLI conventions while preserving WaveMaker’s runtime, bindings, and page composition model. The generated code aligns with Angular best practices and is structured to be modular, maintainable, and production ready, while accurately reflecting the UI, logic, and data bindings defined in WaveMaker Studio. - -**Key characteristics of the generated Angular code include:** - - **Component Based Structure**: Each page is generated as an Angular component with a clearly defined scope, promoting modularity and separation of concerns. This makes individual pages easier to maintain, test, and evolve without impacting unrelated parts of the application. - - **Security & Performance Optimizations**: The generated setup incorporates standard Angular build optimizations such as route guards for access control, tree-shaking to remove unused code, and minification for smaller bundle sizes. Together, these practices help keep the application secure, fast, and production ready. - - **Custom Extensions & Integrations**: The project structure allows teams to extend generated components with custom logic and integrate third party Angular components and libraries, enabling advanced UI patterns and feature enhancements without disrupting the generated core. - - **Deployment Friendly Frontend Output**: The compiled frontend output is suitable for deployment as static assets, making it straightforward to host on web servers or CDNs as part of standard frontend deployment pipelines. - -#### Working with the Exported Project Follows Three Main Steps: - - **Export workflow:** how the Angular ZIP is generated and downloaded - - **Project structure:** how the Angular application is organized at a high level - - **Page structure:** how each WaveMaker page is represented as an Angular component - -### Steps to Export a WaveMaker Project as Angular ZIP - -- **Open your project in WaveMaker Studio** Make sure the project you want to export is loaded and ready. -- **Click on “Export Project”** This opens the export options menu. -- **Select “Project as Angular ZIP”** Choose the option to export your application as an Angular source bundle. -- **Confirm the Export Job** A dialog appears saying the export job has been created (Click OK to proceed) -- **Open Project Notifications** Click the Project Notification icon to view background jobs. -- **Navigate to the Jobs Tab** In the popup, go to the Jobs tab to see export progress. -- **Find the Export Job** Locate the job related to “Angular ZIP export”. -- **Download the Angular ZIP** Click the Download button for the completed job. - - -### Understanding the WaveMaker Angular Project Structure - -When you export a WaveMaker app as an Angular ZIP, you get a standard Angular CLI project with WaveMaker-specific runtime and build layers on top. - -Think of it as: **Angular app + WaveMaker runtime + generated pages + service bindings** - -```javascript -angular_app/ -├── angular.json // Angular CLI configuration (build, serve, assets, styles) -├── package.json // NPM dependencies + scripts -├── package-lock.json // Locked dependency versions -├── tsconfig.json // Base TypeScript configuration -├── proxy.conf.js // Dev-time backend proxy (avoids CORS during local run) -├── wm-custom-webpack.config.js // Wavemaker webpack extensions (rarely edited manually) -│ -├── build-scripts/ -│ ├── build.js // Custom build logic used by Wavemaker -│ ├── index-html-transform.js // Injects scripts/styles during build -│ └── index-html-transform-ng-serve.ts // Same as above but for ng serve -│ -├── src/ -│ ├── index.html // Main HTML shell for the Angular app -│ ├── main.ts // Angular bootstrap entry point -│ ├── polyfills.ts // Browser compatibility polyfills -│ ├── styles.css // Global styles (themes usually injected by WM) -│ ├── environment.ts // Environment configuration (URLs, flags) -│ │ -│ ├── app/ -│ │ ├── app.component.ts / html / css // Root Angular component -│ │ ├── app.routes.ts // Central routing config (Mostly Wavemaker generated) -│ │ ├── app.config.ts // App-level configuration and providers -│ │ ├── wm-project-properties.ts // Project metadata generated by Wavemaker -│ │ ├── wmProperties.js // Runtime project settings (do not edit) -│ │ ├── lazy-load-scripts.resolve.ts // Handles lazy loading of scripts/components -│ │ │ -│ │ ├── extensions/ -│ │ │ └── formatters.js // Custom value formatters (SAFE to extend) -│ │ │ -│ │ ├── pages/ -│ │ │ ├── Login/ -│ │ │ │ ├── Login.component.ts // Page component logic -│ │ │ │ ├── Login.component.html // Page UI layout -│ │ │ │ ├── Login.component.css // Page-specific styles -│ │ │ │ ├── Login.component.variables.ts // Page variables / state (WM-managed) -│ │ │ │ ├── Login.component.expressions.ts // Auto-generated data bindings -│ │ │ │ └── Login.component.script.js // Custom JS logic (SAFE for manual logic) -│ │ │ -│ │ └── prefabs/ -│ │ └── prefab-config.ts // Configuration for reusable prefabs -│ │ -│ ├── framework/ -│ │ ├── services/ -│ │ │ ├── app-extension.service.ts -│ │ │ ├── app-js-provider.service.ts -│ │ │ ├── app-variables-provider.service.ts -│ │ │ ├── component-ref-provider.service.ts -│ │ │ ├── lazy-component-ref-provider.service.ts -│ │ │ └── prefab-config-provider.service.ts // Wavemaker runtime services (DO NOT MODIFY) -│ │ │ -│ │ └── util/ -│ │ ├── lazy-module-routes.ts -│ │ └── page-util.ts // Internal navigation/helpers -│ │ -│ └── servicedefs/ -│ └── app-servicedefs.json // Backend API definitions used by WM - -``` - -### WaveMaker Page Component Structure - -In a WaveMaker Angular export, each WaveMaker page is generated as a standalone Angular component. -All the UI, logic, state, and bindings for a page are split across multiple files to separate concerns and make customization safer. - -#### Files Generated for Each WaveMaker Page -Each wavemaker page (for example: **Main/**) contains the following files: - - **Main.component.html** Contains the HTML template for the page (All WaveMaker components and layout definitions are rendered here) - - **Main.component.css** Holds page specific styles - - **Main.component.script.js** Intended for developer written JavaScript logic - - **Main.component.ts** Declares the Angular component for the page (Wires together template, styles, variables, and expressions) - - **Main.component.variable.ts** Contains all WaveMaker generated page variables - - **Main.component.expression.ts** Contains auto generated expression logic (🚫 Do not edit manually) - -This modular structure helps keep presentation, behavior, expressions, and state management cleanly organized. - -```mermaid -flowchart TD - B[WaveMaker Page] --> C[Main.component.ts
Component Definition
Extends BasePageComponent] - - C --> D[Main.component.html
Page UI Layout] - C --> E[Main.component.css
Page Styling] - C --> F[Main.component.variable.ts
Page Variables & State] - C --> G[Main.component.expression.ts
Data Bindings & Expressions] - C --> H[Main.component.script.js
Custom Page Logic] -``` - - -#### Generated Angular Markup of WaveMaker Page -```html -
-
-
- -
@if (compilePageContent) {{{onPageContentReady()}}}
-
-
-
-``` - - - - diff --git a/docs/user-interfaces/mobile/develop/create-web-app-project/react-project-structure.mdx b/docs/user-interfaces/mobile/develop/create-web-app-project/react-project-structure.mdx deleted file mode 100644 index fbabd01..0000000 --- a/docs/user-interfaces/mobile/develop/create-web-app-project/react-project-structure.mdx +++ /dev/null @@ -1,180 +0,0 @@ ---- -last_update: { author: 'Raj Kumar Reddy Abbadi' } ---- - -# Working with Generated React Code - -WaveMaker allows applications to be exported as a standard React (Next.js) project, producing a complete frontend codebase that follows modern React and Next.js conventions while preserving WaveMaker’s runtime engine, data bindings, and page composition model. The generated code aligns with React best practices and is structured to be modular, maintainable, and production ready, while accurately reflecting the UI, logic, and data bindings defined in WaveMaker Studio. - -The exported project includes a fully configured Next.js application with TypeScript support, environment configuration, static assets, page modules, and WaveMaker runtime wiring. This enables teams to work with a familiar React ecosystem while continuing to benefit from WaveMaker’s low-code page composition and service binding model. - -**Key characteristics of the generated React code include:** - - **Component Based Page Architecture:** Each WaveMaker page is generated as a self-contained React page module, typically organized under react-pages/ with the following structure: - - A routing entry (```page.tsx```) to integrate with Next.js navigation - - A React component file (```[PageName].component.tsx```) that defines the page’s UI layout - - A page-specific stylesheet (```[PageName].css```) - - A script/controller file (```[PageName].script.js```) for page behavior and lifecycle hooks - - A variable definition file (```[PageName].variable.ts```) for page state, service bindings, and data flow - - ```mermaid - flowchart TD - A["WaveMaker Studio"] - A --> B["React Export (Next.js + TypeScript)"] - B --> E["React Pages (Generated)"] - - %% Page Structure - E --> E1["page.tsx (Route Entry)"] - E --> E2["PageName.component.tsx (UI Layout)"] - E --> E3["PageName.css (Page Styles)"] - E --> E4["PageName.script.js (Page Logic)"] - E --> E5["PageName.variable.ts (State and API Bindings)"] - - %% Runtime Integration - E2 --> H["WaveMaker Runtime Layer"] - ``` - This structure enforces a clear separation of concerns between UI layout, styling, behavior, and data, making individual pages easier to maintain, test, and evolve independently without impacting unrelated parts of the application. - - - **WaveMaker Runtime Integration with React**: The generated React components are not plain React components; they are bound to the WaveMaker runtime. The runtime layer manages: - - Page lifecycle (initialization, ready state, teardown) - - Two-way data binding between UI components and variables - - Service invocation and response mapping - - Navigation and event wiring - - This allows React to serve as the rendering framework while WaveMaker continues to control page composition, data flow, and interaction patterns defined in Studio. - - - **Security & Performance Optimizations**: The exported React application leverages Next.js production features and standard frontend optimizations. - - Route-level rendering via Next.js for optimized page loading - - Tree-shaking and code-splitting during production builds to reduce bundle size - - Static asset optimization for images and public files - - Environment-based configuration using .env for separating development and production settings - - These practices ensure the generated React app is secure, performant, and suitable for enterprise grade deployments. - - - **Deployment Ready Frontend Output**: The React project compiles into standard static and server-rendered assets (depending on Next.js configuration), making it suitable for: - - Hosting on traditional web servers - - Deployment on CDNs - - Integration into CI/CD pipelines - - Containerized deployment environments - - This allows the exported frontend to fit seamlessly into modern DevOps workflows and frontend deployment pipelines, similar to hand crafted React/Next.js applications. - -### Steps to Export a WaveMaker Project as React ZIP - -- **Open your project in WaveMaker Studio** Make sure the project you want to export is loaded and ready. -- **Click on “Export Project”** This opens the export options menu. -- **Select “Project as React ZIP”** Choose the option to export your application as an React source bundle. -- **Confirm the Export Job** A dialog appears saying the export job has been created (Click OK to proceed) -- **Open Project Notifications** Click the Project Notification icon to view background jobs. -- **Navigate to the Jobs Tab** In the popup, go to the Jobs tab to see export progress. -- **Find the Export Job** Locate the job related to “React ZIP export”. -- **Download the React ZIP** Click the Download button for the completed job. - -### Understanding the WaveMaker React Project Structure - -When you export a WaveMaker application as a React ZIP, you get a standard React (Next.js + TypeScript) project with WaveMaker-specific runtime, page composition, and build layers on top. - -The exported project follows modern React and Next.js conventions while preserving WaveMaker’s low-code model for UI composition, event handling, and data binding. This allows teams to work in a familiar React ecosystem without losing the productivity benefits of WaveMaker Studio. - -```javascript -Documentation-react-app/ -├─ .build/ // Used for internal build metadata. -| -├─ .env // Environment variables (API URLs, secrets, runtime configs) -| -├─ .npmignore // Files to exclude when publishing package (if used as lib) -| -├─ .prettierrc // Code formatting rules for consistent styling across the team -| -├─ README.md // Project documentation and setup instructions -| -├─ next-env.d.ts // Next.js TypeScript environment definitions (auto-generated) -| -├─ next.config.ts // Next.js configuration Controls routing, builds, environment variables, etc. -| -├─ package.json // Project metadata + dependencies + scripts (npm run dev/build) -| -├─ package-lock.json // Locked dependency versions (auto-generated) -| -├─ tsconfig.json // TypeScript compiler configuration -| -├─ app // Main application source code -│ ├─ _app.tsx // Root React wrapper component. -│ ├─ app.css // Global CSS styles for the entire application -│ ├─ app.script.js // Wavemaker runtime bootstrap file -│ ├─ (other generated folders/files) // Pages, Components, Services, Variables, Routes -│ ├─ react-pages -│ ├─ page.tsx // Page Router / Entry Wrapper (Registers the page with Next.js routing) -│ ├─ [PageName].component.tsx // Main UI Layout (actual React component for your page UI) -│ ├─ [PageName].css // Page Level Styling (CSS scoped to this page) -│ ├─ [PageName].script.js // Page Logic & Events (page specific JavaScript logic) -│ ├─ [PageName].variable.ts // Page State & Data Binding (page level state & variables) -│ -├─ public -│ └─ Static assets (served directly by the web server) -│ ├─ Readme.txt // Static assets info -│ ├─ files // Public downloadable files (PDFs, docs, exports) -│ ├─ i18n // Localization files -│ │ └─ en.json // English translations for UI labels and messages -│ └─ images // UI branding assets -│ ├─ imagelists // Default UI images -│ └─ logos // App branding - -``` - -### WaveMaker Page Component Structure - -In a WaveMaker React export, each WaveMaker page is generated as a standalone React component. -All the UI, logic, state, and bindings for a page are split across multiple files to separate concerns and make customization safer. - -#### Files Generated for Each WaveMaker Page -Each wavemaker page (for example: **Main/**) contains the following files: - - **Main.component.html** Contains the HTML template for the page (All WaveMaker components and layout definitions are rendered here) - - **Main.component.css** Holds page specific styles - - **Main.component.script.js** Intended for developer written JavaScript logic - - **Main.component.ts** Declares the React component for the page (Wires together template, styles, variables, and expressions) - - **Main.component.variable.ts** Contains all WaveMaker generated page variables - - **Main.component.expression.ts** Contains auto generated expression logic (🚫 Do not edit manually) - -This modular structure helps keep presentation, behavior, expressions, and state management cleanly organized. - -```mermaid -flowchart TD - B[WaveMaker Page] --> C[Main.component.ts
Component Definition
Extends BasePageComponent] - - C --> D[Main.component.html
Page UI Layout] - C --> E[Main.component.css
Page Styling] - C --> F[Main.component.variable.ts
Page Variables & State] - C --> G[Main.component.expression.ts
Data Bindings & Expressions] - C --> H[Main.component.script.js
Custom Page Logic] -``` - - -#### Generated React Markup of WaveMaker Page -```html - - - -
{ - fragment.Widgets["header"] = partialContext; - }} /> - - - - { - fragment.Widgets["leftpanel"] = partialContext; - }} /> - - - - - - -