Metadata-Version: 2.5
Name: palestine
Version: 0.2.0
Summary: A full spec DOM implementation for server-side rendering in Python
Project-URL: Homepage, https://github.com/u84u/palestine
Project-URL: Documentation, https://github.com/u84u/palestine#readme
Project-URL: Repository, https://github.com/u84u/palestine
Project-URL: Issues, https://github.com/u84u/palestine/issues
Author: u84u
License: MIT
Keywords: dom,html,rendering,server-side,ssr,template
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.14
Provides-Extra: all
Requires-Dist: django>=6.1; extra == 'all'
Requires-Dist: fastapi>=0.141; extra == 'all'
Requires-Dist: flask>=3.1; extra == 'all'
Requires-Dist: jinja2>=3.1; extra == 'all'
Requires-Dist: weasyprint>=70.0; extra == 'all'
Provides-Extra: django
Requires-Dist: django>=6.1; extra == 'django'
Provides-Extra: fastapi
Requires-Dist: fastapi>=0.141; extra == 'fastapi'
Requires-Dist: jinja2>=3.1; extra == 'fastapi'
Provides-Extra: flask
Requires-Dist: flask>=3.1; extra == 'flask'
Provides-Extra: pdf
Requires-Dist: weasyprint>=70.0; extra == 'pdf'
Description-Content-Type: text/markdown

# Palestine

A full spec DOM implementation in Python.

## Installation

```bash
pip install palestine
```

## Quick Start

```python
from palestine import Document, Button, Div, Span

doc = Document()
body = doc.create_element('body')
doc.append_child(body)

btn = Button(type="submit", class_="primary")
btn.append_child(Text("Click me"))
body.append_child(btn)

print(doc)
# <!DOCTYPE html>
# <html><body><button type="submit" class="primary">Click me</button></body></html>
```

## Features

### Core DOM

- **Nodes & Elements** - Full DOM tree implementation with `Node`, `Element`, `Text`, `Comment`, and `Document`
- **HTML Parsing** - Parse HTML strings into DOM trees with `parse_html` and `parse_fragment`
- **Rendering** - Render elements to HTML with `render_element`, `render_node`, and `minify`

### Components & Templating

- **Template Engine** - Create reusable templates with `Template`
- **Component System** - Build composable UI components with `Component`, `@component`, and `register_component`
- **Virtual DOM** - Efficient updates with `VNode`, `h`, `render_vdom`, `diff_vdom`, and `patch`
- **Diffing** - Compute and apply patches between DOM trees with `diff` and `apply_patches`

### Routing & State

- **Router** - Client-side routing with `Router`, `Route`, and `link_element`
- **Reactive Signals** - Fine-grained reactivity with `Signal`, `Computed`, `Effect`, `computed`, `effect`, `batch`
- **Store** - Application state management with `Store`, `Action`, `create_store`, `combine_reducers`

### Styling & Animation

- **Styled Elements** - CSS-in-Python with `Styles`, `styled`, `Box`, `Flex`, `Grid`
- **Animations** - Keyframe animations and transitions with `Animation`, `Transition`, `animate`
- **Built-in Animations** - Pre-built effects like `fade_in`, `fade_out`, `slide_in`, `scale_in`

### Forms & Validation

- **Form Builder** - Declarative form construction with `FormBuilder`
- **Validation** - Schema validation with `Validator`, `Required`, `Email`, `URL`, `Pattern`, and more
- **Serialization** - JSON and form data serialization with `to_json`, `form_data`, `to_query_string`

### Web Standards

- **Internationalization** - i18n support with `I18n`, `create_i18n`
- **SEO** - Generate sitemaps, robots.txt, and structured data with `SEO`
- **PWA** - Service worker generation with `PWA`, `generate_service_worker`
- **Feeds** - RSS and Atom feed generation with `RSSFeed`, `AtomFeed`
- **Sitemaps** - XML sitemap generation with `Sitemap`, `SitemapIndex`
- **Structured Data** - Schema.org markup with `Schema`
- **Open Graph & Twitter Cards** - Social meta tags with `OpenGraph`, `TwitterCard`

### Security

- **CSRF Protection** - Token generation and validation
- **HTML Sanitization** - Safe HTML rendering with `sanitize_html`, `escape_html`
- **Password Hashing** - Secure password storage with `hash_password`, `verify_password`
- **Rate Limiting** - Request throttling with `RateLimiter`
- **CSP Headers** - Content Security Policy generation

### Advanced Features

- **Web Components** - Custom elements with shadow DOM via `CustomElement`, `define_element`
- **WebSocket** - Real-time communication with `WebSocket`, `Channel`
- **ORM** - Database models with `Model`, `Field`, `QuerySet`
- **Authentication** - User auth with `Auth`, `login_user`, `logout_user`, `@login_required`
- **File Uploads** - Handle file uploads with `FileUpload`, `UploadedFile`
- **Caching** - LRU cache and memoization with `Cache`, `memoize`, `LRUCache`
- **Charts** - Data visualization with `Chart`, `BarChart`, `LineChart`, `PieChart`
- **PDF Generation** - Convert HTML to PDF with `PDF`, `html_to_pdf`
- **Email** - Email composition with `Email`, `EmailTemplate`
- **GraphQL** - GraphQL client with `GraphQLClient`, `query`, `mutation`
- **Middleware** - Request/response middleware with `MiddlewareStack`

### Developer Tools

- **Testing** - Test utilities with `TestCase`, `TestClient`, `TestResponse`
- **Assertions** - DOM assertions with `ElementAssert`, `DocumentAssert`
- **Mock Server** - API mocking with `MockServer`, `MockResponse`
- **Debugging** - Debug tools with `inspect`, `tree`, `stats`, `validate_html`
- **Benchmarks** - Performance testing with `Benchmark`, `benchmark_render`
- **Pretty Print** - Formatted HTML output with `pretty_print`
- **Markdown** - Markdown parsing with `markdown_to_html`, `Markdown`
- **Export** - Data export to CSV, TSV, JSON, XML, Excel with `to_csv`, `to_excel`
- **Analytics** - Analytics integration with `GoogleAnalytics`, `PlausibleAnalytics`

## WSGI Integration

```python
from palestine import Document, html_response

def app(environ, start_response):
    doc = Document()
    # ... build your page
    return html_response(doc, start_response)
```

## License

MIT
