Skip to content

Commit

Permalink
Merge pull request #454 from live-codes/develop
Browse files Browse the repository at this point in the history
release sdk-v0.2.1
  • Loading branch information
hatemhosny authored Oct 16, 2023
2 parents 48a65c0 + eea5d73 commit 45acbcd
Show file tree
Hide file tree
Showing 89 changed files with 1,779 additions and 369 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@ All notable changes to this project will be documented in this file. See [standa

---

## [sdk-v0.2.1](https://github.com/live-codes/livecodes/compare/v15...sdk-v0.2.1) (2023-10-16)

This release mainly updates TypeScript type definitions.

### Bug Fixes

- **types:** fix types and pkg info for modules with CDN specifier ([7cdd9b2](https://github.com/live-codes/livecodes/commit/7cdd9b25b0c5180090a199f7156d3c2e487b775b))

### Features

- **SDK:** add `flex-grow` to playground container and export type `Language` ([3de6805](https://github.com/live-codes/livecodes/commit/3de6805d3852a41b223df4a05a0784e27da03a67))
- **compilers:** add language `lua-wasm` using wasmoon ([832c8e6](https://github.com/live-codes/livecodes/commit/832c8e6ce61799766a93441f6decd809f793f16f))
- **compilers:** add support for php-wasm ([7cf8780](https://github.com/live-codes/livecodes/commit/7cf878010a1346c51f5149c995db4d68ccf532a2))
- **compilers:** add support for ruby-wasm ([0842d01](https://github.com/live-codes/livecodes/commit/0842d0150754f3aa87fc73172063d65180b710b7))
- **import:** allow importing typescript playground projects ([ced7678](https://github.com/live-codes/livecodes/commit/ced7678dfbd3417dd286920b0f540f114d91cce8))
- **import:** import from svelte playground ([a8d35e2](https://github.com/live-codes/livecodes/commit/a8d35e20727a554f9e392134ef30f0959ffa7a77))
- **import:** import from vue playground ([9406630](https://github.com/live-codes/livecodes/commit/94066306638c397781f50c0075f33e17447309a4))

---

## [v15](https://github.com/live-codes/livecodes/compare/v14...v15) (2023-10-01)

This release improves R and Python(Pyodide) language support:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A [feature-rich](https://livecodes.io/docs/features/), open-source, **client-sid
[![LiveCodes: app version](https://img.shields.io/github/v/release/live-codes/livecodes?label=app)](https://livecodes.io)
[![LiveCodes: npm version](https://img.shields.io/npm/v/livecodes)](https://www.npmjs.com/package/livecodes)
[![LiveCodes: npm downloads](https://img.shields.io/npm/dw/livecodes)](https://www.npmjs.com/package/livecodes)
[![LiveCodes: languages](https://img.shields.io/badge/languages-84-blue)](https://livecodes.io/docs/languages/)
[![LiveCodes: languages](https://img.shields.io/badge/languages-87-blue)](https://livecodes.io/docs/languages/)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/3d39f15618e048db9d13c2a0e8002b33)](https://www.codacy.com/gh/live-codes/livecodes/dashboard?utm_source=github.com&utm_medium=referral&utm_content=live-codes/livecodes&utm_campaign=Badge_Grade)
[![license - MIT](https://img.shields.io/github/license/live-codes/livecodes)](https://github.com/live-codes/livecodes/blob/develop/LICENSE)
[![LiveCodes: GitHub repo](https://img.shields.io/github/stars/live-codes/livecodes?style=social)](https://github.com/live-codes/livecodes)
Expand Down
1 change: 1 addition & 0 deletions docs/docs/contribution/adding-languages.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ If you still have doubts if the language qualifies, [let's discuss it](https://g
- [ ] Add language [documentation](https://github.com/live-codes/livecodes/tree/develop/docs/docs/languages).
- [ ] Add language to documentation website [slider](https://github.com/live-codes/livecodes/blob/develop/docs/src/components/LanguageSliders.tsx).
- [ ] Add compiler/formatter [license(s)](https://github.com/live-codes/livecodes/blob/develop/vendor-licenses.md).
- [ ] Update language count badge in [README](https://github.com/live-codes/livecodes/blob/develop/README.md).
7 changes: 7 additions & 0 deletions docs/docs/features/import.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ For [embedded playgrounds](./embeds.md), use the [SDK](../sdk/index.md) property

[Open in LiveCodes](https://livecodes.io/?x=https://jsbin.com/iwovaj/73/embed?html,js,output)

- Vue Playground:

URL: [https://play.vuejs.org/#eNp9kUFKAzEUhq/yyKYKtUW6K9OCli4UUVFxlU2Z...](https://play.vuejs.org/#eNp9kUFKAzEUhq/yyKYKtUW6K9OCli4UUVFxlU2Zvk5TM0lIXsbCMGdw7QG8g+fxAl7Bl5RWF9Jd3v//7+cLrxUXzg2aiGIsilB65QgCUnRTaVTtrCdoweMKOlh5W0OPoz1ppCmtCQR1qGCS/JPejWpwZpcY4Ov94/vzDZ45eSpNMdzVciEPhLXTC0KeAIr1+bRtc0nXFUOesqqMiwTNWc1teiIF+1KwVQwP26IvKDDCSlWDTbCG6du0K0Vpa6c0+jtHihGlGEN2krfQ2r5eZ418xP5eL9dYvvyjb8I2aVLcewzoG5Ti4NHCV0g7e/54i1t+H0wmj5rTR8wHDFbHxLiLXUazZOw/uUx7lW+gTPUU5ltCE/afSqAp2eW8FHyX2ZGv/+KOBqO8J00nuh/8Wasi)

[Open in LiveCodes](https://livecodes.io/?x=https%3A%2F%2Fplay.vuejs.org%2F%23eNp9kUFKAzEUhq%2FyyKYKtUW6K9OCli4UUVFxlU2Zvk5TM0lIXsbCMGdw7QG8g%2BfxAl7Bl5RWF9Jd3v%2F%2F7%2BcLrxUXzg2aiGIsilB65QgCUnRTaVTtrCdoweMKOlh5W0OPoz1ppCmtCQR1qGCS%2FJPejWpwZpcY4Ov94%2FvzDZ45eSpNMdzVciEPhLXTC0KeAIr1%2BbRtc0nXFUOesqqMiwTNWc1teiIF%2B1KwVQwP26IvKDDCSlWDTbCG6du0K0Vpa6c0%2BjtHihGlGEN2krfQ2r5eZ418xP5eL9dYvvyjb8I2aVLcewzoG5Ti4NHCV0g7e%2F54i1t%2BH0wmj5rTR8wHDFbHxLiLXUazZOw%2FuUx7lW%2BgTPUU5ltCE%2FafSqAp2eW8FHyX2ZGv%2F%2BKOBqO8J00nuh%2F8Wasi)

## Sources

Import is supported from any of the following:
Expand All @@ -53,6 +59,7 @@ Import is supported from any of the following:
- Raw code
- Code in web page DOM
- Code in zip file
- Projects shared in official playgrounds of [TypeScript](https://www.typescriptlang.org/play), [Vue](https://play.vuejs.org/) and [Svelte](https://svelte.dev/repl)
- [Exported project JSON](./export.md) (single project and bulk import)

Import sources are identified by URL patterns (e.g. origin, pathname and extension).
Expand Down
3 changes: 0 additions & 3 deletions docs/docs/languages/clang.md

This file was deleted.

8 changes: 7 additions & 1 deletion docs/docs/languages/clojurescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ ClojureScript is a compiler for [Clojure](https://clojure.org/) that targets
JavaScript. <br />In LiveCodes, it runs in the browser using
[Cherry](https://github.com/squint-cljs/cherry).

:::info Note

Lisp language family supported in LiveCodes includes [Common Lisp](./commonlisp.md), [Scheme](./scheme.md), [ClojureScript](./clojurescript.md) and [Fennel](./fennel.md).

:::

## Language Info

### Name
Expand All @@ -32,7 +38,7 @@ If `JSX` is used (using `#jsx` reader tag - [example](https://github.com/squint-

## Code Formatting

using [Parinfer.js](https://github.com/oakmac/parinfer/)
Using [Parinfer](https://shaunlebron.github.io/parinfer/).

## Example Usage

Expand Down
3 changes: 3 additions & 0 deletions docs/docs/languages/cpp-wasm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# C/C++ (Wasm)

TODO...
59 changes: 58 additions & 1 deletion docs/docs/languages/fennel.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,60 @@
# Fennel

TODO...
[Fennel](https://fennel-lang.org/) is a programming language that brings together the speed, simplicity, and reach of [Lua](https://www.lua.org/) with the flexibility of a [lisp syntax and macro system](<https://en.wikipedia.org/wiki/Lisp_(programming_language)>).

Fennel code is compiled to Lua, which then runs in the browser using [Fengari](https://fengari.io/). See documentation for Lua language support in LiveCodes [here](./lua.md).

:::info Note

Lisp language family supported in LiveCodes includes [Common Lisp](./commonlisp.md), [Scheme](./scheme.md), [ClojureScript](./clojurescript.md) and [Fennel](./fennel.md).

:::

## Usage

JavaScript interoperability and DOM access is achieved using [`"js"` module](https://github.com/fengari-lua/fengari-interop).

import LiveCodes from '../../src/components/LiveCodes.tsx';

This example demonstrates usage, JavaScript interoperability and DOM access:

<LiveCodes template="fennel" height="80vh"></LiveCodes>

## Language Info

### Name

`fennel`

### Extension

`.fnl`

### Editor

`script`

## Compiler

[Fennel](https://fennel-lang.org/)

### Version

Fennel v1.3.0

## Code Formatting

Using [Parinfer](https://shaunlebron.github.io/parinfer/).

## Starter Template

https://livecodes.io/?template=fennel

## Links

- [Fennel](https://fennel-lang.org/)
- [Fennel tutorial](https://fennel-lang.org/tutorial)
- [Lua](https://www.lua.org/)
- [Fengari](https://fengari.io/)
- [lua](./lua.md) in LiveCodes
- [Common Lisp](./commonlisp.md) in LiveCodes
66 changes: 66 additions & 0 deletions docs/docs/languages/lua-wasm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Lua (Wasm)

[Lua](https://www.lua.org/) is a powerful, efficient, lightweight, embeddable scripting language. It supports procedural programming, object-oriented programming, functional programming, data-driven programming, and data description.

LiveCodes can run Lua in the browser using [Wasmoon](https://github.com/ceifa/wasmoon).

> Wasmoon is a real Lua 5.4 VM with JS bindings made with WebAssembly.
>
> [github.com/ceifa/wasmoon](https://github.com/ceifa/wasmoon)
:::info Note

LiveCodes also supports running Lua using [Fengari](https://fengari.io/) which is the Lua VM written in JavaScript. Read documentation [here](./lua.md)

:::

## Usage

LiveCodes runs Lua in the browser. JavaScript interoperability and DOM access is achieved using the global variable `window` which exposes the page `window` object.

import LiveCodes from '../../src/components/LiveCodes.tsx';

This example demonstrates usage, JavaScript interoperability and DOM access:

<LiveCodes template="lua-wasm" height="80vh"></LiveCodes>

## Language Info

### Name

`lua-wasm`

### Alias

`luawasm`

### Extension

`.wasm.lua`

### Editor

`script`

## Compiler

[Wasmoon](https://github.com/ceifa/wasmoon)

### Version

Wasmoon v1.15.0

## Code Formatting

Using [`lua-fmt`](https://github.com/trixnz/lua-fmt).

## Starter Template

https://livecodes.io/?template=lua-wasm

## Links

- [Lua](https://www.lua.org/)
- [Lua documentation](https://www.lua.org/docs.html)
- [wasmoon](https://github.com/ceifa/wasmoon)
- [Lua (using Fengari)](./lua.md) in LiveCodes
61 changes: 60 additions & 1 deletion docs/docs/languages/lua.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,62 @@
# Lua

TODO...
[Lua](https://www.lua.org/) is a powerful, efficient, lightweight, embeddable scripting language. It supports procedural programming, object-oriented programming, functional programming, data-driven programming, and data description.

LiveCodes runs Lua in the browser using [Fengari](https://fengari.io/).

> Fengari (Moon in greek) is the Lua VM written in JavaScript. It uses JavaScript's garbage collector so that interoperability with the DOM is non-leaky.
>
> [fengari.io](https://fengari.io/)
:::info Note

LiveCodes also supports running Lua using [Wasmoon](https://github.com/ceifa/wasmoon) which is a real Lua 5.4 VM with JS bindings made with WebAssembly. Read documentation [here](./lua-wasm.md)

:::

## Usage

LiveCodes runs Lua in the browser. JavaScript interoperability and DOM access is achieved using [`"js"` module](https://github.com/fengari-lua/fengari-interop).

import LiveCodes from '../../src/components/LiveCodes.tsx';

This example demonstrates usage, JavaScript interoperability and DOM access:

<LiveCodes template="lua" height="80vh"></LiveCodes>

## Language Info

### Name

`lua`

### Extension

`.lua`

### Editor

`script`

## Compiler

[Fengari](https://fengari.io/)

### Version

Fengari v0.1.4

## Code Formatting

Using [`lua-fmt`](https://github.com/trixnz/lua-fmt).

## Starter Template

https://livecodes.io/?template=lua

## Links

- [Lua](https://www.lua.org/)
- [Lua documentation](https://www.lua.org/docs.html)
- [Fengari](https://fengari.io/)
- [lua-wasm](./lua-wasm.md) in LiveCodes
87 changes: 87 additions & 0 deletions docs/docs/languages/php-wasm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# PHP (Wasm)

import LiveCodes from '../../src/components/LiveCodes.tsx';

PHP in Browser, powered by WebAssembly (using [php-wasm](https://github.com/seanmorris/php-wasm)).

`php-wasm` runs PHP in the browser using WebAssembly. This matches the behavior of the official PHP interpreter and allows using PHP's standard library. However, it requires relatively large download and has limited capabilities for client-side DOM manipulation.

:::info Note

If you need a lighter-weight interpreter with more capable client-side DOM manipulation in PHP and do not need to use PHP's standard library, you may want to use the [PHP interpreter written in JavaScript](./php.md).

:::

## Usage

### Standard Library

The PHP standard library is supported.

```php
<?php
phpinfo();
```

<!-- prettier-ignore -->
export const infoConfig = {script: {language: "php-wasm", content: `<?php\n\nphpinfo();`}, activeEditor: "script", mode: "result"};

<LiveCodes config={infoConfig} height="80vh"></LiveCodes>

### JavaScript Interoperability

[JavaScript Interoperability](https://github.com/seanmorris/php-wasm#accessing-the-dom) is achieved via the [VRZNO](https://github.com/seanmorris/vrzno) php extension.

Example:

<!-- prettier-ignore -->
export const jsOpParams = { phpwasm: `<?php\n\n// read from DOM\n$oldTitle = vrzno_eval('document.querySelector("#title").innerText');\necho $oldTitle;\n\n$newTitle = 'Changed@' . date('h:i:s');\n\n// set DOM properties\nvrzno_eval('document.querySelector("#title").innerText = "' . $newTitle . '"' );\n\n// run console.log\nvrzno_eval('console.log("Hello, World!")');\n`, html: `<h1 id="title">Hello, PHP!</h1>\n`, console: 'open' };

<LiveCodes params={jsOpParams} height="80vh"></LiveCodes>

Check the [starter template](#example-usage) for another example.

## Language Info

### Name

`php-wasm`

### Extension

`.wasm.php`

### Alias

`phpwasm`

### Editor

`script`

## Compiler

[php-wasm](https://github.com/seanmorris/php-wasm)

### Version

`php-wasm` v0.0.7, running PHP v8.2.4

## Code Formatting

Using [prettier](https://prettier.io/) and [Prettier PHP Plugin](https://github.com/prettier/plugin-php).

## Example Usage

<LiveCodes template="php-wasm" height="80vh"></LiveCodes>

## Starter Template

https://livecodes.io/?template=php-wasm

## Links

- [PHP](https://php.net/)
- [PHP documentation](https://www.php.net/manual/en/)
- [php-wasm](https://github.com/seanmorris/php-wasm)
- [PHP using Uniter](./php.md) in LiveCodes
Loading

0 comments on commit 45acbcd

Please sign in to comment.