# @pai-tech/spell

> Spell.JS UI Framework

Latest version **1.1.36** (published 2022-05-16) · GPL-3.0 license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @pai-tech/spell
pnpm add @pai-tech/spell
yarn add @pai-tech/spell
bun add @pai-tech/spell
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.1.36 |
| Published | 2022-05-16 |
| First published | 2022-04-03 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 21.4 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Tamir Fridman |
| Maintainers | liadpar, calibero, tamirf |
| Keywords | PAI, Spell |

## Links

- npm: https://www.npmjs.com/package/@pai-tech/spell
- Repository: https://github.com/PAI-Tech/Spell.js
- Homepage: https://github.com/PAI-Tech/Spell.js#readme
- Issues: https://github.com/PAI-Tech/Spell.js/issues
- npm.io page: https://npm.io/package/@pai-tech/spell

## Recent versions

- 1.1.36 (latest) — 2022-05-16
- 1.1.35 — 2022-05-16
- 1.1.34 — 2022-05-16
- 1.1.33 — 2022-05-16
- 1.1.32 — 2022-05-16
- 1.1.31 — 2022-05-09
- 1.1.30 — 2022-05-09
- 1.1.29 — 2022-05-08
- 1.1.28 — 2022-05-08
- 1.1.27 — 2022-05-03
- 1.1.26 — 2022-05-02
- 1.1.25 — 2022-04-27
- 1.1.24 — 2022-04-25
- 1.1.23 — 2022-04-24
- 1.1.22 — 2022-04-24
- … 16 more at https://npm.io/package/@pai-tech/spell/versions

## README

# Spell - Universal UI Framework for Distributed Applications

Spell is a universal user interface (UI) framework for distributed application development, such application requires control on several devices with full sync but each device provides a different user interface, Spell enables real-time translation from any command (spell-command) to platform specific command (like HTML, video file, sound, lights and more).  

# Spell.js
This package is an implementation of Spell engine for web applications (Javascript/HTML), the engine supports native HTML DOM manipulation engine (SpellUI) and real-time 3D engine for browsers based on THREE.JS and WebGL.


## Overview

### Distributed Application
A distributed application (d'app) is an application that runs on several devices concurrently, the "Hello World" example in this case would be a program (app) that when it will run it will display "Hello World" on two different computers screens:

```
     -------------         -------------
    | Hello World |       | Hello World |
     -------------         -------------
        |PC 1|                 |PC 2|
        ------                 ------
          /\                     /\
          ||                     ||
           =====[Application]=====
```

Since a single application cant work on multiple context sessions (especially because of the different O/S instances) the way to accomplish such task is to write a program, deploy it to the computers and synchronized the running apps.

## Spell Real-Time Interpreter 
Spell is a rear-time interpreter that provides an interface to control both output and input devices (like screens, lights, sounds, microphones, vr headset etc').

Generally Spell is a frontend framework but it can work seamlessly with PAI-Bots which are used to develop backend applications that manages security, data management, transactions and more.  

Distributed Application (d'app) example:

```
  

                                          ::::> (frontend html/3d (WebGL based engines))
                                          :     
                                          :         :::>(wormhole - bots communication channel)   
                                          :         :
                                       -------      :     ---------
  [d'app] --> [ pc based * ] --------> |spell| <=-|WH|-=> |backend| :::>(node/python/java)
                    |                  -------            ---------
                    |                                         /\
                    |                                        |WH| :::> bot-to-bot communication for sync (P2P)
                    |                                         \/
                    |                  -------            ---------
              [ smart devices ** ] --> |spell| <=-|WH|-=> |backend|
                    |                  -------            ---------
                    |                     :
                    |                     :::>(iOS/Android native app/OpenGL based engines)
                    |             
                    |
                   ...

* PC based O/S: Windows, Linux & MacOS
** Smart devices O/S: iOS & Android
```   
  

## Spell Engine

Spell is a modular framework, meaning the basic engine can load external modules ad run them.  

```
  [user] --> spell-command --> [spell]  
                                  |  
                                  |-----> [spell-module-ui]  
                                  |  
                                  |-----> [spell-module-3d]  
                                  |  
                                  |-----> [spell-module]  
```   

The way to communicate with Spell engine is to send SpellCommand that will be analyzed and activate the appropriate module:

```
  [spell-command]
     - module (the name of the module to run the command)
     - created (date/timestamp of the command)
     - op (the operation (method/function) to run within the module)
        - params (list of parameters)
  optional:
     = on-frame (when to run the command)
     = on-event (event to run the command)
```

SpellCommand can be send in several formats:

- CLI style    
  >   module-name op-name on-frame:"frame-number" param1:"param1-value" param2:"param2-value" ...
- JSON 
  > {
    "module":"module-name",
    "op":"op-name",
    "on-frame":"frame-number"
    params: {
      "param1":"param1-value",
      "param2":"param2-value",
    }
  }


Creating Spell Object
-----------------------
Spell objects can be created by calling the interpreter with create command, the parameters is the object meta json:
{
  _id:"object-id",
  _type:"object-type",
  style:"html style",
}



- spell
  - object-manager (om)
  - event-manager (em)
  - spell-command
  - spell-module
  - spell-ui
    - spell-ui-engine
    - spell-ui-module
    - spell-ui-object
    - spell-core-objects
  - spell3d
    - spell3d-engine
    - spell3d-world
    - spell3d-object
      - spell-primitives
      - spell-gltf







Credits & References:

THREE.JS: [threejs.org](https://threejs.org/)

---
_Source: https://npm.io/package/@pai-tech/spell · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
