Metadata-Version: 2.1
Name: xtyle
Version: 0.1.7
Summary: Xtyle (Toolkit)
Author-Email: hlop3z <23062270+hlop3z@users.noreply.github.com>
License: MIT
Project-URL: Homepage, https://github.com/hlop3z/xtyle-python/
Requires-Python: >=3.10
Requires-Dist: py-mini-racer>=0.6.0
Requires-Dist: libsass>=0.22.0
Requires-Dist: requests>=2.31.0
Description-Content-Type: text/markdown

# Xtyle

Python (**JSX-Toolkit**) Documentation

## Introduction

Welcome to the Xtyle! This tool allows you to work with JSX components.

It is **powered by**.

- Python: `py-mini-racer`, `css-html-js-minify`, and `libsass`
- JavaScript: `babel`, and `prettier`

## Example (**JSX**)

```python
import xtyle

code_js = xtyle.jsx("const App = () => <div>Hello World</div>")

print(code_js)
```

## Example (**SCSS**)

```python
import xtyle

code_css = xtyle.scss("$color: red; body { color: $color; }")

print(code_css)
```

## [Get Server and Learn More...](https://github.com/hlop3z/xtyle-server)

## Example (**Client**)

```python
import xtyle

engine = xtyle.client("http://localhost:3000")


engine.component(
    name="kebab-case-name",
    code="TypeScript Code",
    props="TypeScript Code",
    style="SASS/SCSS Code",
    docs="TypeScript Code",
)

engine.plugin(
    name="myPlugin",
    components=[
        dict(
            name="kebab-case-name",
            code="TypeScript Code",
            props="TypeScript Code",
            style="SASS/SCSS Code",
            docs="TypeScript Code",
        )
    ],
    install=dict(
        init="export default list",
        store="export default dict",
        globals="export default dict",
        directives="export default dict",
    ),
)
```

## Example (**Client-Extended**)

```python
import xtyle

engine = xtyle.client("http://localhost:3000")

def create_component(name):
    return {
        "name": name,
        "code": "\nexport default function Component(props: Props = {}) {\n  return (\n    <div x-html {...props} class={[$NAME, props.class]}>\n      {props.children}\n    </div>\n  );\n}\n",
        "style": "\n$color: red;\n.#{$NAME} { color: $color; }\n",
        "props": "\ntype Props = {\n  class?: string | string[] | object;\n  style?: string | string[] | object;\n  children?: any;\n};\n\nexport default Props;\n",
        "docs": "\n/**\n * Component - This is a my component.\n */\n",
    }


one_component = create_component("alert")
example_components = [
    create_component("alert"),
    create_component("custom-button"),
]

plugin_name = "myPlugin"
install_code = {"init": """export default [() => console.log("Plugin INIT")]"""}

# Component
demo_component = engine.component(**one_component)

# Plugin
demo_plugin = engine.plugin(plugin_name, example_components, install_code)

print(demo_component)
print("\n\n")
print(demo_plugin)
```

## Browser Usage

```html
<!-- Babel & Prettier -->
<script src="https://cdn.jsdelivr.net/gh/hlop3z/xtyle-python@main/src/xtyle/babel.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/hlop3z/xtyle-python@main/src/xtyle/prettier.min.js"></script>
```
