Skip to content

Commit

Permalink
#76 export format: Improved Initiative JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
ebshimizu committed Dec 30, 2022
1 parent 8fc700a commit 5e386ed
Show file tree
Hide file tree
Showing 5 changed files with 436 additions and 8 deletions.
14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,31 @@
"pinia": "^2.0.11",
"pinia-plugin-persistedstate": "^1.6.1",
"quasar": "^2.10.2",
"slugify": "^1.6.5",
"url": "^0.11.0",
"uuid": "^8.3.2",
"vue": "^3.0.0",
"vue-i18n": "^9.0.0",
"vue-router": "^4.0.0"
},
"devDependencies": {
"@intlify/vite-plugin-vue-i18n": "^3.3.1",
"@quasar/app-vite": "^1.0.0",
"@types/dom-to-image": "^2.6.4",
"@types/lodash": "^4.14.182",
"@types/node": "^12.20.21",
"@types/number-to-words": "^1.2.1",
"@types/uuid": "^8.3.4",
"@typescript-eslint/eslint-plugin": "^5.10.0",
"@typescript-eslint/parser": "^5.10.0",
"autoprefixer": "^10.4.2",
"eslint": "^8.10.0",
"eslint-plugin-vue": "^8.5.0",
"eslint-config-prettier": "^8.1.0",
"prettier": "^2.5.1",
"@types/node": "^12.20.21",
"@intlify/vite-plugin-vue-i18n": "^3.3.1",
"@quasar/app-vite": "^1.0.0",
"autoprefixer": "^10.4.2",
"typescript": "^4.5.4",
"eslint-plugin-vue": "^8.5.0",
"http": "^0.0.1-security",
"https": "^1.0.0"
"https": "^1.0.0",
"prettier": "^2.5.1",
"typescript": "^4.5.4"
},
"engines": {
"node": "^18 || ^16 || ^14.19",
Expand Down
14 changes: 14 additions & 0 deletions src/components/file/DownloadButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
<q-item v-close-popup clickable @click="saveMd3()">
<q-item-section>{{ $t('io.export.md3') }}</q-item-section>
</q-item>
<q-item v-close-popup clickable @click="saveImprovedInit()">
<q-item-section>{{ $t('io.export.improvedInit') }}</q-item-section>
</q-item>
<q-item v-close-popup clickable @click="saveLatex()">
<q-item-section>{{ $t('io.export.latex') }}</q-item-section>
</q-item>
Expand Down Expand Up @@ -44,6 +47,7 @@ import copy from 'copy-to-clipboard'
import DomToImage from 'dom-to-image'
import { useLatexRenderer } from '../rendering/useLatexRenderer'
import { useTarrasqueRenderer } from '../rendering/useTarrasqueRenderer'
import { useImprovedInitRenderer } from '../rendering/useImprovedInitRenderer'
import * as jsonurl from 'json-url'
import { useEditorStore } from 'src/stores/editor-store'
Expand All @@ -58,6 +62,7 @@ export default defineComponent({
const { renderMarkdownV3 } = useMd3Renderer()
const { renderLatex } = useLatexRenderer()
const { renderTarrasqueJson } = useTarrasqueRenderer()
const { renderImprovedInitJson } = useImprovedInitRenderer()
const codec = jsonurl('lzma')
const editorStore = useEditorStore()
Expand Down Expand Up @@ -162,6 +167,14 @@ export default defineComponent({
}
}
const saveImprovedInit = async () => {
download(
await renderImprovedInitJson(),
`${monster.name}.improved-initiative.json`,
'application/json'
)
}
const copyLink = async () => {
try {
const b64 = await codec.compress(JSON.stringify(monster.$state))
Expand Down Expand Up @@ -201,6 +214,7 @@ export default defineComponent({
saveLatex,
saveTio,
savePng,
saveImprovedInit,
copyLink,
}
},
Expand Down
Loading

0 comments on commit 5e386ed

Please sign in to comment.