Merge branch 'feature/theme-one' into dev
This commit is contained in:
@@ -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>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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] ?? [];
|
||||
}
|
||||
}
|
||||
|
||||
-1903
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Vendored
+5
File diff suppressed because one or more lines are too long
Vendored
+2511
-1
File diff suppressed because one or more lines are too long
@@ -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>
|
||||
|
||||
Generated
+2096
-2262
File diff suppressed because it is too large
Load Diff
@@ -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",
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
module.exports = {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
import './style.css'
|
||||
// import typescriptLogo from './typescript.svg'
|
||||
import Alpine from 'alpinejs'
|
||||
import {localeMapper} from "./helpers/localemapper.ts";
|
||||
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
@import "tailwindcss";
|
||||
@plugin "daisyui";
|
||||
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
/// <reference types="vite/client" />
|
||||
@@ -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")
|
||||
]
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
},
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user