From d1f2c274b9b2a7f26755d6c49952773d65174ae8 Mon Sep 17 00:00:00 2001 From: wflixu Date: Sun, 21 Apr 2024 18:48:49 +0800 Subject: [PATCH 1/3] [feat] suport bib type file --- .github/workflows/build-pkg.yml | 2 +- README.md | 12 +++- src/pages/home/Sidebar.vue | 4 +- src/pages/project/Project.vue | 9 ++- tests/main.typ | 99 +++++++++++++++++++++++++++++++++ tests/show.typ | 22 -------- tests/works.bib | 22 ++++++++ 7 files changed, 143 insertions(+), 27 deletions(-) create mode 100644 tests/main.typ delete mode 100644 tests/show.typ create mode 100644 tests/works.bib diff --git a/.github/workflows/build-pkg.yml b/.github/workflows/build-pkg.yml index 2f89ff9..98fe4a7 100644 --- a/.github/workflows/build-pkg.yml +++ b/.github/workflows/build-pkg.yml @@ -3,7 +3,7 @@ name: "build pkg" on: push: branches: - - dev + - release jobs: publish-tauri: diff --git a/README.md b/README.md index a078f82..db40407 100644 --- a/README.md +++ b/README.md @@ -35,4 +35,14 @@ Typster is built using [Tauri](https://tauri.app/). ``` pnpm tauri icon -``` \ No newline at end of file +``` + + +## Other similar projects: + +- https://github.com/Cubxity/typstudio +- https://github.com/Enter-tainer/typst-preview + +## Related projects +- https://github.com/Enter-tainer/typstyle +- https://github.com/nvarner/typst-lsp diff --git a/src/pages/home/Sidebar.vue b/src/pages/home/Sidebar.vue index 28c3851..3fa7812 100644 --- a/src/pages/home/Sidebar.vue +++ b/src/pages/home/Sidebar.vue @@ -124,12 +124,12 @@ const onCreateFile = async () => { title: "新建文件", filters: [{ name: 'untitled', - extensions: ['typ'] + extensions: ['typ', 'bib', 'yml'] }], defaultPath: systemStore.editingProject?.path }); - console.log(filePath) + console.warn(filePath) if (filePath) { await writeTextFile({ path: filePath, contents: ' ' }); await initFiles(); diff --git a/src/pages/project/Project.vue b/src/pages/project/Project.vue index 34ceadf..999a7c1 100644 --- a/src/pages/project/Project.vue +++ b/src/pages/project/Project.vue @@ -91,14 +91,21 @@ onMounted(() => { } .list { + display: flex; + flex-wrap: wrap; + gap: 40px; + .list-item { + flex-shrink: 0; cursor: pointer; border: 1px solid #ddd; border-radius: 4px; position: relative; padding: 16px; margin-top: 40px; - + /* max-width: 420px; */ + min-width: max(240px, 20vw); + flex: 1; .actions { position: absolute; right: 16px; diff --git a/tests/main.typ b/tests/main.typ new file mode 100644 index 0000000..9477fc7 --- /dev/null +++ b/tests/main.typ @@ -0,0 +1,99 @@ +#set page( + paper: "a4", + margin: (x: 1.8cm, y: 1.5cm), +) +#set text( + font: "New Computer Modern", + size: 16pt +) + +#set par( + justify: true, + leading: 0.52em, +) + + += Introduction + +In this report, we will explore the +various factors that influence fluid +dynamics in glaciers and how they +contribute to the formation and +behaviour of these natural structures. + ++ The climate + - Temperature + - Precipitation ++ The topography ++ The geology + +#image("./app-icon.png") + + +The flow rate of a glacier is +defined by the following equation: + +$ Q = rho A v + C $ + + + += Introduction + +In this report, we will explore the +various factors that influence fluid +dynamics in glaciers and how they +contribute to the formation and +behaviour of these natural structures. + += picture + #figure( + image("app-icon.png", width: 70%), + caption: [ + _Glaciers_ form an important part + of the earth's climate system. + ], +) + + += Methods +We follow the glacier melting models + + + +The equation $Q = rho A v + C$ +defines the glacial flow rate. + +Total displaced soil by glacial flow: + +$ 7.32 beta + + sum_(i=0)^nabla + (Q_i (a_i - epsilon)) / 2 $ + + +$ v := vec(x_1, x_2, x_3) $ + + +#par(justify: true)[ + = Background + In the case of glaciers, fluid + dynamics principles can be used + to understand how the movement + and behaviour of the ice is + influenced by factors such as + temperature, pressure, and the + presence of other fluids (such as + water). +] + + +== Background + +#lorem(100) + + += bib + +#lorem(40) +@smith2020 + +#bibliography("works.bib", full: true) diff --git a/tests/show.typ b/tests/show.typ deleted file mode 100644 index 5d831ce..0000000 --- a/tests/show.typ +++ /dev/null @@ -1,22 +0,0 @@ - -= Introduction - -In this report, we will explore the -various factors that influence fluid -dynamics in glaciers and how they -contribute to the formation and -behaviour of these natural structures. - -+ The climate - - Temperature - - Precipitation -+ The topography -+ The geology - -#image("./app-icon.png") - - -The flow rate of a glacier is -defined by the following equation: - -$ Q = rho A v + C $ \ No newline at end of file diff --git a/tests/works.bib b/tests/works.bib new file mode 100644 index 0000000..077b314 --- /dev/null +++ b/tests/works.bib @@ -0,0 +1,22 @@ +@ARTICLE{smith2020, + author = "John Smith", + title = "A New Algorithm for Sorting Numbers", + journal = "Journal of Algorithms", + year = 2020, + volume = 100, + number = 1, + pages = "1-10", + keywords = {sorting, algorithms, complexity}, + abstract = "This paper presents a new algorithm for sorting numbers. The algorithm is based on the idea of...", + note = "This is a preliminary version of the paper." +} + +@BOOK{jones2019, + author = "Jane Jones", + title = "Introduction to Machine Learning", + publisher = "MIT Press", + year = 2019, + keywords = {machine learning, artificial intelligence, data science}, + abstract = "This book provides an introduction to the field of machine learning.", + note = "" +} \ No newline at end of file From 5118512253bfbd3162e16da4d06bcf4d63d0f8d7 Mon Sep 17 00:00:00 2001 From: wflixu Date: Sun, 21 Apr 2024 18:55:24 +0800 Subject: [PATCH 2/3] [release] v0.3.0 --- package.json | 2 +- src-tauri/tauri.conf.json | 2 +- tests/main.typ | 27 +++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a1bca25..96b9697 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "typster", "private": true, - "version": "0.2.0", + "version": "0.3.0", "type": "module", "scripts": { "dev": "vite", diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index ecd9701..9b5db94 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -11,7 +11,7 @@ }, "package": { "productName": "typster", - "version": "0.2.0" + "version": "0.3.0" }, "tauri": { "macOSPrivateApi": true, diff --git a/tests/main.typ b/tests/main.typ index 9477fc7..f6001a2 100644 --- a/tests/main.typ +++ b/tests/main.typ @@ -90,6 +90,33 @@ $ v := vec(x_1, x_2, x_3) $ #lorem(100) += package + +#import "@preview/cetz:0.2.2": canvas, plot + + +#let style = (stroke: black, fill: rgb(0, 0, 200, 75)) + +#canvas(length: 1cm, { + plot.plot(size: (8, 6), + x-tick-step: none, + x-ticks: ((-calc.pi, $-pi$), (0, $0$), (calc.pi, $pi$)), + y-tick-step: 1, + { + plot.add( + style: style, + domain: (-calc.pi, calc.pi), calc.sin) + plot.add( + hypograph: true, + style: style, + domain: (-calc.pi, calc.pi), calc.cos) + plot.add( + hypograph: true, + style: style, + domain: (-calc.pi, calc.pi), x => calc.cos(x + calc.pi)) + }) +}) + = bib From c193a82f0041ef2d73771d07351d5f695806b62c Mon Sep 17 00:00:00 2001 From: wflixu Date: Sun, 21 Apr 2024 19:00:55 +0800 Subject: [PATCH 3/3] [ci] github action change --- .github/workflows/build-pkg.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-pkg.yml b/.github/workflows/build-pkg.yml index 98fe4a7..38eb055 100644 --- a/.github/workflows/build-pkg.yml +++ b/.github/workflows/build-pkg.yml @@ -2,8 +2,8 @@ name: "build pkg" on: push: - branches: - - release + branches: + - ['tags'] jobs: publish-tauri: