Merge branch 'feature/theme-one' into dev

This commit is contained in:
2026-11-23 12:36:01 +01:00
15 changed files with 4674 additions and 4265 deletions
+5 -15
View File
@@ -641,27 +641,17 @@ if (! function_exists('phpb_registered_assets')) {
*/
function phpb_registered_assets(string $location = 'header'): void
{
$assets = [];
if($location === 'header'){
$assets = Extensions::getHeaderAssets();
}elseif($location === 'footer'){
$assets = Extensions::getFooterAssets();
}elseif($location === 'admin-header'){
$assets = Extensions::getAdminHeaderAssets();
}elseif($location === 'admin-footer'){
$assets = Extensions::getAdminFooterAssets();
}
$assets = Extensions::getAssetsArray($location);
foreach ($assets as $asset) {
$attributes = '';
foreach ($asset['attributes'] as $key => $value) {
$attributes .= ' ' . $key . '="' . $value . '"';
$attributes .= ' ' . htmlspecialchars($key, ENT_QUOTES, 'UTF-8') . '="' . htmlspecialchars($value, ENT_QUOTES, 'UTF-8') . '"';
}
if ($asset['type'] == 'style') {
echo '<link rel="stylesheet" href="' . $asset['src'] . '" ' . $attributes . '/>';
if ($asset['type'] === 'style') {
echo '<link rel="stylesheet" href="' . htmlspecialchars($asset['src'], ENT_QUOTES, 'UTF-8') . '"' . $attributes . '/>';
} else {
echo '<script type="text/javascript" src="' . $asset['src'] . '" ' . $attributes . '></script>';
echo '<script type="text/javascript" src="' . htmlspecialchars($asset['src'], ENT_QUOTES, 'UTF-8') . '"' . $attributes . '></script>';
}
}
}
+45 -13
View File
@@ -241,7 +241,7 @@ class Extensions
}
/**
* Get all header assets.
* Get all html blocks for the given location.
*/
public static function getHtmlBlocks(string $location = 'head'): string
{
@@ -249,31 +249,63 @@ class Extensions
}
/**
* Get all header assets.
* Render assets as HTML string.
*/
public static function getHeaderAssets(): array
protected static function renderAssets(array $assets): string
{
return self::$assets['header'];
$html = '';
foreach ($assets as $asset) {
$attributes = '';
foreach ($asset['attributes'] as $key => $value) {
$attributes .= ' ' . htmlspecialchars($key, ENT_QUOTES, 'UTF-8') . '="' . htmlspecialchars($value, ENT_QUOTES, 'UTF-8') . '"';
}
if ($asset['type'] === 'style') {
$html .= '<link rel="stylesheet" href="' . htmlspecialchars($asset['src'], ENT_QUOTES, 'UTF-8') . '"' . $attributes . '/>';
} else {
$html .= '<script type="text/javascript" src="' . htmlspecialchars($asset['src'], ENT_QUOTES, 'UTF-8') . '"' . $attributes . '></script>';
}
}
return $html;
}
/**
* Get all footer assets.
* Get all header assets as HTML string.
*/
public static function getFooterAssets() {
return self::$assets['footer'];
public static function getHeaderAssets(): string
{
return self::renderAssets(self::$assets['header']);
}
/**
* Get all admin header assets.
* Get all footer assets as HTML string.
*/
public static function getAdminHeaderAssets() {
return self::$assets['admin-header'];
public static function getFooterAssets(): string
{
return self::renderAssets(self::$assets['footer']);
}
/**
* Get all admin footer assets.
* Get all admin header assets as HTML string.
*/
public static function getAdminFooterAssets() {
return self::$assets['admin-footer'];
public static function getAdminHeaderAssets(): string
{
return self::renderAssets(self::$assets['admin-header']);
}
/**
* Get all admin footer assets as HTML string.
*/
public static function getAdminFooterAssets(): string
{
return self::renderAssets(self::$assets['admin-footer']);
}
/**
* Get raw assets array for internal use by phpb_registered_assets().
*/
public static function getAssetsArray(string $location): array
{
return self::$assets[$location] ?? [];
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2511 -1
View File
File diff suppressed because one or more lines are too long
+4
View File
@@ -14,14 +14,18 @@ use Plugi\Repositories\MenuRepository;
$page->getTranslation("meta_description"),
) ?>">
<link href="<?= phpb_asset("icons/duotone/style.css") ?>" rel="stylesheet">
<link href="<?= phpb_asset("icons/regular/style.css") ?>" rel="stylesheet">
<link href="<?= phpb_asset("icons/bold/style.css") ?>" rel="stylesheet">
<link href="<?= phpb_theme_asset("dist/style.css") ?>" rel="stylesheet">
<?= Extensions::getHtmlBlocks() ?>
<?= Extensions::getHeaderAssets() ?>
<?php phpb_registered_assets('header'); ?>
<script src="<?= phpb_theme_asset("dist/script.js") ?>"></script>
</head>
<body>
+2096 -2262
View File
File diff suppressed because it is too large Load Diff
+6 -7
View File
@@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"dev": "npm-watch build",
"build": "tsc && vite build"
"build": "tsc && rolldown src/main.ts --file dist/script.js -m && npx @tailwindcss/cli -i ./src/style.css -o ./dist/style.css"
},
"watch": {
"build": {
@@ -20,13 +20,12 @@
}
},
"devDependencies": {
"autoprefixer": "^10.4.14",
"daisyui": "^3.0.3",
"@tailwindcss/cli": "^4.3.5",
"daisyui": "^5.8.2",
"npm-watch": "^0.11.0",
"postcss": "^8.4.24",
"tailwindcss": "^3.3.2",
"typescript": "^5.1.6",
"vite": "^4.3.9"
"rolldown": "^1.3.3",
"tailwindcss": "^4.3.5",
"typescript": "^6.0.3"
},
"dependencies": {
"@types/alpinejs": "^3.7.2",
-6
View File
@@ -1,6 +0,0 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
}
}
-2
View File
@@ -1,5 +1,3 @@
import './style.css'
// import typescriptLogo from './typescript.svg'
import Alpine from 'alpinejs'
import {localeMapper} from "./helpers/localemapper.ts";
+2 -3
View File
@@ -1,3 +1,2 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@import "tailwindcss";
@plugin "daisyui";
-1
View File
@@ -1 +0,0 @@
/// <reference types="vite/client" />
-33
View File
@@ -1,33 +0,0 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./pages/**/*.{html,ts,php}",
"./src/**/*.{html,ts,php}",
"./blocks/**/*.{html,ts,php}",
"./layouts/**/*.{html,ts,php}",
"./node_modules/flowbite/**/*.js",
],
theme: {
extend: {
colors: {
'primary': {
'50': '#f6faf3',
'100': '#e9f5e3',
'200': '#d3eac8',
'300': '#afd89d',
'400': '#82bd69',
'500': '#61a146',
'600': '#4c8435',
'700': '#3d692c',
'800': '#345427',
'900': '#2b4522',
'950': '#13250e',
},
}
},
},
plugins: [
require("daisyui")
]
}
-14
View File
@@ -1,14 +0,0 @@
// vite.config.js
import { resolve } from 'path'
import { defineConfig } from 'vite'
export default defineConfig({
build: {
lib: {
// Could also be a dictionary or array of multiple entry points
entry: resolve(__dirname, 'src/main.ts'),
name: 'phpb-demo-template',
fileName: 'phpb-demo-template',
},
},
})