打包好的livecode,版本v-46

This commit is contained in:
yangxin
2025-06-11 22:23:49 +08:00
commit 1214258379
1323 changed files with 133464 additions and 0 deletions

79
docs/features/ai.html.md Normal file
View File

@@ -0,0 +1,79 @@
# AI Code Assistant 🪄
LiveCodes supports AI-powered code completion, totally for **free** with **no account or API token required**, using [Codeium](https://codeium.com/), the ultrafast Copilot alternative. This can be easily enabled from the UI (as easy as [flipping a switch](#ui)!)
The large generative machine learning model is capable of understanding the context of your code and comments (across the [3 code editors](./projects#markup-editor)) in order to generate suggestions on what you might want to type next.
It has a wide range of language support, and it works everywhere (in the [standalone app](../getting-started.html.md)#standalone-app), [embedded playgrounds](./embeds.html.md) and [self-hosted](./self-hosting.html.md) apps).
Powered by:
<a href="https://codeium.com/">
<img width="300px" src="/docs/img/credits/codeium.svg" alt="Codeium logo" />
</a>
.
## Examples:
JavaScript:
<video controls style={{width: '100%'}}>
<source src="/docs/vid/LiveCodes-AI.mp4" type="video/mp4" />
</video>
Python:
<video controls style={{width: '100%'}}>
<source src="/docs/vid/LiveCodes-AI-py.mp4" type="video/mp4" />
</video>
## Instructions
The AI code assistant can be enabled from:
### UI
The [editor settings](./editor-settings.html.md) screen (Settings menu → Editor Settings → Enable AI Code Assistant).
import RunInLiveCodes from '../../src/components/RunInLiveCodes.tsx';
<RunInLiveCodes params={{ screen: 'editor-settings' }} linkText="direct link" />
![LiveCodes Editor Settings](../../static/img/screenshots/editor-settings-1.jpg)
**Note**
When set from the UI, this configuration is saved locally to [user settings](./user-settings.html.md) and is remembered across sessions.
### Configuration
Alternatively, this can be enabled (_only for the current session_) using the [`enableAI`](../configuration/configuration-object.html.md)#enableai) property in the [configuration object](../configuration/configuration-object.html.md). This can be used to enable the AI code assistant in [embedded playgrounds](./embeds.html.md).
Example:
```js
import { createPlayground } from 'livecodes';
createPlayground('#container', {
config: {
// highlight-next-line
enableAI: true,
},
});
```
Also this can be enabled using [query params](../configuration/query-params.html.md) (e.g. https://livecodes.io/?enableAI).
## Usage
On typing, the code completion suggestions will be shown in dimmed color. Press <kbd>Tab</kbd> to accept, or <kbd>Esc</kbd> to cancel.
On mobile, tap on the suggestion to accept it, or continue typing to reject.
:::caution Note
Please note that when using Codeium AI assistant, your code is sent to Codeium servers for code completion. However, your code is not used for training their model. Check Codeium [FAQ](https://codeium.com/faq#Will-Codeium-regurgitate-private-code%3F) and [privacy policy](https://codeium.com/privacy-policy) for more details.
:::

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,26 @@
# Assets
Adding local assets (e.g. images, fonts, stylesheets, scripts) that are not hosted online is such a common need that a UI was developed to allow easily adding them.
The assets are saved locally on the user's device and are available across projects (i.e the same image can be used in different projects without having to add it multiple times).
In addition, assets are supported in [sync](./sync.html.md), [backup](./backup-restore.html.md)#backup) and [restore](./backup-restore.html.md)#restore).
The `Assets` screen can be accessed from Settings menu → Assets
![Assets](/img/screenshots/assets-1.jpg)
import RunInLiveCodes from '../../src/components/RunInLiveCodes.tsx';
<RunInLiveCodes params={{ screen: 'assets' }} linkText="direct link" />
Assets are either:
- Encoded as [data URLs](./data-urls.html.md).
- Uploaded to a [GitHub Pages](https://pages.github.com/). This requires login with a [GitHub account](./github-integration.html.md) (allowing access to repos). A **public** repo called `livecodes-assets` is created if not present. The assets are pushed to `gh-pages` branch. They can then be accessed by URLs like:
https://\{user\}.github.io/livecodes-assets/assets/...
When an asset item is clicked, the URL is copied to clipboard. The URL can then be used in projects.
![Assets](/img/screenshots/assets-2.jpg)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,38 @@
# Backup / Restore
LiveCodes data can be backed-up, so that it can be later restored on the same or different device.
The Backup/Restore screen can be accessed from the Settings menu → Backup / Restore.
import RunInLiveCodes from '../../src/components/RunInLiveCodes.tsx';
<RunInLiveCodes params={{ screen: 'backup' }} linkText="direct link" />
## Backup
![LiveCode Backup](../../static/img/screenshots/backup-restore-1.jpg)
The backup can include one or more of the following:
- [Projects](./projects.html.md)
- [User Templates](./templates.html.md)
- [Code Snippets](./snippets.html.md)
- [Assets](./assets.html.md)
- [User Settings](./user-settings.html.md)
A zip file containing the (base64-encoded binary) backup data is downloaded. This file can be restored later on the same or different device.
## Restore
![LiveCode Restore](../../static/img/screenshots/backup-restore-2.jpg)
When restoring a backup, there are 2 options for managing the current data:
1. The current data can be deleted and replaced by the backup data. It cannot then be retrieved, so you may want to back it up first.
2. The backup data can be merged with the current data with best effort to preserve both.
## Related
- [Sync](./sync.html.md)
- [Export](./export.html.md)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,94 @@
# Broadcast
## Overview
LiveCodes Broadcast allows sending the [result page](./result.html.md) (and optionally source & compiled code and project configuration) to custom API. This can be used to live-view result page updates on different browsers/devices in real-time or broadcast live-coding sessions.
:::note
Broadcast can only be performed from the full app, and not from embedded playgrounds.
:::
The `Broadcast` screen can be accessed from the Broadcast icon in the [tools pane](./tools-pane.html.md) (below the result page), or from the Project menu → Broadcast.
import RunInLiveCodes from '../../src/components/RunInLiveCodes.tsx';
<RunInLiveCodes params={{ screen: 'broadcast' }} linkText="direct link" />
![Broadcast UI](./../../static/img/screenshots/broadcast-1.jpg)
On connecting to the server, the channel URL returned by the server is displayed. The channel URL can be shared to different clients (browsers on same or different devices) to view result page or code updates in real-time.
If the option `Include source code` is enabled, the source and compiled code together with the current project configuration are also posted to the server with each update.
![Broadcast UI - broadcasting](./../../static/img/screenshots/broadcast-2.jpg)
The Broadcast icon (in tools pane), shows the broadcast status. Clicking the icon, opens the broadcast UI, where the channel URL is displayed and the broadcast can be stopped.
![Broadcast icon - broadcasting](./../../static/img/screenshots/broadcast-3.jpg)
:::info Server
An open-source example implementation of an API server is available on: [live-codes/broadcast](https://github.com/live-codes/broadcast).
It is a [simple implementation](https://github.com/live-codes/broadcast/blob/main/index.js), which you can use or extend. It makes use of LiveCodes [Embeds](./embeds.html.md) and [SDK](../sdk/index.html.md) for code broadcasting.
A demo, free-to-test, instance is hosted on:
https://livecodes-broadcast.onrender.com/ (low resources - sleeps after 15 minutes of inactivity)
You can use one of these links to self-host it:
<a href="https://render.com/deploy?repo=https://github.com/live-codes/broadcast">
<img
src="https://render.com/images/deploy-to-render-button.svg"
alt="Deploy to Render"
width="150"
/>
</a>
&nbsp;&nbsp;&nbsp;
<a href="https://heroku.com/deploy?template=https://github.com/live-codes/broadcast/tree/main">
<img src="https://www.herokucdn.com/deploy/button.svg" alt="Deploy to Heroku" width="150" />
</a>
:::
:::tip Hosted API
[LiveCodes sponsors](../sponsor.html.md) (bronze sponsors and above) get access to a hosted (always-on) API, which they can use without having to manage their own server.
:::
These are screenshots for the live-updated result page and code:
![Broadcasting result](./../../static/img/screenshots/broadcast-4.jpg)
![Broadcasting code](./../../static/img/screenshots/broadcast-5.jpg)
## Technical Details
When starting a broadcast, the app sends a `POST` request to the specified server with a body that has the following properties:
- `result`: a string with the result page html.
- `data` (Only if `Include source code` option is enabled): an object containing source and compiled code together with the current project configuration.
- `userToken` (Optional): Can be used by the server to authorize users who can broadcast (see below how to set it).
When the server successfully creates a channel, it should respond by sending a JSON object with the following properties:
- `channel`: a string representing the channel Id.
- `channelUrl`: a string with the URL of the channel that can be shared to the clients who want to connect to it.
- `channelToken`: a string representing a secret token for this channel, to prevent others from sending to the same channel. This is only sent once (in response to the request that created the channel).
The `channel` and `channelToken` are remembered by the app, and are sent in subsequent requests for the same channel (with every result page update). They are deleted when stopping broadcast or when the app reloads.
:::note
To set a `userToken` for authorization with a broadcast server, run the following in the browser console:
```js
await livecodes.exec('setBroadcastToken', 'my-token');
```
The supplied value (in this case `my-token`) will be posted to the server with every update as the value for the property `userToken`.
This value is saved for the current user across app reloads.

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,52 @@
# Code Format
Code formatting is supported for most [languages](../languages/index.html.md).
## Code Formatters
The code formatter used for each language is specified in the [language documentation](../languages/index.html.md) page.
For example:
- [Prettier](https://prettier.io/) is used for many languages including HTML, CSS, JavaScript, TypeScript, JSX, TSX.
- [gofmt](https://pkg.go.dev/cmd/gofmt) (via [GopherJS](https://github.com/gopherjs/gopherjs)) is used for Go.
- [Parinfer](https://shaunlebron.github.io/parinfer/) is used for Scheme, Common Lisp and ClojureScript.
## Format Button
Code formatting for the code in the active editor can be triggered by the `Format` button below the editor.
![code format](../../static/img/screenshots/format-1.jpg)
## Keyboard Shortcut
Code formatting can also be trigger by the keyboard shortcut <kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>F</kbd>.
## Format on-save
Format on-save can be enabled from the Settings menu → Format on-save.
## Format Options
Some format options can be configured from [Editor Settings](./editor-settings.html.md) screen. These include [Prettier](https://prettier.io/) [configuration options](https://prettier.io/docs/en/options.html) for:
- Indentation (Spaces/Tabs)
- Tab size
- Use Semicolons
- Use Single Quotes
- Use Trailing Commas
## Configuration
Code format can be configured using the [configuration object](../configuration/configuration-object.html.md) properties:
- [`formatOnsave`](../configuration/configuration-object.html.md)#formatonsave)
- [`useTabs`](../configuration/configuration-object.html.md)#usetabs)
- [`tabSize`](../configuration/configuration-object.html.md)#tabsize)
- [`semicolons`](../configuration/configuration-object.html.md)#semicolons)
- [`singleQuote`](../configuration/configuration-object.html.md)#singlequote)
- [`trailingComma`](../configuration/configuration-object.html.md)#trailingcomma)
## SDK Method: `format`
The code format can be programmatically triggered by the [SDK](../sdk/index.html.md) method [`format`](../sdk/js-ts.html.md)#format).

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,71 @@
# Code Prefill
import LiveCodes from '../../src/components/LiveCodes.tsx';
There are many ways to pre-fill code into playgrounds. This is generally achieved either by the [SDK](../sdk/index.html.md) or using [query params](../configuration/query-params.html.md).
## Prefill using SDK
When creating an embedded playground, the following [embed options](../sdk/js-ts.html.md)#embed-options) allow prefill with code:
### config
[EmbedOptions.config](../sdk/js-ts.html.md)#config)
loads a [configuration object](../configuration/configuration-object.html.md) (or a URL to JSON file representing the configuration object)
<LiveCodes
config={{
markup: { language: 'html', content: '<h1>Hello World!</h1>' },
style: { language: 'css', content: 'h1 { color: blue; }' },
}}
></LiveCodes>
### import
[EmbedOptions.import](../sdk/js-ts.html.md)#import)
allows [importing](./import.html.md) from many sources.
Examples:
Import GitHub directory:
<LiveCodes import="https://github.com/bradtraversy/50projects50days/tree/master/progress-steps"></LiveCodes>
Import shared project:
<LiveCodes import="id/6ys2b8txf33"></LiveCodes>
### template
[EmbedOptions.template](../sdk/js-ts.html.md)#template)
loads one of the [starter templates](./templates.html.md).
<LiveCodes template="react"></LiveCodes>
## Prefill using query params
[Query parameters](../configuration/query-params.html.md) can provide easy and powerful ways for configuring the playground.
Example:
<a href="https://livecodes.io/?md=**Hello World!**" target="_blank">
{'https://livecodes.io/?md=**Hello World!**'}
</a>
<br />
<br />
<LiveCodes params={{ md: '**Hello World!**' }}></LiveCodes>
## Auto-Prefill from page DOM
TODO...
## Related
- [Import](./import.html.md)
- [Templates](./templates.html.md)
- [Configuration](../configuration/index.html.md)
- [SDK](../sdk/index.html.md)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,23 @@
# Code to Image
LiveCodes has a feature called "Code to Image" that allows converting the code in the code editor into nice-looking images (or code screenshots), that can be downloaded or shared.
This can be accessed from the camera icon in the toolbar below the editor. Clicking the icon will open the "Code to Image" screen and load the code in the editor.
![Code to Image](../../static/img/screenshots/code-to-image-1.jpg)
Code can be modified in the "Code to Image" screen and then downloaded as image or shared.
![Code to Image](../../static/img/screenshots/code-to-image-2.jpg)
There are many options to configure the image to be generated, including background color, border radius, image size, padding, shadow, window style, share URL, editor theme, opacity, code font, image format, etc.
There are multiple presets that can be used or the options can be manually configured.
![Code to Image](../../static/img/screenshots/code-to-image-3.jpg)
![Code to Image](../../static/img/screenshots/code-to-image-4.jpg)
![Code to Image](../../static/img/screenshots/code-to-image-5.jpg)
![Code to Image](../../static/img/screenshots/code-to-image-6.jpg)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,34 @@
# Command Menu
The command menu allows running a large set of commands from the UI. It is keyboard-friendly and allows for searching and selecting commands. Most of the functionality of LiveCodes can be achieved using the command menu, which can really improve productivity and DX.
It can be triggered from the keyboard by pressing <kbd>Ctrl</kbd> + <kbd>K</kbd> (or <kbd>⌘</kbd> + <kbd>K</kbd> on Mac), or from the Help Menu.
![Open Command Menu from UI](../../static/img/screenshots/command-menu-1.jpg)
The available commands cover a wide range of functionality, like showing and hiding UI elements (e.g. different editors, the [result page](./result.html.md), [console](./console.html.md), [compiled code viewer](./compiled-code.html.md), and [tests](./tests.html.md)), changing [languages](../languages), loading [starter templates](./templates.html.md), opening different screens (e.g. new project, opening saved projects, [import](./import.html.md), [embeds](./embeds.html.md), [deploy](./deploy.html.md), [share](./share.html.md) and more).
In addition many commands can be executed from the command menu, such as running code, formatting code, changing settings (e.g. autorun, autosave, [AI code assistant](./ai.html.md), changing [themes](./themes.html.md), [editor settings](./editor-settings.html.md), and more).
![LiveCodes Command Menu](../../static/img/screenshots/command-menu-2.jpg)
![LiveCodes Command Menu](../../static/img/screenshots/command-menu-3.jpg)
![LiveCodes Command Menu](../../static/img/screenshots/command-menu-4.jpg)
## Using the Command Menu
Commands can be navigated and selected by:
- The mouse: scrolling and clicking
- The keyboard: using the up and down arrow keys to navigate, pressing <kbd>Enter</kbd> to select, <kbd>Backspace</kbd> to move to parent category and <kbd>Esc</kbd> to close the command menu.
- Searching: typing in the search box for fuzzy search.
![LiveCodes Command Menu](../../static/img/screenshots/command-menu-5.jpg)
![LiveCodes Command Menu](../../static/img/screenshots/command-menu-6.jpg)
## Keyboard Shortcuts
If a command has a keyboard shortcut, it will be shown in the command menu. In addition, the whole list of keyboard shortcuts can be opened from the command menu (by searching for "Keyboard Shortcuts") or from the UI from the Help Menu.
![Keyboard Shortcuts](../../static/img/screenshots/keyboard-shortcuts.jpg)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,19 @@
# Compiled Code
import LiveCodes from '../../src/components/LiveCodes.tsx';
The resulting compiled/transpiled code can be seen in the compiled code viewer (in the [tools pane](./tools-pane.html.md)) in real-time, as you type. This works for all compiled code (e.g. Markdown, Pug, SCSS, Less, Stylus, Typescript, CoffeeScript, ...etc.).
This can be a great tool for learning. As you write code, you see the compiled code and the resulting page at the same time. The compiled code viewer shows the code compiled from the currently active editor (markup/style/script). This includes the CSS produced by CSS processors (e.g. Autoprefixer), if enabled.
![Compiled Code Viewer](./../../static/img/screenshots/compiled-code-1.jpg)
e.g. https://livecodes.io/?ts&compiled=full <br />
sets TypeScript as the active editor and shows compiled code viewer maximized.
This demo shows TypeScript code along with the compiled Javascript code, similar to the [official TypeScript Playground](https://www.typescriptlang.org/play):
<LiveCodes
import="https://gist.github.com/hatemhosny/4bed283ef9757a6a541aee685c710dc7"
params={{ 'ts-selector': 'playground.ts', activeEditor: 'script', compiled: 'full' }}
></LiveCodes>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,36 @@
# Console
import LiveCodes from '../../src/components/LiveCodes.tsx';
Console messages are shown in the integrated console (in the [tools pane](./tools-pane.html.md), below the result page), without having to open the native browser console.
Messages can be sent to the console using the standard `console` methods in the code editor (e.g. `console.log`, `console.warn`, `console.error`, `console.table`, ...etc). The console can also be used as REPL (readevalprint loop) using the integrated console input.
The code is evaluated in the context of the result page (i.e. variables defined in the script editor are accessible for evaluation in the console input). Also code completion works in the console input.
e.g. https://livecodes.io/?ts&console=full <br />
sets TypeScript as the active editor and shows the console maximized.
Demo: (console=full)
<LiveCodes
params={{
console: 'full',
js: `const x = 5;\nconsole.log('x:', x);\nconsole.log({x, y: 6});\nconsole.table({x, y: 6});\nconsole.warn('take care!');\nconst z = x * y;`,
}}
></LiveCodes>
<p>&nbsp;</p>
:::tip
Setting the querystring `languages` only shows these languages.
Selecting one language and setting console to `full` gives an environment similar to a REPL.
:::
Demo: (Python - print to console)
<LiveCodes
params={{ languages: 'py', console: 'full', py: "print('hello from python')" }}
></LiveCodes>

File diff suppressed because one or more lines are too long

143
docs/features/css.html.md Normal file
View File

@@ -0,0 +1,143 @@
# CSS
import LiveCodes from '../../src/components/LiveCodes.tsx';
The [result page](./result.html.md) can be styled with CSS using various methods, including:
## Style Editor
Code added to [style editor](./projects.html.md)#style-editor) is [compiled](#languages) and [processed](#css-processors), then added as CSS to the [result page](./result.html.md) `head` element.
![LiveCodes styles](../../static/img/screenshots/css-processors.jpg) <!-- http://127.0.0.1:8080/?x=id/8gvn866qvh5 -->
### Languages
LiveCodes supports multiple languages that compile to CSS, including [SCSS](../languages/scss.html.md), [Sass](../languages/sass.html.md), [Less](../languages/less.html.md) and [Stylus](../languages/stylus.html.md). Code authored in any of these languages is compiled to CSS before being added to the [result page](./result.html.md).
The style language can be selected from the style editor menu. In embedded playgrounds, the language can be configured via the configuration object property [`style.language`](../configuration/configuration-object.html.md)#style)
### CSS Processors
The (compiled) CSS code can be processed by one or more of the supported CSS processors. Examples of these include: [Autoprefixer](../languages/autoprefixer.html.md), [postcss-preset-env](../languages/postcssPresetEnv.html.md), [Lightning CSS](../languages/lightningcss.html.md), [CSS Modules](../languages/cssmodules.html.md), [cssnano](../languages/cssnano.html.md), ...etc.
Multiple CSS processors can be enabled at the same time. The code is processed in the order of processors placed in the style editor menu of the app.
Processors are enabled in the [standalone app](../getting-started.html.md)#standalone-app) from the style editor menu, by switching on the toggles of the required processors.
In embedded playgrounds, processors are enabled via the [`processors`](../configuration/configuration-object.html.md)#processors) property of the [configuration object](../configuration/configuration-object.html.md).
### Style Imports
[Bare modules](./module-resolution.html.md)#bare-module-imports) used with `@import` rules are supposed to be npm modules. These are converted to [full URLs from CDN](./module-resolution.html.md)#cdn-providers).
#### Example
This code:
```css
@import 'github-markdown-css/github-markdown.css';
```
becomes:
```css
@import 'https://unpkg.com/github-markdown-css/github-markdown.css';
```
Packages that specify a stylesheet as the main module can be imported like that:
```css
@import 'github-markdown-css';
```
demo:
<LiveCodes template="markdown" params={{ activeEditor: 'style', compiled: 'open' }}></LiveCodes>
The content can be inlined in the compiled CSS by enabling the processor [postcss-import-url](../languages/postcssImportUrl.html.md).
### Compiled CSS
Compiled CSS (following compilation of style language, and all enabled processors) is added to the [result page](./result.html.md) `head` element.
The compiled code can be inspected in the [compiled code viewer](./compiled-code.html.md) in the [tools pane](./tools-pane.html.md).
### Auto-update
When [`autoupdate`](../configuration/configuration-object.html.md)#autoupdate) is enabled (default), in contrast to [markup editor](./projects.html.md)#markup-editor) and [script editor](./projects.html.md)#script-editor), changes in style editor code does NOT trigger a full reload of the [result page](./result.html.md). The updated CSS code is sent to the page and applied without a reload.
The page can be force-reloaded by clicking the run button or using the keyboard shortcut: <kbd>Shift</kbd>&nbsp;+&nbsp;<kbd>Enter</kbd>.
## External Resources
External stylesheets can be added in [external resources](./external-resources.html.md) screen. These are added to the [result page](./result.html.md) before the compiled style editor code. This allows code in style editor to override CSS properties in external stylesheets.
External stylesheets can be added to embedded playgrounds using the [configuration object](../configuration/configuration-object.html.md) property [`stylesheets`](../configuration/configuration-object.html.md)#stylesheets).
## CSS Presets
CSS presets like [Normalize.css](https://necolas.github.io/normalize.css/) and [Reset CSS](https://meyerweb.com/eric/tools/css/reset/) can be selected in [external resources](./external-resources.html.md)#css-presets) screen.
## Stylesheets Imported in Script Editor
### External Stylesheets
CSS stylesheets imported in the script editor are added to the [result page](./result.html.md) `head` element. _The URL has to end with **`.css` extension**_.
For example, adding this in the script editor (JavaScript):
```js
import 'https://unpkg.com/github-markdown-css/github-markdown.css';
```
adds this to the page `head`:
```html
<link rel="stylesheet" href="https://unpkg.com/github-markdown-css/github-markdown.css" />
```
Currently, compiling imported stylesheets (e.g. SCSS) is not supported.
Similar to [imports in style editor](#style-imports), bare imports are converted to full URLs from CDN.
For example:
```js
import 'github-markdown-css/github-markdown.css';
```
becomes:
```html
<link rel="stylesheet" href="https://unpkg.com/github-markdown-css/github-markdown.css" />
```
### `./style.css`
Importing the URLs (`./style.css` or `./styles.css`) gets the style editor compiled/processed CSS **string** as the module's default export.
Example:
```js
import styles from './style.css';
console.log(styles); // => compiled CSS as string
```
## CSS Modules
CSS modules are supported and are [documented separately](../languages/cssmodules.html.md).
## CSS Frameworks
Multiple CSS frameworks are supported including [Tailwind CSS](../languages/tailwindcss.html.md), [UnoCSS](../languages/unocss.html.md) and [WindiCSS](../languages/windicss.html.md).
## Styles in Markup & Script
Of course, styles and stylesheets can still be added as usual in markup and script editors (via HTML elements and/or DOM).
## Related
- [Projects](./projects.html.md)
- [External resources](./external-resources.html.md)
- [Module resolution](./module-resolution.html.md)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,70 @@
# Data URLs
> **Data URLs**, URLs prefixed with the `data:` scheme, allow content creators to embed small files inline in documents.
>
> — [MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs)
Sometimes, you need to use an external file (e.g. script, stylesheet) that is not hosted online. In this case, you can use data URLs to embed the file in your code. These can then be used similar to regular URLs (e.g. for `<script src>`, `<link href>`, import URL, etc.).
LiveCodes UI allows creating and consuming these data URLs.
## Creating data URLs
Data URLs can be created from:
### Assets
For local files on user's device.
[Assets screen](./assets.html.md) can be accessed from Settings menu → Assets. This works for any file type, including text files (e.g. stylesheets or scripts) and binary files like images. Generated data URLs are saved locally in the user's browser storage and are available across projects.
### "Copy code as data URL" button
For code in code editor.
The button can be found in the editor toolbar, below the code editor. This copies the code of the active editor as data URL to the clipboard.
The content is base64-encoded. Unicode content is appropriately encoded (see [The "Unicode Problem"](https://developer.mozilla.org/en-US/docs/Glossary/Base64#the_unicode_problem)).
## Consuming data URLs
Data URLs can be used anywhere you use a regular URL (e.g. for `<script src>`, `<link href>`, import URL, etc.).
In addition, LiveCodes supports [importing](./import.html.md) data URLs, like other URLs. If the language is detected, it is loaded in the appropriate editor (e.g. `data:text/typescript;charset=UTF-8;base64,....` is detected as TypeScript).
:::caution
Depending on the browser, there may be [length limitations](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs#common_problems) on URLs. So, it is generally recommended to use data URLs for small files.
For large files, it is better to host these online. LiveCodes allows hosting assets on [GitHub Pages](https://pages.github.com/) (see [assets](./assets.html.md)).
:::
## Example
If we add this this in script editor:
```js
export const sayHello = (name) => 'Hello ' + name;
```
then copy it as data URL, we will get:
`data:text/javascript;charset=UTF-8;base64,ZXhwb3J0IGNvbnN0IHNheUhlbGxvID0gKG5hbWUpID0+ICdIZWxsbyAnICsgbmFtZTs=`.
This can be used (e.g. in another project) like this:
```js
import { sayHello } from 'data:text/javascript;charset=UTF-8;base64,ZXhwb3J0IGNvbnN0IHNheUhlbGxvID0gKG5hbWUpID0+ICdIZWxsbyAnICsgbmFtZTs=';
console.log(sayHello('Ali'));
```
## Related
- [Data URLs (MDN)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs)
- [Assets](./assets.html.md)
- [Import](./import.html.md)
- [External Resources](./external-resources.html.md)
- [Module resolution](./module-resolution.html.md)
- [CSS](./css.html.md)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,22 @@
# Default Template/Language
When the app is loaded, by default, the last used [language](../languages/index.html.md) is selected.
The app can also be configured to load a default [user template](./templates.html.md)#user-templates).
If you do not already have any user templates, save any loaded project as template:
Project menu → Save as → Template.
Then, in the user templates screen (Project menu → New ... → My Templates), find your template and click "Set as default".
If you wish to clear that selection, find the default template in user templates and click "unset".
If you want to temporarily not load the default template/language add the [query param](../configuration/query-params.html.md) `no-defaults`.
Example: https://livecodes.io?no-defaults
## Related
- [Templates](./templates.html.md)
- [Query params](../configuration/query-params.html.md)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,47 @@
# Default View
import LiveCodes from '../../src/components/LiveCodes.tsx';
The playground can be loaded in one of the following views:
## `split`
Both the code editor and the result page are visible. This is the default.
Example: https://livecodes.io/?view=split
Demo:
<LiveCodes config={{ view: 'split' }}></LiveCodes>
## `editor`
The code editor is visible, while the result page is collapsed. The result page can be shown by dragging the split gutter, or clicking the "Toggle Result" button.
Example: https://livecodes.io/?view=editor
Demo:
<LiveCodes config={{ view: 'editor' }}></LiveCodes>
## `result`
The result page is visible, while the code editor is collapsed. The code editor can be shown by dragging the split gutter, or clicking one of the editor tabs.
Example: https://livecodes.io/?view=result
Demo:
<LiveCodes config={{ view: 'result' }}></LiveCodes>
## Display Mode vs Default View
:::info
"[Display Mode](./display-modes.html.md)" is different from "Default View".
In `editor` display mode, only the editor is loaded and the result page is not available. While `editor` default view shows the editor by default, and the result page can be shown by dragging the split gutter.
The same applies for `result` display mode and default view.
:::

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,28 @@
# Deploy
The result page (of any number of projects) can be deployed and hosted at [GitHub Pages](https://pages.github.com/) (a free service from GitHub for hosting static websites). This requires login with a [GitHub account](./github-integration.html.md).
The `Deploy` screen can be accessed from the Project menu → Deploy.
import RunInLiveCodes from '../../src/components/RunInLiveCodes.tsx';
<RunInLiveCodes params={{ screen: 'deploy' }} linkText="direct link" />
![LiveCodes Deploy](../../static/img/screenshots/deploy-1.jpg)
The result page (and optionally the source code) is pushed to `gh-pages` branch of a **public** GitHub repo (new or existing). The page, shortly, becomes available on `https://{user}.github.io/{repo}/`.
If an existing repo is selected, the content of the `gh-pages` branch (if existing) is replaced by the deployed content.
If the option `Commit source code` is enabled, the source code will be deployed to the directory `/src`.
The code for the result page (and source code) is deployed as separate files for markup (`/index.html`), styles (`style.css`) and script (`script.js`). This allows re-use of these resources in other projects. Of course, multiple projects can be deloyed and linked to each other to act like a multi-page website.
The LiveCodes app will remember the repo used to deploy each project, so that later updates to the project can be deployed to the same repo.
## Related
- [Export](./export.html.md)
- [Share](./share.html.md)
- [Broadcast](./broadcast.html.md)
- [GitHub integration](./github-integration.html.md)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,134 @@
# Display Modes
import LiveCodes from '../../src/components/LiveCodes.tsx';
The [configuration](../configuration/configuration-object.html.md) option [`mode`](../configuration/configuration-object.html.md)#mode), also available as [query param](../configuration/query-params.html.md), can be used to select different display modes.
The following display modes are supported:
## `full`
This is the default mode with toolbars, editor and result panes.
Example: https://livecodes.io/?template=react
Screenshot: (App in full mode)
![full-mode](../../static/img/screenshots/mode-full.jpg)
Demo: (Embedded playground in full mode)
<LiveCodes template="react"></LiveCodes>
## `focus`
This hides most of UI buttons and menus and keeps only the essential elements: editors, editor titles, result page, console, and run and share buttons. It can be toggled during runtime from the full mode through the UI from a button in the lower left corner. Also the query param `?mode=focus`.
Example: https://livecodes.io/?template=react&mode=focus
Screenshot: (focus mode)
![focus-mode](../../static/img/screenshots/mode-focus.jpg)
## `simple`
This mode is mainly useful for embedded playgrounds.
It shows only 1 editor with the output (result page +/- console). The content of other editors can be set using [SDK](../sdk/index.html.md) [config](../configuration/configuration-object.html.md) even though the editors are not shown.
By default, `codemirror` editor is used, however, this can be changed by the [`editor`](../configuration/configuration-object.html.md)#editor) option.
By default, the layout is `responsive` but can also be overridden by the [`layout`](../configuration/configuration-object.html.md)#layout) option to `vertical` or `horizontal`.
Demo: JS with console
<LiveCodes
params={{ mode: 'simple', js: 'console.log("hello world")', layout: 'vertical', console: 'full' }}
></LiveCodes>
Demo: JSX & Result page (Monaco editor, add CSS)
export const simpleConfig = {
mode: 'simple',
layout: 'vertical',
activeEditor: 'script',
editor: 'monaco',
tools: { status: 'none' },
script: {
language: 'jsx',
content: `import { atom, useAtom } from 'jotai';\n\nconst countAtom = atom(0);\n\nconst Counter = () => {\n const [count, setCount] = useAtom(countAtom);\n const inc = () => setCount((c) => c + 1);\n return (\n <>\n {count} <button onClick={inc}>+1</button>\n </>\n );\n};\n\nconst App = () => (\n <div className="App">\n <h1>Hello Jotai</h1>\n <h2>Enjoy coding!</h2>\n <Counter />\n </div>\n);\n\nexport default App;\n`,
},
style: {
language: 'css',
content: '.App {\n font-family: sans-serif;\n text-align: center;\n}\n'.trimStart(),
},
};
<LiveCodes config={simpleConfig} height="400px"></LiveCodes>
## `lite`
Loads a light-weight, minimal code editor, with limited playground features.
See the section about [lite mode](./lite.html.md) for details
Example: https://livecodes.io/?mode=lite&template=react
Demo:
<LiveCodes config={{ mode: 'lite' }} template="react"></LiveCodes>
## `editor`
Hides the results pane and works as editor only.
Example: https://livecodes.io/?mode=editor&template=react
Demo:
<LiveCodes config={{ mode: 'editor' }} template="react"></LiveCodes>
## `codeblock`
A read-only mode showing only the code block without editor interface. On mouse-over a copy button appears that allows to copy the code. This is specially useful when embedded.
Example: https://livecodes.io/?mode=codeblock&template=react
Demo:
<LiveCodes config={{ mode: 'codeblock' }} template="react"></LiveCodes>
By default, in `codeblock` mode, the light-weight `CodeJar` editor is used (in read-only mode). You can override this by setting the `editor` option. Refer to [Editor Settings](./editor-settings.html.md)#code-editor) for details.
Example: https://livecodes.io/?mode=codeblock&editor=monaco&template=react
Demo:
<LiveCodes config={{ mode: 'codeblock', editor: 'monaco' }} template="react"></LiveCodes>
## `result`
Shows the result page only, with a drawer at the bottom (which can be closed) that allows opening the project in the full playground.
Example: https://livecodes.io/?mode=result&template=react
Demo:
<LiveCodes params={{ mode: 'result', template: 'react' }}></LiveCodes>
The tools pane (e.g. console/compiled code viewer) is hidden by default in `result` mode. It can be shown if set to `open` or `full`. Refer to [Tools pane](./tools-pane.html.md) documentation for details.
Example: https://livecodes.io/?mode=result&tools=console|full&&js=console.log("Hello%20World!")
Demo:
<LiveCodes
params={{ mode: 'result', tools: 'console|full', js: 'console.log("Hello World!")' }}
></LiveCodes>
## Display Mode vs Default View
:::info
"Display Mode" is different from "[Default View](./default-view.html.md)".
In `editor` display mode, only the editor is loaded and the result page is not available. While `editor` default view shows the editor by default, and the result page can be shown by dragging the split gutter.
The same applies for `result` display mode and default view.
:::

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,71 @@
# Editor Settings
LiveCodes allows a lot of flexibility for configuring which code editor to use and its settings.
`Editor Settings` screen can be accessed from Settings menu → Editor Settings.
import RunInLiveCodes from '../../src/components/RunInLiveCodes.tsx';
<RunInLiveCodes params={{ screen: 'editor-settings' }} linkText="direct link" />
![LiveCodes Editor Settings](../../static/img/screenshots/editor-settings-1.jpg)
![LiveCodes Editor Settings](../../static/img/screenshots/editor-settings-2.jpg)
![LiveCodes Editor Settings](../../static/img/screenshots/editor-settings-3.jpg)
A preview code editor is displayed to preview the settings in real time.
The settings selected in the `Editor Settings` screen are saved locally to [user settings](./user-settings.html.md) and are used subsequently. These include:
### Enable AI Code Assistant
Enables the [AI code assistant](./ai.html.md). (Free and no account required)
### Code Editor
The following code editors are supported:
- [**Monaco Editor**](https://microsoft.github.io/monaco-editor/): This is the code editor that powers [**VS Code**](https://code.visualstudio.com/). It is [feature-rich](https://code.visualstudio.com/docs/editor/codebasics) and supports autocomplete with [**IntelliSense**](https://code.visualstudio.com/docs/editor/intellisense) (including [types for custom libraries](./intellisense.html.md)). However, it requires a relatively large download and is not supported in mobile browsers.
- [**CodeMirror**](https://codemirror.net/): Has [many editing features](https://codemirror.net/docs/extensions/), including autocomplete, with good **mobile support**.
- [**CodeJar**](https://medv.io/codejar/): A **lightweight** code editor with very basic editing features. [PrismJs](https://prismjs.com/) is used for syntax highlighting. Please note that some editor settings are not supported in CodeJar (see below).
This can be configured using the [`editor`](../configuration/configuration-object.html.md)#editor) configuration option.
By default, Monaco editor is used on desktop, CodeMirror is used on mobile and CodeJar is used in [codeblocks](./display-modes.html.md)#codeblock), in [lite mode](./lite.html.md) and in [readonly](../configuration/configuration-object.html.md)#readonly) playgrounds.
### Editor Options
These include:
- [Editor theme](../configuration/configuration-object.html.md)#editortheme)
- [Font family](../configuration/configuration-object.html.md)#fontfamily)
- [Font size](../configuration/configuration-object.html.md)#fontsize)
- [Indentation](../configuration/configuration-object.html.md)#usetabs) (Spaces/Tabs)
- [Tab size](../configuration/configuration-object.html.md)#tabsize)
- [Line numbers](../configuration/configuration-object.html.md)#linenumbers)
- [Word-wrap](../configuration/configuration-object.html.md)#wordwrap)
- [Auto-close brackets and quotes](../configuration/configuration-object.html.md)#closebrackets)
- [Fold (collapse) regions](../configuration/configuration-object.html.md)#foldregions)
### Emmet
Allows using [**Emmet**](https://emmet.io/) [abbreviations and actions](https://docs.emmet.io/). See [`emmet`](../configuration/configuration-object.html.md)#emmet) configuration option.
(Not supported in CodeJar)
### Editor Modes
Allows using [**Vim**](https://vimhelp.org/) and [**Emacs**](https://www.gnu.org/software/emacs/manual/html_node/emacs/Basic.html) keyboard bindings. See [`editorMode`](../configuration/configuration-object.html.md)#editormode) configuration option.
(Not supported in CodeJar)
### Format Options
These are [**Prettier**](https://prettier.io/) [configuration options](https://prettier.io/docs/en/options.html) used for code formatting.
In addition to those specified in [Editor Options](#editor-options), the following options are available:
- [Use Semicolons](../configuration/configuration-object.html.md)#semicolons)
- [Use Single Quotes](../configuration/configuration-object.html.md)#singlequote)
- [Use Trailing Commas](../configuration/configuration-object.html.md)#trailingcomma)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,101 @@
# Embedded Playgrounds
import LiveCodes from '../../src/components/LiveCodes.tsx';
## Overview
LiveCodes playgrounds can be embedded in any web page. The playground can be [prefilled with code](./code-prefill.html.md) in any supported language. This can be very useful in documentation websites, technical blogs, educational websites and others.
Demo:
<LiveCodes template="javascript"></LiveCodes>
The embedding web page can communicate with the playground using a powerful [SDK](../sdk/index.html.md) (e.g. edit/format code, watch for code changes, get the compiled code or result page HTML, run tests, change layout, ...etc).
## Create Embedded Playground
### App Embed Screen
In the [standalone app](../getting-started.html.md)#standalone-app), the Embed Screen can be accessed from Project menu → Embed.
import RunInLiveCodes from '../../src/components/RunInLiveCodes.tsx';
<RunInLiveCodes params={{ screen: 'embed' }} linkText="direct link" />
It shows a preview of the embedded playground, allows customizations of [embed options](../sdk/js-ts.html.md)#embed-options) and provides generated code that can be added to the web page that will embed the playground.
![LiveCodes embed](../../static/img/screenshots/embed-1.jpg)
![LiveCodes embed](../../static/img/screenshots/embed-2.jpg)
![LiveCodes embed](../../static/img/screenshots/embed-3.jpg)
:::info Note
Please note that the Embed Screen sends the project code to [LiveCodes share service](./share.html.md) to generate a short URL for usage in the embed code.
:::
The setting "Embed Type" allows selection from different variations of the generated code:
- Using the SDK from CDN.
- Using the SDK with a bundler (e.g. vite, parcel, webpack, etc).
- Using the React SDK.
- Using the Vue SDK.
- Using iframe and [query params](../configuration/query-params.html.md).
- Using HTML code that the SDK can use to [auto-prefill](./code-prefill.html.md)#auto-prefill-from-page-dom) the playground.
### SDK
The LiveCodes [SDK](../sdk/index.html.md) can be used to embed playgrounds, specify [embed](../sdk/js-ts.html.md)#embed-options) and [configuration](../configuration/index.html.md) options and allows communication with the embedded playground with many [SDK methods](../sdk/js-ts.html.md)#sdk-methods).
This method provides more control and allows advanced scenarios.
## Avoid Breaking Changes
To avoid breaking changes that would cause the embedded playgrounds to stop working as expected with later updates, follow these recommendations:
- Use a [permanent URL](./permanent-url.html.md) to a pinned version of the LiveCodes app for [`EmbedOptions.appUrl`](../sdk/js-ts.html.md)#appurl). The code generated in the Embed screen uses that by default.
- Specify the version of the SDK used. The code generated in the Embed screen also does that.
- For project code, [specify the versions](./module-resolution.html.md)#package-version) of the imported packages and [external resources](./external-resources.html.md). [Custom import maps](./module-resolution.html.md)#custom-module-resolution) can be set to control the module import behavior.
Check the [Permanent URL](./permanent-url.html.md) section for more details.
## Differences from Full App
Some of the features of the full standalone app are not available or shown by default in embedded playgrounds, either because of security reasons, being not useful when embedded or because of space limitations.
### Features Not Available
- All features that require saving/loading from browser storage:
e.g. [projects](./projects.html.md), [assets](./assets.html.md), [code snippets](./snippets.html.md), [user settings](./user-settings.html.md), [default template/language](./default-template-language.html.md), [recover unsaved](./recover.html.md), [backup/restore](./backup-restore.html.md).
- All features that require authentication:
e.g. [login/logout](./github-integration.html.md), [sync](./sync.html.md), [deploy](./deploy.html.md), [importing](./import.html.md) from private github repos.
- [Broadcast](./broadcast.html.md).
- App menus.
- Some tools in [tools pane](./tools-pane.html.md):
e.g. open result page in new window, broadcast status.
- [Welcome screen](./welcome.html.md).
### Features Not Shown by Default
- [External resources](./external-resources.html.md) button (below the editor) and external resources screen are only shown if the loaded project has external resources (e.g. via [`EmbedOptions.config.stylesheets`](../configuration/configuration-object.html.md)#stylesheets) and [`EmbedOptions.config.scripts`](../configuration/configuration-object.html.md)#scripts)).
- [Tests](./tests.html.md) are not shown in [tools pane](./tools-pane.html.md) unless the loaded project has tests (e.g. via [`EmbedOptions.config.tests`](../configuration/configuration-object.html.md)#tests)). Test editor is not available.
- Loading [starter templates](./templates.html.md) can be achieved by the [SDK](../sdk/index.html.md) ([`EmbedOptions.template`](../sdk/js-ts.html.md)#template)), not from the UI.
- [Importing](./import.html.md) from external sources can be achieved by the [SDK](../sdk/index.html.md) ([`EmbedOptions.import`](../sdk/js-ts.html.md)#import)), not from the UI.
- Getting a [share](./share.html.md) URL can be achieved by the [SDK](../sdk/index.html.md) ([`getShareUrl`](../sdk/js-ts.html.md)#getshareurl) method), not from the UI.
## Security
- All user code, [result page](./result.html.md) and compilers run in [sandboxed iframes](https://www.html5rocks.com/en/tutorials/security/sandboxed-iframes/) with a unique origin.
- Embedded playgrounds do not have access to the parent page, or to sensitive data like user cookies and localstorage of the embedding page origin. Communications with the SDK occur by means of [`postMessage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage) calls.
## Related
- [SDK](../sdk/index.html.md)
- [Code prefill](./code-prefill.html.md)
- [Configuration](../configuration/index.html.md)
- [Embed options](../sdk/js-ts.html.md)#embed-options)
- [SDK methods](../sdk/js-ts.html.md)#sdk-methods)
- [Permanent URL](./permanent-url.html.md)
- [Lite mode](./lite.html.md)
- [Read-only](./read-only.html.md)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,45 @@
# Export
## Exporting A Single Project
Project export can be accessed from the Project menu → Export.
![LiveCodes Export](../../static/img/screenshots/export-1.jpg)
Any project can be exported to:
- **Project (JSON):** a JSON file containing project [configuration object](../configuration/configuration-object.html.md). This can be used to later [import](./import.html.md)#import-exported-livecodes-projects) that project on the same or a different device or to share a copy of the project with others.
- **Source (ZIP):** a zip file containing the project configuration file as JSON, in addition to the source code in separate files. This can be useful for opening the code in an external IDE.
- **Result (HTML):** [result page](./result.html.md) as a single html file. Can be used for the purpose of demo or deploy.
- **GitHub gist** (_requires login with [GitHub account](./github-integration.html.md)_): creates a **public** GitHub gist on the user's GitHub account containing the source code as separate files.
- **CodePen:** creates a [CodePen](https://codepen.io/) prefilled with the project code. If the used [languages/frameworks](./../languages/index.html.md) are not supported in CodePen (e.g. Astro, Svelte, Python, ...etc), the compiled code is exported so that it continues to work there. [Bare module imports](./module-resolution.html.md) are converted to esm imports, for example:
```js
```
becomes:
```js
import React from 'https://cdn.skypack.dev/react';
```
- **JSFiddle:** creates a [JSFiddle](https://jsfiddle.net/) prefilled with the project code. Exported code may be modified like with CodePen (see above).
## Exporting Multiple Projects
Multiple projects can be exported in bulk from the [Saved Projects](./projects.html.md) screen (Project menu → Open) using the button `Export All`.
![saved projects](../../static/img/screenshots/export-2.jpg)
This produces a JSON file containing an array of project configuration objects. They can be later imported in the same or a different device using the `Bulk Import` functionality in the [Import screen](./import.html.md)#import-exported-livecodes-projects).
All the currently visible projects will be exported. If projects are filtered (e.g. by language, tag or search query), only the shown projects are exported.
## Related
- [Projects](./projects.html.md)
- [Import](./import.html.md)
- [Backup/Restore](./backup-restore.html.md)
- [Sync](./sync.html.md)
- [Share](./share.html.md)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,51 @@
# External Resources
## Stylesheets and Scripts
URLs to external CSS stylesheets and JS scripts can be added to the page from the UI using the Project menu → External Resources. In addition, there is a button to the External Resources in the toolbar below the editors.
import RunInLiveCodes from '../../src/components/RunInLiveCodes.tsx';
<RunInLiveCodes params={{ screen: 'resources' }} linkText="direct link" />
URLs to stylesheets/scripts should be added each in a separate line.
Stylesheets and scripts are loaded in the [result page](./result.html.md) before editor codes. Thus, CSS properties defined in external stylesheets can be overridden in the style editor. Global javascript variables defined in external scripts are available to code in the script editor.
![External Resources](/img/screenshots/resources.jpg)
Importing and Exporting code to other services (e.g. Codepen and Github gists) takes into consiedration the external resources.
## Search for NPM Packages
Package search allows finding NPM Packages and adding URLs to default scripts/stylesheets (hosted by [jsDelivr](https://www.jsdelivr.com/)). Specific package version can be specified.
Examples for search terms:
```
jque
jquery
jquery@3
jquery@3.6
jquery@3.6.3
```
![External Resources Search](/img/screenshots/resources-search.jpg)
## Fonts
Fonts can be added from [Google fonts](https://fonts.google.com/).
## CSS Presets
CSS presets currently include [Normalize.css](https://necolas.github.io/normalize.css/) and [Reset CSS](https://meyerweb.com/eric/tools/css/reset/).
## Related
- [Module resolution](./module-resolution.html.md)
- [Assets](./assets.html.md)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,43 @@
# GitHub Integration
Generally, LiveCodes can be used anonymously without any accounts. This includes [importing](./import.html.md) code from GitHub gists or public repos.
However, some features do require [login](./user-management.html.md) with a GitHub account and giving [specific permissions](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/scopes-for-oauth-apps#available-scopes) to make use of GitHub services (e.g. [import](./import.html.md) from private repos, [export](./export.html.md) to gist, [deploy](./deploy.html.md), [assets](./assets.html.md) and [sync](./sync.html.md)).
:::caution cookies
User authentication is handled using [Firebase Authentication](https://firebase.google.com/products/auth) which **may use cookies**. By logging in, you agree that cookies may be stored on your device.
:::
## Features that require GitHub Account
### Public Repos
Access to public repos is required for:
- [Deploy](./deploy.html.md): A new public repo is created (if required) and code is pushed to the branch `gh-pages` of the repo. The is deployed on [GitHub pages](https://pages.github.com/).
- [Assets](./assets.html.md): can be stored on a public repo published on [GitHub pages](https://pages.github.com/).
### Private Repos
Access to private repos is required to:
- [Import](./import.html.md) code from private repos.
- [Sync](./sync.html.md) LiveCodes data to a private repo.
### Gists
Access to gists is required to:
- [Export](./export.html.md) projects to GitHub gist.
## Setting Permissions
GitHub user permissions for LiveCodes app are set the first time the user logs in. Any subsequent login will use the first permissions, even if they are set differently.
To change previously set permissions:
- [Logout](./user-management.html.md) from the LiveCodes app.
- [Revoke permissions](https://docs.github.com/en/apps/oauth-apps/using-oauth-apps/reviewing-your-authorized-oauth-applications) of LiveCodes app in your GitHub account.
- [Login](./user-management.html.md) again in LiveCodes and set the new permissions.

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,40 @@
# Internationalization (i18n)
import LiveCodes from '../../src/components/LiveCodes.tsx';
LiveCodes currently supports UI internationalization. By default, the UI language will be automatically detected based on your browser settings.
You can easily switch between supported UI languages using the i18n menu, allowing you to explore and use LiveCodes in your preferred language!
If you are interested in contributing to the translation of LiveCodes, please refer to the [i18n Contribution Guide](https://github.com/live-codes/livecodes/blob/develop/docs/docs/contribution/i18n.html.md).
![I18n menu](../../static/img/screenshots/i18n-1.jpg)
![LiveCodes in Chinese](../../static/img/screenshots/i18n-2.jpg)
Demo: ([Embedded playground](./embeds.html.md) with `appLanguage: 'zh-CN'`)
<LiveCodes template="javascript" config={{ appLanguage: 'zh-CN' }}></LiveCodes>
## Using SDK
Set the [configuration object](../configuration/configuration-object.html.md) property [`appLanguage`](../configuration/configuration-object.html.md)#applanguage) to a supported language code.
```js
import { createPlayground } from 'livecodes';
createPlayground('#container', { template: 'javascript', config: { appLanguage: 'auto' } });
```
## Using query params
Add the [query parameter](../configuration/query-params.html.md) `appLanguage` with your preferred language code.
https://livecodes.io?template=javascript&appLanguage=fr
## Related
- [User Settings](./user-settings.html.md)
- [Editor Settings](./editor-settings.html.md)
- [Query params](../configuration/query-params.html.md)
- [i18n Contribution Guide](https://github.com/live-codes/livecodes/blob/develop/docs/docs/contribution/i18n.html.md)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,190 @@
# Import
## Overview
LiveCodes supports importing code from a wide variety of [sources](#sources). This can be achieved using one of the following methods:
### UI
The Import screen can be accessed from the Project menu → Import.
import RunInLiveCodes from '../../src/components/RunInLiveCodes.tsx';
<RunInLiveCodes params={{ screen: 'import' }} linkText="direct link" />
![LiveCodes Import](../../static/img/screenshots/import-1.jpg)
![LiveCodes Import](../../static/img/screenshots/import-2.jpg)
### Query Param
A URL of any of the [sources](#sources) can be imported by adding it as a value to [query param](../configuration/query-params.html.md) key: `x`.
Example:
https://livecodes.io/?x=https://gist.github.com/f01deb828a42f363502fbae7964d48e9
### Bookmarklet
Instead of manually copy/pasting URLs to import, adding [**"Edit in LiveCodes"** bookmarklet](../bookmarklet.html.md) to the browser bookmarks bar can be a more convenient way. It opens LiveCodes in a new window and imports the current webpage URL.
### SDK
For [embedded playgrounds](./embeds.html.md), use the [SDK](../sdk/index.html.md) property [`EmbedOptions.import`](../sdk/js-ts.html.md)#import).
## Examples
- GitHub File:
URL: https://github.com/lodash/lodash/blob/master/isObject.js
[Open in LiveCodes](https://livecodes.io/?x=https://github.com/lodash/lodash/blob/master/isObject.js)
- GitHub Directory:
URL: https://github.com/bradtraversy/50projects50days/tree/master/expanding-cards
[Open in LiveCodes](https://livecodes.io/?x=https://github.com/bradtraversy/50projects50days/tree/master/expanding-cards)
- GitHub Gist:
URL: https://gist.github.com/f01deb828a42f363502fbae7964d48e9
[Open in LiveCodes](https://livecodes.io/?x=https://gist.github.com/f01deb828a42f363502fbae7964d48e9)
- JS Bin:
URL: https://jsbin.com/iwovaj/73/embed?html,js,output
[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:
- GitHub gist
- GitHub file
- Directory in a GitHub repo
- Gitlab snippet
- Gitlab file
- Directory in a Gitlab repo
- JS Bin
- [Shared projects](./share.html.md)
- Raw code
- Code in web page DOM
- Projects shared in official playgrounds of [TypeScript](https://www.typescriptlang.org/play) and [Vue](https://play.vuejs.org/)
- Local file(s)
- Code in zip file (Local or URL)
- [Exported project JSON](./export.html.md) (single project and bulk import)
Import sources are identified by URL patterns (e.g. origin, pathname and extension).
:::tip
Local files can be imported from the "Import Screen" or by dragging and dropping the file(s) in the editor.
:::
## File Selection
For sources that provide multiple files (e.g. GitHub/GitLab directories, GitHub gists, GitLab snippets and local files), a best guess is tried to load files in respective editors. Best results are when there are 3 files and each file is in a language (identified by file extension) that can be loaded to a different editor, for example:
- index.html, style.css, script.js
- default.pug, app.scss, main.ts
The following file names are given higher priority:
- Markup files starting with `index.` or `default.`
- Style files starting with `style.` or `styles.`
- Script files starting with `script.`, `app.`, `main.` or `index.`
While README, markdown files and files with no extension are given lower priority.
Alternatively, files can be specified using the `files` [query param](../configuration/query-params.html.md). It takes a **comma-separated list** of filenames. The first 3 found files are loaded. If 1 or 2 files are specified, only these will be loaded. The first matching file is shown by default in the active editor.
The query params should have the following format:
`?x={url}&files={file1},{file2},{file3}`
Example:
`?x={url}&files=Counter.tsx,counter.scss,counter.html`
The active editor can be specified using the [`activeEditor`](../configuration/configuration-object.html.md)#activeeditor) (or its alias `active`) [query param](../configuration/query-params.html.md). It takes the name of the editor (`markup`, `style` or `script`) or its ID (`0`, `1` or `2`) to be shown by default.
Example:
`?x={url}&activeEditor=style` or `?x={url}&active=1`
## Import Shared Projects
[Shared Projects](./share.html.md) can be imported using the value of the query param `x` generated by the Share screen. This starts with either:
- `code/`: for compressed base64-encoded project config
- `id/`: for short URLs recognized by shared project id.
Example:
https://livecodes.io/?x=id/bi9qszw86w3
## Import Code from DOM
If the source URL does not match one of the supported origins (GitHub, GitLab and JS Bin), the URL is fetched, its response text is parsed as [DOM](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model) and code is extracted from elements that match specific CSS selectors.
(By default: `.livecodes [data-lang="{language}"]`)
:::info Example
```html
<code class="livecodes">
<pre data-lang="html">This is identified as &lt;strong&gt;HTML&lt;/strong&gt; code</pre>
</code>
```
The HTML editor is prefilled with: `This is identified as <strong>HTML</strong> code`
Please note that the code should be html-encoded to avoid interference with the HTML of the page.
:::
Example:
https://livecodes.io/?x=https://live-codes.github.io/livecodes-examples/prefill-from-code-blocks.html
Alternatively, custom CSS selectors can be specified using [query params](../configuration/query-params.html.md):
`?x={url}&{language}-selector={selector}`
The following example loads the content of the first element that matches the CSS selector `h3` as `html`:
https://livecodes.io/?html-selector=h3&x=https://live-codes.github.io/livecodes-examples/prefill-from-code-blocks.html
Of course, [embedded playgrounds](./embeds.html.md) can be prefilled with code from the same embedding page. This works well for documentation and educational websites.
[This is a demo](https://live-codes.github.io/livecodes-examples/prefill-from-code-blocks.html) for automatic extraction of code blocks to prefill editors by creating "Edit in LiveCodes" links. Also embedded editors are prefilled from the code blocks. ([View source](https://github.com/live-codes/livecodes-examples/blob/master/prefill-from-code-blocks.html))
## Import Raw Code
If the response text could not be parsed as DOM or no elements matched the CSS selectors, it is assumed to be raw code and the response text is loaded to editor. If the URL ends with an extension it is used to identify the language, otherwise it is assumed to be `html`.
Alternatively, the language of raw code can be specified using [query params](../configuration/query-params.html.md):
`?x={url}&raw={language}`
## Import from CodePen
Currently, CodePen API does not allow directly importing code from Pens. However, you can export any saved Pen as a [zip file](https://blog.codepen.io/documentation/exporting-pens/#export-zip-1) or [Github gist](https://blog.codepen.io/documentation/exporting-pens/#save-as-github-gist-2) and then import it to LiveCodes. The format that Codepen exports is well understood by LiveCodes. Most Pens can be imported with no or minimal changes.
**Note:** External resources (styles/scripts) are not exported with source code in zip file export of CodePen. However, export to GitHub gist does export these. So if a Pen with external resources exported as zip file is not imported properly, try exporting to GitHub gist or manually add the [external resources](./external-resources.html.md).
## Import Exported LiveCodes Projects
A [single project exported as JSON](./export.html.md)#exporting-a-single-project) can be imported in the same or a different device from the import screen under the tab "Import Project JSON". The JSON file can be supplied as a local file upload or from a URL.
Similarly, [multiple projects exported in bulk](./export.html.md)#exporting-multiple-projects) can be imported from the tab "Bulk Import".
## Related
- [Code prefill](./code-prefill.html.md)
- [Export](./export.html.md)
- [External resources](./external-resources.html.md)
- [Module resolution](./module-resolution.html.md)
- [Projects](./projects.html.md)

File diff suppressed because one or more lines are too long

61
docs/features/index.html Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,99 @@
# Features
## Overview
_LiveCodes_ is an open-source, client-side, code playground that runs in the browser. It enables quick prototyping and experimenting with a wide variety of [technologies](../languages/index.html.md) (including 90+ languages, frameworks and processors) without having to manually setup a development environment for each. The [result](./result.html.md) is displayed as a regular web page. The rapid feedback of previewing the result page without waiting for build steps significantly boosts productivity.
![LiveCodes screenshot](../../static/img/screenshots/features-1.jpg)
![LiveCodes screenshot](../../static/img/screenshots/features-2.jpg)
![LiveCodes screenshot](../../static/img/screenshots/features-3.jpg)
In this page, a quick overview of the important features are presented. A more detailed description of each feature is described in the following sections.
## Powerful Editor
The default code editor is the powerful editor that powers [VS Code](https://code.visualstudio.com/), featuring code-completion, go-to-definition, multi-cursor support and other powerful features you got used to. The editor is very [customizable](./editor-settings.html.md). It supports [keyboard shortcuts](./keyboard-shortcuts.html.md), [code formatting](./code-format.html.md), [Emmet abbreviations](./editor-settings.html.md)#emmet) and even [Vim and Emacs bindings](./editor-settings.html.md)#editor-modes).
## AI Code Assistant
LiveCodes supports AI-powered code completion, totally for **free**, using [Codeium](https://codeium.com/), the ultrafast Copilot alternative. Install the [Codeium chrome extension](https://codeium.com/chrome_tutorial) and enjoy the magic!
## Mobile-friendly
The responsive layout allows working on devices with different screen sizes. On mobile, a lighter-weight touch-friendly code editor (CodeMirror 6) is used, so that you can experiment your ideas on the go.
## External Code/Libraries
[External scripts/stylesheets](./external-resources.html.md) can be added to the web page. There is a UI screen that helps you search for and add NPM libraries and google fonts. Moreover, [NPM modules can be imported](./module-resolution.html.md) without the need for any `npm install`s.
## Import and Code Pre-fill
Code can be [imported](./import.html.md) from a variety of sources including GitHub gist, GitHub file, directory in a GitHub repo, Gitlab snippet, Gitlab file, directory in a Gitlab repo, JS Bin, raw code, code in web page DOM and code in zip file. You can also [pre-fill code](./code-prefill.html.md) using various ways.
## Share/Export
Projects can be easily [shared](./share.html.md) as URLs or QR codes. In addition, you may [export](./export.html.md) any project as HTML, JSON or zip file containing source code files. You may also export to other services like GitHub gists, CodePen or JSFiddle.
## Embed
Projects can be [embedded](./embeds.html.md) in any web page. The embed screen allows you to customize the embed options and preview the resulting playground. An easy-to-use, yet powerful, [SDK](../sdk/index.html.md), that allows [communication](../sdk/js-ts.html.md)#sdk-methods) between the embedding page and the playground.
## Deploy
Projects can be [deployed](./deploy.html.md) to public URLs that can be shared with others. This is hosted for free on GitHub Pages.
## Starter Templates
A large number of [starter templates](./templates.html.md) are available. They can be used to get you started with most of the supported technologies.
![Starter templates](../../static/img/screenshots/templates-1.jpg)
## Assets
Your own local assets (e.g. images, icons, fonts, local scripts and stylesheets) can be added to the app and then used in any project. The assets are made available even when the projects are shared, exported or deployed.
## Dev Tools
[Tools](./tools-pane.html.md) like [console](./console.html.md), [compiled code viewer](./compiled-code.html.md) and [test runner](./tests.html.md) can significantly improve your development experience.
## Broadcast
You can [broadcast](./broadcast.html.md) source code or result in real-time to others. This can be of great value as an educational tool and for demo purposes.
## Sync/Backup/Restore
Do you work on multiple devices? No Problem! You may [sync](./sync.html.md), [backup and restore](./backup-restore.html.md) your data any time on any device.
## Themes
LiveCodes comes with dark and light themes. In addition, a theme color can be set to change the app color.
## i18n
LiveCodes supports [internationalization](./i18n.html.md) for multiple languages.
## Client-side!
LiveCodes runs in the browser, where all the processing/transpilation occurs, with no server rounds required. So, after the initial load, it becomes pretty fast. It can be hosted on any static file server or CDN. No `npm install`s. Just the browser!
## Developer-friendly
LiveCodes makes it easy to [get started](../getting-started.html.md). It is highly [configurable](../configuration/index.html.md). Lots of features can be configured by URL [query params](../configuration/query-params.html.md). The [SDK](../sdk/index.html.md) facilitates [embedding](./embeds.html.md) playgrounds and allows easy [communication](../sdk/js-ts.html.md)#sdk-methods) with them. The SDK is available for use in [JS/TS](../sdk/js-ts.html.md), [React](../sdk/react.html.md) [Vue](../sdk/vue.html.md) and [Svelte](../sdk/svelte.html.md).
## Comprehensive Documentations
Rich documentations with screenshots, code samples and live demos are available. They cover the app [features](../features/index.html.md), [configuration](../configuration/index.html.md), [supported languages](../languages/index.html.md) and [SDK](../sdk/index.html.md) (including [TypeScript Types](../api/globals.md)). A gallery of usage examples is provided as a [storybook](pathname:///../stories).
## Focused on Privacy
Projects are private by default. The code you write in LiveCodes never leaves your computer, unless you choose to [share](./share.html.md), [export](./export.html.md), [broadcast](./broadcast.html.md) or [sync](./sync.html.md) it. User data is stored in the browser.
## Free and Open-Source
LiveCodes is free, with no limits for use and no ads.
No account is even required (unless [GitHub integration](./github-integration.html.md) is needed).
Do you want to [self-host](./self-hosting.html.md) it for commercial use? No problem! It is [MIT-licensed](../license.html.md) 🎉. Please consider [sponsoring LiveCodes](../sponsor.html.md) ❤.
This was a quick overview of the important features of LiveCodes. A more detailed description of each feature is described in the following sections.

View File

@@ -0,0 +1 @@
# Integrations

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,165 @@
# IntelliSense
import LiveCodes from '../../src/components/LiveCodes.tsx';
The [code editor](./editor-settings.html.md)#code-editor) provides a rich experience with [intellisense](https://code.visualstudio.com/docs/editor/intellisense) and autocompletion. Many of the features required for this are based on TypeScript types that are either inferred by the editor or supplied as data definition files.
This not only works when the editor language is TypeScript, but also works with others like JavaScript and JSX.
Example:
![LiveCodes Autocomplete](../../static/img/screenshots/autocomplete.jpg)
## Types for imported npm packages
LiveCodes will try to automatically find type definitions for npm modules imported in the editor.
These are examples for automatically loading React types with autocomplete and hover info:
![LiveCodes Intellisense](../../static/img/screenshots/intellisense-1.jpg)
![LiveCodes Intellisense](../../static/img/screenshots/intellisense-2.jpg)
## TypeScript TwoSlash
The code editor supports [TypeScript TwoSlash](https://github.com/microsoft/TypeScript-Website/tree/v2/packages/ts-twoslasher). This can be very useful for debugging, sharing and teaching TypeScript.
This is supported in [JavaScript](../languages/javascript.html.md), [TypeScript](../languages/typescript.html.md), [JSX](../languages/jsx.html.md) and [TSX](../languages/tsx.html.md). This also includes [Babel](../languages/babel.html.md), [Sucrase](../languages/sucrase.html.md), [Solid](../languages/solid.html.md), [React Native](../languages/react-native.html.md), etc.
![TypeScript TwoSlash](../../static/img/screenshots/twoslash.jpg) <!-- http://127.0.0.1:8080/?x=id/npgxgngikwj -->
![TwoSlash in JSX](../../static/img/screenshots/twoslash-jsx.jpg) <!-- http://127.0.0.1:8080/?x=id/c9ttudp5b4x -->
## Custom Types
If no type definitions are found, or if you want to provide your own (e.g. for a module that is not hosted on npm), custom type definition files can be used.
In the standalone app, these can be provided in [custom settings](../advanced/custom-settings.html.md) using the `types` property. This takes an object with the key representing the module name and the value representing the URL of the file.
Example:
```json title="Custom Settings"
{
"types": {
"my-module": "https://cdn.jsdelivr.net/npm/my-module@1.0.0/types/my-module.d.ts",
"my-other-module": "https://my-website.com/my-other-module/my-other-module.d.ts"
}
}
```
For embedded playgrounds, these can be provided in the [configuration object](../configuration/configuration-object.html.md) using the [`types`](../configuration/configuration-object.html.md)#types) property.
This can be combined with the [`imports`](../configuration/configuration-object.html.md)#imports) property to provide [importmap](./module-resolution.html.md)#custom-module-resolution) for runtime implementation of your custom modules.
This is an example of how to create a playground that provides the implementation of the custom module: `my-module` and its type definition to provide editor intellisense:
```js
import { createPlayground } from 'livecodes';
const config = {
activeEditor: 'script',
script: {
language: 'javascript',
content: `import { foo } from 'my-module';\n\nconsole.log(foo());`
};
imports: {
'my-module': 'https://my-website.com/my-module/index.js',
},
types: {
'my-module': 'https://my-website.com/my-module/my-module.d.ts',
},
};
createPlayground('#container', {config});
```
Please note that the URLs used for `types` and `imports` properties may be full URLs or [data URLs](./data-urls.html.md).
This can be of great use for library authors who want to provide playgrounds for documenting their libraries that are not (yet) published to npm.
## Demo
Let's assume we have this TypeScript module:
```ts title="Greeter.ts"
export class Greeter {
private morningGreetings = ['Good morning', 'Have a good day', 'How are you today?'];
private eveningGreetings = ['Good evening', 'Good night', 'Sleep well'];
private randomSelector(array: string[]) {
return array[Math.floor(Math.random() * array.length)];
}
public morning() {
return this.randomSelector(this.morningGreetings);
}
public evening() {
return this.randomSelector(this.eveningGreetings);
}
}
```
which compiles to this JavaScript:
```js title="Greeter.js"
export class Greeter {
constructor() {
this.morningGreetings = ['Good morning', 'Have a good day', 'How are you today?'];
this.eveningGreetings = ['Good evening', 'Good night', 'Sleep well'];
}
randomSelector(array) {
return array[Math.floor(Math.random() * array.length)];
}
morning() {
return this.randomSelector(this.morningGreetings);
}
evening() {
return this.randomSelector(this.eveningGreetings);
}
}
```
and this type definition:
```ts title="Greeter.d.ts"
export declare class Greeter {
private morningGreetings;
private eveningGreetings;
private randomSelector;
morning(): string;
evening(): string;
}
```
The JavaScript output (Greeter.js) and the data definition file (Greeter.d.ts) should be hosted online or converted to data URLs (see [assets](./assets.html.md) and [data URLs](./data-urls.html.md)).
Then, they can be used like that:
export const customModules = {
editor: 'monaco',
activeEditor: 'script',
script: {
language: 'typescript',
content:
"import { Greeter } from 'my-greeter';\n\nconst greeter = new Greeter();\n// now `greeter` has autocomplete\n\ndocument.body.innerText = greeter.morning();\n\n// this should show error in the editor\n// Property 'morningGreetings' is private and only accessible within class 'Greeter'\nconsole.log(greeter.morningGreetings);",
},
imports: {
'my-greeter':
'data:text/javascript;charset=UTF-8;base64,ZXhwb3J0IGNsYXNzIEdyZWV0ZXIgew0KICAgIGNvbnN0cnVjdG9yKCkgew0KICAgICAgICB0aGlzLm1vcm5pbmdHcmVldGluZ3MgPSBbJ0dvb2QgbW9ybmluZycsICdIYXZlIGEgZ29vZCBkYXknLCAnSG93IGFyZSB5b3UgdG9kYXk/J107DQogICAgICAgIHRoaXMuZXZlbmluZ0dyZWV0aW5ncyA9IFsnR29vZCBldmVuaW5nJywgJ0dvb2QgbmlnaHQnLCAnU2xlZXAgd2VsbCddOw0KICAgIH0NCiAgICByYW5kb21TZWxlY3RvcihhcnJheSkgew0KICAgICAgICByZXR1cm4gYXJyYXlbTWF0aC5mbG9vcihNYXRoLnJhbmRvbSgpICogYXJyYXkubGVuZ3RoKV07DQogICAgfQ0KICAgIG1vcm5pbmcoKSB7DQogICAgICAgIHJldHVybiB0aGlzLnJhbmRvbVNlbGVjdG9yKHRoaXMubW9ybmluZ0dyZWV0aW5ncyk7DQogICAgfQ0KICAgIGV2ZW5pbmcoKSB7DQogICAgICAgIHJldHVybiB0aGlzLnJhbmRvbVNlbGVjdG9yKHRoaXMuZXZlbmluZ0dyZWV0aW5ncyk7DQogICAgfQ0KfQ0K',
},
types: {
'my-greeter':
'data:text/typescript;charset=UTF-8;base64,ZXhwb3J0IGRlY2xhcmUgY2xhc3MgR3JlZXRlciB7DQogIHByaXZhdGUgbW9ybmluZ0dyZWV0aW5nczsNCiAgcHJpdmF0ZSBldmVuaW5nR3JlZXRpbmdzOw0KICBwcml2YXRlIHJhbmRvbVNlbGVjdG9yOw0KICBtb3JuaW5nKCk6IHN0cmluZzsNCiAgZXZlbmluZygpOiBzdHJpbmc7DQp9DQo=',
},
};
<LiveCodes config={customModules} height="80vh" />
## Related
- [Module Resolution](./module-resolution.html.md)
- [Data Urls](./data-urls.html.md)
- [Assets](./assets.html.md)
- [Custom Settings](../advanced/custom-settings.html.md)
- [Configuration Object](../configuration/configuration-object.html.md)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
# Keyboard Shortcuts
Many commands can be executed from the keyboard using keyboard shortcuts. The full list can be found in the [Keyboard Shortcuts screen](https://livecodes.io/?screen=keyboard-shortcuts), which can be accessed from the Help Menu or from the [command menu](./command-menu.html.md) by pressing <kbd>Ctrl</kbd> + <kbd>K</kbd> (or <kbd>⌘</kbd> + <kbd>K</kbd> on Mac) and searching for "Keyboard Shortcuts".
The code editor shortcuts are the same as VS Code, which can be found [here](https://code.visualstudio.com/docs/getstarted/keybindings#_basic-editing).
![Keyboard Shortcuts](../../static/img/screenshots/keyboard-shortcuts.jpg)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,31 @@
# Lite Mode
import LiveCodes from '../../src/components/LiveCodes.tsx';
In case you need to embed a playground in your web page to show case some code and expect users to mainly read through the code and to have just minor edits, it would be an overkill to load full-blown code editors with auto-complete and code formatting, specially if you want to embed more than one playground in the same page. That's why the LiveCodes playground has a lite mode.
In lite mode, a light-weight, minimal code editor is used ([CodeJar](./editor-settings.html.md)#code-editor)). [Emmet abbreviations](./emmet.html.md) and [tools pane](./tools-pane.html.md) are not available. However, any language supported by LiveCodes can be used, with syntax highlighting. Code edits are compiled and shown in the [result page](./result.html.md) as usual.
Demo:
<LiveCodes template="react" config={{ mode: 'lite' }}></LiveCodes>
## Using SDK
Set [`EmbedOptions.config.mode`](../configuration/configuration-object.html.md)#mode) to `"lite"`.
```js
import { createPlayground } from 'livecodes';
createPlayground('#container', { config: { mode: 'lite' } });
```
## Using query params
Add the [query parameter](../configuration/query-params.html.md) `?mode=lite`.
https://livecodes.io?mode=lite
## Related
- [Read-only](./read-only.html.md).

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,9 @@
# Mobile Support
LiveCodes provides a responsive layout that adapts to different screen sizes. Don't wait to be on your desk. Try your ideas on the go!
Projects that you create on mobile can be easily [shared](./share.html.md) or [synchronized](./sync.html.md) across devices. You can even share using QR code.
![Responsive layout](../../static/img/screenshots/responsive.jpg) <!-- https://yujinyeoh.com/website-mockup-generator -->
By default, LiveCodes uses the touch-friendly [CodeMirror 6](https://codemirror.net/) editor on mobile. This is configurable in the [editor settings](./editor-settings.html.md) and can be changed at any time.

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,265 @@
# Module Resolution
import LiveCodes from '../../src/components/LiveCodes.tsx';
## NPM Modules
### Bare Module Imports
In LiveCodes you can use node-style bare module imports for npm modules like you do in your local development. However, there are no installation or build steps required.
e.g. consider the following code:
```js
import { v4 } from 'uuid';
document.body.innerHTML = v4();
```
If you run it directly in the browser, you get this error:
```
Uncaught TypeError: Failed to resolve module specifier "uuid". Relative references must start with either "/", "./", or "../".
```
However, in LiveCodes, bare module imports are transformed to full URLs that are imported from CDN (by default: [esm.sh](https://esm.sh/)) which provides ESM versions of NPM packages.
`import { v4 } from 'uuid';` <br /> becomes <br />
`import { v4 } from 'https://esm.sh/uuid';`
This is made possible by using [import maps](https://github.com/WICG/import-maps).
<p id="npm-modules-demo1">Demo:</p>
<LiveCodes
params={{ js: "import { v4 } from 'uuid';\n\ndocument.body.innerHTML = v4();" }}
></LiveCodes>
<p>&nbsp;</p>
You can import from React like that:
```js
import { useState } from 'react';
```
Demo:
<LiveCodes template="react"></LiveCodes>
It just works without a build step and without you having to worry about. And when you [export your project](./export.html.md) to another service (e.g. CodePen) or as HTML, the full URL imports are used, so your code continues to work.
:::tip
It is recommended to use this method for dependencies over using [external scripts](./external-resources.html.md). The dependencies are explicitly stated in the code. And if you move to a local development environment, your bundler will take care of importing them and doing other optimizations like [tree-shaking](https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking).
:::
### CommonJS Modules
CommonJS module `require`s are also supported (they are converted to ESM imports).
So this also works (although not recommended - use ESM imports instead):
```js
const { v4 } = require('uuid');
document.body.innerHTML = v4();
```
Exercise:
Copy the previous code snippet and paste it in the playground below. Check the generated code in the compiled code viewer.
<LiveCodes params={{ activeEditor: 'script', compiled: 'open' }}></LiveCodes>
:::info
Script code that contains `import`, `export` or `require` gets served in a script tag with [`type="module"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules).
:::
### NPM Package Search
NPM packages can be searched and added as script tags from the [External Resources](./external-resources.html.md) screen.
## Deno Modules
Modules imported from [deno.land/x](https://deno.land/x) (or any other URL ending in `.ts`, `.jsx` or `.tsx`) are automatically transpiled (ts -> js) and bundled by [bundlejs](https://bundlejs.com/) (using [esbuild](https://esbuild.github.io/)), including their relative imports. The project on LiveCodes that imports these modules does not need to be using TypeScript.
Example:
```js
import { uuid } from 'https://deno.land/x/uuid/mod.ts';
document.body.innerHTML = uuid();
```
[Open in LiveCodes](<https://livecodes.io/?js=import%20%7B%20uuid%20%7D%20from%20'https%3A%2F%2Fdeno.land%2Fx%2Fuuid%2Fmod.ts'%3B%0A%0Adocument.body.innerHTML%20%3D%20uuid()%3B>)
## JSR Modules
Modules can be imported from [jsr.io](https://jsr.io/) using the prefix `jsr:`. The project on LiveCodes that imports these modules does not need to be using TypeScript.
Example:
```js
import { yassify } from 'jsr:@kwhinnery/yassify';
document.body.innerHTML = yassify('Hello, World!');
```
[Open in LiveCodes](<https://livecodes.io/?js=import%20%7B%20yassify%20%7D%20from%20'jsr%3A%40kwhinnery%2Fyassify'%3B%0A%0Adocument.body.innerHTML%20%3D%20yassify('Hello%2C%20World!')%3B>)
## GitHub/GitLab/Bitbucket
Modules can also be similarly imported from GitHub, Gitlab or Bitbucket. Also these imports are transpiled and bundled (see [Deno Modules](#deno-modules)).
```js
import { flatten } from 'https://github.com/remeda/remeda/blob/master/src/flatten.ts';
console.log(flatten([[1, 2], [3], [4, 5]])); // -> [1, 2, 3, 4, 5]
```
[Open in LiveCodes](<https://livecodes.io/?console=open&js=import%20%7B%20flatten%20%7D%20from%20'https%3A%2F%2Fgithub.com%2Fremeda%2Fremeda%2Fblob%2Fmaster%2Fsrc%2Fflatten.ts'%3B%0A%0Aconsole.log(flatten(%5B%5B1%2C%202%5D%2C%20%5B3%5D%2C%20%5B4%2C%205%5D%5D))%3B>)
:::tip
If you do not want the import URL to be bundled (e.g. in Deno or GitHub imports), add `#nobundle` to the end of URL.
Example:
```js
import { flatten } from 'https://github.com/remeda/remeda/blob/master/src/flatten.ts#nobundle';
```
If you want to bundle (and transpile) any import URL, prefix it with `bundle:` (see below).
:::
## CDN Providers
By default, npm modules are imported from [esm.sh](https://esm.sh/). You may choose another provider by using a CDN prefix. These are examples of importing the library `uuid`:
`uuid` → https://esm.sh/uuid ([info](https://esm.sh))
`esm.sh:uuid` → https://esm.sh/uuid ([info](https://esm.sh/))
`skypack:uuid` → https://cdn.skypack.dev/uuid ([info](https://www.skypack.dev/))
`jsdelivr:uuid` → https://cdn.jsdelivr.net/npm/uuid ([info](https://www.jsdelivr.com/))
`esm.run:uuid` → https://esm.run/uuid ([info](https://esm.run/))
`unpkg:uuid` → https://unpkg.com/uuid?module ([info](https://unpkg.com/))
`esbuild:uuid` → https://esbuild.vercel.app/uuid ([info](https://esbuild.vercel.app/))
`bundlejs:uuid` → https://deno.bundlejs.com/?file&q=uuid ([info](https://bundlejs.com/))
`bundle:uuid` → https://deno.bundlejs.com/?file&q=uuid ([info](https://bundlejs.com/))
`deno:uuid` → https://deno.bundlejs.com/?file&q=https://deno.land/x/uuid/mod.ts ([info](https://bundlejs.com/))
`npm:uuid` → https://esm.sh/uuid ([info](https://esm.sh))
`node:uuid` → https://esm.sh/uuid ([info](https://esm.sh))
`jsr:@std/uuid` → https://esm.sh/jsr/@std/uuid ([info](https://esm.sh))
`jspm:uuid` → https://jspm.dev/uuid ([info](https://jspm.org) - [DEPRECATED](https://jspm.org/jspm-dev-deprecation))
Example:
```js
import { useState } from 'esm.sh:react';
```
:::caution
Please note that importing the same module (even for dependencies) from different CDNs may cause conflicts.
Example:
```js
// this will NOT work!
import React, { useState } from 'esm.sh:react'; // React from esm.sh
import { createRoot } from 'skypack:react-dom/client'; // React from skypack.dev
```
:::
### Change Default CDN
Default CDN can be changed on project-level using the [custom settings](../advanced/custom-settings.html.md) property `defaultCDN` which accepts a string representing one of the CDN aliases listed above.
Example: This assigns [Skypack](https://www.skypack.dev/) as the default CDN for all imports of the project
```json
{
"defaultCDN": "skypack"
}
```
### Package Version
Most CDN providers allow specifying package version using the format: <br />
`{pkgName}@{version}/{path}`.
Example:
```js
import latest from 'lodash';
import v3 from 'lodash@3';
console.log(latest.VERSION); // -> 4.17.21
console.log(v3.VERSION); // -> 3.10.1
```
## Custom Module Resolution
Module resolution described in this page mainly depends on [import maps](https://github.com/WICG/import-maps). The generated import map is added to the [result page](./result.html.md).
You may wish to override or customize module resolution behavior (e.g. change URL, CDN, specify version, import custom unpublished library, ...etc. ), however you cannot add another import map script because [currently multiple import maps are not yet supported](https://github.com/WICG/import-maps#multiple-import-map-support).
LiveCodes allows you to add your custom import map by one of the following methods:
#### Custom Settings
In the standalone app, via the [custom settings](../advanced/custom-settings.html.md) property `imports`.
Example:
```json title="Custom Settings"
{
"imports": {
"my-lib": "https://my-server.com/path/to/library.js"
}
}
```
#### SDK
For embedded playgrounds, use the [SDK](../sdk/index.html.md) embed option [`config.imports`](../configuration/configuration-object.html.md)#imports).
Example:
```js title="index.js"
import { createPlayground } from 'livecodes';
const config = {
imports: {
'my-lib': 'https://my-server.com/path/to/library.js',
},
// other configurations ...
};
createPlayground('#container', { config });
```
Please note that you may also provide [custom type definitions](./intellisense.html.md)#custom-types) for your custom modules for editor intellisense and better development experience.
## Related
- [Import](./import.html.md)
- [External Resources](./external-resources.html.md)
- [Projects](./projects.html.md)
- [Intellisense](./intellisense.html.md)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,131 @@
# Permanent URL
Any specific version of LiveCodes app can be accessed through the permanent unique URL:
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import CodeBlock from '@theme/CodeBlock';
import { AppVersion } from '../../src/components/Versions.tsx';
export const AppVersionLink = () => {
const { siteConfig } = useDocusaurusContext();
return (
<a href={`https://v${siteConfig.customFields.appVersion}.livecodes.io`} target="\_blank">
https://v{siteConfig.customFields.appVersion}.livecodes.io
</a>
);
};
`{version}.livecodes.io`
(e.g. <AppVersionLink />)
This allows [embedded playgrounds](./embeds.html.md) to use a pinned version of the LiveCodes app and its dependencies and avoid any breaking changes that may occur in later versions.
Permanent URL is used by default in the code generated by the [embed screen UI](./embeds.html.md).
It is also available when [sharing](./share.html.md) projects from the share screen.
The [SDK](../sdk/index.html.md) embed option [`appUrl`](../sdk/js-ts.html.md)#appurl) allows specifying the URL for the app to be used.
In addition, it is always a good practice to use a specific version of the SDK.
Example:
export const Code = () => {
const { siteConfig } = useDocusaurusContext();
return (
<CodeBlock title="index.html" language="html">
{`<div id="container"></div>\n<script type="module">
${' '}// specific SDK version
// highlight-next-line
${' '}import { createPlayground } from 'https://cdn.jsdelivr.net/npm/livecodes@${siteConfig.customFields.sdkVersion}';\n
${' '}createPlayground('#container', {
${' '}// App permanent URL
// highlight-next-line
${' '}appUrl: 'https://v${siteConfig.customFields.appVersion}.livecodes.io',
${' '}template: 'react',
${' '}});
</script>`}
</CodeBlock>
);
};
<Code />
## Get Permanent URL
You can get the permanent URL for the app from the [About screen](pathname:///../?screen=about) (Help menu → About). By default, the code generated in the [Embed screen](./embeds.html.md)#app-embed-screen) uses permanent URL.
Alternatively, open the browser console of the standalone app (e.g. https://livecodes.io), and run this:
export const GetPermanentUrl = () => {
const { siteConfig } = useDocusaurusContext();
return (
<CodeBlock language="js">
{`await livecodes.exec('showVersion');\n
// output:
// App Version: ${siteConfig.customFields.appVersion} (https://github.com/live-codes/livecodes/releases/tag/v${siteConfig.customFields.appVersion})
// SDK Version: ${siteConfig.customFields.sdkVersion} (https://www.npmjs.com/package/livecodes/v/${siteConfig.customFields.sdkVersion})
// Git commit: 0698f9f (https://github.com/live-codes/livecodes/commit/0698f9f)
// App Permanent URL: https://v${siteConfig.customFields.appVersion}.livecodes.io/
// SDK Permanent URL: https://cdn.jsdelivr.net/npm/livecodes@${siteConfig.customFields.sdkVersion}/livecodes.js
`}
</CodeBlock>
);
};
<GetPermanentUrl />
:::caution
Please note that this only applies to the LiveCodes app and its dependencies.
[NPM imports](./module-resolution.html.md) in [project code](./projects.html.md)#script-editor) that do not specify versions use the latest version.
[Package versions](./module-resolution.html.md)#package-version) can be specified in the import.
[Custom import maps](./module-resolution.html.md)#custom-module-resolution) can be set to control the module import behavior.
Example:
```js
import lodash from 'lodash@4.17.21';
console.log(lodash.VERSION); // -> 4.17.21
```
It is recommended to also specify versions of [external resources](./external-resources.html.md).
:::
#### Full Example:
export const FullCode = () => {
const { siteConfig } = useDocusaurusContext();
return (
<CodeBlock title="index.html" language="html">
{`<div id="container"></div>\n<script type="module">
${' '}// specific SDK version
// highlight-next-line
${' '}import { createPlayground } from 'https://cdn.jsdelivr.net/npm/livecodes@${siteConfig.customFields.sdkVersion}';\n
${' '}createPlayground('#container', {
${' '}// App permanent URL
// highlight-next-line
${' '}appUrl: 'https://v${siteConfig.customFields.appVersion}.livecodes.io',
${' '}config: {
${' '}script: {
${' '}language: 'javascript',
${' '}// project code imports package with specific version
// highlight-next-line
${' '}content: 'import lodash from "lodash@4.17.21";\\nconsole.log(lodash.VERSION);',
${' '}},
${' '}activeEditor: 'script',
${' '}tools: { status: 'open', active: 'console' },
${' '}},
${' '}});
</script>`}
</CodeBlock>
);
};
<FullCode />
## Related
- [Embedded playgrounds](./embeds.html.md)
- [Share](./share.html.md)
- [SDK](../sdk/index.html.md)
- [`exec` SDK method](../sdk/js-ts.html.md)#exec)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,63 @@
# Projects
A _LiveCodes_ project is a combination of markup, styles & scripts that result in a **single web page**. Check the section about the [Result Page](./result.html.md) to have more details about how this page is constructed.
There is no concept of file system or, for example, organizing multiple files in a directory structure of a single project.
:::info Simple Concept
code in [markup editor](#markup-editor) + code in [style editor](#style-editor) + code in [script editor](#script-editor) + [external resources](./external-resources.html.md) => [result page](./result.html.md)
:::
## Markup Editor
Code added in this editor eventually represents the page markup (HTML).
Examples for languages supported include HTML, Markdown, Pug, Haml.
## Style Editor
Code added in this editor eventually represents the page styles (CSS).
Examples for languages supported include CSS, SCSS, SASS, Less, Stylus. In addition, many CSS processors are supported (e.g. Autoprefixer, postcss-preset-env, postcss-import-url, PurgeCSS, Tailwind CSS).
## Script Editor
Code added in this editor eventually represents the page scripts.
These are either:
- Languages compiled to JavaScript (e.g TypeScript, JSX, CoffeeScript)
- Languages that are interpreted by a JavaScript runtime (e.g. PHP - interpreted by [Uniter runtime](https://github.com/asmblah/uniter), Scheme - interpreted by [BiwaScheme](https://www.biwascheme.org))
- Languages running in WASM (e.g. Python - [Pyodide](https://pyodide.org/), AssemblyScript).
For the full list of supported languages, check the [Languages section](../languages/index.html.md).
## Organizing Projects
Projects can be saved to the local device browser storage from Project menu → Save / Project menu → Save as → Fork (New Project) or using the keyboard shortcut <kbd>Ctrl</kbd> + <kbd>S</kbd>.
The list of saved projects can be accessed from Project menu → Open.
![LiveCodes Projects](../../static/img/screenshots/saved-projects-1.jpg).
Saved projects can be sorted by title or date (asc/desc). They can also be filtered by language and/or tags. You may, as well, search for a project by title or description.
Project title, description and tags can be edited from Project menu → Project Info.
Projects can be [imported](./import.html.md), [exported](./export.html.md), [synchronized](./sync.html.md), [backed up and restored](./backup-restore.html.md).
[Assets](./assets.html.md) and [code snippets](./snippets.html.md) are stored in the browser storage and can be used across projects.
## Related
- [Result Page](./result.html.md)
- [Templates](./templates.html.md)
- [Code Snippets](./snippets.html.md)
- [Assets](./assets.html.md)
- [External Resources](./external-resources.html.md)
- [Import](./import.html.md)
- [Export](./export.html.md)
- [Backup/Restore](./backup-restore.html.md)
- [Sync](./sync.html.md)
- [Share](./share.html.md)
- [Broadcast](./broadcast.html.md)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,34 @@
# Read-Only
import LiveCodes from '../../src/components/LiveCodes.tsx';
In case you need to embed a playground in your web page to show case some code and want users to read through the code and not allow edits, you may use the `readonly` setting.
Code editing, [formatting](./code-format.html.md), and [console input](./console.html.md) are not available. However, any language supported by LiveCodes can be used, with syntax highlighting. Code can be [prefilled](./code-prefill.html.md), and is compiled and shown in the [result page](./result.html.md) as usual.
By default, a light-weight, minimal [code editor](./editor-settings.html.md)#code-editor) is used. This can be changed by explicitly setting the [configuration object](../configuration/configuration-object.html.md) property [`editor`](../configuration/configuration-object.html.md)#editor) (e.g. to show hover intellisense).
Demo:
<LiveCodes template="javascript" config={{ readonly: true }}></LiveCodes>
## Using SDK
set the [configuration object](../configuration/configuration-object.html.md) property [`readonly`](../configuration/configuration-object.html.md)#readonly) to `true`.
```js
import { createPlayground } from 'livecodes';
createPlayground('#container', { template: 'javascript', config: { readonly: true } });
```
## Using query params
add the [query parameter](../configuration/query-params.html.md) `readonly` (no need to set a value).
https://livecodes.io?template=javascript&readonly
## Related
- [Code prefill](./code-prefill.html.md)
- [Lite mode](./lite.html.md)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
# Recover Unsaved

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,107 @@
# Result Page
The output of a LiveCodes project is a single HTML page. This includes the (compiled) code from editors (markup + style + script) and [external resources](./external-resources.html.md) (CSS + JS), in addition to customizations specified in [custom settings](../advanced/custom-settings.html.md).
This page is loaded in a [sandboxed iframe](https://www.html5rocks.com/en/tutorials/security/sandboxed-iframes/) with a unique origin to enforce [security](./security.html.md). The page code is sent to the iframe in the browser (no code is sent to the server).
## Result page structure
This is the pseudo-code for the structure of the result page (inspired by [CodePen docs](https://blog.codepen.io/documentation/preview-template/)).
<!-- prettier-ignore -->
```html
<!DOCTYPE html>
<html { Config.htmlAttrs }*>
<head>
<title>{ Config.title }*</title>
<meta name="title" content="{ Config.title }*" />
<meta name="description" content="{ Config.description }*" />
{ Config.head }*
{ CSS preset }**
{ External CSS }**
{ Editor CSS }
{ Language(s) run-time CSS }***
{ Language(s) run-time JS }***
{ Import map }****
</head>
<body>
{ Editor HTML }
{ External JS }**
{ Editor JS }
{ Spacing script (if enabled) }*****
{ Test scripts (if enabled) }******
</body>
</html>
```
\* See [Configuration Object](../configuration/configuration-object.html.md).
\*\* See [External Resources](./external-resources.html.md).
\*\*\* Although most languages are compiled and then the compiled code is used, some languages require run-time scripts or styles to run in the result page.
\*\*\*\* See [Module Resolution](./module-resolution.html.md).
\*\*\*\*\* See [Show Sapcings](#show-spacings).
\*\*\*\*\*\* See [Tests](./tests.html.md).
## Result page zoom
The zoom button in the [tools pane](./tools-pane.html.md) below result page, allows you to toggle result page zoom (1x/0.5x/0.25x).
![Result page zoom](../../static/img/screenshots/zoom.jpg)
## Open in new window
From the [tools pane](./tools-pane.html.md), the result page can be viewed in a separate window.
![Open in new window](../../static/img/screenshots/new-window.jpg)
:::caution
Please note that the URL of the result page shown in the new window is a [temporary URL](https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL#parameters), for local preview. Sharing this URL will not work.
If you need to share a project, use the [Share screen](./share.html.md). While, if you need to share the result page use the `result` [display mode](./display-modes.html.md) or the [broadcast](./broadcast.html.md) feature.
:::
## Show Spacings
The spacing between elements on the result page can be measured by adding [Spacing.js](https://spacingjs.com/) to the result page.
![Show Spacings](../../static/img/screenshots/spacing.jpg)
1. Enable `Show Spacing` setting in the Settings menu.
2. Move your cursor to an element and press Alt on Windows, or Option on a Mac.
3. Move your cursor to another element, the measurement results will be there.
:::note
`Show Spacing` is only available when viewing the result page in the app. It is not added to the result page for example when [exported](./export.html.md) or [deployed](./deploy.html.md).
:::
## Scroll Position
By default, the result page scroll position is maintained after reloads.
To disable this behavior, set the [query param](../configuration/query-params.html.md) `scrollPosition` to `false`.
Example:
https://livecodes.io?scrollPosition=false

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,12 @@
# Security
import MailLink from '../../src/components/MailLink.tsx';
User privacy and security are taken seriously.
- All user code, [result page](./result.html.md) and compilers run in [sandboxed iframes](https://www.html5rocks.com/en/tutorials/security/sandboxed-iframes/) with a unique origin.
- [Embedded playgrounds](./embeds.html.md) do not have access to the parent page, or to sensitive data like user cookies and localstorage of the embedding page origin.
If you find any security vulnerability, please report it in the [contact page](../contact.html.md) or by email to <MailLink email="security&#64;livecodes&#46;io" text="security&#64;livecodes&#46;io" />
For other non-security-related bugs, please report them in the [repo issues](https://github.com/live-codes/livecodes/issues).

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,77 @@
# Self-Hosting
The LiveCodes app can be self-hosted on any static file server or CDN.
## Guide
The built app can be obtained by **one of the following** ways:
- Download the app from the [releases](https://github.com/live-codes/livecodes/releases), extract the folder and add it to your website.
- Fork the [GitHub repo](https://github.com/live-codes/livecodes) and clone it. You may wish to use the included setup to deploy to [GitHub Pages](https://pages.github.com/):
```shell
git clone https://github.com/{your-username}/livecodes
cd livecodes
npm install
npm build # build the app to "build" directory
npm run serve # locally serve to http://localhost:8080
# deploy
npm run deploy # build and deploy to github pages
# for development
npm start # start local development with code watch, rebuild and live-reload
```
- Fork the [GitHub repo](https://github.com/live-codes/livecodes) and use one of the hosting services that integrate with GitHub to allow automatic deploys on code push (e.g. [Cloudflare Pages](https://developers.cloudflare.com/pages/get-started), [Vercel](https://vercel.com/docs/concepts/git), [Netlify](https://docs.netlify.com/configure-builds/overview/), [Firebase](https://firebase.google.com/docs/hosting/github-integration)). When prompted, the build command is `npm run build` and the build output directory is `build`.
## Custom Build
By default, when building the app, it is expected to be hosted on the root of the domain/subdomain (e.g. `https://my-website.com` or `https://playground.my-website.com`). The documentation is also hosted in the `/docs/` directory (e.g. `https://my-website.com/docs`).
If you wish to host the app in a subdirectory (e.g. `https://my-username.github.io/playground/`), the base URL of the documentation directory needs to be supplied by the environment variable `DOCS_BASE_URL` during build.
Example:
```shell
npx cross-env DOCS_BASE_URL="/playground/docs/" npm run build
```
If you do not want to build documentations and direct all links to documentations to https://livecodes.io/docs/, use the following command:
```shell
npx cross-env DOCS_BASE_URL=null npm run build:app
```
## Services
Some of the [services](../advanced/services.html.md) used by the app are not supported on [self-hosted](../features/self-hosting.html.md) deploys and are either replaced by other compatible services (e.g. the [share](../features/share.html.md) service uses [dpaste](https://dpaste.com/) for short URLs, which are [**deleted after 365 days**](https://dpaste.com/help)) or require you to provide an alternative service (e.g. [Firebase configuration](https://github.com/live-codes/livecodes/tree/develop/src/livecodes/services/firebase.ts) for authentication).
You may wish to edit one or more of the used [services](../advanced/services.html.md) to use your own.
:::info
LiveCodes [sponsors](../sponsor.html.md) (Bronze sponsors and above) get access to managed custom services.
:::
## Example
This is an example of a self-hosted deployment, that was deployed to [GitHub Pages](https://pages.github.com/) using the [built-in setup](#guide):
https://live-codes.github.io/livecodes/
## SDK Usage
The [SDK](../sdk/index.html.md) can still be used with the self-hosted app by providing the [`appUrl`](../sdk/js-ts.html.md)#appurl) [embed option](../sdk/js-ts.html.md)#embed-options).
```js title="index.js"
import { createPlayground } from 'livecodes';
const options = {
appUrl: 'https://playground.my-website.com',
template: 'react',
// other embed options
};
createPlayground('#container', options);
```

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,45 @@
# Share
It is easy to share LiveCodes projects!
A URL is generated to load the shared project. This URL can be copied or shared to different social media.
The share screen can be accessed from the share icon at the top right or from the Project menu → Share.
![LiveCodes Share](../../static/img/screenshots/share-1.jpg)
By default, the generated URL encodes the project configuration in a base-64-encoded compressed query string. This step is generated locally in the browser without sending the code to any server. However, depending on the size of the project, the URL can be very long. The length of the URL is indicated in the share screen. [Try not to use very long URLs](https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers) to ensure cross-browser compatibility.
When requested by the user, short URLs can be generated. This requires sending the project configuration (**including source code**) to a server that saves the code and provides a short Id which can be used to retrieve the project.
![LiveCodes Share - short URL](../../static/img/screenshots/share-2.jpg)
:::caution
Generating a short URL for sharing requires sending the project configuration (**including source code**) to LiveCodes share service. **It cannot then be deleted**.
:::
:::info Note
The app hosted on [`https://livecodes.io`](https://livecodes.io) uses an API endpoint specifically provided to generate short URLs for LiveCodes share service. We will make every effort to keep that online and available for free use, so long as it is not abused. Please help keep it available by not abusing it and by [sponsoring the project](../sponsor.html.md).
Short URLs generated by LiveCodes share service are **private** by default and are not listed or indexed.
However, [**self-hosted apps**](./self-hosting.html.md) use the free service [dpaste](https://dpaste.com/) for short URLs which are [**deleted after 365 days**](https://dpaste.com/help). You may want to use a [custom service](../advanced/services.html.md) instead. LiveCodes [sponsors](../sponsor.html.md) (Bronze sponsors and above) get access to managed custom services.
:::
QR code can be generated for the share URL. This can then be scanned by any QR code scanner (e.g. mobile/tablet camera) to load the project on other devices without having to send the link. Please note that generating QR code also requires generating a short URL (code is sent to the share service - see above).
![LiveCodes Share - QR code](../../static/img/screenshots/share-3.jpg)
## Related
- [Export](./export.html.md)
- [Import](./import.html.md)
- [Deploy](./deploy.html.md)
- [Broadcast](./broadcast.html.md)
- [Backup / Restore](./backup-restore.html.md)
- [Sync](./sync.html.md)
- [Permanent URL](./permanent-url.html.md)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,28 @@
# Code Snippets
LiveCodes supports saving and organizing code snippets in different languages.
Code snippets are saved locally on user's device. However, they are supported in [sync](./sync.html.md), [backup](./backup-restore.html.md)#backup) and [restore](./backup-restore.html.md)#restore).
Code snippets screen can be accessed from Settings menu → Code Snippets.
![Code Snippets](../../static/img/screenshots/snippets-1.jpg)
import RunInLiveCodes from '../../src/components/RunInLiveCodes.tsx';
<RunInLiveCodes params={{ screen: 'snippets' }} linkText="direct link" />
Each snippet has a title, description, language and code.
![Code Snippets](../../static/img/screenshots/snippets-add.jpg)
After adding snippets they can be sorted (by date modified or title), filtered (by language) or searched.
![Code Snippets](../../static/img/screenshots/snippets-list.jpg)
Code snippets can then be copied to clipboard and pasted in projects.
## Related
- [Projects](./projects.html.md)
- [Assets](./assets.html.md)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,28 @@
# Sync
LiveCodes local data can be synchronized to a GitHub repo. This can be used as a cloud backup, and to synchronize multiple devices.
A GitHub account is required. The user must give access to [(Private Repos) while logging in](./github-integration.html.md).
The Sync screen can be accessed from the Settings menu → Sync.
import RunInLiveCodes from '../../src/components/RunInLiveCodes.tsx';
<RunInLiveCodes params={{ screen: 'sync' }} linkText="direct link" />
![LiveCodes Sync](../../static/img/screenshots/sync.jpg)
Data can be synchronized to a new (**private**) or existing repo.
The data is synchronized with the `main` branch in a directory named `livecodes-data`.
If `Auto sync` is selected, the sync will be attempted every 5 minutes. Remote files are downloaded only when changed (e.g. sync from another device).
`Auto sync` can be turned off and on by the switch on the Settings menu.
The sync can be manually triggered at any time from the Sync UI. Information regarding the last sync time and repo are displayed on the UI screen.
## Related
- [Backup / restore](./backup-restore.html.md)
- [Export](./export.html.md)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,49 @@
# Templates
import TemplateList from '../../src/components/TemplateList';
A new project can be based on any of the provided [starter templates](#starter-templates) or [user templates](#user-templates).
A new project (from template) can be started from:
- Project menu → New
- [Welcome Screen](./welcome.html.md) → New
- Direct URL: https://livecodes.io?new
## Starter Templates
A Large number of starter templates are available. They act as starting points and example usage for the [languages](../languages/index.html.md) available in LiveCodes.
A direct link for a starter template has the following format:
`?template={template_name}` (e.g. https://livecodes.io/?template=react)
The list of template names are documented [here](../api/internal/type-aliases/TemplateName.md).
### Template List
The following list of starter templates are available:
<TemplateList />
## User Templates
Any project loaded in LiveCodes can be saved as a user template, to be used later as a starting point for new projects.
A project can be saved as a user template from Project menu → Save as → Template.
It can then be accessed from Project menu → New ... → My Templates.
A user template can be set as [default template](./default-template-language.html.md) to be automatically loaded when loading the app.
User templates are scoped to the currently [logged-in user](./user-management.html.md). They can be [backed up/restored](./backup-restore.html.md) and [synced](./sync.html.md) the same as other user data.
## Related
- [Default Template/Language](./default-template-language.html.md)
- [Project](./projects.html.md)
- [Code Snippets](./snippets.html.md)
- [User management](./user-management.html.md)
- [Backup/Restore](./backup-restore.html.md)
- [Sync](./sync.html.md)
- [Languages](../languages/index.html.md)

File diff suppressed because one or more lines are too long

178
docs/features/tests.html.md Normal file
View File

@@ -0,0 +1,178 @@
# Tests
import LiveCodes from '../../src/components/LiveCodes.tsx';
## Overview
Automated tests can be added for projects. The tests are run in the context of the result web page.
The automated tests are run by the <a href="https://jestjs.io/" target="_blank">Jest testing framework</a>, which runs totally in the browser. In addition, other [testing libraries](#supported-testing-libraries) are also supported.
Screenshots:
![Livecodes Tests](/img/screenshots/tests.jpg)
![Livecodes Tests](/img/screenshots/test-editor.jpg)
## Use Cases
- Automated tests increase the confidence in the code and can improve the quality of projects.
- Allows <a href="https://en.wikipedia.org/wiki/Test-driven_development" target="_blank">Test-driven development (TDD)</a>.
- Can be used for education and training by preparing projects with tests that are required to pass by the students' implementation (similar to <a href="https://www.freecodecamp.org/learn" target="_blank">freeCodeCamp</a>).
- Can be used by wesites that offer coding challenges (similar to <a href="https://www.codewars.com/" target="_blank">Codewars</a>).
## Demos
Demo: (template=jest)
<LiveCodes template="jest" params={{tests: 'open'}}></LiveCodes>
<p>&nbsp;</p>
Demo: (template=jest-react)
<LiveCodes template="jest-react" params={{tests: 'open'}}></LiveCodes>
## Tests Panel
The "Tests" panel is located in the "[Tools pane](./tools-pane.html.md)" below the result page.
In the tests panel, you can find:
- "Run" button: To run tests (keyboard shortcut: Ctrl/Cmd + Alt + t).
- "Watch" button toggle: To watch the project and re-run tests automatically when code changes.
- "Reset" button: Resets test results.
- "Edit" button: Opens a code editor to edit tests (not in embeds).
- Test results.
:::info Note
Please note that the tests panel are hidden by default in [embedded playgrounds](./embeds.html.md) unless the [project has tests](../configuration/configuration-object.html.md)#tests). In such case, the panel is added to the [tools pane](./tools-pane.html.md). However, the test editor is not shown.
The [SDK](../sdk/index.html.md) can control the visibility of the different tools in the tools pane (see [`tools`](../configuration/configuration-object.html.md)#tools) property of the [configuration object](../configuration/configuration-object.html.md)).
The tests panel and the test editor are always shown in the [full standalone app](../getting-started.html.md)#standalone-app).
:::
## Supported Languages
The testing code can be written using JavaScript, TypeScript, JSX or TSX.
However, since the tests run against the result web page, they can test projects that use any language/framework.
This is [a demo](https://livecodes.io/?x=id/xyi6usem2sf&tests) for running tests against a Ruby project.
<LiveCodes import="id/xyi6usem2sf" params={{tests: "open"}} height="80vh"></LiveCodes>
Languages may have test modules. This is [an example](https://livecodes.io/?x=id/665ar3bpqka&console=full) of running [Python doctest](https://docs.python.org/3/library/doctest.html) tests:
<LiveCodes import="id/665ar3bpqka" params={{console: "full"}} height="80vh"></LiveCodes>
## Importing Code
Functions, objects or values can be exported from the `script` code like a regular ES module.
These can then be imported in the test code for usage. This is only available for code in the `script` editor. The testing code also have access to global objects like `window`.
Example:
```js
// in the script editor
export default function greet() {
return 'Hello, World!';
}
export const add = (x, y) => x + y;
window.multiply = (x, y) => x * y;
```
```js
// in the test editor
import greet, { add } from './script'; // relative import without extension
describe('test imported', () => {
test('greet', () => {
expect(greet()).toBe('Hello, World!');
});
test('add', () => {
expect(add(1, 2)).toBe(3);
});
});
describe('test global', () => {
test('multiply', () => {
expect(window.multiply(2, 3)).toBe(6);
});
});
```
## Supported Jest features
- [Jest globals](https://jestjs.io/docs/api): `expect`, `test`, `xtest`, `it`, `fit`, `xit`, `describe`, `fdescribe`, `xdescribe`, `beforeAll`, `afterAll`, `beforeEach`, `afterEach`
- Jest function mocks: `jest.fn`, `jest.mocked`, `jest.replaceProperty`, `jest.spyOn`
These can be directly used in the test editor, without the need for any imports.
Autocomplete is available in Monaco editor for Jest API.
## Supported testing libraries
In addition to Jest, you may wish to use other supported testing libraries. These have to be explicitly imported to the testing code.
### Testing library
Simple and complete testing utilities that encourage good testing practices.
- <a href="https://testing-library.com/docs/dom-testing-library/intro" target="_blank">DOM Testing Library</a>
```js
import {
getByLabelText,
getByText,
getByTestId,
queryByTestId,
waitFor,
} from '@testing-library/dom';
```
- <a href="https://testing-library.com/docs/react-testing-library/intro" target="_blank">React Testing Library</a>
```js
import { render, fireEvent, waitFor, screen } from '@testing-library/react';
```
- <a href="https://testing-library.com/docs/ecosystem-jest-dom" target="_blank">jest-dom</a>
```js
import '@testing-library/jest-dom';
```
- <a href="https://testing-library.com/docs/user-event/intro" target="_blank">user-event</a>
```js
import userEvent from '@testing-library/user-event';
```
### Chai
Jest assertions can be used in the tests. However, if you prefer Chai, it can be easily used.
Autocomplete is also available in Monaco editor for Chai API.
```js
import { assert } from 'chai';
```
## Examples
Usage examples are provided in the starter templates (<a href="pathname:///../?template=jest" target="_blank">Jest Starter</a> and <a href="pathname:///../?template=jest-react" target="_blank">Jest/React Starter</a>).
:::caution
The test code is added to the result page and runs in its context. Please note that script errors (e.g. import or syntax errors) may prevent the tests from loading.
:::
## SDK
The [SDK](../sdk/index.html.md) allows [running tests](../sdk/js-ts.html.md)#runtests) and collecting results.

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,53 @@
# Themes
import ThemeDemo from '../../src/components/ThemeDemo.tsx';
LiveCodes comes with dark and light themes. In addition, a theme color can be set to change the app color.
## Theme
Dark/Light theme can be set in:
- UI, either:
- Dark/Light theme switch in toolbar
- Settings menu → Dark theme switch
- [Query params](../configuration/query-params.html.md): `?theme=dark` or `?theme=light`.
e.g. https://livecodes.io/?theme=light
- [Configuration object](../configuration/configuration-object.html.md): [`theme`](../configuration/configuration-object.html.md)#theme) property.
![LiveCodes dark theme](../../static/img/screenshots/themes-1.jpg)
<div className="caption">LiveCodes dark theme</div>
![LiveCodes light theme](../../static/img/screenshots/themes-2.jpg)
<div className="caption">LiveCodes light theme</div>
## Theme Color
Similarly, a theme color can be set in:
- UI: Settings menu → Color
- [Query params](../configuration/query-params.html.md): `?themeColor={color}`.
e.g. https://livecodes.io/?themeColor=lightblue
- [Configuration object](../configuration/configuration-object.html.md): [`themeColor`](../configuration/configuration-object.html.md)#themecolor) property.
![LiveCodes alternate theme color](../../static/img/screenshots/themes-3.jpg)
<div className="caption">Change theme color from UI</div>
![LiveCodes custom theme color](../../static/img/screenshots/themes-4.jpg)
<div className="caption">Custom theme color</div>
## Demo
<ThemeDemo></ThemeDemo>
:::info Note
Please note that editor themes can be set in the [editor settings](./editor-settings.html.md) or using the [`editorTheme`](../configuration/configuration-object.html.md)#editortheme) configuration option.

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,34 @@
# Tools Pane
import LiveCodes from '../../src/components/LiveCodes.tsx';
The resizeable tools pane (below the result page) provides an area for developer tools. This currently includes:
- [Console](./console.html.md)
- [Compiled code viewer](./compiled-code.html.md)
- [Tests](./tests.html.md)
- Open result page in new window (not in embeds)
- [Broadcast](broadcast.html.md) status (not in embeds)
- Loading spinner that appears when the result page is loading
The pane can be resized by dragging the bar. Clicking a tool button toggles opening/closing the pane. Double-click toggles maximize/close.
It can be configured to have any of the following states:
- `closed` (default)
- `open`
- `full`
- `none`
e.g. https://livecodes.io/?console=open&js=console.log('hello') <br />
opens the console and sets JavaScript code.
Demo: (console=open)
<LiveCodes params={{ console: 'open', js: "console.log('hello')" }}></LiveCodes>
<p>&nbsp;</p>
Demo: (console=full)
<LiveCodes params={{ console: 'full', js: "console.log('hello')" }}></LiveCodes>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,37 @@
# User Management
Generally, LiveCodes can be used anonymously without any accounts. This includes creating/saving [projects](./projects.html.md) and [importing](./import.html.md) code from GitHub gists or public repos.
However, some features do require login with a GitHub account and giving [specific permissions](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/scopes-for-oauth-apps#available-scopes) to make use of GitHub services (e.g. [import](./import.html.md) from private repos, [export](./export.html.md) to gist, [deploy](./deploy.html.md), [assets](./assets.html.md) and [sync](./sync.html.md)).
Please see the section about [GitHub Integration](./github-integration.html.md) for permissions required and how to change them.
:::caution cookies
User authentication is handled using [Firebase Authentication](https://firebase.google.com/products/auth) which **may use cookies**. By logging in, you agree that cookies may be stored on your device.
:::
:::info note
GitHub user permissions for LiveCodes app are set the first time the user logs in. Any subsequent login will use the first permissions, even if they are set differently.
Please see the section about [GitHub Integration](./github-integration.html.md)#setting-permissions) for how to change/revoke permissions .
:::
## User Data
User data includes [saved projects](./projects.html.md), [code snippets](./snippets.html.md), [assets](./assets.html.md) and [user settings](./user-settings.html.md). This data is saved in the browser linked to the logged in user account. When a user first logs in, data that was previously saved anonymously is linked to that user account.
If the user logs off, the data is cleared from the app, but is kept in the browser storage. This allows another user to use the same device without the data leaking. When the user, logs in again, the previously stored data (under that account) is reloaded to the app.
## Login/Logout
Login/Logout links are accessible at the top right corner of the app.
:::info note
All user management features, including ability to login/logout, access to user data, and [GitHub services](./github-integration.html.md) that require account, are not available in [embedded playgrounds](./embeds.html.md).
:::

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,30 @@
# User Settings
A user can select various settings that are stored locally in the browser and are subsequently used.
User settings can be configured in Settings menu. These include settings like:
- Auto-update
- Auto-save
- Delay (before auto-update and auto-save)
- [Format on-save](./code-format.html.md)#format-on-save)
- [Theme](./themes.html.md) (light/dark)
- [Theme color](./themes.html.md)#theme-color)
- [Recover unsaved projects](./recover.html.md)
- [Show spacing](./result.html.md)#show-spacings)
- Layout (responsive/vertical/horizontal)
- [Sync](./sync.html.md)
- Show [welcome screen](./welcome.html.md)
- [App language](./i18n.html.md)
The settings selected in the [`Editor Settings`](./editor-settings.html.md) screen are also saved locally as user settings.
User settings are scoped to the currently [logged-in user](./user-management.html.md). They can be [backed up/restored](./backup-restore.html.md) and [synced](./sync.html.md) the same as other user data ([projects](./projects.html.md), [user templates](./templates.html.md)#user-templates), [assets](./assets.html.md), [code snippets](./snippets.html.md)).
## Related
- [User management](./user-management.html.md)
- [Project](./projects.html.md)
- [Templates](./templates.html.md)
- [Backup/Restore](./backup-restore.html.md)
- [Sync](./sync.html.md)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
# Welcome Screen

File diff suppressed because one or more lines are too long