Use Symfony UX Twig
Some checks failed
Quality Check / QS Frontend (push) Failing after 13s
Quality Check / QS Mixed (push) Failing after 11s
Quality Check / QS Backend (push) Successful in 14s

This commit is contained in:
Snoweuph 2024-07-20 08:38:12 +02:00
parent 9e60830cd2
commit d0ec79fd71
Signed by: Snoweuph
GPG key ID: 0021ADF278B2F49B
53 changed files with 840 additions and 817 deletions

View file

@ -20,8 +20,8 @@ jobs:
working-directory: app/frontend working-directory: app/frontend
run: "node ../node_modules/typescript/bin/tsc --noEmit" run: "node ../node_modules/typescript/bin/tsc --noEmit"
- name: "Stylelint" - name: "Stylelint"
working-directory: app/frontend/styles working-directory: app/frontend
run: "node ../../node_modules/stylelint/bin/stylelint.mjs ." run: "node ../node_modules/stylelint/bin/stylelint.mjs ."
- name: "ESLint" - name: "ESLint"
working-directory: app working-directory: app
run: "node node_modules/eslint/bin/eslint.js frontend" run: "node node_modules/eslint/bin/eslint.js frontend"

View file

@ -1,8 +1,8 @@
_default: _default:
@bin/just/choose.sh {{ source_file() }} choose @bin/just/choose.sh {{ source_file() }} choose
mod backend mod backend 'app/backend/mod.just'
mod frontend mod frontend 'app/frontend/mod.just'
alias i := install alias i := install
alias start := up alias start := up
@ -69,7 +69,7 @@ lint linter="":
just frontend::lint all && just backend::lint;; just frontend::lint all && just backend::lint;;
*PHP*) just backend::lint ;; *PHP*) just backend::lint ;;
*TS*) just frontend::lint TS ;; *TS*) just frontend::lint TS ;;
*SCSS*) just frontend::lint all SCSS ;; *SCSS*) just frontend::lint SCSS ;;
*Twig*) just frontend::lint TWIG ;; *Twig*) just frontend::lint TWIG ;;
esac esac

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 257"><circle cx="128" cy="128.827" r="128" fill="#1a171b"/><path fill="#fff" d="M183.706 48.124c-12.986.453-24.32 7.61-32.757 17.51c-9.342 10.855-15.557 23.73-20.035 36.872c-8.01-6.565-14.19-15.064-27.041-18.77c-9.933-2.852-20.366-1.674-29.96 5.474c-4.545 3.395-7.676 8.527-9.165 13.351c-3.855 12.537 4.053 23.694 7.645 27.7l7.853 8.416c1.619 1.65 5.518 5.955 3.612 12.127c-2.06 6.71-10.15 11.055-18.448 8.495c-3.706-1.13-9.03-3.891-7.838-7.779c.493-1.59 1.631-2.78 2.241-4.155c.56-1.181.827-2.067.997-2.587c1.516-4.95-.555-11.39-5.857-13.025c-4.946-1.516-10.007-.315-11.969 6.054c-2.225 7.235 1.237 20.366 19.783 26.084c21.729 6.676 40.11-5.155 42.717-20.586c1.642-9.665-2.722-16.845-10.717-26.08l-6.514-7.204c-3.946-3.942-5.301-10.661-1.217-15.825c3.446-4.356 8.354-6.215 16.392-4.029c11.733 3.186 16.963 11.327 25.69 17.893c-3.603 11.819-5.958 23.682-8.09 34.32l-1.299 7.931c-6.238 32.721-11 50.688-23.375 61.003c-2.493 1.773-6.057 4.427-11.429 4.612c-2.816.087-3.726-1.85-3.765-2.694c-.067-1.977 1.599-2.883 2.706-3.773c1.654-.902 4.155-2.398 3.985-7.191c-.18-5.664-4.872-10.575-11.654-10.35c-5.08.173-12.823 4.954-12.532 13.705c.303 9.039 8.728 15.813 21.43 15.384c6.79-.233 21.952-2.997 36.895-20.76c17.392-20.362 22.256-43.705 25.915-60.79l4.084-22.556c2.269.272 4.695.453 7.334.516c21.661.457 32.496-10.763 32.657-18.924c.107-4.939-3.241-9.799-7.928-9.689c-3.355.095-7.57 2.328-8.582 6.968c-.988 4.552 6.893 8.66.733 12.65c-4.376 2.832-12.221 4.828-23.269 3.206l2.009-11.103c4.1-21.055 9.157-46.954 28.341-47.584c1.398-.071 6.514.063 6.633 3.446c.035 1.13-.245 1.418-1.568 4.005c-1.347 2.017-1.855 3.734-1.792 5.707c.185 5.376 4.273 8.909 10.185 8.696c7.916-.256 10.193-7.963 10.063-11.921c-.32-9.3-10.122-15.175-23.1-14.75"/></svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -27,7 +27,7 @@ final readonly class TestController
{ {
return new Response( return new Response(
$this->twig->render( $this->twig->render(
'base.html.twig' 'sites/index.html.twig'
) )
); );
} }

View file

@ -1,17 +1,19 @@
__default: __default:
@../bin/just/choose.sh {{ source_file() }} choose @../../bin/just/choose.sh {{ source_file() }} choose
# Checks whether the requriements are met # Checks whether the requriements are met
[group('main')] [group('main')]
check: check:
#!/bin/bash #!/bin/bash
source ../bin/just/colors.sh source ../../bin/just/colors.sh
source ../bin/just/check.sh source ../../bin/just/check.sh
printf "${BLUE_BG}${BLACK_FG} Checking Backend Requirements ${CLEAR}\n" printf "${BLUE_BG}${BLACK_FG} Checking Backend Requirements ${CLEAR}\n"
cd .. cd ..
check_cmd "php" "Php" check_cmd "php" "Php"
check_cmd "composer" "Composer" check_cmd "composer" "Composer"
check_cmd "symfony" "Symfony cli"
current_composer_version=$(composer --version 2>/dev/null | awk '{print $3}' | cut -d '.' -f 1) current_composer_version=$(composer --version 2>/dev/null | awk '{print $3}' | cut -d '.' -f 1)
if [ "${current_composer_version}" = "2" ]; then if [ "${current_composer_version}" = "2" ]; then
printf >&2 "${GREEN_FG}✔ Composer${BLUE_FG} Version ${GREEN_FG}${current_composer_version}${BLUE_FG} is ${GREEN_FG}installed${BLUE_FG}.\n" printf >&2 "${GREEN_FG}✔ Composer${BLUE_FG} Version ${GREEN_FG}${current_composer_version}${BLUE_FG} is ${GREEN_FG}installed${BLUE_FG}.\n"
@ -19,8 +21,6 @@ check:
printf >&2 "${RED_FG}✘ Wrong Composer Version${YELLOW_FG} is installed!\n Version ${RED_FG}2${YELLOW_FG} is ${RED_FG}required${YELLOW_FG}.\n" printf >&2 "${RED_FG}✘ Wrong Composer Version${YELLOW_FG} is installed!\n Version ${RED_FG}2${YELLOW_FG} is ${RED_FG}required${YELLOW_FG}.\n"
error = 1 error = 1
fi fi
check_cmd "symfony" "Symfony cli"
required_php_version=$(cat .php-version) required_php_version=$(cat .php-version)
current_php_version=$(symfony php -r "echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;") current_php_version=$(symfony php -r "echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;")
if [ "${current_php_version}" = "${required_php_version}" ]; then if [ "${current_php_version}" = "${required_php_version}" ]; then
@ -34,7 +34,12 @@ check:
check "[ $(php -m | grep -c pdo_mysql) -eq 1 ]" "Php Mysql PDO" check "[ $(php -m | grep -c pdo_mysql) -eq 1 ]" "Php Mysql PDO"
check_cmd "docker" "Docker" check_cmd "docker" "Docker"
check "$(docker compose version >/dev/null 2>&1)" "Docker Compose" if [[ "$(docker compose version 2>&1)" == "Docker Compose version v"* ]]; then
printf >&2 "${GREEN_FG}✔ Docker Compose${BLUE_FG} is ${GREEN_FG}installed${BLUE_FG}.\n"
else
printf >&2 "${RED_FG}✘ Docker Compose${YELLOW_FG} is ${RED_FG}not installed${YELLOW_FG}! \n"
error=1
fi
if ((error > 0 )); then if ((error > 0 )); then
exit 1 exit 1

View file

@ -1,5 +1,3 @@
version: '3'
services: services:
mysql: mysql:
container_name: 'euph-website_mysql' container_name: 'euph-website_mysql'

View file

@ -23,11 +23,14 @@
"symfony/flex": "^2", "symfony/flex": "^2",
"symfony/form": "7.1.*", "symfony/form": "7.1.*",
"symfony/framework-bundle": "7.1.*", "symfony/framework-bundle": "7.1.*",
"symfony/http-client": "7.1.*",
"symfony/monolog-bundle": "^3.0", "symfony/monolog-bundle": "^3.0",
"symfony/runtime": "7.1.*", "symfony/runtime": "7.1.*",
"symfony/stimulus-bundle": "^2.12", "symfony/stimulus-bundle": "^2.18",
"symfony/twig-bundle": "7.1.*", "symfony/twig-bundle": "7.1.*",
"symfony/uid": "7.1.*", "symfony/uid": "7.1.*",
"symfony/ux-icons": "^2.18",
"symfony/ux-twig-component": "*",
"symfony/validator": "7.1.*", "symfony/validator": "7.1.*",
"symfony/webpack-encore-bundle": "^2.1", "symfony/webpack-encore-bundle": "^2.1",
"symfony/yaml": "7.1.*", "symfony/yaml": "7.1.*",

345
app/composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "ee85551bd6012966efcff3c2d44a4b98", "content-hash": "21f94f5ff4dac04b4bfc19b949fcea8c",
"packages": [ "packages": [
{ {
"name": "dflydev/dot-access-data", "name": "dflydev/dot-access-data",
@ -3675,6 +3675,178 @@
], ],
"time": "2024-06-28T08:00:31+00:00" "time": "2024-06-28T08:00:31+00:00"
}, },
{
"name": "symfony/http-client",
"version": "v7.1.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-client.git",
"reference": "90ace27d17ccc9afc6f7ec0081e8529fb0e29425"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-client/zipball/90ace27d17ccc9afc6f7ec0081e8529fb0e29425",
"reference": "90ace27d17ccc9afc6f7ec0081e8529fb0e29425",
"shasum": ""
},
"require": {
"php": ">=8.2",
"psr/log": "^1|^2|^3",
"symfony/deprecation-contracts": "^2.5|^3",
"symfony/http-client-contracts": "^3.4.1",
"symfony/service-contracts": "^2.5|^3"
},
"conflict": {
"php-http/discovery": "<1.15",
"symfony/http-foundation": "<6.4"
},
"provide": {
"php-http/async-client-implementation": "*",
"php-http/client-implementation": "*",
"psr/http-client-implementation": "1.0",
"symfony/http-client-implementation": "3.0"
},
"require-dev": {
"amphp/amp": "^2.5",
"amphp/http-client": "^4.2.1",
"amphp/http-tunnel": "^1.0",
"amphp/socket": "^1.1",
"guzzlehttp/promises": "^1.4|^2.0",
"nyholm/psr7": "^1.0",
"php-http/httplug": "^1.0|^2.0",
"psr/http-client": "^1.0",
"symfony/dependency-injection": "^6.4|^7.0",
"symfony/http-kernel": "^6.4|^7.0",
"symfony/messenger": "^6.4|^7.0",
"symfony/process": "^6.4|^7.0",
"symfony/rate-limiter": "^6.4|^7.0",
"symfony/stopwatch": "^6.4|^7.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\HttpClient\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously",
"homepage": "https://symfony.com",
"keywords": [
"http"
],
"support": {
"source": "https://github.com/symfony/http-client/tree/v7.1.2"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-06-28T08:00:31+00:00"
},
{
"name": "symfony/http-client-contracts",
"version": "v3.5.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-client-contracts.git",
"reference": "20414d96f391677bf80078aa55baece78b82647d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/20414d96f391677bf80078aa55baece78b82647d",
"reference": "20414d96f391677bf80078aa55baece78b82647d",
"shasum": ""
},
"require": {
"php": ">=8.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "3.5-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"autoload": {
"psr-4": {
"Symfony\\Contracts\\HttpClient\\": ""
},
"exclude-from-classmap": [
"/Test/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Generic abstractions related to HTTP clients",
"homepage": "https://symfony.com",
"keywords": [
"abstractions",
"contracts",
"decoupling",
"interfaces",
"interoperability",
"standards"
],
"support": {
"source": "https://github.com/symfony/http-client-contracts/tree/v3.5.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-04-18T09:32:20+00:00"
},
{ {
"name": "symfony/http-foundation", "name": "symfony/http-foundation",
"version": "v7.1.1", "version": "v7.1.1",
@ -5786,6 +5958,177 @@
], ],
"time": "2024-05-31T14:57:53+00:00" "time": "2024-05-31T14:57:53+00:00"
}, },
{
"name": "symfony/ux-icons",
"version": "v2.18.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/ux-icons.git",
"reference": "a00140b15feb16a0d991ee04e115f2a15b0d9941"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/ux-icons/zipball/a00140b15feb16a0d991ee04e115f2a15b0d9941",
"reference": "a00140b15feb16a0d991ee04e115f2a15b0d9941",
"shasum": ""
},
"require": {
"php": ">=8.1",
"symfony/framework-bundle": "^6.4|^7.0",
"symfony/twig-bundle": "^6.4|^7.0"
},
"conflict": {
"symfony/flex": "<1.13"
},
"require-dev": {
"symfony/asset-mapper": "^6.4|^7.0",
"symfony/console": "^6.4|^7.0",
"symfony/http-client": "6.4|^7.0",
"symfony/phpunit-bridge": "^6.3|^7.0",
"symfony/ux-twig-component": "^2.14",
"zenstruck/console-test": "^1.5"
},
"type": "symfony-bundle",
"extra": {
"thanks": {
"name": "symfony/ux",
"url": "https://github.com/symfony/ux"
}
},
"autoload": {
"psr-4": {
"Symfony\\UX\\Icons\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kevin Bond",
"email": "kevinbond@gmail.com"
},
{
"name": "Simon André",
"email": "smn.andre@gmail.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Renders local and remote SVG icons in your Twig templates.",
"homepage": "https://symfony.com",
"keywords": [
"icons",
"svg",
"symfony-ux",
"twig"
],
"support": {
"source": "https://github.com/symfony/ux-icons/tree/v2.18.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-06-07T23:22:02+00:00"
},
{
"name": "symfony/ux-twig-component",
"version": "v2.18.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/ux-twig-component.git",
"reference": "c5ba36dc0f55b75d4c6d7dc546dfdbe4002f82e7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/ux-twig-component/zipball/c5ba36dc0f55b75d4c6d7dc546dfdbe4002f82e7",
"reference": "c5ba36dc0f55b75d4c6d7dc546dfdbe4002f82e7",
"shasum": ""
},
"require": {
"php": ">=8.1",
"symfony/dependency-injection": "^5.4|^6.0|^7.0",
"symfony/deprecation-contracts": "^2.2|^3.0",
"symfony/event-dispatcher": "^5.4|^6.0|^7.0",
"symfony/property-access": "^5.4|^6.0|^7.0",
"twig/twig": "^3.8"
},
"conflict": {
"symfony/config": "<5.4.0"
},
"require-dev": {
"symfony/console": "^5.4|^6.0|^7.0",
"symfony/css-selector": "^5.4|^6.0|^7.0",
"symfony/dom-crawler": "^5.4|^6.0|^7.0",
"symfony/framework-bundle": "^5.4|^6.0|^7.0",
"symfony/phpunit-bridge": "^6.0|^7.0",
"symfony/stimulus-bundle": "^2.9.1",
"symfony/stopwatch": "^5.4|^6.0|^7.0",
"symfony/twig-bundle": "^5.4|^6.0|^7.0",
"symfony/webpack-encore-bundle": "^1.15"
},
"type": "symfony-bundle",
"extra": {
"thanks": {
"name": "symfony/ux",
"url": "https://github.com/symfony/ux"
}
},
"autoload": {
"psr-4": {
"Symfony\\UX\\TwigComponent\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Twig components for Symfony",
"homepage": "https://symfony.com",
"keywords": [
"components",
"symfony-ux",
"twig"
],
"support": {
"source": "https://github.com/symfony/ux-twig-component/tree/v2.18.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-06-11T18:51:33+00:00"
},
{ {
"name": "symfony/validator", "name": "symfony/validator",
"version": "v7.1.2", "version": "v7.1.2",

View file

@ -16,4 +16,6 @@ return [
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true], Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
Presta\SitemapBundle\PrestaSitemapBundle::class => ['all' => true], Presta\SitemapBundle\PrestaSitemapBundle::class => ['all' => true],
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true], Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
Symfony\UX\TwigComponent\TwigComponentBundle::class => ['all' => true],
Symfony\UX\Icons\UXIconsBundle::class => ['all' => true],
]; ];

View file

@ -0,0 +1,5 @@
twig_component:
anonymous_template_directory: 'components/'
defaults:
# Namespace & directory for components
App\Components\: 'components/'

View file

@ -7,9 +7,9 @@ controllers:
presta_sitemap: presta_sitemap:
resource: "@PrestaSitemapBundle/config/routing.yml" resource: "@PrestaSitemapBundle/config/routing.yml"
when@dev: #when@dev:
test_style: # test_style:
path: /test/styles # path: /test/styles
controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController # controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController
defaults: # defaults:
template: 'test/styles.html.twig' # template: 'test/styles.html.twig'

View file

@ -12,6 +12,12 @@
"ecmaVersion": "latest", "ecmaVersion": "latest",
"sourceType": "module" "sourceType": "module"
}, },
"overrides": [
{
"files": ["*.svelte"],
"parser": "svelte-eslint-parser"
}
],
"plugins": [ "plugins": [
"@typescript-eslint" "@typescript-eslint"
], ],

View file

@ -0,0 +1,4 @@
*.ts
*.twig
*.json
mod.just

View file

@ -1,3 +1,45 @@
import '@styles/app.scss'; import '@styles/app.scss';
import '@pkg/stimulus'; import '@pkg/stimulus';
import '@pkg/flowbite';
import {Theme, THEME_LOCAL_STORAGE_ID} from '#const/theme';
const DARK_MODE_QUERY: MediaQueryList = window.matchMedia('(prefers-color-scheme: dark)');
function initTheme(): void {
handleTheme(DARK_MODE_QUERY.matches);
DARK_MODE_QUERY.addEventListener('change', handleThemeChange);
}
function handleThemeChange(e: MediaQueryListEvent): void {
handleTheme(e.matches);
}
function handleTheme(prefersDark: boolean): void {
const theme = localStorage[THEME_LOCAL_STORAGE_ID];
if (theme === Theme.DARK) {
document.documentElement.classList.add(Theme.DARK);
console.log('explicit dark');
} else if (!(THEME_LOCAL_STORAGE_ID in localStorage) && prefersDark) {
document.documentElement.classList.add(Theme.DARK);
console.log('implicit dark');
} else {
document.documentElement.classList.remove(Theme.DARK);
console.log('light');
}
}
export {initTheme};
// On page load or when changing themes, best to add inline in `head` to avoid FOUC
// Whenever the user explicitly chooses light mode
//localStorage.theme = 'light';
// Whenever the user explicitly chooses dark mode
//localStorage.theme = 'dark';
// Whenever the user explicitly chooses to respect the OS preference
//localStorage.removeItem('theme');
initTheme();

View file

@ -1,5 +0,0 @@
declare enum HttpCodes {
OK = 200
}
export {HttpCodes};

View file

@ -1,12 +0,0 @@
import {Controller} from '@hotwired/stimulus';
export default class extends Controller {
static targets: Array<string> = ['container'];
declare readonly containerTarget: HTMLElement;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
afterLoad(identifier: string, application: HTMLElement): void {
console.log(this.containerTarget);
}
}

View file

@ -1,40 +0,0 @@
import {Theme, THEME_LOCAL_STORAGE_ID} from '@const/theme';
const DARK_MODE_QUERY: MediaQueryList = window.matchMedia('(prefers-color-scheme: dark)');
function initTheme(): void {
handleTheme(DARK_MODE_QUERY.matches);
DARK_MODE_QUERY.addEventListener('change', handleThemeChange);
}
function handleThemeChange(e: MediaQueryListEvent): void {
handleTheme(e.matches);
}
function handleTheme(prefersDark: boolean): void {
const theme = localStorage[THEME_LOCAL_STORAGE_ID];
if (theme === Theme.DARK) {
document.documentElement.classList.add(Theme.DARK);
console.log('explicit dark');
} else if (!(THEME_LOCAL_STORAGE_ID in localStorage) && prefersDark) {
document.documentElement.classList.add(Theme.DARK);
console.log('implicit dark');
} else {
document.documentElement.classList.remove(Theme.DARK);
console.log('light');
}
}
export {initTheme};
// On page load or when changing themes, best to add inline in `head` to avoid FOUC
// Whenever the user explicitly chooses light mode
//localStorage.theme = 'light';
// Whenever the user explicitly chooses dark mode
//localStorage.theme = 'dark';
// Whenever the user explicitly chooses to respect the OS preference
//localStorage.removeItem('theme');

View file

@ -1,14 +1,15 @@
__default: __default:
@../bin/just/choose.sh {{ source_file() }} choose @../../bin/just/choose.sh {{ source_file() }} choose
# Checks whether the requriements are met # Checks whether the requriements are met
[group('main')] [group('main')]
check: check:
#!/bin/bash #!/bin/bash
source ../bin/just/colors.sh source ../../bin/just/colors.sh
source ../bin/just/check.sh source ../../bin/just/check.sh
printf "${BLUE_BG}${BLACK_FG} Checking Frontend Requirements ${CLEAR}\n" printf "${BLUE_BG}${BLACK_FG} Checking Frontend Requirements ${CLEAR}\n"
check_cmd "screen" "screen"
check_cmd "volta" "Volta" check_cmd "volta" "Volta"
check_cmd "node" "Node" check_cmd "node" "Node"
check_cmd "npm" "NPM" check_cmd "npm" "NPM"
@ -39,7 +40,7 @@ session_name := "euph-website_frontend"
[group('main')] [group('main')]
up: halt up: halt
#!/bin/bash #!/bin/bash
source ../bin/just/colors.sh source ../../bin/just/colors.sh
cd .. && screen -dmS {{ session_name }} npm run watch >> /dev/null cd .. && screen -dmS {{ session_name }} npm run watch >> /dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
printf "${GREEN_FG}Frontend was started${CLEAR}\n" printf "${GREEN_FG}Frontend was started${CLEAR}\n"
@ -51,7 +52,7 @@ up: halt
[group('main')] [group('main')]
halt: halt:
#!/bin/bash #!/bin/bash
source ../bin/just/colors.sh source ../../bin/just/colors.sh
screen -XS {{ session_name }} quit >> /dev/null screen -XS {{ session_name }} quit >> /dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
printf "${GREEN_FG}Frontend was stopped${CLEAR}\n" printf "${GREEN_FG}Frontend was stopped${CLEAR}\n"
@ -60,7 +61,7 @@ halt:
[group('main')] [group('main')]
attach: attach:
#!/bin/bash #!/bin/bash
source ../bin/just/colors.sh source ../../bin/just/colors.sh
if screen -ls | grep -q {{ session_name }}; then if screen -ls | grep -q {{ session_name }}; then
screen -r {{ session_name }} screen -r {{ session_name }}
else else

View file

@ -1,4 +0,0 @@
import 'flowbite';
import {initFlowbite} from 'flowbite';
initFlowbite();

View file

@ -1,5 +1,5 @@
@import "components/header"; @import "components/Header";
@import "components/burger-menu"; @import "components/BurgerMenu/Index";
@tailwind base; @tailwind base;
@tailwind components; @tailwind components;
@tailwind utilities; @tailwind utilities;

View file

@ -1,4 +1,6 @@
#burger-menu { @import "Nav";
.burger-menu {
@apply fixed top-0 right-0 h-screen overflow-y-auto z-40; @apply fixed top-0 right-0 h-screen overflow-y-auto z-40;
@apply flex flex-col p-2 gap-2 w-64; @apply flex flex-col p-2 gap-2 w-64;
@apply bg-gray-100 dark:bg-gray-700; @apply bg-gray-100 dark:bg-gray-700;
@ -59,21 +61,4 @@
@apply flex p-2 gap-2 items-center justify-center; @apply flex p-2 gap-2 items-center justify-center;
@apply rounded-lg bg-blue-500 app__text; @apply rounded-lg bg-blue-500 app__text;
} }
&__nav {
@apply text-lg app__text;
&-list {
@apply flex flex-col gap-2;
}
&-item {
@apply h-8;
}
&-link {
@apply flex p-1 gap-2 items-center;
@apply rounded-md hover:bg-gray-200 dark:hover:bg-gray-600;
}
}
} }

View file

@ -0,0 +1,16 @@
.burger-menu-nav {
@apply text-lg app__text;
&__list {
@apply flex flex-col gap-2;
}
&__item {
@apply h-8;
}
&__link {
@apply flex p-1 gap-2 items-center;
@apply rounded-md hover:bg-gray-200 dark:hover:bg-gray-600;
}
}

View file

@ -1,4 +1,4 @@
#header { .header {
@apply flex h-12 p-2 gap-2 items-center; @apply flex h-12 p-2 gap-2 items-center;
@apply bg-gray-300 dark:bg-gray-700; @apply bg-gray-300 dark:bg-gray-700;

View file

@ -15,14 +15,14 @@
<link rel="mask-icon" href="{{ asset('/safari-pinned-tab.svg') }}" color="#000000"> <link rel="mask-icon" href="{{ asset('/safari-pinned-tab.svg') }}" color="#000000">
<meta name="msapplication-TileColor" content="#000000"> <meta name="msapplication-TileColor" content="#000000">
<meta name="theme-color" content="#ffffff"> <meta name="theme-color" content="#ffffff">
{{ encore_entry_link_tags('app') }} {{ encore_entry_link_tags('app') }}
{{ encore_entry_script_tags('theme') }}
{{ encore_entry_script_tags('app') }} {{ encore_entry_script_tags('app') }}
<title>{% block title %}Euph{% endblock %}</title> <title>{% block title %}Euph{% endblock %}</title>
</head> </head>
<body class="bg-gray-100 dark:bg-gray-600"> <body>
{% include 'components/header.html.twig' %} <twig:Header/>
{% block body %}{% endblock %} {% block body %}{% endblock %}
</body> </body>
</html> </html>

View file

@ -0,0 +1,49 @@
{% set logged_in = true %}
<button
class="burger-menu__button-open"
>
<twig:ux:icon name="ph:list" />
</button>
<div
class="burger-menu"
tabindex="-1"
>
<button
class="burger-menu__button-close"
>
<twig:ux:icon name="ph:x" />
</button>
<div class="burger-menu__user-section">
<div class="burger-menu__user-picture-wrapper">
<twig:ux:icon name="ph:user-circle-fill" />
</div>
{% if logged_in %}
<span class="burger-menu__user-name">Username</span>
<span class="burger-menu__user-email">username@email.com</span>
<div class="burger-menu__user-actions">
{{ _self.user_action('Profile', 'user-fill') }}
{{ _self.user_action('Settings', 'gear-fill') }}
{{ _self.user_action('Logout', 'sign-out') }}
</div>
{% else %}
<span class="burger-menu__user-info">not logged in</span>
{% endif %}
</div>
{% if not logged_in %}
<hr/>
<a class="burger-menu__login">
<span>Login with Euphcloud</span>
</a>
{% endif %}
<hr/>
<twig:BurgerMenu:Nav/>
</div>
{% macro user_action(name, icon) %}
<button>
<twig:ux:icon name="ph:{{ icon }}" />
<span>{{ name }}</span>
</button>
{% endmacro %}

View file

@ -0,0 +1,16 @@
<nav class="burger-menu-nav">
<ul class="burger-menu-nav__list">
{{ _self.nav_item('Test1', '#test1', 'list') }}
{{ _self.nav_item('Test2', '#test2', 'list') }}
{{ _self.nav_item('Test3', '#test3', 'list') }}
</ul>
</nav>
{% macro nav_item(name, href, icon) %}
<li class="burger-menu-nav__item">
<a class="burger-menu-nav__link" href="{{ href }}">
<twig:ux:icon name="ph:{{ icon }}" />
<span class="flex-1">{{ name }}</span>
</a>
</li>
{% endmacro %}

View file

@ -1,14 +1,14 @@
<header id="header"> <header class="header">
<img <img
id="header__logo" class="header__logo"
src="{{ asset("icons/logo/logo.svg") }}" src="{{ asset("icons/logo/logo.svg") }}"
alt="Euph Logo" alt="Euph Logo"
> >
<img <img
id="header__logo-dark" class="header__logo-dark"
src="{{ asset("icons/logo/dark-logo.svg") }}" src="{{ asset("icons/logo/dark-logo.svg") }}"
alt="Euph Logo" alt="Euph Logo"
> >
<h1 id="header__logo-text">Euph</h1> <span class="header__logo-text">Euph</span>
{% include 'components/burger-menu.html.twig' %} <twig:BurgerMenu:Index/>
</header> </header>

View file

@ -1,71 +0,0 @@
<button
id="burger-menu__button-open"
type="button"
data-drawer-target="burger-menu"
data-drawer-show="burger-menu"
data-drawer-placement="right"
aria-controls="burger-menu"
>
{% include 'icons/bars.svg.twig' with {'class': 'h-full w-full'} %}
</button>
<div
id="burger-menu"
class="transition-transform translate-x-full"
tabindex="-1"
>
<button
type="button"
id="burger-menu__button-close"
data-drawer-hide="burger-menu"
aria-controls="burger-menu"
>
{% include 'icons/close.svg.twig' with {'class': 'h-full w-full'} %}
</button>
<div id="burger-menu__user-section">
<div id="burger-menu__user-picture-wrapper">
{% include 'icons/user-placeholder.svg.twig' with {'class': 'h-full w-full'} %}
</div>
{% if logged_in %}
<span id="burger-menu__user-name">Username</span>
<span id="burger-menu__user-email">username@email.com</span>
<div id="burger-menu__user-actions">
{{ _self.user_action('Profile', 'user') }}
{{ _self.user_action('Settings', 'settings') }}
{{ _self.user_action('Logout', 'logout') }}
</div>
{% else %}
<span id="burger-menu__user-info">not logged in</span>
{% endif %}
</div>
{% if not logged_in %}
<hr/>
<a id="burger-menu__login">
{% include 'icons/euphcloud.svg.twig' with {'class': 'w-6 h-6'} %}
<span>Login with Euphcloud</span>
</a>
{% endif %}
<hr/>
<nav id="burger-menu__nav">
<ul id="burger-menu__nav-list">
{{ _self.nav_item('Test1', '#test1', 'bars') }}
{{ _self.nav_item('Test2', '#test2', 'bars') }}
{{ _self.nav_item('Test3', '#test3', 'bars') }}
</ul>
</nav>
</div>
{% macro user_action(name, icon) %}
<button>
{% include 'icons/' ~ icon ~ '.svg.twig' with {'class': 'h-6 w-6'} %}
<span>{{ name }}</span>
</button>
{% endmacro %}
{% macro nav_item(name, href, icon) %}
<li id="burger-menu__nav-item">
<a id="burger-menu__nav-link" href="{{ href }}">
{% include 'icons/' ~ icon ~ '.svg.twig' with {'class': 'h-6 w-6'} %}
<span class="flex-1">{{ name }}</span>
</a>
</li>
{% endmacro %}

View file

@ -1,16 +0,0 @@
<svg
class="text-gray-800 dark:text-white {{ class|default('') }}"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
fill="none"
viewBox="0 0 24 24"
>
<path
stroke="currentColor"
stroke-linecap="round"
stroke-width="2"
d="M5 7h14M5 12h14M5 17h14"
/>
</svg>

Before

Width:  |  Height:  |  Size: 352 B

View file

@ -1,17 +0,0 @@
<svg
class="text-gray-800 dark:text-white {{ class|default('') }}"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
fill="none"
viewBox="0 0 24 24"
>
<path
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M6 18 17.94 6M18 18 6.06 6"
/>
</svg>

Before

Width:  |  Height:  |  Size: 387 B

View file

@ -1,14 +0,0 @@
<svg
class="text-gray-800 dark:text-white {{ class|default('') }}"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
xml:space="preserve"
width="32mm"
height="32mm"
viewBox="0 0 32 32"
>
<path
d="M16 0A16 16 0 0 0 0 16a16 16 0 0 0 16 16 16 16 0 0 0 16-16A16 16 0 0 0 16 0zm-.555 1.034 3.304 3.302a7.95 7.95 0 0 1 0 11.243l-2.97 2.971a4.364 4.364 0 0 0 0 6.174l7.852-7.852a8.532 8.532 0 0 0 1.868-4.747l.079-1.093c2.55 2.82 1.891 7.774.267 9.398l-10.47 10.537L6.5 22.09a8.566 8.566 0 0 1 0-12.114l8.945-8.943zm.03 5.936-6.23 6.226a3.512 3.512 0 0 0 0 4.966l.508.507 6.07-6.07a3.732 3.732 0 0 0 0-5.28l-.348-.35z"
fill="currentColor"
/>
</svg>

Before

Width:  |  Height:  |  Size: 734 B

View file

@ -1,17 +0,0 @@
<svg
class="text-gray-800 dark:text-white {{ class|default('') }}"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
fill="none"
viewBox="0 0 24 24"
>
<path
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M20 12H8m12 0-4 4m4-4-4-4M9 4H7a3 3 0 0 0-3 3v10a3 3 0 0 0 3 3h2"
/>
</svg>

Before

Width:  |  Height:  |  Size: 425 B

View file

@ -1,14 +0,0 @@
<svg
class="text-gray-800 dark:text-white {{ class|default('') }}"
aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
fill="currentColor"
viewBox="0 0 24 24"
>
<path
fill-rule="evenodd"
d="M17 10v1.126c.367.095.714.24 1.032.428l.796-.797 1.415 1.415-.797.796c.188.318.333.665.428 1.032H21v2h-1.126c-.095.367-.24.714-.428 1.032l.797.796-1.415 1.415-.796-.797a3.979 3.979 0 0 1-1.032.428V20h-2v-1.126a3.977 3.977 0 0 1-1.032-.428l-.796.797-1.415-1.415.797-.796A3.975 3.975 0 0 1 12.126 16H11v-2h1.126c.095-.367.24-.714.428-1.032l-.797-.796 1.415-1.415.796.797A3.977 3.977 0 0 1 15 11.126V10h2Zm.406 3.578.016.016c.354.358.574.85.578 1.392v.028a2 2 0 0 1-3.409 1.406l-.01-.012a2 2 0 0 1 2.826-2.83ZM5 8a4 4 0 1 1 7.938.703 7.029 7.029 0 0 0-3.235 3.235A4 4 0 0 1 5 8Zm4.29 5H7a4 4 0 0 0-4 4v1a2 2 0 0 0 2 2h6.101A6.979 6.979 0 0 1 9 15c0-.695.101-1.366.29-2Z"
clip-rule="evenodd"
/>
</svg>

Before

Width:  |  Height:  |  Size: 969 B

View file

@ -1,14 +0,0 @@
<svg
class="text-gray-800 dark:text-white {{ class|default('') }}"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
width="24" height="24"
fill="currentColor"
viewBox="0 0 24 24"
>
<path
fill-rule="evenodd"
d="M12 20a7.966 7.966 0 0 1-5.002-1.756l.002.001v-.683c0-1.794 1.492-3.25 3.333-3.25h3.334c1.84 0 3.333 1.456 3.333 3.25v.683A7.966 7.966 0 0 1 12 20ZM2 12C2 6.477 6.477 2 12 2s10 4.477 10 10c0 5.5-4.44 9.963-9.932 10h-.138C6.438 21.962 2 17.5 2 12Zm10-5c-1.84 0-3.333 1.455-3.333 3.25S10.159 13.5 12 13.5c1.84 0 3.333-1.455 3.333-3.25S13.841 7 12 7Z"
clip-rule="evenodd"
/>
</svg>

Before

Width:  |  Height:  |  Size: 650 B

View file

@ -1,15 +0,0 @@
<svg
class="text-gray-800 dark:text-white {{ class|default('') }}"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
fill="currentColor"
viewBox="0 0 24 24"
>
<path
d="M12 4a4 4 0 1 0 0 8 4 4 0 0 0 0-8Zm-2 9a4 4 0 0 0-4 4v1a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-1a4 4 0 0 0-4-4h-4Z"
fill-rule="evenodd"
clip-rule="evenodd"
/>
</svg>

Before

Width:  |  Height:  |  Size: 413 B

View file

@ -0,0 +1,4 @@
{% extends 'base.html.twig' %}
{% block body %}
<p>A Phrase</p>
{% endblock %}

View file

@ -1,53 +0,0 @@
{% extends 'base.html.twig' %}
{% block body %}
<h1>H1 Hello World</h1>
<h2>H2 Hello World</h2>
<h3>H3 Hello World</h3>
<h4>H4 Hello World</h4>
<h5>H5 Hello World</h5>
<h6>H6 Hello World</h6>
<p>P Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Ad consectetur consequuntur culpa debitis dignissimos
dolore est ex illo iure maxime, molestiae pariatur recusandae,
reiciendis saepe similique temporibus voluptatum? Eos,
repudiandae!
</p>
<a href="">A Link</a>
<button>Button</button>
<input type="text">
<input type="checkbox" name="" id="">
<button id="dropdownButton" data-dropdown-toggle="dropdownMenu" class="shadow" type="button">
Select an option
</button>
<ul id="dropdownMenu" class="hidden border-red-300 shadow">
<li>
<a href="#" class="block hover:bg-red-500" data-value="1">Option 1</a>
</li>
<li>
<a href="#" class="block hover:bg-green-500" data-value="2">Option 2</a>
</li>
<li>
<a href="#" class="block hover:bg-blue-500" data-value="3">Option 3</a>
</li>
</ul>
<script>
document.querySelectorAll('#dropdownMenu a').forEach(function (option) {
option.addEventListener('click', function (event) {
event.preventDefault();
console.log(this.dataset.value);
document.getElementById('dropdownButton').textContent = this.textContent;
console.log('close');
document.getElementById('dropdownMenu').classList.add('hidden');
});
});
document.getElementById('dropdownButton').addEventListener('click', function () {
let menu = document.getElementById('dropdownMenu');
console.log('open', menu);
menu.classList.remove('hidden');
console.log('open2', menu);
});
</script>
{% endblock %}

View file

@ -1,3 +0,0 @@
import {initTheme} from '@domain/theme';
initTheme();

View file

@ -13,23 +13,23 @@
"~*": [ "~*": [
".*" ".*"
], ],
"@styles/*": [ "@components/*": [
"./styles/*" "./templates/components/*"
], ],
"@controllers/*": [ "@controllers/*": [
"./controllers/*" "./controllers/*"
], ],
"@styles/*": [
"./styles/*"
],
"@pkg/*": [ "@pkg/*": [
"./packages/*" "./packages/*"
], ],
"@domain/*": [
"./domain/*"
],
"@const/*": [
"./constants/*"
],
"#types/*": [ "#types/*": [
"./types/*" "./types/*"
],
"#const/*": [
"./types/constants/*"
] ]
} }
}, },

640
app/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -8,12 +8,8 @@
"build": "encore production --progress", "build": "encore production --progress",
"lint:ts": "cd frontend && eslint .", "lint:ts": "cd frontend && eslint .",
"lint:ts:fix": "cd frontend && eslint . --fix", "lint:ts:fix": "cd frontend && eslint . --fix",
"lint:scss": "cd frontend/styles && stylelint .", "lint:scss": "cd frontend && stylelint .",
"lint:scss:fix": "cd frontend/styles && stylelint . --fix" "lint:scss:fix": "cd frontend && stylelint . --fix"
},
"dependencies": {
"easymde": "^2.18.0",
"flowbite": "^2.4.1"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.23.3", "@babel/core": "^7.23.3",
@ -33,10 +29,8 @@
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
"fork-ts-checker-webpack-plugin": "^9.0.0", "fork-ts-checker-webpack-plugin": "^9.0.0",
"ignore-loader": "^0.1.2", "ignore-loader": "^0.1.2",
"jquery": "^3.7.1",
"junit-report-merger": "^6.0.3",
"postcss": "^8.4.39", "postcss": "^8.4.39",
"postcss-loader": "^7.3.4", "postcss-loader": "^8.1.1",
"prettier": "^2.8.8", "prettier": "^2.8.8",
"regenerator-runtime": "^0.13.9", "regenerator-runtime": "^0.13.9",
"sass": "^1.69.4", "sass": "^1.69.4",
@ -45,7 +39,6 @@
"stylelint-config-standard-scss": "^13.0.0", "stylelint-config-standard-scss": "^13.0.0",
"stylelint-config-tailwindcss": "^0.0.7", "stylelint-config-tailwindcss": "^0.0.7",
"stylelint-scss": "^6.3.1", "stylelint-scss": "^6.3.1",
"tailwindcss": "^3.4.4",
"ts-loader": "^9.5.0", "ts-loader": "^9.5.0",
"tsconfig-paths-webpack-plugin": "^4.1.0", "tsconfig-paths-webpack-plugin": "^4.1.0",
"typescript": "^5.2.2", "typescript": "^5.2.2",

View file

@ -249,6 +249,42 @@
"config/packages/uid.yaml" "config/packages/uid.yaml"
] ]
}, },
"symfony/ux-icons": {
"version": "2.18",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "2.17",
"ref": "803a3bbd5893f9584969ab8670290cdfb6a0a5b5"
},
"files": [
"assets/icons/symfony.svg"
]
},
"symfony/ux-svelte": {
"version": "2.18",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "2.9",
"ref": "4a6ee82d817d4e9be8d4a861476a112011d701e1"
},
"files": [
"assets/svelte/controllers/Hello.svelte"
]
},
"symfony/ux-twig-component": {
"version": "2.18",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "2.13",
"ref": "67814b5f9794798b885cec9d3f48631424449a01"
},
"files": [
"config/packages/twig_component.yaml"
]
},
"symfony/validator": { "symfony/validator": {
"version": "6.3", "version": "6.3",
"recipe": { "recipe": {

View file

@ -3,16 +3,11 @@ module.exports = {
content: [ content: [
"./frontend/**/*.ts", "./frontend/**/*.ts",
"./frontend/templates/**/*.html.twig", "./frontend/templates/**/*.html.twig",
"./node_modules/flowbite/**/*.js"
], ],
theme: { theme: {
extend: { extend: {
}, },
}, },
plugins: [
require('flowbite/plugin')
],
darkMode: 'selector' darkMode: 'selector'
} }

View file

@ -14,16 +14,9 @@ Encore
.setPublicPath('/build') .setPublicPath('/build')
.copyFiles({ .copyFiles({
from: './assets/', from: './assets/',
to: '../[path][name].[ext]', to: '../[path][name].[ext]'
pattern: /\.(?!scss|stylelint.*|json|woff).*$/
}) })
// Code Entries
.addEntry('app', './frontend/app.ts') .addEntry('app', './frontend/app.ts')
.addEntry('theme', './frontend/theme.ts')
// Style Entries
//.addStyleEntry('name', './frontend/styles/name.scss')
// Webpack // Webpack
.splitEntryChunks() .splitEntryChunks()
@ -38,7 +31,7 @@ Encore
config.useBuiltIns = 'usage'; config.useBuiltIns = 'usage';
config.corejs = '3.23'; config.corejs = '3.23';
}) })
.enableStimulusBridge('./frontend/controllers.json') .enableStimulusBridge('./frontend/controllers/controllers.json')
.enableSassLoader() .enableSassLoader()
.enablePostCssLoader() .enablePostCssLoader()
.enableTypeScriptLoader(function tsconfigCallback(tsConfig) { .enableTypeScriptLoader(function tsconfigCallback(tsConfig) {

1
bin/just/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.cache/

View file

@ -9,5 +9,5 @@ check() {
} }
check_cmd() { check_cmd() {
check "$(command -v $1 >/dev/null 2>&1)" $2 check "$(command -v $1 >/dev/null 2>&1)" "$2"
} }

View file

@ -9,9 +9,9 @@ function preview() {
if [[ -z "$recipe" ]] || echo $recipe | grep -q "^\["; then if [[ -z "$recipe" ]] || echo $recipe | grep -q "^\["; then
printf "${RED_FG}Select this to Exit${CLEAR}" printf "${RED_FG}Select this to Exit${CLEAR}"
elif [[ "$content" == *" ..." ]]; then elif [[ "$content" == *" ..." ]]; then
just_wrapper --list $recipe | highlight --out-format xterm256 --syntax conf hash_highlight "$(just_wrapper --list $recipe)" "conf"
else else
just_wrapper --show $recipe | highlight --out-format xterm256 --syntax sh hash_highlight "$(just_wrapper --show $recipe)" "sh"
fi fi
} }
@ -33,7 +33,19 @@ function choose_truncate() {
function choose_list() { function choose_list() {
just_wrapper -l --no-aliases --list-heading="" | awk '{$1=$1};1' just_wrapper -l --no-aliases --list-heading="" | awk '{$1=$1};1'
} }
function hash_highlight() {
cache_dir="$(dirname ${BASH_SOURCE[0]})/.cache"
hash=$(echo $1 | md5sum | cut -d ' ' -f1)
file="$cache_dir/$hash"
if [[ -e $file ]]; then
cat $file
else
mkdir -p $cache_dir
data=$(printf "$1" | highlight --out-format xterm256 --syntax "$2")
printf "$data"
printf "$data" > $file
fi
}
case "$action" in case "$action" in
*choose) choose;; *choose) choose;;
*preview) preview;; *preview) preview;;