Plugin-SDK: CSS-Varianten gegen andere Plugins absichern (0.39.1) #61
5 changed files with 49 additions and 4 deletions
|
|
@ -4,6 +4,11 @@ Neueste Version oben. Jeder Abschnitt beginnt mit `## MAJOR.MINOR.PATCH` und
|
|||
enthält kurze Stichpunkte für Anwenderinnen und Anwender – keine Commit-Texte.
|
||||
Der Self-Updater zeigt diese Abschnitte bei neuen Versionen an.
|
||||
|
||||
## 0.39.1
|
||||
|
||||
- Plugin-SDK: Sind mehrere Plugins mit eigener Oberfläche aktiv, konnte das CSS eines Plugins die Handy-/Desktop-Umschaltung (z. B. `ih:lg:hidden`) eines anderen überschreiben. Regeln mit Variante werden beim Bauen jetzt verstärkt – Plugins bitte mit der neuen `inhaus-sdk/vite.js` neu bauen
|
||||
- Neue Plugins bekommen `postcss` als Entwicklungs-Abhängigkeit
|
||||
|
||||
## 0.39.0
|
||||
|
||||
- Für Plugins: eigene Symbole in der Kopfzeile neben der Glocke (z. B. „Nachrichten“ mit Zahl der ungelesenen). Grundlage für das Chat-Plugin
|
||||
|
|
|
|||
|
|
@ -9,5 +9,5 @@ namespace App;
|
|||
*/
|
||||
final class Version
|
||||
{
|
||||
public const VERSION = '0.39.0';
|
||||
public const VERSION = '0.39.1';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
"devDependencies": {
|
||||
"@tailwindcss/vite": "{{v_tailwind_vite}}",
|
||||
"@vitejs/plugin-vue": "{{v_plugin_vue}}",
|
||||
"postcss": "^8.5.0",
|
||||
"tailwindcss": "{{v_tailwind}}",
|
||||
"vite": "{{v_vite}}",
|
||||
"vue": "{{v_vue}}"
|
||||
|
|
|
|||
41
sdk/vite.js
41
sdk/vite.js
|
|
@ -12,6 +12,7 @@
|
|||
*/
|
||||
import { existsSync, globSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
import postcss from 'postcss';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
|
||||
|
|
@ -37,7 +38,7 @@ export function inhausPlugin({ root = process.cwd() } = {}) {
|
|||
}
|
||||
|
||||
return {
|
||||
plugins: [vue(), tailwindcss(), manifest(Object.keys(input))],
|
||||
plugins: [vue(), tailwindcss(), manifest(Object.keys(input)), strongerVariants()],
|
||||
// Plugins laufen unter /plugin-assets/<slug>/<version>/ – Pfade relativ halten
|
||||
base: './',
|
||||
build: {
|
||||
|
|
@ -86,3 +87,41 @@ function manifest(entries) {
|
|||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Mehrere Plugins bringen jeweils eigenes CSS mit, und dieselbe Hilfsklasse (z. B. ih:grid) kann in
|
||||
* mehreren Dateien stehen. Lädt ein anderes Plugin sein CSS später, würde dessen „ih:grid“ sonst
|
||||
* die Varianten dieses Plugins (ih:lg:hidden, ih:hover:…) überstimmen. Deshalb bekommen Regeln
|
||||
* mit Variante (Media Query, :hover …) eine doppelte Klasse – sie gewinnen so immer gegen
|
||||
* einfache Klassen, egal in welcher Reihenfolge die Dateien laden.
|
||||
*/
|
||||
export function strongerVariants() {
|
||||
const pseudo = /(?<!\\):/;
|
||||
const firstClass = /\.((?:\\.|[\w-])+)/;
|
||||
|
||||
return {
|
||||
name: 'inhaus-stronger-variants',
|
||||
enforce: 'post',
|
||||
generateBundle(_, bundle) {
|
||||
for (const file of Object.values(bundle)) {
|
||||
if (file.type !== 'asset' || !file.fileName.endsWith('.css')) continue;
|
||||
|
||||
const root = postcss.parse(String(file.source));
|
||||
|
||||
root.walkRules((rule) => {
|
||||
let conditional = false;
|
||||
|
||||
for (let parent = rule.parent; parent && parent.type !== 'root'; parent = parent.parent) {
|
||||
if (parent.type === 'atrule' && parent.name !== 'layer') conditional = true;
|
||||
}
|
||||
|
||||
rule.selectors = rule.selectors.map((selector) => (conditional || pseudo.test(selector.replace(/^[^.]*/, ''))) && firstClass.test(selector)
|
||||
? selector.replace(firstClass, (match) => match + match)
|
||||
: selector);
|
||||
});
|
||||
|
||||
file.source = root.toString();
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
|||
4
vendor/composer/installed.php
vendored
4
vendor/composer/installed.php
vendored
|
|
@ -3,7 +3,7 @@
|
|||
'name' => 'inhaus/inhaus',
|
||||
'pretty_version' => 'dev-main',
|
||||
'version' => 'dev-main',
|
||||
'reference' => 'faf7962b6bfbaae6560075e68d5d57b3b9b6415a',
|
||||
'reference' => '93e83469f308f39f18f11899ba884a7a6f6f0f3e',
|
||||
'type' => 'project',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
|
|
@ -550,7 +550,7 @@
|
|||
'inhaus/inhaus' => array(
|
||||
'pretty_version' => 'dev-main',
|
||||
'version' => 'dev-main',
|
||||
'reference' => 'faf7962b6bfbaae6560075e68d5d57b3b9b6415a',
|
||||
'reference' => '93e83469f308f39f18f11899ba884a7a6f6f0f3e',
|
||||
'type' => 'project',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue