Skip to content

Commit

Permalink
0.7.1: Micro Plum integration
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj committed Jun 9, 2023
1 parent d46f3ab commit de1481c
Show file tree
Hide file tree
Showing 13 changed files with 555 additions and 91 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
browser: [chromium, firefox, webkit]
browser: [chromium, firefox] # webkit
include:
- os: macos-latest
browser: webkit
Expand All @@ -84,6 +84,7 @@ jobs:
run: |
npm i -g pnpm
pnpm i
npx playwright install
npx playwright install-deps ${{ matrix.browser }}
- name: Download artifact
uses: actions/download-artifact@v3
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ It's not recommended to clone recursively, as many boost libs are not needed.
pnpm run submodule
```
### Get font
Uncommon characters are rendered using [花园明朝](https://github.com/max32002/max-hana).
Uncommon characters are rendered using
[遍黑体](https://github.com/Fitzgerald-Porthmouth-Koenigsegg/Plangothic-Project)
and
[花园明朝](https://github.com/max32002/max-hana).
```sh
pnpm run font
```
Expand Down
17 changes: 17 additions & 0 deletions doc/deploy.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
# Deploy
## Use [Micro Plum](https://github.com/LibreService/micro_plum)
Click `Micro Plum`.

Either provide
* a single schema URL
(e.g. https://github.com/rime/rime-luna-pinyin/blob/master/luna_pinyin.schema.yaml),

or
* a plum target
(e.g. rime/rime-luna-pinyin)
and a list of schema Ids
(e.g. luna_pinyin).

Click `Install`.

Select the schemas and click `Deploy`.
## Manual upload
Turn on `Advanced` switch or append `debug=on` URL parameter,
so that you can interact with emscripten's file system.

Expand Down
31 changes: 16 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@libreservice/my-rime",
"version": "0.7.0",
"version": "0.7.1",
"files": [
"dist"
],
Expand Down Expand Up @@ -31,41 +31,42 @@
"devDependencies": {
"@codemirror/legacy-modes": "^6.3.2",
"@libreservice/lazy-cache": "^0.1.0",
"@libreservice/micro-plum": "^0.1.0",
"@libreservice/my-widget": "^0.1.2",
"@libreservice/my-worker": "^0.4.0",
"@libreservice/wasm-code": "^0.1.1",
"@playwright/test": "1.32.3",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.2",
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-replace": "^5.0.2",
"@typescript-eslint/eslint-plugin": "^5.59.6",
"@typescript-eslint/parser": "^5.59.6",
"@types/js-yaml": "^4.0.5",
"@typescript-eslint/eslint-plugin": "^5.59.9",
"@typescript-eslint/parser": "^5.59.9",
"@vicons/fa": "^0.12.0",
"@vicons/fluent": "^0.12.0",
"@vitejs/plugin-vue": "^4.2.3",
"emoji-regex": "^10.2.1",
"esbuild": "^0.17.19",
"eslint": "^8.40.0",
"eslint-config-standard": "^17.0.0",
"eslint": "^8.42.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^16.0.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-vue": "^9.13.0",
"eslint-plugin-vue": "^9.14.1",
"idb": "^7.1.1",
"js-yaml": "^4.1.0",
"naive-ui": "^2.34.3",
"playwright": "1.32.3",
"rollup": "^3.22.0",
"naive-ui": "^2.34.4",
"rollup": "^3.24.0",
"rollup-plugin-esbuild": "^5.0.0",
"textarea-caret": "^3.1.0",
"tslib": "^2.5.1",
"typescript": "^5.0.4",
"vite": "^4.3.8",
"vite-plugin-pwa": "^0.14.7",
"tslib": "^2.5.3",
"typescript": "^5.1.3",
"vite": "^4.3.9",
"vite-plugin-pwa": "^0.16.3",
"vite-plugin-run": "^0.4.1",
"vooks": "^0.2.12",
"vue": "^3.3.4",
"vue-router": "^4.2.1",
"vue-router": "^4.2.2",
"vue-tsc": "^1.6.5"
}
}
24 changes: 18 additions & 6 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<script setup lang="ts">
import { NConfigProvider, NNotificationProvider, NH1, darkTheme, useOsTheme } from 'naive-ui'
import {
NConfigProvider,
NNotificationProvider,
NDialogProvider,
NMessageProvider,
NH1,
darkTheme,
useOsTheme
} from 'naive-ui'
import { MyLayout, MyHeader, MyFooter } from '@libreservice/my-widget'
import MyPwa from './components/MyPwa.vue'
import { homepage, appName } from '../package.json'
Expand All @@ -22,11 +30,15 @@ const osThemeRef = useOsTheme()
<n-h1>{{ appName }}</n-h1>
</div>
<n-notification-provider :max="1">
<router-view v-slot="{ Component }">
<keep-alive>
<component :is="Component" />
</keep-alive>
</router-view>
<n-dialog-provider>
<n-message-provider>
<router-view v-slot="{ Component }">
<keep-alive>
<component :is="Component" />
</keep-alive>
</router-view>
</n-message-provider>
</n-dialog-provider>
</n-notification-provider>
</template>
<template #footer>
Expand Down
66 changes: 66 additions & 0 deletions src/components/MyDeployer.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<script setup lang="ts">
import { toRefs } from 'vue'
import { useNotification } from 'naive-ui'
import { worker } from '../workerAPI'
import {
changeIME,
deployed,
selectOptions
} from '../control'
import type MyMenu from './MyMenu.vue'
const props = defineProps<{
menu: InstanceType<typeof MyMenu> | undefined
}>()
const { menu } = toRefs(props)
const notification = useNotification()
worker.control('deployStatus', async (status: 'start' | 'failure' | 'success', schemas: string) => {
const options = {
duration: 5000,
keepAliveOnHover: true
}
switch (status) {
case 'start':
notification.info({
content: 'Deployment started',
...options
})
menu.value?.setLoading(true)
break
case 'failure':
notification.error({
content: 'Deployment failed',
...options
})
menu.value?.setLoading(false)
break
case 'success':
notification.success({
content: 'Deployment succeeded',
...options
})
deployed.value = true
selectOptions.value = []
{
const schemasJson = JSON.parse(schemas) as {
id: string,
name: string
}[]
for (const schema of schemasJson) {
selectOptions.value.push({
label: schema.name,
value: schema.id
})
}
const currentSchema = schemasJson[0].id
await changeIME(currentSchema)
menu.value?.displayIME(currentSchema)
}
menu.value?.setLoading(false)
break
}
})
</script>
66 changes: 3 additions & 63 deletions src/components/MyEditor.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
<script setup lang="ts">
import { ref, toRaw, onMounted } from 'vue'
import { NButton, useNotification } from 'naive-ui'
import { ref, onMounted } from 'vue'
import { NButton } from 'naive-ui'
import { json } from '@codemirror/legacy-modes/mode/javascript'
import { lua } from '@codemirror/legacy-modes/mode/lua'
import { yaml } from '@codemirror/legacy-modes/mode/yaml'
import { WasmCode } from '@libreservice/wasm-code'
import { worker, deploy, FS } from '../workerAPI'
import {
changeIME,
deployed,
selectOptions
} from '../control'
import type MyMenu from './MyMenu.vue'
import { deploy, FS } from '../workerAPI'
const langParserMap = {
json, lua, yaml
Expand All @@ -23,60 +17,6 @@ const extLangMap = {
yaml: 'yaml'
}
const props = defineProps<{
menu?: InstanceType<typeof MyMenu>
}>()
const { menu } = toRaw(props)
const notification = useNotification()
worker.control('deployStatus', async (status: 'start' | 'failure' | 'success', schemas: string) => {
const options = {
duration: 5000,
keepAliveOnHover: true
}
switch (status) {
case 'start':
notification.info({
content: 'Deployment started',
...options
})
menu?.setLoading(true)
break
case 'failure':
notification.error({
content: 'Deployment failed',
...options
})
menu?.setLoading(false)
break
case 'success':
notification.success({
content: 'Deployment succeeded',
...options
})
deployed.value = true
selectOptions.value = []
{
const schemasJson = JSON.parse(schemas) as {
id: string,
name: string
}[]
for (const schema of schemasJson) {
selectOptions.value.push({
label: schema.name,
value: schema.id
})
}
const currentSchema = schemasJson[0].id
await changeIME(currentSchema)
menu?.displayIME(currentSchema)
}
menu?.setLoading(false)
break
}
})
const wc = ref<InstanceType<typeof WasmCode>>()
onMounted(() => {
Expand Down
Loading

0 comments on commit de1481c

Please sign in to comment.