From 5589cfd6a5b15e00f88264597b888a9a34f875fe Mon Sep 17 00:00:00 2001 From: aumetra Date: Tue, 26 Nov 2024 23:09:22 +0100 Subject: [PATCH] build css ahead of time --- kitsune-fe/tailwind.config.ts | 17 +------- kitsune/assets/app.css | 1 + kitsune/package.json | 18 +++++++++ kitsune/styles/app.css | 3 ++ kitsune/tailwind.config.ts | 17 ++++++++ kitsune/templates/base.html | 33 ++++++--------- kitsune/templates/fallback-fallback.html | 2 +- kitsune/templates/oauth/login.html | 51 +++++++++++++----------- kitsune/templates/oauth/token.html | 21 ++++------ kitsune/theme.ts | 19 +++++++++ pnpm-lock.yaml | 26 +++++++++++- pnpm-workspace.yaml | 1 + website/package.json | 4 +- 13 files changed, 137 insertions(+), 76 deletions(-) create mode 100644 kitsune/assets/app.css create mode 100644 kitsune/package.json create mode 100644 kitsune/styles/app.css create mode 100644 kitsune/tailwind.config.ts create mode 100644 kitsune/theme.ts diff --git a/kitsune-fe/tailwind.config.ts b/kitsune-fe/tailwind.config.ts index b1314168d..c5877b1c2 100644 --- a/kitsune-fe/tailwind.config.ts +++ b/kitsune-fe/tailwind.config.ts @@ -1,5 +1,6 @@ import forms from '@tailwindcss/forms'; import typography from '@tailwindcss/typography'; +import { extendTheme } from '../kitsune/theme'; import type { Config } from 'tailwindcss'; @@ -8,21 +9,7 @@ export default { theme: { extend: { - colors: { - dark: { - '1': '#1c1626', - '2': '#2b233a', - '3': '#042f40' - }, - shade1: { - dark: '#ff9e55', - light: '#afd7fa' - }, - shade2: { - dark: '#935d7e', - light: '#d68fbc' - } - } + ...extendTheme } }, diff --git a/kitsune/assets/app.css b/kitsune/assets/app.css new file mode 100644 index 000000000..f6dbfb5bf --- /dev/null +++ b/kitsune/assets/app.css @@ -0,0 +1 @@ +*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.15 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}[multiple],[type=date],[type=datetime-local],[type=email],[type=month],[type=number],[type=password],[type=search],[type=tel],[type=text],[type=time],[type=url],[type=week],input:where(:not([type])),select,textarea{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border-color:#6b7280;border-width:1px;border-radius:0;padding:.5rem .75rem;font-size:1rem;line-height:1.5rem;--tw-shadow:0 0 #0000}[multiple]:focus,[type=date]:focus,[type=datetime-local]:focus,[type=email]:focus,[type=month]:focus,[type=number]:focus,[type=password]:focus,[type=search]:focus,[type=tel]:focus,[type=text]:focus,[type=time]:focus,[type=url]:focus,[type=week]:focus,input:where(:not([type])):focus,select:focus,textarea:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-inset:var(--tw-empty,/*!*/ /*!*/);--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#2563eb;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);border-color:#2563eb}input::-moz-placeholder,textarea::-moz-placeholder{color:#6b7280;opacity:1}input::placeholder,textarea::placeholder{color:#6b7280;opacity:1}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-date-and-time-value{min-height:1.5em;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-year-field{padding-top:0;padding-bottom:0}select{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");background-position:right .5rem center;background-repeat:no-repeat;background-size:1.5em 1.5em;padding-right:2.5rem;-webkit-print-color-adjust:exact;print-color-adjust:exact}[multiple],[size]:where(select:not([size="1"])){background-image:none;background-position:0 0;background-repeat:unset;background-size:initial;padding-right:.75rem;-webkit-print-color-adjust:unset;print-color-adjust:unset}[type=checkbox],[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:0;-webkit-print-color-adjust:exact;print-color-adjust:exact;display:inline-block;vertical-align:middle;background-origin:border-box;-webkit-user-select:none;-moz-user-select:none;user-select:none;flex-shrink:0;height:1rem;width:1rem;color:#2563eb;background-color:#fff;border-color:#6b7280;border-width:1px;--tw-shadow:0 0 #0000}[type=checkbox]{border-radius:0}[type=radio]{border-radius:100%}[type=checkbox]:focus,[type=radio]:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-inset:var(--tw-empty,/*!*/ /*!*/);--tw-ring-offset-width:2px;--tw-ring-offset-color:#fff;--tw-ring-color:#2563eb;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}[type=checkbox]:checked,[type=radio]:checked{border-color:transparent;background-color:currentColor;background-size:100% 100%;background-position:50%;background-repeat:no-repeat}[type=checkbox]:checked{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 16 16'%3E%3Cpath d='M12.207 4.793a1 1 0 0 1 0 1.414l-5 5a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L6.5 9.086l4.293-4.293a1 1 0 0 1 1.414 0'/%3E%3C/svg%3E")}@media (forced-colors:active) {[type=checkbox]:checked{-webkit-appearance:auto;-moz-appearance:auto;appearance:auto}}[type=radio]:checked{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='3'/%3E%3C/svg%3E")}@media (forced-colors:active) {[type=radio]:checked{-webkit-appearance:auto;-moz-appearance:auto;appearance:auto}}[type=checkbox]:checked:focus,[type=checkbox]:checked:hover,[type=radio]:checked:focus,[type=radio]:checked:hover{border-color:transparent;background-color:currentColor}[type=checkbox]:indeterminate{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3E%3Cpath stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3E%3C/svg%3E");border-color:transparent;background-color:currentColor;background-size:100% 100%;background-position:50%;background-repeat:no-repeat}@media (forced-colors:active) {[type=checkbox]:indeterminate{-webkit-appearance:auto;-moz-appearance:auto;appearance:auto}}[type=checkbox]:indeterminate:focus,[type=checkbox]:indeterminate:hover{border-color:transparent;background-color:currentColor}[type=file]{background:unset;border-color:inherit;border-width:0;border-radius:0;padding:0;font-size:unset;line-height:inherit}[type=file]:focus{outline:1px solid ButtonText;outline:1px auto -webkit-focus-ring-color}.block{display:block}.hidden{display:none} \ No newline at end of file diff --git a/kitsune/package.json b/kitsune/package.json new file mode 100644 index 000000000..e2b133261 --- /dev/null +++ b/kitsune/package.json @@ -0,0 +1,18 @@ +{ + "name": "kitsune", + "version": "0.1.0", + "private": true, + "scripts": { + "build": "tailwindcss -i styles/app.css -o assets/app.css --minify", + "dev": "tailwindcss -i styles/tailwind.css -o assets/app.css --watch", + "fmt": "prettier --write --ignore-unknown --cache ." + }, + "devDependencies": { + "@tailwindcss/forms": "^0.5.9", + "@tailwindcss/typography": "^0.5.15", + "@trivago/prettier-plugin-sort-imports": "^4.3.0", + "prettier": "^3.4.1", + "prettier-plugin-tailwindcss": "^0.6.9", + "tailwindcss": "^3.4.15" + } +} \ No newline at end of file diff --git a/kitsune/styles/app.css b/kitsune/styles/app.css new file mode 100644 index 000000000..b5c61c956 --- /dev/null +++ b/kitsune/styles/app.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; diff --git a/kitsune/tailwind.config.ts b/kitsune/tailwind.config.ts new file mode 100644 index 000000000..79b83645e --- /dev/null +++ b/kitsune/tailwind.config.ts @@ -0,0 +1,17 @@ +import forms from "@tailwindcss/forms"; +import typography from "@tailwindcss/typography"; +import { extendTheme } from "./theme"; + +import type { Config } from "tailwindcss"; + +export default { + content: ["./templates/**/*.{html,js,ts}"], + + theme: { + extend: { + ...extendTheme, + }, + }, + + plugins: [typography, forms], +} as Config; diff --git a/kitsune/templates/base.html b/kitsune/templates/base.html index 36a748e9e..81b9cbd43 100644 --- a/kitsune/templates/base.html +++ b/kitsune/templates/base.html @@ -1,24 +1,17 @@ - + + + + + + - - - - - + {% block head %} {% endblock %} - {% block head %} - {% endblock %} + {% block title %} {% endblock %} + - - {% block title %} - {% endblock %} - - - - - {% block body %} - {% endblock %} - - - \ No newline at end of file + + {% block body %} {% endblock %} + + diff --git a/kitsune/templates/fallback-fallback.html b/kitsune/templates/fallback-fallback.html index 45211a2c9..7a3d043e8 100644 --- a/kitsune/templates/fallback-fallback.html +++ b/kitsune/templates/fallback-fallback.html @@ -1,4 +1,4 @@ - + Welcome to Kitsune! diff --git a/kitsune/templates/oauth/login.html b/kitsune/templates/oauth/login.html index ac29594e0..e92724f06 100644 --- a/kitsune/templates/oauth/login.html +++ b/kitsune/templates/oauth/login.html @@ -1,25 +1,30 @@ -{% extends "../base.html" %} +{% extends "../base.html" %} {% block title %}OAuth Login{% endblock %} {% block +body %} +

Kitsune

-{% block title %} - OAuth Login -{% endblock %} - -{% block body %} -

Kitsune

+{% for (_level, msg) in flash_messages %} +
{{ msg }}
+{% endfor %} - {% for (_level, msg) in flash_messages %} -
- {{ msg }} -
- {% endfor %} - -
-
-
-
-
-

-
- -
-{% endblock %} \ No newline at end of file +
+
+
+
+
+

+
+ +
+{% endblock %} diff --git a/kitsune/templates/oauth/token.html b/kitsune/templates/oauth/token.html index 9c03e9f9b..75af4ccba 100644 --- a/kitsune/templates/oauth/token.html +++ b/kitsune/templates/oauth/token.html @@ -1,16 +1,9 @@ -{% extends "../base.html" %} +{% extends "../base.html" %} {% block title %} OAuth Token {% endblock %} {% +block body %} +

{{domain}}

-{% block title %} - OAuth Token +
+

Copy & Paste this token into {{app_name}}

+ {{token}} +
{% endblock %} - -{% block body %} -

- {{domain}} -

- -
-

Copy & Paste this token into {{app_name}}

- {{token}} -
-{% endblock %} \ No newline at end of file diff --git a/kitsune/theme.ts b/kitsune/theme.ts new file mode 100644 index 000000000..9525240bd --- /dev/null +++ b/kitsune/theme.ts @@ -0,0 +1,19 @@ +const extendTheme = { + colors: { + dark: { + "1": "#1c1626", + "2": "#2b233a", + "3": "#042f40", + }, + shade1: { + dark: "#ff9e55", + light: "#afd7fa", + }, + shade2: { + dark: "#935d7e", + light: "#d68fbc", + }, + }, +}; + +export { extendTheme }; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bb7083c47..0df3d0682 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,6 +6,30 @@ settings: importers: + kitsune: + devDependencies: + '@tailwindcss/forms': + specifier: ^0.5.9 + version: 0.5.9(tailwindcss@3.4.15) + '@tailwindcss/typography': + specifier: ^0.5.15 + version: 0.5.15(tailwindcss@3.4.15) + '@trivago/prettier-plugin-sort-imports': + specifier: ^4.3.0 + version: 4.3.0(prettier@3.4.1) + autoprefixer: + specifier: ^10.4.20 + version: 10.4.20(postcss@8.4.49) + prettier: + specifier: ^3.4.1 + version: 3.4.1 + prettier-plugin-tailwindcss: + specifier: ^0.6.9 + version: 0.6.9(@trivago/prettier-plugin-sort-imports@4.3.0(prettier@3.4.1))(prettier-plugin-astro@0.14.1)(prettier-plugin-css-order@2.1.2(postcss@8.4.49)(prettier@3.4.1))(prettier-plugin-svelte@3.3.2(prettier@3.4.1)(svelte@5.2.9))(prettier@3.4.1) + tailwindcss: + specifier: ^3.4.15 + version: 3.4.15 + kitsune-fe: devDependencies: '@iconify-json/eos-icons': @@ -4178,7 +4202,7 @@ snapshots: '@babel/generator@7.17.7': dependencies: - '@babel/types': 7.17.0 + '@babel/types': 7.26.0 jsesc: 2.5.2 source-map: 0.5.7 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 359192ead..c96708173 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,3 +1,4 @@ packages: + - kitsune/ - kitsune-fe/ - website/ diff --git a/website/package.json b/website/package.json index b9a5c618a..6b1f1897a 100644 --- a/website/package.json +++ b/website/package.json @@ -8,7 +8,7 @@ "build": "astro check && astro build", "preview": "astro preview", "astro": "astro", - "format": "prettier -w . --cache" + "fmt": "prettier -w . --cache" }, "dependencies": { "@astrojs/check": "^0.9.4", @@ -23,4 +23,4 @@ "prettier-plugin-astro": "^0.14.1", "sass": "^1.81.0" } -} +} \ No newline at end of file