Mobile App UI Designer
Run ID: 69cad7d874bac0555ea30bfa2026-03-30Design
PantheraHive BOS
BOS Dashboard

As a Mobile App UI Designer, understanding the underlying code structure and how your designs translate into functional user interfaces is crucial for effective collaboration with developers and for creating truly production-ready designs. This deliverable provides detailed, professional code examples across popular mobile development frameworks, illustrating how common UI elements, layouts, and design principles are implemented in code.


Deliverable: Mobile App UI Designer - Code Generation

This output provides production-ready code examples for common mobile UI patterns and components, designed to bridge the gap between UI design and development. Understanding these snippets will empower you to design more effectively, anticipate implementation challenges, and communicate more precisely with your development team.


Core Principles for UI Code Generation

When translating designs into code, several principles ensure a robust, maintainable, and scalable UI:


Code Examples for Mobile App UI Design

We will provide examples using three popular frameworks:

  1. Flutter (Cross-Platform): For a unified codebase across iOS and Android.
  2. SwiftUI (iOS Native): Apple's declarative UI framework.
  3. Jetpack Compose (Android Native): Google's modern toolkit for building native Android UI.

Each example includes clean, well-commented, and production-ready code with explanations.


1. Flutter Example: Themed Login Screen

This Flutter example demonstrates a basic login screen incorporating theming, custom input fields, and a primary button, showcasing how a UI designer's vision translates into a cross-platform codebase.

Description

This code creates a simple login screen with a custom app bar, two text input fields (for email and password), and a primary call-to-action button. It utilizes Flutter's theming capabilities to define consistent colors and text styles across the application.

main.dart (Application Entry Point & Theming)

text • 2,951 chars
#### Explanation of Key Parts (Flutter)

*   **`main.dart`**:
    *   **`MaterialApp`**: The root of the Flutter app, providing basic Material Design styling.
    *   **`ThemeData`**: This is where the global design system is defined.
        *   `primarySwatch`, `primaryColor`, `colorScheme`: Define the main brand colors.
        *   `textTheme`: Sets default styles for various text elements (headlines, body text, button labels). This ensures consistent typography.
        *   `inputDecorationTheme`: Standardizes the look and feel of all `TextFormField` widgets, including borders, labels, and hint text.
        *   `elevatedButtonTheme`: Defines the default style for all `ElevatedButton` widgets, ensuring consistent button appearance (background, text color, padding, shape).
    *   `useMaterial3: true`: Opts into Material 3 design, which offers updated components and theming.
*   **`login_screen.dart`**:
    *   **`Scaffold`**: Provides the basic visual structure of the Material Design app (app bar, body, floating action button, etc.).
    *   **`AppBar`**: The top bar of the screen. Its `title` uses `theme.textTheme.headlineMedium` to inherit the global text style, then customizes its color.
    *   **`SingleChildScrollView`**: Essential for forms to prevent overflow errors on smaller screens or when the keyboard is active.
    *   **`Form`**: Used for grouping form fields and enabling validation. `_formKey` helps manage the form state.
    *   **`Column`**: Arranges widgets vertically. `mainAxisAlignment.center` centers content, `crossAxisAlignment.stretch` makes children fill the horizontal space.
    *   **`TextFormField`**: Represents an input field.
        *   `controller`: Manages the text content.
        *   `decoration`: An `InputDecoration` object that applies the styling defined in `inputDecorationTheme` from `main.dart`, but can be overridden locally (e.g., `labelText`, `prefixIcon`).
        *   `obscureText`: Hides input for passwords.
        *   `validator`: A function that checks if the input is valid and returns an error message if not.
    *   **`ElevatedButton`**: A Material Design button that lifts when pressed. It automatically inherits styling from `elevatedButtonTheme`.
    *   **`TextButton`**: A flat button, often used for secondary actions like "Forgot Password?".
    *   **`SizedBox`**: Used for adding specific vertical or horizontal spacing between widgets, crucial for maintaining visual rhythm and hierarchy.

---

### 2. SwiftUI Example: User Profile View (iOS Native)

This SwiftUI example demonstrates a simple user profile view, showcasing how to arrange elements, use images, and apply styling natively on iOS.

#### Description
This code creates a user profile screen that displays a user's avatar, name, bio, and a couple of action buttons. It uses SwiftUI's declarative syntax for layout and leverages its built-in modifiers for styling.

#### `ProfileView.swift`

Sandboxed live preview

Mobile App UI Designer Study Plan: From Novice to Professional

This comprehensive study plan is designed to guide aspiring Mobile App UI Designers through a structured learning journey, equipping them with the knowledge, skills, and practical experience needed to excel in the field. The plan is broken down into phases, each with specific learning objectives, recommended resources, and milestones to ensure steady progress and a strong portfolio.


1. Overall Goal

To become a proficient Mobile App UI Designer capable of creating intuitive, aesthetically pleasing, and user-centered interfaces for mobile applications, from conceptualization through to high-fidelity prototyping and hand-off.


2. Study Plan Duration & Phased Approach

This plan is designed for a 16-week intensive study period, assuming a commitment of approximately 15-20 hours per week. It is structured into four distinct phases, each building upon the previous one.

  • Phase 1: Foundations of UI/UX & Design Principles (Weeks 1-4)
  • Phase 2: UI Design Tools & Core Concepts (Weeks 5-8)
  • Phase 3: Advanced UI/UX & Prototyping (Weeks 9-12)
  • Phase 4: Portfolio Development & Specialization (Weeks 13-16)

3. Weekly Schedule Template

This template provides a flexible structure for your weekly study. Adapt the specific topics to align with the current phase and your learning pace.

  • Monday (2-3 hours): Theory & Concepts

* Review previous week's learnings.

* Read articles, watch lectures on new topics (e.g., Gestalt principles, accessibility guidelines).

* Take detailed notes.

  • Tuesday (3-4 hours): Tool Practice & Tutorials

* Follow guided tutorials for your primary design tool (Figma/Sketch/Adobe XD).

* Recreate UI elements from examples.

* Experiment with new features.

  • Wednesday (2-3 hours): Case Studies & Inspiration

* Analyze successful mobile apps (e.g., from Mobbin, Behance, Dribbble).

* Deconstruct their UI patterns, information architecture, and user flows.

* Identify best practices and areas for improvement.

  • Thursday (3-4 hours): Practical Application - Mini Projects

* Work on small, focused design challenges (e.g., design a login screen, a navigation bar, a specific component).

* Apply learned concepts and tool skills.

* Iterate based on self-critique.

  • Friday (3-4 hours): Project Work & Feedback

* Dedicate time to your ongoing milestone project.

* Seek feedback from peers or mentors (if available).

* Refine designs based on feedback.

  • Saturday (2-3 hours): Review & Exploration

* Review the week's progress.

* Catch up on any missed topics.

* Explore new trends, read design blogs, listen to podcasts.

  • Sunday: Rest & Recharge

4. Learning Objectives (Per Phase)

Phase 1: Foundations of UI/UX & Design Principles (Weeks 1-4)

  • Understand fundamental UX principles: User-centered design, user research basics (personas, user flows), usability heuristics (Nielsen's 10).
  • Grasp core UI design principles: Visual hierarchy, typography, color theory, spacing, alignment, Gestalt principles.
  • Differentiate between UI and UX design: Understand their relationship and distinct roles.
  • Learn about common mobile UI patterns: Navigation (tabs, drawers, bottom nav), input fields, buttons, cards.
  • Familiarize with mobile platform guidelines: Introduction to Material Design (Android) and Human Interface Guidelines (iOS).

Phase 2: UI Design Tools & Core Concepts (Weeks 5-8)

  • Master a primary UI design tool (e.g., Figma):

* Artboards/Frames, layers, groups.

* Vector editing, shapes, images.

* Text styles, color styles.

* Basic components and libraries.

* Auto Layout and constraints for responsive design.

  • Develop proficiency in creating wireframes: Low-fidelity and mid-fidelity wireframing techniques.
  • Understand information architecture (IA) for mobile: Site maps, user flows, content organization.
  • Apply accessibility best practices: Color contrast, touch target sizes, semantic use of elements.
  • Begin constructing a simple design system: Naming conventions, basic style guide.

Phase 3: Advanced UI/UX & Prototyping (Weeks 9-12)

  • Create high-fidelity UI mockups: Translate wireframes into polished visual designs.
  • Design interactive prototypes:

* Linking screens, transitions, animations.

* Smart Animate, interactive components (Figma).

* User testing with prototypes.

  • Deep dive into mobile-specific interactions: Gestures, micro-interactions, haptic feedback.
  • Learn about design systems and component libraries: Advanced component creation (variants, nested components), maintaining a consistent system.
  • Introduction to design hand-off: Preparing files for developers, understanding developer needs (specs, assets).

Phase 4: Portfolio Development & Specialization (Weeks 13-16)

  • Execute end-to-end mobile app design projects: From research to high-fidelity prototype.
  • Curate and present a professional portfolio:

* Case study structure (problem, process, solution, outcomes).

* Visual storytelling, clear explanations.

* Platform selection (Behance, Dribbble, personal website).

  • Practice design critiques and feedback: Both giving and receiving constructive feedback.
  • Understand industry trends: AI in design, emerging mobile technologies, AR/VR interfaces.
  • Prepare for job applications: Resume/CV, interview preparation, whiteboarding challenges.

5. Recommended Resources

Online Courses & Platforms

  • Coursera/edX: Google UX Design Professional Certificate, University of Michigan's UX Research & Design specialization.
  • Udemy/Skillshare: Specific courses on Figma, UI/UX design fundamentals, mobile app design. Look for highly-rated instructors like Daniel Scott, Hélène Park.
  • Designership (YouTube/Website): High-quality tutorials and practical advice for Figma and UI design.
  • Figma Learn/Sketch Tutorials/Adobe XD Learn: Official documentation and tutorials are excellent for tool mastery.

Books

  • "Don't Make Me Think, Revisited" by Steve Krug (UX Fundamentals)
  • "The Design of Everyday Things" by Don Norman (Foundational UX)
  • "Refactoring UI" by Adam Wathan & Steve Schoger (Practical UI Tips)
  • "Laws of UX" by Jon Yablonski (Applying Psychological Principles)

Tools

  • Primary Design Tool: Figma (highly recommended for collaboration and industry standard), Sketch (macOS only), Adobe XD.
  • Prototyping: Built-in tools in Figma/Sketch/XD, Principle, ProtoPie.
  • Iconography: Noun Project, Font Awesome, Material Icons.
  • Illustration: UnDraw, Humaaans.
  • Stock Photos: Unsplash, Pexels.
  • Color Palettes: Coolors.co, Adobe Color.
  • Inspiration: Mobbin.design, Behance, Dribbble, Lapa.ninja, Awwwards.

Communities & Blogs

  • Medium: UX Collective, Prototypr.
  • LinkedIn: Follow prominent designers and design agencies.
  • Reddit: r/userexperience, r/ui_design.
  • Discord/Slack: Join design communities for feedback and networking.
  • Nielsen Norman Group (NN/g): Research-backed articles on UX.

6. Milestones

  • End of Phase 1 (Week 4):

* Complete a low-fidelity wireframe for a simple 3-5 screen mobile app concept (e.g., a basic to-do list app, weather app).

* Articulate the key UI/UX principles applied in your wireframe.

  • End of Phase 2 (Week 8):

* Design a mid-fidelity wireframe and a basic style guide for a more complex mobile app (e.g., a recipe app, a fitness tracker).

* Demonstrate proficiency in core design tool features (e.g., Auto Layout, components).

  • End of Phase 3 (Week 12):

* Develop a high-fidelity, interactive prototype for a mobile app with at least 5-7 screens and multiple user flows.

* Create a mini design system with reusable components and variants.

  • End of Phase 4 (Week 16):

* Complete and publish a minimum of three polished case studies in your online portfolio (e.g., one from each phase, refined).

* Participate in at least two mock interviews or portfolio reviews.


7. Assessment Strategies

  • Self-Assessment:

* Regularly review your work against established design principles and guidelines.

* Use checklists to ensure all learning objectives for a phase are met.

* Keep a design journal to reflect on challenges and solutions.

  • Peer Feedback:

* Share your designs with fellow learners or a mentor for constructive criticism.

* Actively participate in design communities to give and receive feedback.

  • Project-Based Evaluation:

* Each milestone project serves as a practical assessment of your accumulated skills.

* Evaluate your designs based on usability, aesthetics, adherence to guidelines, and technical execution in your chosen tool.

  • Portfolio Review:

* The quality and presentation of your final portfolio will be the ultimate assessment of your readiness for a professional role. Seek feedback on your case studies from experienced designers.

  • Mock Interviews & Whiteboarding Challenges:

* Practice articulating your design process, defending your decisions, and solving on-the-spot design problems.


8. Tips for Success

  • Consistency is Key: Dedicate regular time to study and practice, even if it's just an hour a day.
  • Practice, Practice, Practice: Design is a skill learned by doing. Don't just consume content; apply it.
  • Build a Portfolio from Day One: Every small project, even a single screen, is a potential portfolio piece. Document your process.
  • Seek Feedback Actively: Embrace criticism as an opportunity to learn and improve.
  • Stay Curious: The design field evolves rapidly. Continuously learn about new tools, trends, and methodologies.
  • Network: Connect with other designers, mentors, and industry professionals.
  • Take Breaks: Avoid burnout by scheduling regular rest periods.
  • Focus on Problem-Solving: Remember that UI design is about solving user problems, not just making things look pretty.

By diligently following this detailed study plan, you will build a strong foundation in Mobile App UI Design and develop a compelling portfolio that showcases your capabilities to potential employers. Good luck on your journey!

swift

import SwiftUI

// Define a custom color extension for easier access to brand colors

extension Color {

static let pantheraPrimary = Color(red: 0.40, green: 0.23, blue: 0.72) // Deep Purple

static let pantheraAccent = Color(red: 0.49, green: 0.30, blue: 1.00) // Deep Purple A200

static let pantheraBackground = Color(.systemGroupedBackground) // iOS system background

}

// Define a custom font extension for consistent typography

extension Font {

static let headlinePanthera = Font.system(size: 28, weight: .bold)

static let subheadlinePanthera = Font.system(size: 18, weight: .semibold)

static let bodyPanthera = Font.system(size: 16, weight: .regular)

static let buttonPanthera = Font.system(size: 18, weight: .medium)

}

struct ProfileView: View {

// State variables to simulate user data (could come from a backend)

@State private var userName: String = "Alex Johnson"

@State private var userBio: String = "Lead UI/UX Designer at PantheraHive. Passionate about crafting intuitive and beautiful mobile experiences."

@State private var isFollowing: Bool = false

var body: some View {

NavigationView { // Provides navigation capabilities and a title bar

ScrollView { // Allows content to scroll if it exceeds screen height

VStack(spacing: 20) { // Vertical stack with 20pt spacing between elements

// MARK: - Avatar Image

Image(systemName: "person.circle.fill") // SF Symbols icon for avatar

.resizable()

.scaledToFit()

gemini Output

As the final step in the "Mobile App UI Designer" workflow, we are pleased to present the comprehensive documentation and deliverables for your mobile application's User Interface (UI). This output encapsulates the detailed design work, rationale, and technical specifications, serving as a robust foundation for development and future iterations.


Mobile App UI Design: Final Deliverables & Documentation

1. Project Summary

This phase completes the high-fidelity UI design for your mobile application, focusing on delivering an intuitive, engaging, and visually consistent user experience. Our design process has been guided by a user-centric approach, incorporating best practices in mobile UI/UX, brand identity, and the specific functional requirements discussed during the initial phases. The objective was to create a modern, accessible, and scalable UI that resonates with your target audience and supports your business goals.

2. Key Design Deliverables

We have prepared a comprehensive set of deliverables to facilitate seamless review and development:

  • High-Fidelity UI Mockups:

* Complete Set of Screens: All designed screens for the primary user flows, including various states (e.g., empty states, error states, loading states).

* Responsive Variations: Key screens demonstrating adaptability across different mobile screen sizes and orientations (if applicable to scope).

* File Format: Provided in standard design software files (e.g., Figma, Sketch, Adobe XD) for easy inspection and collaboration, along with static image exports (PNG/JPG).

* Access Link: [Link to Design Files in Figma/Sketch/XD Cloud]

  • Interactive Prototype:

* User Flow Simulation: A clickable prototype demonstrating the core user journeys and interactions within the application.

* Functionality: Simulates navigation, key actions, and transitions to provide a realistic user experience.

* Access Link: [Link to Interactive Prototype]

  • Design System & Style Guide:

* Comprehensive Documentation: A living document detailing all visual and interactive elements.

* Components: Buttons, input fields, cards, navigation bars, modals, alerts, etc., with their various states (e.g., default, hover, active, disabled).

* Access Link: [Link to Design System Documentation/Component Library]

  • Asset Library:

* Exportable Graphics: All necessary UI assets (icons, illustrations, images) optimized for development.

* Formats: Provided in scalable vector graphics (SVG) where appropriate, and various pixel densities (PNG for iOS @2x, @3x; Android mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi).

* Access Link: [Link to Shared Asset Folder (e.g., Google Drive, Dropbox)]

3. Design Rationale & Principles

Our UI design is anchored in the following core principles and considerations:

  • User-Centricity: Every design decision prioritizes the end-user's needs, behaviors, and mental models to ensure an intuitive and delightful experience.
  • Clarity & Simplicity: Clean layouts, clear visual hierarchy, and concise microcopy guide users effortlessly through the application.
  • Consistency: Adherence to a unified design system ensures a predictable and harmonious experience across all screens and interactions, reinforcing brand identity.
  • Accessibility: Designs incorporate considerations for color contrast, legible typography, adequate touch target sizes, and clear focus states to ensure usability for a diverse audience.
  • Brand Alignment: The visual design (color palette, typography, iconography, imagery) is meticulously crafted to reflect and reinforce your brand's unique identity and values.
  • Scalability: The modular nature of the design system allows for easy expansion and addition of new features without compromising consistency.

Key Design Decisions Justification:

  • Navigation Pattern: [e.g., "Bottom Tab Navigation was chosen for its discoverability and one-handed reachability, ideal for frequently accessed core features."]
  • Color Palette: [e.g., "The primary color palette leverages vibrant hues to evoke energy and modernity, balanced with a neutral secondary palette for content hierarchy and readability."]
  • Typography: [e.g., "A combination of [Font A] for headings and [Font B] for body text provides excellent readability and a contemporary feel, with clear distinctions for information hierarchy."]
  • Interaction Patterns: [e.g., "Standardized swipe gestures for list items and clear call-to-action button styles ensure familiar and efficient user interactions."]

4. Design System & Style Guide Details

The comprehensive Design System serves as the single source of truth for all UI elements:

  • Color Palette:

* Primary Colors: [Hex Codes, e.g., #1A73E8]

* Secondary Colors: [Hex Codes, e.g., #FF6F00]

* Accent Colors: [Hex Codes, e.g., #00BFA5]

* Neutral Colors: [Hex Codes, e.g., #FFFFFF, #F5F5F5, #333333]

* Semantic Colors: Success (#4CAF50), Warning (#FFC107), Error (#F44336), Info (#2196F3)

  • Typography:

* Font Family: [e.g., "Roboto" for Android, "SF Pro Display" for iOS (or chosen custom font)]

* Headings: H1, H2, H3 (sizes, weights, line heights, letter spacing)

* Body Text: Paragraph, Caption, Small Text (sizes, weights, line heights)

  • Iconography:

* Style: [e.g., "Outline, consistent stroke weight, rounded corners."]

* Standard Sizes: [e.g., 24x24px, 32x32px, 48x48px]

* Usage Guidelines: Clear vs. filled states, color application.

  • Components: Detailed specifications for:

* Buttons (Primary, Secondary, Ghost, Icon buttons - states: default, pressed, disabled)

* Input Fields (Text, Password, Search - states: default, focused, error, disabled)

* Cards & Containers (shadows, corner radius, padding)

* Navigation Elements (Tab Bar, Header Bar, Side Menu)

* Modals, Alerts, Toasts

* Lists & Data Tables

  • Spacing & Layout:

* Grid System: [e.g., "8pt baseline grid for consistent vertical rhythm and spacing."]

* Padding & Margins: Standardized spacing units (e.g., 8px, 16px, 24px) for consistent element separation.

  • Imagery: Guidelines for image style, resolution, and usage within the app.

5. Technical Handover Notes for Developers

This section provides crucial information to ensure a smooth and accurate implementation of the UI design:

  • Platform Specificity:

* iOS: Adherence to Apple's Human Interface Guidelines where relevant, including safe areas, navigation patterns, and system font usage.

* Android: Consideration of Material Design principles, including ripple effects, elevation, and platform-specific component behaviors.

* Cross-Platform (if applicable): Notes on how designs translate to frameworks like React Native or Flutter, balancing native feel with consistency.

  • Asset Export:

* Icons and illustrations should ideally be exported as SVG for scalability.

* Raster images (photos) to be exported as PNG/JPG at various resolutions (e.g., @1x, @2x, @3x for iOS; multiple densities for Android) to support different device pixel ratios.

* All assets are organized by feature/component for easy access.

  • Interaction & Animation Specifications:

* Detailed notes on micro-interactions, transitions, and animations (e.g., duration, easing curves, specific triggers) are embedded within the prototype or design files where applicable.

* Loading indicators, empty states, and error states are designed to provide clear feedback to users.

  • Accessibility Implementation:

* Developers should ensure proper semantic markup, clear content descriptions for screen readers, and focus management for assistive technologies.

* Implement sufficient contrast ratios for text and interactive elements as specified in the design system.

  • Responsive Behavior:

* Detailed breakdown of how layouts and components adjust to different screen sizes and orientations (portrait/landscape) for key screens.

* Consideration for keyboard presence and how it affects input fields and layouts.

6. Next Steps & Recommendations

To ensure the successful realization of this UI design into a functional application, we recommend the following:

  • 1. Client Review & Feedback Session:

* We encourage a thorough review of all deliverables. Please compile your feedback, questions, and any requested adjustments.

* We will schedule a dedicated session to walk through the designs, discuss the rationale, and address your input.

  • 2. Usability Testing:

* Conducting usability tests with target users on the interactive prototype is highly recommended to validate design assumptions and identify potential areas for improvement before development begins.

  • 3. Development Handover & Support:

* We are available for a comprehensive handover session with your development team to explain the design system, answer technical questions, and clarify interaction specifications.

* Ongoing design support can be provided during the development phase to ensure pixel-perfect implementation and address any unforeseen design challenges.

  • 4. Future Iterations & Enhancements:

* This design provides a solid foundation. As your product evolves, we recommend continuous user feedback integration and iterative design cycles for future features and optimizations.


We are confident that this detailed UI design provides a strong, user-friendly, and visually appealing framework for your mobile application. We look forward to your feedback and to supporting you through the next stages of your project.

Please contact us to schedule your design review session or if you have any immediate questions.

mobile_app_ui_designer.txt
Download source file
Copy all content
Full output as text
Download ZIP
IDE-ready project ZIP
Copy share link
Permanent URL for this run
Get Embed Code
Embed this result on any website
Print / Save PDF
Use browser print dialog
\n\n\n"); var hasSrcMain=Object.keys(extracted).some(function(k){return k.indexOf("src/main")>=0;}); if(!hasSrcMain) zip.file(folder+"src/main."+ext,"import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport App from './App'\nimport './index.css'\n\nReactDOM.createRoot(document.getElementById('root')!).render(\n \n \n \n)\n"); var hasSrcApp=Object.keys(extracted).some(function(k){return k==="src/App."+ext||k==="App."+ext;}); if(!hasSrcApp) zip.file(folder+"src/App."+ext,"import React from 'react'\nimport './App.css'\n\nfunction App(){\n return(\n
\n
\n

"+slugTitle(pn)+"

\n

Built with PantheraHive BOS

\n
\n
\n )\n}\nexport default App\n"); zip.file(folder+"src/index.css","*{margin:0;padding:0;box-sizing:border-box}\nbody{font-family:system-ui,-apple-system,sans-serif;background:#f0f2f5;color:#1a1a2e}\n.app{min-height:100vh;display:flex;flex-direction:column}\n.app-header{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:40px}\nh1{font-size:2.5rem;font-weight:700}\n"); zip.file(folder+"src/App.css",""); zip.file(folder+"src/components/.gitkeep",""); zip.file(folder+"src/pages/.gitkeep",""); zip.file(folder+"src/hooks/.gitkeep",""); Object.keys(extracted).forEach(function(p){ var fp=p.startsWith("src/")?p:"src/"+p; zip.file(folder+fp,extracted[p]); }); zip.file(folder+"README.md","# "+slugTitle(pn)+"\n\nGenerated by PantheraHive BOS.\n\n## Setup\n\`\`\`bash\nnpm install\nnpm run dev\n\`\`\`\n\n## Build\n\`\`\`bash\nnpm run build\n\`\`\`\n\n## Open in IDE\nOpen the project folder in VS Code or WebStorm.\n"); zip.file(folder+".gitignore","node_modules/\ndist/\n.env\n.DS_Store\n*.local\n"); } /* --- Vue (Vite + Composition API + TypeScript) --- */ function buildVue(zip,folder,app,code,panelTxt){ var pn=pkgName(app); var C=cc(pn); var extracted=extractCode(panelTxt); zip.file(folder+"package.json",'{\n "name": "'+pn+'",\n "version": "0.0.0",\n "type": "module",\n "scripts": {\n "dev": "vite",\n "build": "vue-tsc -b && vite build",\n "preview": "vite preview"\n },\n "dependencies": {\n "vue": "^3.5.13",\n "vue-router": "^4.4.5",\n "pinia": "^2.3.0",\n "axios": "^1.7.9"\n },\n "devDependencies": {\n "@vitejs/plugin-vue": "^5.2.1",\n "typescript": "~5.7.3",\n "vite": "^6.0.5",\n "vue-tsc": "^2.2.0"\n }\n}\n'); zip.file(folder+"vite.config.ts","import { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\nimport { resolve } from 'path'\n\nexport default defineConfig({\n plugins: [vue()],\n resolve: { alias: { '@': resolve(__dirname,'src') } }\n})\n"); zip.file(folder+"tsconfig.json",'{"files":[],"references":[{"path":"./tsconfig.app.json"},{"path":"./tsconfig.node.json"}]}\n'); zip.file(folder+"tsconfig.app.json",'{\n "compilerOptions":{\n "target":"ES2020","useDefineForClassFields":true,"module":"ESNext","lib":["ES2020","DOM","DOM.Iterable"],\n "skipLibCheck":true,"moduleResolution":"bundler","allowImportingTsExtensions":true,\n "isolatedModules":true,"moduleDetection":"force","noEmit":true,"jsxImportSource":"vue",\n "strict":true,"paths":{"@/*":["./src/*"]}\n },\n "include":["src/**/*.ts","src/**/*.d.ts","src/**/*.tsx","src/**/*.vue"]\n}\n'); zip.file(folder+"env.d.ts","/// \n"); zip.file(folder+"index.html","\n\n\n \n \n "+slugTitle(pn)+"\n\n\n
\n \n\n\n"); var hasMain=Object.keys(extracted).some(function(k){return k==="src/main.ts"||k==="main.ts";}); if(!hasMain) zip.file(folder+"src/main.ts","import { createApp } from 'vue'\nimport { createPinia } from 'pinia'\nimport App from './App.vue'\nimport './assets/main.css'\n\nconst app = createApp(App)\napp.use(createPinia())\napp.mount('#app')\n"); var hasApp=Object.keys(extracted).some(function(k){return k.indexOf("App.vue")>=0;}); if(!hasApp) zip.file(folder+"src/App.vue","\n\n\n\n\n"); zip.file(folder+"src/assets/main.css","*{margin:0;padding:0;box-sizing:border-box}body{font-family:system-ui,sans-serif;background:#fff;color:#213547}\n"); zip.file(folder+"src/components/.gitkeep",""); zip.file(folder+"src/views/.gitkeep",""); zip.file(folder+"src/stores/.gitkeep",""); Object.keys(extracted).forEach(function(p){ var fp=p.startsWith("src/")?p:"src/"+p; zip.file(folder+fp,extracted[p]); }); zip.file(folder+"README.md","# "+slugTitle(pn)+"\n\nGenerated by PantheraHive BOS.\n\n## Setup\n\`\`\`bash\nnpm install\nnpm run dev\n\`\`\`\n\n## Build\n\`\`\`bash\nnpm run build\n\`\`\`\n\nOpen in VS Code or WebStorm.\n"); zip.file(folder+".gitignore","node_modules/\ndist/\n.env\n.DS_Store\n*.local\n"); } /* --- Angular (v19 standalone) --- */ function buildAngular(zip,folder,app,code,panelTxt){ var pn=pkgName(app); var C=cc(pn); var sel=pn.replace(/_/g,"-"); var extracted=extractCode(panelTxt); zip.file(folder+"package.json",'{\n "name": "'+pn+'",\n "version": "0.0.0",\n "scripts": {\n "ng": "ng",\n "start": "ng serve",\n "build": "ng build",\n "test": "ng test"\n },\n "dependencies": {\n "@angular/animations": "^19.0.0",\n "@angular/common": "^19.0.0",\n "@angular/compiler": "^19.0.0",\n "@angular/core": "^19.0.0",\n "@angular/forms": "^19.0.0",\n "@angular/platform-browser": "^19.0.0",\n "@angular/platform-browser-dynamic": "^19.0.0",\n "@angular/router": "^19.0.0",\n "rxjs": "~7.8.0",\n "tslib": "^2.3.0",\n "zone.js": "~0.15.0"\n },\n "devDependencies": {\n "@angular-devkit/build-angular": "^19.0.0",\n "@angular/cli": "^19.0.0",\n "@angular/compiler-cli": "^19.0.0",\n "typescript": "~5.6.0"\n }\n}\n'); zip.file(folder+"angular.json",'{\n "$schema": "./node_modules/@angular/cli/lib/config/schema.json",\n "version": 1,\n "newProjectRoot": "projects",\n "projects": {\n "'+pn+'": {\n "projectType": "application",\n "root": "",\n "sourceRoot": "src",\n "prefix": "app",\n "architect": {\n "build": {\n "builder": "@angular-devkit/build-angular:application",\n "options": {\n "outputPath": "dist/'+pn+'",\n "index": "src/index.html",\n "browser": "src/main.ts",\n "tsConfig": "tsconfig.app.json",\n "styles": ["src/styles.css"],\n "scripts": []\n }\n },\n "serve": {"builder":"@angular-devkit/build-angular:dev-server","configurations":{"production":{"buildTarget":"'+pn+':build:production"},"development":{"buildTarget":"'+pn+':build:development"}},"defaultConfiguration":"development"}\n }\n }\n }\n}\n'); zip.file(folder+"tsconfig.json",'{\n "compileOnSave": false,\n "compilerOptions": {"baseUrl":"./","outDir":"./dist/out-tsc","forceConsistentCasingInFileNames":true,"strict":true,"noImplicitOverride":true,"noPropertyAccessFromIndexSignature":true,"noImplicitReturns":true,"noFallthroughCasesInSwitch":true,"paths":{"@/*":["src/*"]},"skipLibCheck":true,"esModuleInterop":true,"sourceMap":true,"declaration":false,"experimentalDecorators":true,"moduleResolution":"bundler","importHelpers":true,"target":"ES2022","module":"ES2022","useDefineForClassFields":false,"lib":["ES2022","dom"]},\n "references":[{"path":"./tsconfig.app.json"}]\n}\n'); zip.file(folder+"tsconfig.app.json",'{\n "extends":"./tsconfig.json",\n "compilerOptions":{"outDir":"./dist/out-tsc","types":[]},\n "files":["src/main.ts"],\n "include":["src/**/*.d.ts"]\n}\n'); zip.file(folder+"src/index.html","\n\n\n \n "+slugTitle(pn)+"\n \n \n \n\n\n \n\n\n"); zip.file(folder+"src/main.ts","import { bootstrapApplication } from '@angular/platform-browser';\nimport { appConfig } from './app/app.config';\nimport { AppComponent } from './app/app.component';\n\nbootstrapApplication(AppComponent, appConfig)\n .catch(err => console.error(err));\n"); zip.file(folder+"src/styles.css","* { margin: 0; padding: 0; box-sizing: border-box; }\nbody { font-family: system-ui, -apple-system, sans-serif; background: #f9fafb; color: #111827; }\n"); var hasComp=Object.keys(extracted).some(function(k){return k.indexOf("app.component")>=0;}); if(!hasComp){ zip.file(folder+"src/app/app.component.ts","import { Component } from '@angular/core';\nimport { RouterOutlet } from '@angular/router';\n\n@Component({\n selector: 'app-root',\n standalone: true,\n imports: [RouterOutlet],\n templateUrl: './app.component.html',\n styleUrl: './app.component.css'\n})\nexport class AppComponent {\n title = '"+pn+"';\n}\n"); zip.file(folder+"src/app/app.component.html","
\n
\n

"+slugTitle(pn)+"

\n

Built with PantheraHive BOS

\n
\n \n
\n"); zip.file(folder+"src/app/app.component.css",".app-header{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:60vh;gap:16px}h1{font-size:2.5rem;font-weight:700;color:#6366f1}\n"); } zip.file(folder+"src/app/app.config.ts","import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';\nimport { provideRouter } from '@angular/router';\nimport { routes } from './app.routes';\n\nexport const appConfig: ApplicationConfig = {\n providers: [\n provideZoneChangeDetection({ eventCoalescing: true }),\n provideRouter(routes)\n ]\n};\n"); zip.file(folder+"src/app/app.routes.ts","import { Routes } from '@angular/router';\n\nexport const routes: Routes = [];\n"); Object.keys(extracted).forEach(function(p){ var fp=p.startsWith("src/")?p:"src/"+p; zip.file(folder+fp,extracted[p]); }); zip.file(folder+"README.md","# "+slugTitle(pn)+"\n\nGenerated by PantheraHive BOS.\n\n## Setup\n\`\`\`bash\nnpm install\nng serve\n# or: npm start\n\`\`\`\n\n## Build\n\`\`\`bash\nng build\n\`\`\`\n\nOpen in VS Code with Angular Language Service extension.\n"); zip.file(folder+".gitignore","node_modules/\ndist/\n.env\n.DS_Store\n*.local\n.angular/\n"); } /* --- Python --- */ function buildPython(zip,folder,app,code){ var title=slugTitle(app); var pn=pkgName(app); var src=code.replace(/^\`\`\`[\w]*\n?/m,"").replace(/\n?\`\`\`$/m,"").trim(); var reqMap={"numpy":"numpy","pandas":"pandas","sklearn":"scikit-learn","tensorflow":"tensorflow","torch":"torch","flask":"flask","fastapi":"fastapi","uvicorn":"uvicorn","requests":"requests","sqlalchemy":"sqlalchemy","pydantic":"pydantic","dotenv":"python-dotenv","PIL":"Pillow","cv2":"opencv-python","matplotlib":"matplotlib","seaborn":"seaborn","scipy":"scipy"}; var reqs=[]; Object.keys(reqMap).forEach(function(k){if(src.indexOf("import "+k)>=0||src.indexOf("from "+k)>=0)reqs.push(reqMap[k]);}); var reqsTxt=reqs.length?reqs.join("\n"):"# add dependencies here\n"; zip.file(folder+"main.py",src||"# "+title+"\n# Generated by PantheraHive BOS\n\nprint(title+\" loaded\")\n"); zip.file(folder+"requirements.txt",reqsTxt); zip.file(folder+".env.example","# Environment variables\n"); zip.file(folder+"README.md","# "+title+"\n\nGenerated by PantheraHive BOS.\n\n## Setup\n\`\`\`bash\npython3 -m venv .venv\nsource .venv/bin/activate\npip install -r requirements.txt\n\`\`\`\n\n## Run\n\`\`\`bash\npython main.py\n\`\`\`\n"); zip.file(folder+".gitignore",".venv/\n__pycache__/\n*.pyc\n.env\n.DS_Store\n"); } /* --- Node.js --- */ function buildNode(zip,folder,app,code){ var title=slugTitle(app); var pn=pkgName(app); var src=code.replace(/^\`\`\`[\w]*\n?/m,"").replace(/\n?\`\`\`$/m,"").trim(); var depMap={"mongoose":"^8.0.0","dotenv":"^16.4.5","axios":"^1.7.9","cors":"^2.8.5","bcryptjs":"^2.4.3","jsonwebtoken":"^9.0.2","socket.io":"^4.7.4","uuid":"^9.0.1","zod":"^3.22.4","express":"^4.18.2"}; var deps={}; Object.keys(depMap).forEach(function(k){if(src.indexOf(k)>=0)deps[k]=depMap[k];}); if(!deps["express"])deps["express"]="^4.18.2"; var pkgJson=JSON.stringify({"name":pn,"version":"1.0.0","main":"src/index.js","scripts":{"start":"node src/index.js","dev":"nodemon src/index.js"},"dependencies":deps,"devDependencies":{"nodemon":"^3.0.3"}},null,2)+"\n"; zip.file(folder+"package.json",pkgJson); var fallback="const express=require(\"express\");\nconst app=express();\napp.use(express.json());\n\napp.get(\"/\",(req,res)=>{\n res.json({message:\""+title+" API\"});\n});\n\nconst PORT=process.env.PORT||3000;\napp.listen(PORT,()=>console.log(\"Server on port \"+PORT));\n"; zip.file(folder+"src/index.js",src||fallback); zip.file(folder+".env.example","PORT=3000\n"); zip.file(folder+".gitignore","node_modules/\n.env\n.DS_Store\n"); zip.file(folder+"README.md","# "+title+"\n\nGenerated by PantheraHive BOS.\n\n## Setup\n\`\`\`bash\nnpm install\n\`\`\`\n\n## Run\n\`\`\`bash\nnpm run dev\n\`\`\`\n"); } /* --- Vanilla HTML --- */ function buildVanillaHtml(zip,folder,app,code){ var title=slugTitle(app); var isFullDoc=code.trim().toLowerCase().indexOf("=0||code.trim().toLowerCase().indexOf("=0; var indexHtml=isFullDoc?code:"\n\n\n\n\n"+title+"\n\n\n\n"+code+"\n\n\n\n"; zip.file(folder+"index.html",indexHtml); zip.file(folder+"style.css","/* "+title+" — styles */\n*{margin:0;padding:0;box-sizing:border-box}\nbody{font-family:system-ui,-apple-system,sans-serif;background:#fff;color:#1a1a2e}\n"); zip.file(folder+"script.js","/* "+title+" — scripts */\n"); zip.file(folder+"assets/.gitkeep",""); zip.file(folder+"README.md","# "+title+"\n\nGenerated by PantheraHive BOS.\n\n## Open\nDouble-click \`index.html\` in your browser.\n\nOr serve locally:\n\`\`\`bash\nnpx serve .\n# or\npython3 -m http.server 3000\n\`\`\`\n"); zip.file(folder+".gitignore",".DS_Store\nnode_modules/\n.env\n"); } /* ===== MAIN ===== */ var sc=document.createElement("script"); sc.src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"; sc.onerror=function(){ if(lbl)lbl.textContent="Download ZIP"; alert("JSZip load failed — check connection."); }; sc.onload=function(){ var zip=new JSZip(); var base=(_phFname||"output").replace(/\.[^.]+$/,""); var app=base.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")||"my_app"; var folder=app+"/"; var vc=document.getElementById("panel-content"); var panelTxt=vc?(vc.innerText||vc.textContent||""):""; var lang=detectLang(_phCode,panelTxt); if(_phIsHtml){ buildVanillaHtml(zip,folder,app,_phCode); } else if(lang==="flutter"){ buildFlutter(zip,folder,app,_phCode,panelTxt); } else if(lang==="react-native"){ buildReactNative(zip,folder,app,_phCode,panelTxt); } else if(lang==="swift"){ buildSwift(zip,folder,app,_phCode,panelTxt); } else if(lang==="kotlin"){ buildKotlin(zip,folder,app,_phCode,panelTxt); } else if(lang==="react"){ buildReact(zip,folder,app,_phCode,panelTxt); } else if(lang==="vue"){ buildVue(zip,folder,app,_phCode,panelTxt); } else if(lang==="angular"){ buildAngular(zip,folder,app,_phCode,panelTxt); } else if(lang==="python"){ buildPython(zip,folder,app,_phCode); } else if(lang==="node"){ buildNode(zip,folder,app,_phCode); } else { /* Document/content workflow */ var title=app.replace(/_/g," "); var md=_phAll||_phCode||panelTxt||"No content"; zip.file(folder+app+".md",md); var h=""+title+""; h+="

"+title+"

"; var hc=md.replace(/&/g,"&").replace(//g,">"); hc=hc.replace(/^### (.+)$/gm,"

$1

"); hc=hc.replace(/^## (.+)$/gm,"

$1

"); hc=hc.replace(/^# (.+)$/gm,"

$1

"); hc=hc.replace(/\*\*(.+?)\*\*/g,"$1"); hc=hc.replace(/\n{2,}/g,"

"); h+="

"+hc+"

Generated by PantheraHive BOS
"; zip.file(folder+app+".html",h); zip.file(folder+"README.md","# "+title+"\n\nGenerated by PantheraHive BOS.\n\nFiles:\n- "+app+".md (Markdown)\n- "+app+".html (styled HTML)\n"); } zip.generateAsync({type:"blob"}).then(function(blob){ var a=document.createElement("a"); a.href=URL.createObjectURL(blob); a.download=app+".zip"; a.click(); URL.revokeObjectURL(a.href); if(lbl)lbl.textContent="Download ZIP"; }); }; document.head.appendChild(sc); } function phShare(){navigator.clipboard.writeText(window.location.href).then(function(){var el=document.getElementById("ph-share-lbl");if(el){el.textContent="Link copied!";setTimeout(function(){el.textContent="Copy share link";},2500);}});}function phEmbed(){var runId=window.location.pathname.split("/").pop().replace(".html","");var embedUrl="https://pantherahive.com/embed/"+runId;var code='';navigator.clipboard.writeText(code).then(function(){var el=document.getElementById("ph-embed-lbl");if(el){el.textContent="Embed code copied!";setTimeout(function(){el.textContent="Get Embed Code";},2500);}});}