From a9dcaf4c94493887baf173fa8e933ddb75f33063 Mon Sep 17 00:00:00 2001 From: terwer Date: Fri, 24 Feb 2023 21:54:55 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20#1=20=E4=BB=A3=E7=A0=81=E5=9D=97?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=8C=E9=A1=B9=E7=9B=AE=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 4 +- src/{App.tsx => apps/blog/BlogApp.tsx} | 10 +- src/{ => apps}/zhi/Lifecycle.ts | 0 src/{ => apps}/zhi/bootstrap.ts | 2 +- src/{main.tsx => blog-main.tsx} | 6 +- src/blog-theme.css | 134 ++++++++++++++++++ src/blog-theme.css.map | 7 + src/index.css | 99 ------------- src/{App.css => styles/app/BlogApp.css} | 34 ++--- src/styles/app/BlogApp.css.map | 7 + src/styles/common/common.css | 53 +++++++ src/styles/common/common.css.map | 7 + src/styles/common/common.sass | 26 ++++ .../zhi}/widgets/code-block.css | 0 src/{theme => styles/zhi}/widgets/webfont.css | 0 src/zhi-theme.sass | 12 +- src/zhi-theme.ts | 2 +- 17 files changed, 260 insertions(+), 143 deletions(-) rename src/{App.tsx => apps/blog/BlogApp.tsx} (90%) rename src/{ => apps}/zhi/Lifecycle.ts (100%) rename src/{ => apps}/zhi/bootstrap.ts (96%) rename src/{main.tsx => blog-main.tsx} (94%) create mode 100644 src/blog-theme.css create mode 100644 src/blog-theme.css.map delete mode 100644 src/index.css rename src/{App.css => styles/app/BlogApp.css} (81%) create mode 100644 src/styles/app/BlogApp.css.map create mode 100644 src/styles/common/common.css create mode 100644 src/styles/common/common.css.map create mode 100644 src/styles/common/common.sass rename src/{theme => styles/zhi}/widgets/code-block.css (100%) rename src/{theme => styles/zhi}/widgets/webfont.css (100%) diff --git a/index.html b/index.html index bb652a76..3d9676a7 100644 --- a/index.html +++ b/index.html @@ -29,10 +29,10 @@ - Vite + React + TS + 基于思源笔记的在线博客
- + diff --git a/src/App.tsx b/src/apps/blog/BlogApp.tsx similarity index 90% rename from src/App.tsx rename to src/apps/blog/BlogApp.tsx index 36328ec5..1b8f58dd 100644 --- a/src/App.tsx +++ b/src/apps/blog/BlogApp.tsx @@ -24,17 +24,17 @@ */ import { useState } from "react" -import reactLogo from "./assets/react.svg" -import "./App.css" +import reactLogo from "../../assets/react.svg" +import "../../styles/app/BlogApp.sass" -function App() { +function BlogApp() { const [count, setCount] = useState(0) return (
- Vite logo + Vite logo React logo @@ -56,4 +56,4 @@ function App() { ) } -export default App +export default BlogApp diff --git a/src/zhi/Lifecycle.ts b/src/apps/zhi/Lifecycle.ts similarity index 100% rename from src/zhi/Lifecycle.ts rename to src/apps/zhi/Lifecycle.ts diff --git a/src/zhi/bootstrap.ts b/src/apps/zhi/bootstrap.ts similarity index 96% rename from src/zhi/bootstrap.ts rename to src/apps/zhi/bootstrap.ts index 6fa5cdda..f9308a07 100644 --- a/src/zhi/bootstrap.ts +++ b/src/apps/zhi/bootstrap.ts @@ -23,7 +23,7 @@ * questions. */ -import Lifecycle from "~/src/zhi/Lifecycle" +import Lifecycle from "~/src/apps/zhi/Lifecycle" /** * zhi主题唯一激活入口 diff --git a/src/main.tsx b/src/blog-main.tsx similarity index 94% rename from src/main.tsx rename to src/blog-main.tsx index 0015bd89..86d0c9dd 100644 --- a/src/main.tsx +++ b/src/blog-main.tsx @@ -25,13 +25,13 @@ import React from "react" import ReactDOM from "react-dom/client" -import App from "./App" -import "./index.css" +import BlogApp from "./apps/blog/BlogApp" +import "./blog-theme.sass" import zhi from "~/src/zhi-theme" ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render( - + ) diff --git a/src/blog-theme.css b/src/blog-theme.css new file mode 100644 index 00000000..4599ecba --- /dev/null +++ b/src/blog-theme.css @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2023, Terwer . All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Terwer designates this + * particular file as subject to the "Classpath" exception as provided + * by Terwer in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com + * or visit www.terwer.space if you need additional information or have any + * questions. + */ + +@charset "UTF-8"; +/* Copyright (c) 2023, Terwer . All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Terwer designates this + * particular file as subject to the "Classpath" exception as provided + * by Terwer in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com + * or visit www.terwer.space if you need additional information or have any + * questions. + */ +/*! + * / Copyright (c) 2023, Terwer . All rights reserved. + * / DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * / + * / This code is free software; you can redistribute it and/or modify it + * / under the terms of the GNU General Public License version 2 only, as + * / published by the Free Software Foundation. Terwer designates this + * / particular file as subject to the "Classpath" exception as provided + * / by Terwer in the LICENSE file that accompanied this code. + * / + * / This code is distributed in the hope that it will be useful, but WITHOUT + * / ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * / FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * / version 2 for more details (a copy is included in the LICENSE file that + * / accompanied this code). + * / + * / You should have received a copy of the GNU General Public License version + * / 2 along with this work; if not, write to the Free Software Foundation, + * / Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * / + * / Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com + * / or visit www.terwer.space if you need additional information or have any + * / questions. + * / */ +/* 字体 */ +:root { + font-family: JetBrains Mono, LXGW WenKai, -apple-system, Microsoft YaHei, Times New Roman, 方正北魏楷书_GBK; + line-height: 1.5; + font-weight: 400; + color-scheme: light dark; + color: rgba(255, 255, 255, 0.87); + background-color: #242424; + font-synthesis: none; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + -webkit-text-size-adjust: 100%; } + +a { + font-weight: 500; + color: #646cff; + text-decoration: inherit; } + a:hover { + color: #535bf2; } + +body { + margin: 0; + display: flex; + place-items: center; + min-width: 320px; + min-height: 100vh; } + +h1 { + font-size: 3.2em; + line-height: 1.1; } + +button { + border-radius: 8px; + border: 1px solid transparent; + padding: 0.6em 1.2em; + font-size: 1em; + font-weight: 500; + font-family: inherit; + cursor: pointer; + transition: border-color 0.25s; + background-color: #1a1a1a; } + button:hover { + border-color: #646cff; } + +button:focus, +button:focus-visible { + outline: 4px auto -webkit-focus-ring-color; } + +@media (prefers-color-scheme: light) { + :root { + color: #213547; + background-color: #ffffff; } + + a:hover { + color: #747bff; } + + button { + background-color: #f9f9f9; } } + +/*# sourceMappingURL=blog-theme.css.map */ diff --git a/src/blog-theme.css.map b/src/blog-theme.css.map new file mode 100644 index 00000000..2e5bd185 --- /dev/null +++ b/src/blog-theme.css.map @@ -0,0 +1,7 @@ +{ +"version": 3, +"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,KAAM;EACJ,WAAW,EAAE,wFAAoB;EACjC,WAAW,EAAE,GAAG;EAChB,WAAW,EAAE,GAAG;EAChB,YAAY,EAAE,UAAU;EACxB,KAAK,EAAE,yBAAyB;EAChC,gBAAgB,EAAE,OAAO;EACzB,cAAc,EAAE,IAAI;EACpB,cAAc,EAAE,kBAAkB;EAClC,sBAAsB,EAAE,WAAW;EACnC,uBAAuB,EAAE,SAAS;EAClC,wBAAwB,EAAE,IAAI;;AAChC,CAAC;EACC,WAAW,EAAE,GAAG;EAChB,KAAK,EAAE,OAAO;EACd,eAAe,EAAE,OAAO;EACxB,OAAO;IACL,KAAK,EAAE,OAAO;;AAClB,IAAI;EACF,MAAM,EAAE,CAAC;EACT,OAAO,EAAE,IAAI;EACb,WAAW,EAAE,MAAM;EACnB,SAAS,EAAE,KAAK;EAChB,UAAU,EAAE,KAAK;;AACnB,EAAE;EACA,SAAS,EAAE,KAAK;EAChB,WAAW,EAAE,GAAG;;AAClB,MAAM;EACJ,aAAa,EAAE,GAAG;EAClB,MAAM,EAAE,qBAAqB;EAC7B,OAAO,EAAE,WAAW;EACpB,SAAS,EAAE,GAAG;EACd,WAAW,EAAE,GAAG;EAChB,WAAW,EAAE,OAAO;EACpB,MAAM,EAAE,OAAO;EACf,UAAU,EAAE,kBAAkB;EAC9B,gBAAgB,EAAE,OAAO;EACzB,YAAO;IACL,YAAY,EAAE,OAAO;;AACzB;oBAAa;EAEX,OAAO,EAAE,iCAAiC;;AAE5C,oCAAsC;EACpC,KAAM;IACJ,KAAK,EAAE,OAAO;IACd,gBAAgB,EAAE,OAAO;;EAC3B,OAAO;IACL,KAAK,EAAE,OAAO;;EAChB,MAAM;IACJ,gBAAgB,EAAE,OAAO", +"sources": ["blog-theme.sass"], +"names": [], +"file": "blog-theme.css" +} diff --git a/src/index.css b/src/index.css deleted file mode 100644 index b05e776d..00000000 --- a/src/index.css +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2023, Terwer . All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Terwer designates this - * particular file as subject to the "Classpath" exception as provided - * by Terwer in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com - * or visit www.terwer.space if you need additional information or have any - * questions. - */ - -:root { - font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; - line-height: 1.5; - font-weight: 400; - - color-scheme: light dark; - color: rgba(255, 255, 255, 0.87); - background-color: #242424; - - font-synthesis: none; - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - -webkit-text-size-adjust: 100%; -} - -a { - font-weight: 500; - color: #646cff; - text-decoration: inherit; -} - -a:hover { - color: #535bf2; -} - -body { - margin: 0; - display: flex; - place-items: center; - min-width: 320px; - min-height: 100vh; -} - -h1 { - font-size: 3.2em; - line-height: 1.1; -} - -button { - border-radius: 8px; - border: 1px solid transparent; - padding: 0.6em 1.2em; - font-size: 1em; - font-weight: 500; - font-family: inherit; - background-color: #1a1a1a; - cursor: pointer; - transition: border-color 0.25s; -} - -button:hover { - border-color: #646cff; -} - -button:focus, -button:focus-visible { - outline: 4px auto -webkit-focus-ring-color; -} - -@media (prefers-color-scheme: light) { - :root { - color: #213547; - background-color: #ffffff; - } - - a:hover { - color: #747bff; - } - - button { - background-color: #f9f9f9; - } -} diff --git a/src/App.css b/src/styles/app/BlogApp.css similarity index 81% rename from src/App.css rename to src/styles/app/BlogApp.css index 86f45799..3bf6e364 100644 --- a/src/App.css +++ b/src/styles/app/BlogApp.css @@ -22,48 +22,36 @@ * or visit www.terwer.space if you need additional information or have any * questions. */ - #root { max-width: 1280px; margin: 0 auto; padding: 2rem; - text-align: center; -} + text-align: center; } .logo { height: 6em; padding: 1.5em; will-change: filter; - transition: filter 300ms; -} + transition: filter 300ms; } .logo:hover { - filter: drop-shadow(0 0 2em #646cffaa); -} + filter: drop-shadow(0 0 2em #646cffaa); } .logo.react:hover { - filter: drop-shadow(0 0 2em #61dafbaa); -} + filter: drop-shadow(0 0 2em #61dafbaa); } @keyframes logo-spin { from { - transform: rotate(0deg); - } + transform: rotate(0deg); } to { - transform: rotate(360deg); - } -} - + transform: rotate(360deg); } } @media (prefers-reduced-motion: no-preference) { a:nth-of-type(2) .logo { - animation: logo-spin infinite 20s linear; - } -} - + animation: logo-spin infinite 20s linear; } } .card { - padding: 2em; -} + padding: 2em; } .read-the-docs { - color: #888; -} + color: #888; } + +/*# sourceMappingURL=BlogApp.css.map */ diff --git a/src/styles/app/BlogApp.css.map b/src/styles/app/BlogApp.css.map new file mode 100644 index 00000000..18931852 --- /dev/null +++ b/src/styles/app/BlogApp.css.map @@ -0,0 +1,7 @@ +{ +"version": 3, +"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAyBA,KAAK;EACH,SAAS,EAAE,MAAM;EACjB,MAAM,EAAE,MAAM;EACd,OAAO,EAAE,IAAI;EACb,UAAU,EAAE,MAAM;;AAEpB,KAAK;EACH,MAAM,EAAE,GAAG;EACX,OAAO,EAAE,KAAK;EACd,WAAW,EAAE,MAAM;EACnB,UAAU,EAAE,YAAY;;AAE1B,WAAW;EACT,MAAM,EAAE,8BAA8B;;AAGxC,iBAAiB;EACf,MAAM,EAAE,8BAA8B;;;;IAKpC,SAAS,EAAE,YAAY;;IAEvB,SAAS,EAAE,cAAc;AAE7B,8CAA8C;EAC5C,sBAAsB;IACpB,SAAS,EAAE,6BAA6B;AAG5C,KAAK;EACH,OAAO,EAAE,GAAG;;AAGd,cAAc;EACZ,KAAK,EAAE,IAAI", +"sources": ["BlogApp.sass"], +"names": [], +"file": "BlogApp.css" +} diff --git a/src/styles/common/common.css b/src/styles/common/common.css new file mode 100644 index 00000000..4e3a4252 --- /dev/null +++ b/src/styles/common/common.css @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2023, Terwer . All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Terwer designates this + * particular file as subject to the "Classpath" exception as provided + * by Terwer in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com + * or visit www.terwer.space if you need additional information or have any + * questions. + */ + +@charset "UTF-8"; +/*! + * / Copyright (c) 2023, Terwer . All rights reserved. + * / DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * / + * / This code is free software; you can redistribute it and/or modify it + * / under the terms of the GNU General Public License version 2 only, as + * / published by the Free Software Foundation. Terwer designates this + * / particular file as subject to the "Classpath" exception as provided + * / by Terwer in the LICENSE file that accompanied this code. + * / + * / This code is distributed in the hope that it will be useful, but WITHOUT + * / ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * / FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * / version 2 for more details (a copy is included in the LICENSE file that + * / accompanied this code). + * / + * / You should have received a copy of the GNU General Public License version + * / 2 along with this work; if not, write to the Free Software Foundation, + * / Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * / + * / Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com + * / or visit www.terwer.space if you need additional information or have any + * / questions. + * / */ +/* 字体 */ + +/*# sourceMappingURL=common.css.map */ diff --git a/src/styles/common/common.css.map b/src/styles/common/common.css.map new file mode 100644 index 00000000..68864e9f --- /dev/null +++ b/src/styles/common/common.css.map @@ -0,0 +1,7 @@ +{ +"version": 3, +"mappings": "", +"sources": [], +"names": [], +"file": "common.css" +} diff --git a/src/styles/common/common.sass b/src/styles/common/common.sass new file mode 100644 index 00000000..10f2fa14 --- /dev/null +++ b/src/styles/common/common.sass @@ -0,0 +1,26 @@ +/*! + / Copyright (c) 2023, Terwer . All rights reserved. + / DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + / + / This code is free software; you can redistribute it and/or modify it + / under the terms of the GNU General Public License version 2 only, as + / published by the Free Software Foundation. Terwer designates this + / particular file as subject to the "Classpath" exception as provided + / by Terwer in the LICENSE file that accompanied this code. + / + / This code is distributed in the hope that it will be useful, but WITHOUT + / ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + / FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + / version 2 for more details (a copy is included in the LICENSE file that + / accompanied this code). + / + / You should have received a copy of the GNU General Public License version + / 2 along with this work; if not, write to the Free Software Foundation, + / Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + / + / Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com + / or visit www.terwer.space if you need additional information or have any + / questions. + / +/* 字体 */ +$font-family-mono: "JetBrains Mono", "LXGW WenKai", "-apple-system", "Microsoft YaHei", "Times New Roman", "方正北魏楷书_GBK" \ No newline at end of file diff --git a/src/theme/widgets/code-block.css b/src/styles/zhi/widgets/code-block.css similarity index 100% rename from src/theme/widgets/code-block.css rename to src/styles/zhi/widgets/code-block.css diff --git a/src/theme/widgets/webfont.css b/src/styles/zhi/widgets/webfont.css similarity index 100% rename from src/theme/widgets/webfont.css rename to src/styles/zhi/widgets/webfont.css diff --git a/src/zhi-theme.sass b/src/zhi-theme.sass index d656c005..6e091fb1 100644 --- a/src/zhi-theme.sass +++ b/src/zhi-theme.sass @@ -22,16 +22,10 @@ / or visit www.terwer.space if you need additional information or have any / questions. / -//$primary_color: #504a4a -//body -// .protyle -// background: $primary_color +@import "./styles/zhi/widgets/webfont.css" +@import "./styles/zhi/widgets/code-block.css" -@import "./theme/widgets/webfont.css" -@import "./theme/widgets/code-block.css" - -/* 字体 */ -$font-family-mono: "JetBrains Mono", "LXGW WenKai", "-apple-system", "Microsoft YaHei", "Times New Roman", "方正北魏楷书_GBK" +@import "./styles/common/common.sass" \:root --b3-font-family: #{$font-family-mono} diff --git a/src/zhi-theme.ts b/src/zhi-theme.ts index 08cef1f1..e5298138 100644 --- a/src/zhi-theme.ts +++ b/src/zhi-theme.ts @@ -24,7 +24,7 @@ */ import strUtil from "~/src/utils/strUtil" -import { Bootstrap } from "~/src/zhi/bootstrap" +import { Bootstrap } from "~/src/apps/zhi/bootstrap" import { version } from "~/package.json" /**