Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions SVELTEKIT_PROTOTYPE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# SvelteKit Prototype

A new SvelteKit-based prototype of the BlockPy application has been created in the `sveltekit-prototype/` directory.

## What is this?

This prototype demonstrates what BlockPy could look like if rebuilt with modern web technologies, specifically SvelteKit and Svelte 5. It showcases the potential benefits of using a modern reactive framework for the BlockPy interface.

## Quick Start

```bash
cd sveltekit-prototype
npm run dev
```

Visit `http://localhost:5173` to see the prototype in action.

## Documentation

See the full documentation in [sveltekit-prototype/README.md](sveltekit-prototype/README.md)

## Key Features

- ✨ Modern component-based architecture
- 🎨 Clean, responsive design
- ⚡ Fast development with Hot Module Replacement
- 📦 Significantly smaller bundle size (~50KB vs ~1.4MB)
- 🔧 Easy to maintain and extend

## Screenshots

![BlockPy SvelteKit Prototype](https://github.com/user-attachments/assets/113e21a4-7fce-4a3a-a57c-fd88b1b8e76a)

## Note

This is a **prototype** focusing on UI/UX demonstration. It does not include the full BlockPy functionality (Blockly, Skulpt, server integration, etc.). It's meant to showcase the potential architecture and benefits of using SvelteKit.
23 changes: 23 additions & 0 deletions sveltekit-prototype/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
node_modules

# Output
.output
.vercel
.netlify
.wrangler
/.svelte-kit
/build

# OS
.DS_Store
Thumbs.db

# Env
.env
.env.*
!.env.example
!.env.test

# Vite
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
1 change: 1 addition & 0 deletions sveltekit-prototype/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
142 changes: 142 additions & 0 deletions sveltekit-prototype/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# BlockPy SvelteKit Prototype

This is a prototype demonstration of what BlockPy could look like built with SvelteKit.

## Overview

This prototype showcases a modern reimagining of the BlockPy interface using SvelteKit, a modern web framework built on Svelte. It demonstrates the core UI structure and layout of BlockPy without the full functionality (which would require Blockly, Skulpt, and other dependencies).

## Features Demonstrated

- **Modern UI Framework**: Built with SvelteKit 2.x and Svelte 5
- **Responsive Design**: Works on desktop and mobile devices
- **Editor Modes**: Toggle between Python, Blocks, and Split view (UI only)
- **Component Architecture**: Modular components for easy maintenance
- **Clean Styling**: Modern CSS with CSS variables for theming

## Components

- `Toolbar.svelte` - Action buttons and mode selection
- `EditorPanel.svelte` - Code/blocks editor area
- `FeedbackPanel.svelte` - Feedback display
- `ConsolePanel.svelte` - Console output display

## Getting Started

### Prerequisites

- Node.js 18+ and npm

### Installation

Dependencies are already installed. If you need to reinstall:

```bash
npm install
```

### Development

Run the development server:

```bash
npm run dev
```

Open your browser to `http://localhost:5173`

### Building

Create a production build:

```bash
npm run build
```

Preview the production build:

```bash
npm run preview
```

## Project Structure

```
sveltekit-prototype/
├── src/
│ ├── lib/
│ │ └── components/ # Reusable Svelte components
│ │ ├── Toolbar.svelte
│ │ ├── EditorPanel.svelte
│ │ ├── FeedbackPanel.svelte
│ │ └── ConsolePanel.svelte
│ ├── routes/
│ │ ├── +layout.svelte # Root layout
│ │ └── +page.svelte # Main page
│ ├── app.css # Global styles
│ └── app.html # HTML template
├── static/ # Static assets
├── package.json
├── svelte.config.js
└── vite.config.js
```

## What This Prototype Shows

✅ **UI Structure**: The layout and organization of BlockPy's interface
✅ **Component Design**: How different parts of the UI can be organized as components
✅ **Modern Framework**: Benefits of using SvelteKit (routing, SSR, etc.)
✅ **Responsive Layout**: Mobile-friendly design
✅ **State Management**: Reactive state using Svelte's built-in reactivity

## What This Prototype Doesn't Include

❌ **Code Execution**: No Skulpt integration (Python execution)
❌ **Block Editor**: No Blockly integration (visual blocks)
❌ **Advanced Features**: No server communication, state persistence, etc.
❌ **Full Dependencies**: Doesn't include the full BlockPy ecosystem

## Next Steps for Full Implementation

To turn this prototype into a full BlockPy application:

1. **Integrate Blockly**: Add Blockly library for visual block editing
2. **Integrate Skulpt**: Add Skulpt for Python code execution
3. **Add BlockMirror**: Integrate block-to-text conversion
4. **Server Integration**: Add API calls for saving/loading assignments
5. **State Management**: Implement comprehensive state management
6. **Testing**: Add unit and integration tests
7. **Accessibility**: Enhance accessibility features
8. **Performance**: Optimize for large codebases

## Technology Stack

- **SvelteKit**: Full-stack framework for building web applications
- **Svelte 5**: Component framework with excellent reactivity
- **Vite**: Fast build tool and dev server
- **CSS Variables**: For easy theming

## Benefits of SvelteKit

- **Modern Development Experience**: Fast HMR, great DX
- **Better Performance**: Smaller bundle sizes, faster runtime
- **Built-in Routing**: File-based routing out of the box
- **SSR/SSG Support**: Server-side rendering and static site generation
- **TypeScript Support**: First-class TypeScript support
- **Modern JavaScript**: Uses latest JavaScript features

## Comparison with Current BlockPy

| Feature | Current BlockPy | SvelteKit Prototype |
|---------|----------------|-------------------|
| Framework | Webpack + KnockoutJS | SvelteKit + Svelte 5 |
| Bundle Size | ~1.4MB | ~50KB (base) |
| Reactivity | Observable-based | Compiler-based |
| Build Tool | Webpack 4 | Vite |
| Development | Slower rebuilds | Fast HMR |
| Learning Curve | Steeper | Gentler |

## License

Same as BlockPy main project.

13 changes: 13 additions & 0 deletions sveltekit-prototype/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": false,
"moduleResolution": "bundler"
}
// Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias
// except $lib which is handled by https://svelte.dev/docs/kit/configuration#files
//
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
// from the referenced tsconfig.json - TypeScript does not merge them in
}
Loading