Merge upstream ui with expand changes

This commit is contained in:
Garrett Mills 2022-04-09 12:36:05 -05:00
commit 4f433e7bf9
8 changed files with 86 additions and 25 deletions

View File

@ -16,9 +16,10 @@
"cd": "pnpm run cd:build && pnpm run cd:push && pnpm run cd:rollout" "cd": "pnpm run cd:build && pnpm run cd:push && pnpm run cd:rollout"
}, },
"dependencies": { "dependencies": {
"@vuetify/vite-plugin": "1.0.0-alpha.10", "@auth0/auth0-vue": "^1.0.0",
"@types/katex": "^0.14.0", "@types/katex": "^0.14.0",
"@types/uuid": "^8.3.4", "@types/uuid": "^8.3.4",
"@vuetify/vite-plugin": "1.0.0-alpha.10",
"dependency-graph": "^0.11.0", "dependency-graph": "^0.11.0",
"install": "^0.13.0", "install": "^0.13.0",
"katex": "^0.15.3", "katex": "^0.15.3",
@ -26,8 +27,7 @@
"uuid": "^8.3.2", "uuid": "^8.3.2",
"vue": "^3.2.25", "vue": "^3.2.25",
"vue-router": "^4.0.14", "vue-router": "^4.0.14",
"vuetify": "3.0.0-beta.0", "vuetify": "3.0.0-beta.0"
"@auth0/auth0-vue": "^1.0.0"
}, },
"devDependencies": { "devDependencies": {
"@braks/revue-draggable": "^0.4.2", "@braks/revue-draggable": "^0.4.2",

View File

@ -4,9 +4,6 @@ import { MathPage } from "./support/page";
(window as any).Stmt = MathStatement; (window as any).Stmt = MathStatement;
(window as any).Pg = MathPage; (window as any).Pg = MathPage;
theme: {
defaultTheme: 'dark'
}
</script> </script>
<template> <template>

40
src/assets/edit.svg Normal file
View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 612.097 612.097" style="enable-background:new 0 0 612.097 612.097;" xml:space="preserve">
<g>
<path d="M320.85,151.725l139.6,139.6l-238,237.9l-139.6-139.6L320.85,151.725z M607.65,124.125l-119.7-119.7
c-5.9-5.9-15.5-5.9-21.4,0l-104,104l141,141l104-104C613.55,139.525,613.55,130.025,607.65,124.125z M0.55,592.825
c-1.4,5.3,0.1,10.9,3.9,14.8c3.9,3.9,9.5,5.4,14.8,3.9l165.5-44.6l-139.6-139.6L0.55,592.825z"/>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 876 B

View File

@ -1,5 +1,4 @@
<script setup> <script setup>
</script> </script>
<template> <template>
@ -7,8 +6,9 @@
</v-navigation-drawer> </v-navigation-drawer>
<v-main> <Draggable>
</v-main> <div class="box">I use a wrapper</div>
</Draggable>
</template> </template>
<style> <style>

View File

@ -1,5 +1,4 @@
<script setup lang="ts"> <script setup lang="ts">
import {HTMLString} from '../types'
import {computed} from 'vue' import {computed} from 'vue'
import {MathStatement} from '../support/parse' import {MathStatement} from '../support/parse'
@ -8,8 +7,10 @@ const props = defineProps<{
size?: 'big' | 'small', size?: 'big' | 'small',
}>() }>()
let displayHtml: HTMLString = props.statement.toHTMLString() const getRenderedHTML = () => props.statement.toHTMLString()
computed(() => displayHtml = props.statement.toHTMLString())
const renderedHtml = getRenderedHTML()
computed(getRenderedHTML)
</script> </script>
<style> <style>
@ -23,7 +24,7 @@ computed(() => displayHtml = props.statement.toHTMLString())
</style> </style>
<template> <template>
<div class="big" v-if="props?.size === 'big'" v-html="displayHtml"></div> <div ref="container" class="big" v-if="props?.size === 'big'" v-html="renderedHtml"></div>
<div class="small" v-else-if="props?.size === 'small'" v-html="displayHtml"></div> <div ref="container" class="small" v-else-if="props?.size === 'small'" v-html="renderedHtml"></div>
<div v-else v-html="displayHtml"></div> <div ref="container" v-else v-html="renderedHtml"></div>
</template> </template>

View File

@ -25,16 +25,32 @@ computed(() => value = getValueStatement())
border: 1px solid #ccc; border: 1px solid #ccc;
border-radius: 3px; border-radius: 3px;
padding: 10px; padding: 10px;
display: flex;
flex-direction: row;
}
.content {
flex: 1;
}
.sidebar {
padding-left: 10px;
} }
</style> </style>
<template> <template>
<div class="math-statement"> <div class="math-statement">
<div class="content">
<Katex :statement="statement" size="big"/> <Katex :statement="statement" size="big"/>
<div class="result" v-if="value"> <div class="result" v-if="value">
<hr v-if="value" style="border: 1px solid #ccc; border-bottom: 0"> <hr v-if="value" style="border: 1px solid #ccc; border-bottom: 0">
<Katex :statement="value" size="small" style="color: #666"/> <Katex :statement="value" size="small" style="color: #666"/>
</div>
</div>
<div class="sidebar">
<button>
<img src="../assets/edit.svg" alt="Edit" height="16">
</button>
</div> </div>
</div> </div>
</template> </template>

View File

@ -8,6 +8,10 @@ import 'vuetify/styles' // Global CSS has to be imported
import { createVuetify } from 'vuetify' import { createVuetify } from 'vuetify'
import * as components from 'vuetify/components' import * as components from 'vuetify/components'
import * as directives from 'vuetify/directives' import * as directives from 'vuetify/directives'
import 'katex/dist/katex.min.css'
import 'katex/dist/contrib/auto-render.min'
const app = createApp(App) const app = createApp(App)
const vuetify = createVuetify({ const vuetify = createVuetify({
@ -29,5 +33,5 @@ app.use(
app.use(router) app.use(router)
app.use(DraggablePlugin) app.use(DraggablePlugin);
app.mount('#app') app.mount('#app')

View File

@ -284,15 +284,18 @@ export class MathStatement {
/** Render the statement as HTML string. */ /** Render the statement as HTML string. */
toHTMLString(): HTMLString { toHTMLString(): HTMLString {
return katex.renderToString(this.toLaTeX(), { return katex.renderToString(this.toLaTeX(), {
output: 'mathml', output: 'html',
}) as HTMLString }) as HTMLString
} }
/** Render the statement to a DOM element. */ /** Render the statement to a DOM element. */
toDOM(): HTMLSpanElement { toDOM(node?: HTMLElement): HTMLSpanElement {
const node = document.createElement('span') if ( !node ) {
node = document.createElement('span')
}
katex.render(this.toLaTeX(), node, { katex.render(this.toLaTeX(), node, {
output: 'mathml', output: 'html',
}) })
return node return node
} }