Skip to content

Commit

Permalink
📝 README update
Browse files Browse the repository at this point in the history
  • Loading branch information
FurryR committed Jan 31, 2024
1 parent 8889d5f commit e378dc8
Show file tree
Hide file tree
Showing 38 changed files with 244 additions and 31 deletions.
151 changes: 151 additions & 0 deletions README-zh_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<div align="center">

# 🐺 lpp

> 一门由 @FurryR 开发的高级编程语言。
[![浏览数](https://hits.dwyl.com/FurryR/lpp-scratch.svg?style=flat-square)](http://github.com/FurryR/lpp-scratch)
[![🛠️ 构建](https://github.com/FurryR/lpp-scratch/actions/workflows/ci.yaml/badge.svg)](https://github.com/FurryR/lpp-scratch/actions/workflows/ci.yaml)

[🇺🇸](./README.md) | 🇨🇳

</div>

## 🛠️ 特性

<table>
<tr><td>

### 📃 全新的类型系统

🌟 lpp 引入了一个全新的类型系统到 Scratch 中。由此,您可以创建您自己的复杂对象或类。

<div align="center">

![复杂对象](doc/zh-cn/image/readme/complex-objects.png)

</div>

<img width=1000 />

</td></tr>
<tr><td>

### 😼 直接构造 JSON

💡 lpp 允许您不使用 `JSON.parse` 而直接构造 JSON。

<div align="center">

![JSON](doc/zh-cn/image/readme/json.png)

</div>

</td></tr>
<tr><td>

### 👾 友好的调试器

🤖 lpp 提供了一个友好的调试器和错误回溯系统。

<div align="center">

![友好的调试器](doc/zh-cn/image/readme/debugger.png)

</div>

</td></tr>
<tr><td>

### 💞 联动

🌎 lpp 导出了它的 API 到 `vm.runtime.lpp`,这样其它的扩展就可以使用它们提供扩展功能了。

<div align="center">

![导出的 API](doc/zh-cn/image/readme/export.png)

</div>

</td></tr>
</table>

## 🤔 如何使用

1. 🔽 从 [`Github Actions`](https://github.com/FurryR/lpp-scratch/actions/workflows/ci.yaml) 下载每日构建 (**需要登录**)。 请总是下载最后一个提交。您可以下载 `lpp-debug` 或者 `lpp-release`。将产物解压到一个文件夹中。

<div align="center">

![下载](doc/zh-cn/image/readme/download.png)

</div>

1. 💡 下载 [`Eureka`](https://eureka.codingclip.cc/)。请注意您需要先下载 [`Tampermonkey`](https://www.tampermonkey.net/)[`ViolentMonkey`](https://violentmonkey.github.io/get-it/)。点击它们的名字就可以导航到下载页面。

<div align="center">

![Eureka](doc/zh-cn/image/readme/eureka.png)

</div>

1. 😼 打开一个(受支持的)Scratch 网站 ([`Gandi`](https://cocrea.world/gandi)[`Co-create world`](https://ccw.site/gandi)[`scratch.mit.edu`](https://scratch.mit.edu/projects/editor/)[Turbowarp](https://turbowarp.org/editor), 等等)。

<div align="center">

![Turbowarp](doc/zh-cn/image/readme/turbowarp.png)

</div>

1. 🛠️ 滚动到 `自制积木` 然后您就会看见 `Eureka`

<div align="center">

![自制积木](doc/zh-cn/image/readme/myblocks.png)

</div>

1. 🐺 使用 `从文件侧载扩展`,在解压的文件夹中选择 `index.global.js`(如果它提示沙盒加载,请选择 **取消**)然后 🎉! Lpp 现在可以用了。

<div align="center">

![完成](doc/zh-cn/image/readme/done.png)

</div>

## 📄 文档

<table>
<tr><td>

### ❤️‍🔥 新手起步

🚧 此段落仍在施工中。

</td></tr>
<tr><td>

### 🤖 渐入佳境

🚧 此段落仍在施工中。

</td></tr>
<tr><td>

### 🛠️ 高级文档

🚧 此段落仍在施工中。

- [内嵌类定义](doc/zh-cn/definition/builtin.md)

</td></tr>
</table>

---

<div align="center">

_`此项目以 MIT 协议发行。`_

❤️

</div>
46 changes: 33 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
[![Visitors](https://hits.dwyl.com/FurryR/lpp-scratch.svg?style=flat-square)](http://github.com/FurryR/lpp-scratch)
[![🛠️ Build](https://github.com/FurryR/lpp-scratch/actions/workflows/ci.yaml/badge.svg)](https://github.com/FurryR/lpp-scratch/actions/workflows/ci.yaml)

🇺🇸 | [🇨🇳](./README-zh_CN.md)

</div>

## 🛠️ Features
Expand All @@ -18,7 +20,13 @@

🌟 lpp adds a new type system to Scratch. By that you can make your own objects or classes.

![OOP in Scratch](doc/image/readme/oop.png)
<div align="center">

![Complex objects](doc/en-us/image/readme/complex-objects.png)

</div>

<img width=1000 />

</td></tr>
<tr><td>
Expand All @@ -27,7 +35,11 @@

💡 lpp allows you to construct JSON directly without using `JSON.parse`.

![JSON](doc/image/readme/json.png)
<div align="center">

![JSON](doc/en-us/image/readme/json.png)

</div>

</td></tr>
<tr><td>
Expand All @@ -36,7 +48,11 @@

🤖 lpp provides a friendly debugger and traceback system.

![Friendly debugger](doc/image/readme/debugger.png)
<div align="center">

![Friendly debugger](doc/en-us/image/readme/debugger.png)

</div>

</td></tr>
<tr><td>
Expand All @@ -45,54 +61,58 @@

🌎 lpp exports its APIs to `vm.runtime.lpp` so other extensions could use them to provide extended functionalities.

![Exported APIs](doc/image/readme/export.png)
<div align="center">

![Exported APIs](doc/en-us/image/readme/export.png)

</div>

</td></tr>
</table>

## 🤔 How to use

1. 🔽 Download lpp from `GitHub`. You can click `Download ZIP` to download compressed version if you are using web client. Decompress it to a folder.
1. 🔽 Download lpp daily build from [`Github Actions`](https://github.com/FurryR/lpp-scratch/actions/workflows/ci.yaml) (**requires login**). Please always download latest commit. You can download either `lpp-debug` or `lpp-release`. Decompress the artifact into a folder.

<div align="center">

![Download](doc/image/readme/download.png)
![Download](doc/en-us/image/readme/download.png)

</div>

1. 💡 Download [`Eureka`](https://eureka.codingclip.cc/). Please note that you need to install [`Tampermonkey`](https://www.tampermonkey.net/) or [`ViolentMonkey`](https://violentmonkey.github.io/get-it/) first. Click on the names to navigate to its install page.

<div align="center">

![Eureka](doc/image/readme/eureka.png)
![Eureka](doc/en-us/image/readme/eureka.png)

</div>

3. 😼 Open a (supported) Scratch website ([`Gandi`](https://cocrea.world/gandi), [`Co-create world`](https://ccw.site/gandi), [`scratch.mit.edu`](https://scratch.mit.edu/projects/editor/), [Turbowarp](https://turbowarp.org/editor), etc.).

<div align="center">

![Turbowarp](doc/image/readme/turbowarp.png)
![Turbowarp](doc/en-us/image/readme/turbowarp.png)

</div>

4. 🛠️ Scroll to `My Blocks` and you will see `Eureka`.

<div align="center">

![My Blocks](doc/image/readme/myblocks.png)
![My Blocks](doc/en-us/image/readme/myblocks.png)

</div>

5. 🐺 Use `Sideload from File`, select `src/main.js` in the decompressed folder and 🎉! Lpp is ready to use.
5. 🐺 Use `Sideload from File`, select `index.global.js` in the decompressed folder (if it asks you about sandbox, click **Cancel**) and 🎉! Lpp is ready to use.

<div align="center">

![Done](doc/image/readme/done.png)
![Done](doc/en-us/image/readme/done.png)

</div>

## ❤️‍🔥 Documentation
## 📄 Documentation

<table>
<tr><td>
Expand All @@ -115,7 +135,7 @@

🚧 This section is still working in progress.

- [Builtin definitions](doc/definition/builtin.md)
- [Builtin definitions](doc/en-us/definition/builtin.md)

</td></tr>
</table>
Expand Down
File renamed without changes.
Binary file added doc/en-us/image/readme/complex-objects.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/en-us/image/readme/debugger.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/en-us/image/readme/done.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/en-us/image/readme/download.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added doc/en-us/image/readme/export.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/en-us/image/readme/json.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/en-us/image/readme/myblocks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/en-us/image/readme/turbowarp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed doc/image/readme/debugger.png
Binary file not shown.
Binary file removed doc/image/readme/done.png
Binary file not shown.
Binary file removed doc/image/readme/download.png
Binary file not shown.
Binary file removed doc/image/readme/export.png
Binary file not shown.
Binary file removed doc/image/readme/json.png
Binary file not shown.
Binary file removed doc/image/readme/myblocks.png
Binary file not shown.
Binary file removed doc/image/readme/oop.png
Binary file not shown.
Binary file removed doc/image/readme/turbowarp.png
Binary file not shown.
Binary file added doc/zh-cn/image/readme/complex-objects.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/zh-cn/image/readme/debugger.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/zh-cn/image/readme/done.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/zh-cn/image/readme/download.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/zh-cn/image/readme/eureka.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/zh-cn/image/readme/export.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/zh-cn/image/readme/json.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/zh-cn/image/readme/myblocks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/zh-cn/image/readme/turbowarp.png
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"fix": "eslint ./src --fix",
"build": "tsup --minify",
"dev": "tsup",
"format": "prettier ./src ./doc README.md -c -w"
"format": "prettier ./src ./doc *.md -c -w"
},
"repository": {
"type": "git",
Expand Down
1 change: 1 addition & 0 deletions src/impl/asset/icon.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDYwMCAzNzIiPjxkZWZzPjxzdHlsZT4KICAgICAgLmNscy0xIHsKICAgICAgICBmaWxsOiAjZmZmOwogICAgICB9CiAgICA8L3N0eWxlPjwvZGVmcz48cmVjdCBjbGFzcz0iY2xzLTEiIHdpZHRoPSI2MDAiIGhlaWdodD0iMzcyIi8+PGc+PHBhdGggZD0iTTIzMC4xNCwxNjEuMzd2NDUuMDVoMjUuNDJjMi4wMywwLDMuNTgsLjQ5LDQuNjcsMS40OCwxLjA4LC45OSwxLjYzLDIuMjIsMS42MywzLjcxcy0uNTQsMi43NS0xLjYsMy42OWMtMS4wNywuOTQtMi42MywxLjQxLTQuNjksMS40MWgtMzAuMjdjLTIuNzMsMC00LjY5LS42LTUuODktMS44Mi0xLjItMS4yMS0xLjc5LTMuMTctMS43OS01Ljg3di00Ny42N2MwLTIuNTMsLjU3LTQuNDMsMS43MS01LjcsMS4xNC0xLjI3LDIuNjQtMS45LDQuNS0xLjlzMy40MSwuNjMsNC41OCwxLjg4YzEuMTcsMS4yNSwxLjc1LDMuMTYsMS43NSw1LjcyWiIvPjxwYXRoIGQ9Ik0yOTQuMSwxOTIuNjJoLTExLjQ4djE3LjUyYzAsMi41LS41OSw0LjQxLTEuNzcsNS43cy0yLjY3LDEuOTQtNC40OCwxLjk0LTMuNDEtLjY0LTQuNTYtMS45MmMtMS4xNS0xLjI4LTEuNzMtMy4xNi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MTIuNjZabTQ0Ljk3LDIzLjljMS43Ni0xLjc2LDQuNjItMS43Niw2LjM4LDBsMTIuMDQsMTIuMDRjMS43NiwxLjc2LDEuNzYsNC42MiwwLDYuMzhsLTEyLjA0LDEyLjA0Yy0xLjY5LDEuODItNC41NSwxLjkzLTYuMzcsLjI0LS42NC0uNTktMS4wOS0xLjM2LTEuMy0yLjItLjQxLTEuNiwuMDktMy4yOSwxLjI5LTQuNDJsOC44NS04Ljg1LTguODUtOC44NWMtMS43Ni0xLjc2LTEuNzYtNC42MiwwLTYuMzhabS0xNC42OSw2LjM4bC04Ljg1LDguODUsOC44NSw4Ljg1YzEuODIsMS42OSwxLjkzLDQuNTUsLjI0LDYuMzctLjU5LC42NC0xLjM2LDEuMDktMi4yLDEuMy0xLjYsLjQxLTMuMjktLjA5LTQuNDItMS4yOWwtMTIuMDQtMTIuMDRjLTEuNzYtMS43Ni0xLjc2LTQuNjIsMC02LjM4bDEyLjA0LTEyLjA0YzEuNzgtMS42Niw0LjU1LTEuNjEsNi4yNywuMTEsMS43MiwxLjcyLDEuNzYsNC40OSwuMTEsNi4yN1oiLz48L3N2Zz4='
10 changes: 9 additions & 1 deletion src/impl/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import {
Extension,
Reporter,
Input,
Command
Command,
Button
} from './blockly'

/**
Expand Down Expand Up @@ -324,6 +325,13 @@ export function defineExtension(
}
}
return new Extension('lpp', color)
.register(
/// Documentation
new Button(
'documentation',
() => `📄 ${formatMessage('lpp.documentation')}`
)
)
.register(
/// Builtin
new Category(() => `#️⃣ ${formatMessage('lpp.category.builtin')}`)
Expand Down
13 changes: 8 additions & 5 deletions src/impl/blockly/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ interface MetadataMap {
arguments: Record<string, never>
}
button: {
func: string
text: string
onClick: () => void
onClick: () => void // compatible with Gandi IDE: Gandi IDE engineer is noob and they don't know how to handle `func` and `onClick` properly.
// TODO: Remove this code when the issue is fixed
}
}
/**
Expand Down Expand Up @@ -60,20 +62,21 @@ export class Button implements ExtensionBlock {
export(): BlockMetadata[] {
return [
{
func: this.id,
blockType: 'button',
text: this.lazyText(),
onClick: this.onClick
onClick: () => {}
}
]
}
/**
* Construct a button.
* @param id Button ID.
* @param lazyText A function that returns button text.
* @param onClick click handler.
*/
constructor(
public lazyText: () => string,
public onClick: () => void
public id: string,
public lazyText: () => string
) {}
}
/**
Expand Down
4 changes: 4 additions & 0 deletions src/impl/l10n/en-us.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
export default {
// Name
'lpp.name': 'lpp',
// Documentation
'lpp.documentation': 'Open documentation',
'lpp.documentation.url':
'https://github.com/FurryR/lpp-scratch/blob/main/README.md',
// Block
/// Construction
'lpp.block.construct.Number': 'Number',
Expand Down
4 changes: 4 additions & 0 deletions src/impl/l10n/zh-cn.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
export default {
// 名称
'lpp.name': 'lpp',
// 文档
'lpp.documentation': '打开文档',
'lpp.documentation.url':
'https://github.com/FurryR/lpp-scratch/blob/main/README-zh_CN.md',
// 积木
/// 构造
'lpp.block.construct.Number': '数字',
Expand Down
2 changes: 1 addition & 1 deletion src/impl/traceback/inspector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export function Inspector(
'[[FunctionLocation]]',
'lpp-code lpp-inspector-key-constructor'
),
Dialog.Text(` ➡ `)
Dialog.Text(` ➡ `)
)
const traceback = document.createElement('span')
traceback.classList.add('lpp-code')
Expand Down
Loading

0 comments on commit e378dc8

Please sign in to comment.