Skip to content

Commit

Permalink
update theme
Browse files Browse the repository at this point in the history
  • Loading branch information
overclokk committed Feb 25, 2024
1 parent 7604aae commit f06b797
Show file tree
Hide file tree
Showing 15 changed files with 410 additions and 1,760 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
},
"extra": {
"theme-json": {
"callable": "\\ItalyStrap\\ExperimentalTheme\\JsonData::getJsonData",
"path-for-theme-sass": "assets/sass/"
}
},
Expand Down
8 changes: 4 additions & 4 deletions src/Asset/Application/Root/Collection/Colors.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@

class Colors
{
private PresetsInterface $collection;
private PresetsInterface $presets;

public function __construct(
PresetsInterface $collection
PresetsInterface $presets
) {
$this->collection = $collection;
$this->presets = $presets;
}

/**
Expand Down Expand Up @@ -71,7 +71,7 @@ public function __invoke(Blueprint $blueprint): void
$dangerClrPalette = new Palette('dangerColor', 'Danger color', $dangerClr);

// Start by adding colors
$this->collection->add($baseClrPalette)
$this->presets->add($baseClrPalette)
->add($lightClrPalette)
->add($darkClrPalette)
->add($bodyBgClrPalette)
Expand Down
34 changes: 17 additions & 17 deletions src/Asset/Application/Root/Collection/Custom.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
use ItalyStrap\ExperimentalTheme\JsonData;
use ItalyStrap\ThemeJsonGenerator\Application\Config\Blueprint;
use ItalyStrap\ThemeJsonGenerator\Domain\Input\Settings\PresetsInterface;
use ItalyStrap\ThemeJsonGenerator\Domain\Input\Settings\Custom\CollectionAdapter;
use ItalyStrap\ThemeJsonGenerator\Domain\Input\Settings\Custom\CustomToPresets;
use ItalyStrap\ThemeJsonGenerator\Domain\Input\Settings\Utilities\CalcExperimental;

class Custom
{
private PresetsInterface $collection;
private PresetsInterface $presets;

public function __construct(
PresetsInterface $collection
PresetsInterface $presets
) {
$this->collection = $collection;
$this->presets = $presets;
}

public function __invoke(Blueprint $blueprint): void
Expand All @@ -33,7 +33,7 @@ public function __invoke(Blueprint $blueprint): void
// var_dump((string)$testCalc);
// $testCalc = new Calc((string)$testDimension, '+', (string)$testDimension, '+', (string)$testDimension);

$collectionAdapter = new CollectionAdapter([
$customToPresets = new CustomToPresets([
'contentSize' => 'clamp(16rem, 60vw, 60rem)',
'wideSize' => 'clamp(16rem, 85vw, 70rem)',
'baseFontSize' => "1rem",
Expand All @@ -54,30 +54,30 @@ public function __invoke(Blueprint $blueprint): void
'l' => '1.7'
],
'body' => [
'bg' => $this->collection->get(JsonData::COLOR_BASE),
'text' => $this->collection->get(JsonData::COLOR_BODY_BG),
'bg' => $this->presets->get(JsonData::COLOR_BASE),
'text' => $this->presets->get(JsonData::COLOR_BODY_BG),
],
'link' => [
'bg' => $this->collection->get(JsonData::COLOR_BASE),
'text' => $this->collection->get(JsonData::COLOR_BODY_BG),
'bg' => $this->presets->get(JsonData::COLOR_BASE),
'text' => $this->presets->get(JsonData::COLOR_BODY_BG),
'decoration' => 'underline',
'hover' => [
'text' => $this->collection->get(JsonData::COLOR_BODY_COLOR),
'text' => $this->presets->get(JsonData::COLOR_BODY_COLOR),
'decoration' => 'underline',
],
],
'button' => [
'bg' => $this->collection->get(JsonData::COLOR_BASE),
'text' => $this->collection->get(JsonData::COLOR_BUTTON_TEXT_HOVER),
'bg' => $this->presets->get(JsonData::COLOR_BASE),
'text' => $this->presets->get(JsonData::COLOR_BUTTON_TEXT_HOVER),
'borderColor' => 'transparent',
'borderRadius' => (string)(new CalcExperimental(
$this->collection->get(JsonData::FONT_SIZE_BASE)->var(),
$this->presets->get(JsonData::FONT_SIZE_BASE)->var(),
'/',
'3'
)),
'hover' => [
'bg' => $this->collection->get(JsonData::COLOR_BUTTON_BG_HOVER),
'text' => $this->collection->get(JsonData::COLOR_BUTTON_TEXT_HOVER),
'bg' => $this->presets->get(JsonData::COLOR_BUTTON_BG_HOVER),
'text' => $this->presets->get(JsonData::COLOR_BUTTON_TEXT_HOVER),
'borderColor' => 'transparent',
],
'padding' => [
Expand Down Expand Up @@ -105,8 +105,8 @@ public function __invoke(Blueprint $blueprint): void
],
]);

$this->collection->addMultiple(
$collectionAdapter->toArray()
$this->presets->addMultiple(
$customToPresets->toArray()
);

// $this->collection
Expand Down
24 changes: 12 additions & 12 deletions src/Asset/Application/Root/Collection/Duotone.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,40 @@

class Duotone
{
private PresetsInterface $collection;
private PresetsInterface $presets;

public function __construct(
PresetsInterface $collection
PresetsInterface $presets
) {
$this->collection = $collection;
$this->presets = $presets;
}

public function __invoke(Blueprint $blueprint): void
{
$this->collection
$this->presets
->add(new \ItalyStrap\ThemeJsonGenerator\Domain\Input\Settings\Color\Duotone(
"black-to-white",
"Black to White",
$this->collection->get(JsonData::COLOR_BODY_COLOR),
$this->collection->get(JsonData::COLOR_BODY_BG)
$this->presets->get(JsonData::COLOR_BODY_COLOR),
$this->presets->get(JsonData::COLOR_BODY_BG)
))
->add(new \ItalyStrap\ThemeJsonGenerator\Domain\Input\Settings\Color\Duotone(
"white-to-black",
"White to Black",
$this->collection->get(JsonData::COLOR_BODY_BG),
$this->collection->get(JsonData::COLOR_BODY_COLOR)
$this->presets->get(JsonData::COLOR_BODY_BG),
$this->presets->get(JsonData::COLOR_BODY_COLOR)
))
->add(new \ItalyStrap\ThemeJsonGenerator\Domain\Input\Settings\Color\Duotone(
"base-to-white",
"Base to White",
$this->collection->get(JsonData::COLOR_BASE),
$this->collection->get(JsonData::COLOR_BODY_BG)
$this->presets->get(JsonData::COLOR_BASE),
$this->presets->get(JsonData::COLOR_BODY_BG)
))
->add(new \ItalyStrap\ThemeJsonGenerator\Domain\Input\Settings\Color\Duotone(
"base-to-black",
"Base to Black",
$this->collection->get(JsonData::COLOR_BASE),
$this->collection->get(JsonData::COLOR_BODY_COLOR)
$this->presets->get(JsonData::COLOR_BASE),
$this->presets->get(JsonData::COLOR_BODY_COLOR)
));
}
}
8 changes: 4 additions & 4 deletions src/Asset/Application/Root/Collection/FontFamily.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@

class FontFamily
{
private PresetsInterface $collection;
private PresetsInterface $presets;

public function __construct(
PresetsInterface $collection
PresetsInterface $presets
) {
$this->collection = $collection;
$this->presets = $presets;
}

public function __invoke(Blueprint $blueprint): void
{
$this->collection
$this->presets
->add(new \ItalyStrap\ThemeJsonGenerator\Domain\Input\Settings\Typography\FontFamily(
'base',
'Default font family',
Expand Down
8 changes: 4 additions & 4 deletions src/Asset/Application/Root/Collection/FontSizes.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@

class FontSizes
{
private PresetsInterface $collection;
private PresetsInterface $presets;

public function __construct(
PresetsInterface $collection
PresetsInterface $presets
) {
$this->collection = $collection;
$this->presets = $presets;
}

public function __invoke(Blueprint $blueprint): void
{
$this->collection
$this->presets
->add(new FontSize('base', 'Base font size 16px', 'clamp(1rem, 2vw, 1.5rem)'))
->add(new FontSize('h1', 'Used in H1 titles', 'calc( {{fontSize.base}} * 2.8125)'))
->add(new FontSize('h2', 'Used in H2 titles', 'calc( {{fontSize.base}} * 2.1875)'))
Expand Down
16 changes: 8 additions & 8 deletions src/Asset/Application/Root/Collection/Gradient.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,33 @@

class Gradient
{
private PresetsInterface $collection;
private PresetsInterface $presets;

public function __construct(
PresetsInterface $collection
PresetsInterface $presets
) {
$this->collection = $collection;
$this->presets = $presets;
}

public function __invoke(Blueprint $blueprint): void
{
$this->collection
$this->presets
->add(new \ItalyStrap\ThemeJsonGenerator\Domain\Input\Settings\Color\Gradient(
'light-to-dark',
'Black to white',
new LinearGradient(
'160deg',
$this->collection->get(JsonData::COLOR_LIGHT),
$this->collection->get(JsonData::COLOR_DARK)
$this->presets->get(JsonData::COLOR_LIGHT),
$this->presets->get(JsonData::COLOR_DARK)
)
))
->add(new \ItalyStrap\ThemeJsonGenerator\Domain\Input\Settings\Color\Gradient(
'base-to-white',
'Base to white',
new LinearGradient(
'135deg',
$this->collection->get(JsonData::COLOR_BASE),
$this->collection->get(JsonData::COLOR_BASE_DARK)
$this->presets->get(JsonData::COLOR_BASE),
$this->presets->get(JsonData::COLOR_BASE_DARK)
)
));
}
Expand Down
8 changes: 4 additions & 4 deletions src/Asset/Application/Root/GlobalStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ class GlobalStyle
private Typography $typography;
private Spacing $spacing;
private CssExperimental $css;
private PresetsInterface $collection;
private PresetsInterface $presets;

public function __construct(
Color $color,
Typography $typography,
Spacing $spacing,
CssExperimental $css,
PresetsInterface $collection
PresetsInterface $presets
) {
$this->color = $color;
$this->typography = $typography;
$this->spacing = $spacing;
$this->css = $css;
$this->collection = $collection;
$this->presets = $presets;
}

/**
Expand Down Expand Up @@ -64,7 +64,7 @@ public function __invoke(Blueprint $blueprint)
->textTransform('none'));

$blueprint->set(SectionNames::STYLES . '.spacing', [
'blockGap' => $this->collection->get(JsonData::SPACER_M)->var(),
'blockGap' => $this->presets->get(JsonData::SPACER_M)->var(),
'margin' => $this->spacing->shorthand(['0px']),
'padding' => $this->spacing->shorthand(['0px']),
]);
Expand Down
11 changes: 1 addition & 10 deletions src/Asset/Application/Root/TermDescription.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,18 @@

class TermDescription
{
private Blueprint $blueprint;
private Color $color;
private Typography $typography;
private Border $border;
private Spacing $spacing;
private PresetsInterface $collection;

public function __construct(
Blueprint $blueprint,
Color $color,
Typography $typography,
Border $border,
Spacing $spacing,
PresetsInterface $collection
Spacing $spacing
) {
$this->blueprint = $blueprint;
$this->color = $color;
$this->typography = $typography;
$this->border = $border;
$this->spacing = $spacing;
$this->collection = $collection;
}

public function __invoke(Blueprint $blueprint)
Expand Down
9 changes: 3 additions & 6 deletions src/Asset/Application/Root/Title.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,29 @@

class Title
{
private Blueprint $blueprint;
private Color $color;
private Typography $typography;

public function __construct(
Blueprint $blueprint,
Color $color,
Typography $typography
) {
$this->blueprint = $blueprint;
$this->color = $color;
$this->typography = $typography;
}

public function __invoke(Blueprint $blueprint): void
{

$this->blueprint->setBlockStyle('core/site-title', [
$blueprint->setBlockStyle('core/site-title', [
'color' => $this->color
->text(JsonData::COLOR_HEADING_TEXT),
'typography' => $this->typography
->fontSize(JsonData::FONT_SIZE_H1)
->fontWeight('600'),
]);

$this->blueprint->setBlockStyle('core/post-title', [ // .wp-block-post-title
$blueprint->setBlockStyle('core/post-title', [ // .wp-block-post-title
'color' => $this->color
->text(JsonData::COLOR_HEADING_TEXT),
'typography' => $this->typography
Expand All @@ -55,7 +52,7 @@ public function __invoke(Blueprint $blueprint): void
* <!-- wp:query-title {"type":"author"} /-->
* .wp-block-query-title
*/
$this->blueprint->setBlockStyle('core/query-title', [
$blueprint->setBlockStyle('core/query-title', [
'color' => $this->color
->text(JsonData::COLOR_GRAY_400),
'typography' => $this->typography
Expand Down
6 changes: 3 additions & 3 deletions src/JsonData.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public static function getJsonData(ContainerInterface $container, PresetsInterfa
(new self())($container, $collection);
}

public function __invoke(ContainerInterface $container, PresetsInterface $collection): void
public function __invoke(ContainerInterface $container, PresetsInterface $presets): void
{
$blueprint = $container->get(Blueprint::class);
$container->get(\ItalyStrap\ExperimentalTheme\Asset\Application\Root\Collection\Colors::class)($blueprint);
Expand Down Expand Up @@ -152,8 +152,8 @@ public function __invoke(ContainerInterface $container, PresetsInterface $collec
// ],

'layout' => [
'contentSize' => $collection->get(self::CONTENT_SIZE)->var(),
'wideSize' => $collection->get(self::WIDE_SIZE)->var(),
'contentSize' => $presets->get(self::CONTENT_SIZE)->var(),
'wideSize' => $presets->get(self::WIDE_SIZE)->var(),
],
],

Expand Down
Loading

0 comments on commit f06b797

Please sign in to comment.