Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c10b123
TASK: Prepare domain objects for styleguide-objects instead of fusion…
mficzel Dec 12, 2025
15196de
TASK: Remove info tabs and associated domain objects as those are har…
mficzel Dec 12, 2025
a77ecdd
TASK: Adjust api controller to use the new StyleguideRepository and P…
mficzel Dec 12, 2025
912ba6b
TASK: Slowly working again
mficzel Dec 18, 2025
984b518
TASK: Add CPX rendering
mficzel Dec 18, 2025
a9cdb32
FEATURE: Props, PropSets, UseCases Container initially work for CPX
mficzel Dec 19, 2025
254179d
TASK: Recreate component factory together with matching tests
mficzel Jan 14, 2026
b8f3559
TASK: Add percent encoding to site name and prototype name
mficzel Jan 14, 2026
0961790
TASK: Render grid inside styleguide
mficzel Jan 19, 2026
b2853a2
TASK: Support instantiating structs
mficzel Jan 19, 2026
5774a6f
Resize grid with preview iframe
mficzel Jan 19, 2026
494349a
TASK: Throw exception for superficial props in styleguide
mficzel Jan 26, 2026
6c03f15
TASK: Support __propSet and __useCase in styleguide.yaml
mficzel Jan 26, 2026
5b8f2aa
Make linter happy
mficzel Jan 27, 2026
791b8b6
TASK: Use styles and scripts from styleguide configuration for cpx pa…
mficzel Jan 27, 2026
abc23ca
Add container support
mficzel Jan 27, 2026
a6d306d
TASK: Support enum mapping from scalar arguments
mficzel Jan 31, 2026
41cb123
TASK: Remove old fusion prototype details ... as those are replaced b…
mficzel Jan 31, 2026
a454050
TASK: Adjust code style
mficzel Mar 13, 2026
6ca7a0f
BUGFIX: Remove config for removed interface
mficzel Mar 18, 2026
96223f9
TASK: add structure meta data to cpx components
Devclaim Mar 26, 2026
6ecdcd7
add group and hidden metadata
Devclaim Mar 27, 2026
afe9463
add multiple items support for cpx styleguide props
Devclaim Mar 27, 2026
a9d3a4c
Merge pull request #234 from Devclaim/task/refactorToEnableUseCasesBe…
mficzel Apr 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: build

on:
push:
branches:
- 'main'
pull_request: ~

jobs:
test:
name: "Test (PHP ${{ matrix.php-versions }}, Neos ${{ matrix.neos-versions }})"

strategy:
fail-fast: false
matrix:
php-versions: ['8.0', '8.1', '8.2', '8.3']
neos-versions: ['8.3']

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
with:
path: ${{ env.FLOW_FOLDER }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml, json, zlib, iconv, intl, pdo_sqlite
ini-values: date.timezone="Africa/Tunis", opcache.fast_shutdown=0, apc.enable_cli=on

- name: Set Neos Version
run: composer require neos/neos ^${{ matrix.neos-versions }} --no-progress --no-interaction

- name: Run Tests
run: composer test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
node_modules/
.idea
npm-debug.log
composer.lock
Packages
vendor
29 changes: 27 additions & 2 deletions Classes/Aspects/FusionCachingAspect.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
<?php
namespace Sitegeist\Monocle\Aspects;

/**
* This file is part of the Sitegeist.Monocle package
*
* (c) 2020
* Martin Ficzel <ficzel@sitegeist.de>
* Wilhelm Behncke <behncke@sitegeist.de>
*
* This package is Open Source Software. For the full copyright and license
* information, please view the LICENSE file which was distributed with this
* source code.
*/

/**
* This file is part of the Sitegeist.Monocle package
*
* (c) 2020
* Martin Ficzel <ficzel@sitegeist.de>
* Wilhelm Behncke <behncke@sitegeist.de>
*
* This package is Open Source Software. For the full copyright and license
* information, please view the LICENSE file which was distributed with this
* source code.
*/

/**
* This file is part of the Sitegeist.Monocle package
Expand All @@ -13,6 +36,8 @@
* source code.
*/

namespace Sitegeist\Monocle\Aspects;

use Neos\Flow\Annotations as Flow;
use Neos\Flow\Aop\JoinPointInterface;
use Neos\Cache\Frontend\VariableFrontend;
Expand All @@ -38,7 +63,7 @@ class FusionCachingAspect
public function cacheFusionConfigurationForPackageKey(JoinPointInterface $joinPoint)
{
$packageKey = $joinPoint->getMethodArgument('packageKey');
$cacheIdentifier = str_replace('.', '_', $packageKey);
$cacheIdentifier = str_replace(['.', ':'], '_', $packageKey);

if ($this->fusionCache->has($cacheIdentifier)) {
$fusionConfigurationArray = $this->fusionCache->get($cacheIdentifier);
Expand Down
134 changes: 69 additions & 65 deletions Classes/Command/StyleguideCommandController.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
<?php
namespace Sitegeist\Monocle\Command;

/**
* This file is part of the Sitegeist.Monocle package
*
* (c) 2020
* Martin Ficzel <ficzel@sitegeist.de>
* Wilhelm Behncke <behncke@sitegeist.de>
*
* This package is Open Source Software. For the full copyright and license
* information, please view the LICENSE file which was distributed with this
* source code.
*/

/**
* This file is part of the Sitegeist.Monocle package
*
* (c) 2020
* Martin Ficzel <ficzel@sitegeist.de>
* Wilhelm Behncke <behncke@sitegeist.de>
*
* This package is Open Source Software. For the full copyright and license
* information, please view the LICENSE file which was distributed with this
* source code.
*/

/**
* This file is part of the Sitegeist.Monocle package
Expand All @@ -13,8 +36,15 @@
* source code.
*/

namespace Sitegeist\Monocle\Command;

use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
use Sitegeist\Monocle\Domain\PrototypeDetails\PropSets\PropSetName;
use Sitegeist\Monocle\Domain\PrototypeDetails\UseCases\UseCaseName;
use Sitegeist\Monocle\Domain\StyleguideAddress;
use Sitegeist\Monocle\Domain\StyleguideObjects\StyleguideObjectIdentifier;
use Sitegeist\Monocle\Domain\StyleguideRepository;
use Sitegeist\Monocle\Fusion\FusionService;
use Sitegeist\Monocle\Fusion\FusionView;
use Neos\Flow\Annotations as Flow;
Expand All @@ -30,102 +60,76 @@
*/
class StyleguideCommandController extends CommandController
{
use DummyControllerContextTrait, PackageKeyTrait;
#[Flow\Inject]
protected StyleguideRepository $styleguideRepository;

/**
* @Flow\Inject
* @var FusionService
*/
protected $fusionService;
#[Flow\Inject]
protected ConfigurationService $configurationService;

/**
* @Flow\Inject
* @var ConfigurationService
* Get a list of all available styleguides
*
* @param string $format Result encoding ``yaml`` and ``json`` are supported
*/
protected $configurationService;
public function listCommand($format = 'json'): void
{
$styleguides = $this->styleguideRepository->getAllStyleGuides();

$data = [];
foreach ($styleguides as $styleguide) {
$data[$styleguide->address->toString()] = $styleguide->name->value;
}
$this->outputData($data, $format);
}

/**
* Get a list of all configured default styleguide viewports
*
* @param string $format Result encoding ``yaml`` and ``json`` are supported
* @param string $packageKey site-package (defaults to first found)
* @param string $styleguide site-package (defaults to first found)
*/
public function viewportsCommand($format = 'json', $packageKey = null)
public function viewportsCommand(string $format = 'json', ?string $styleguide = null): void
{
$sitePackageKey = $packageKey ?: $this->getDefaultSitePackageKey();
$viewportPresets = $this->configurationService->getSiteConfiguration($sitePackageKey, 'ui.viewportPresets');
$styleguide = $styleguide ? $this->styleguideRepository->getStyleGuide(StyleguideAddress::fromString($styleguide)) : $this->styleguideRepository->getDefault();
$viewportPresets = $this->configurationService->getSiteConfiguration($styleguide->address->toString(), 'ui.viewportPresets');
$this->outputData($viewportPresets, $format);
}

/**
* Get all styleguide items currently available
*
* @param string $format Result encoding ``yaml`` and ``json`` are supported
* @param string $packageKey site-package (defaults to first found)
* @param string $styleguide site-package (defaults to first found)
*/
public function itemsCommand($format = 'json', $packageKey = null)
public function itemsCommand(string $format = 'json', ?string $styleguide = null): void
{
$sitePackageKey = $packageKey ?: $this->getDefaultSitePackageKey();

$fusionAst = $this->fusionService->getMergedFusionObjectTreeForSitePackage($sitePackageKey);
$styleguideObjects = $this->fusionService->getStyleguideObjectsFromFusionAst($fusionAst);

$styleguide = $styleguide ? $this->styleguideRepository->getStyleGuide(StyleguideAddress::fromString($styleguide)) : $this->styleguideRepository->getDefault();
$styleguideObjects = $styleguide->getStyleguideObjectList();
$styleguideObjects = json_decode(json_encode($styleguideObjects, JSON_THROW_ON_ERROR), true, 512, JSON_THROW_ON_ERROR);
$this->outputData($styleguideObjects, $format);
}

/**
* Render a given fusion component to HTML
*
* @param string $prototypeName The prototype name of the component
* @param string|null $packageKey site-package (defaults to first found)
* @param string $styleguide The prototype name of the component
* @param string $item site-package (defaults to first found)
* @param string|null $useCase The useCase for the preview
* @param string|null $propSet The propSet used for the preview
* @param string|null $props Custom props for the preview
* @param string|null $props Custom props for the preview
* @param string|null $locales Custom locales for the preview
* @return void
*/
public function renderCommand($prototypeName, $packageKey = null, ?string $useCase = '__default', ?string $propSet = '__default', ?string $props = '', ?string $locales = '')
public function renderCommand(string $styleguide, string $item, ?string $useCase = '__default', ?string $propSet = '__default', ?string $props = '', ?string $locales = '')
{
$sitePackageKey = $packageKey ?: $this->getDefaultSitePackageKey();
$convertedProps = json_decode($props, true) ?? [];
$convertedLocales = json_decode($locales, true) ?? [];

$controllerContext = $this->createDummyControllerContext();

$fusionView = new FusionView();
$fusionView->setControllerContext($controllerContext);
$fusionView->setPackageKey($sitePackageKey);

$fusionRootPath = $this->configurationService->getSiteConfiguration($sitePackageKey, ['cli', 'fusionRootPath']);

$fusionView->setPackageKey($sitePackageKey);
$fusionView->setFusionPath($fusionRootPath);

if ($useCase == '__default') {
$useCase = null;
}

if ($propSet == '__default') {
$propSet = null;
}

$fusionView->assignMultiple([
'sitePackageKey' => $packageKey,
'prototypeName' => $prototypeName,
'useCase' => $useCase,
'propSet' => $propSet,
'props' => $convertedProps,
'locales' => $convertedLocales
]);
$result = $fusionView->render();
if ($result instanceof ResponseInterface) {
return (string) $result->getBody();
}
if ($result instanceof StreamInterface) {
return (string) $result;
}
// support for Neos 8.3
$this->output($result);
$styleguide = $this->styleguideRepository->getStyleGuide(StyleguideAddress::fromString($styleguide));
$styleguide->renderStyleguideObject(
StyleguideObjectIdentifier::fromString($item),
json_decode($props, true) ?? [],
$propSet ? PropSetName::fromString($propSet) : null,
$useCase ? UseCaseName::fromString($useCase) : null,
json_decode($locales, true) ?? []
);
}

protected function outputData($data, $format)
Expand Down
Loading
Loading