Skip to content

Commit 60dd4c3

Browse files
committed
chore: rename blade template files to flatten blade component names, updated docs/readme
1 parent 4889db2 commit 60dd4c3

132 files changed

Lines changed: 256 additions & 397 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,12 @@ Files are grouped into inline, block and void elements. For elements with a spec
5555

5656
### Blade
5757
Blade templates can be found in [`templates/blade`](https://github.com/vardumper/extended-htmldocument/tree/main/templates/blade). The [README](https://github.com/vardumper/extended-htmldocument/blob/main/templates/blade/README.md) has more infos and usage examples. Blade templates can also be installed via `npm` with the [@typesafe-html5/blade](https://www.npmjs.com/package/@typesafe-html5/blade) package.
58+
59+
Each element's template is generated as `index.blade.php` inside a subdirectory named after the element (e.g. `blade/block/div/index.blade.php`), which Blade resolves as `x-block.div`.
60+
61+
The `blade-component` generator converts a full YAML component definition into a Blade document using `<x-block.*>`, `<x-inline.*>` and `<x-void.*>` component tags. Use it via the `watch` command — see the [README](https://github.com/vardumper/extended-htmldocument/blob/main/templates/blade/README.md) for examples.
5862
### React & NextJS
59-
React and NextJS templates can be found in `templates/blade`. See the Blade-specific [README](https://github.com/vardumper/extended-htmldocument/blob/main/templates/blade/README.md) file for details. Blade templates can also be installed via `npm` with the [@typesafe-html5/react](https://www.npmjs.com/package/@typesafe-html5/react) package.
63+
React and NextJS templates can be found in [`templates/nextjs`](https://github.com/vardumper/extended-htmldocument/tree/main/templates/nextjs). See the [README](https://github.com/vardumper/extended-htmldocument/blob/main/templates/nextjs/README.md) file for details. NextJS templates can also be installed via `npm` with the [@typesafe-html5/react](https://www.npmjs.com/package/@typesafe-html5/react) package.
6064
### Storybook
6165
Storybook with atoms for all HTML5 elements can be [seen in the Demo](https://vardumper.github.io/extended-htmldocument/storybook-site/). Files can be found in [`templates/storybook`](https://github.com/vardumper/extended-htmldocument/tree/main/templates/storybook). There's also a [README](https://github.com/vardumper/extended-htmldocument/blob/main/templates/storybook/README.md) with more details.
6266
### Storybook for Twig

clover.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<coverage generated="1779087504">
3-
<project timestamp="1779087504" name="Clover Coverage">
2+
<coverage generated="1779348799">
3+
<project timestamp="1779348799" name="Clover Coverage">
44
<package name="Html\Delegator">
55
<file name="/home/erik-poehler/Sites/ExtendedHTMLDocument/src/Delegator/HTMLDocumentDelegator.php">
66
<class name="Html\Delegator\HTMLDocumentDelegator" namespace="Html\Delegator">

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"ext-dom": "*",
4545
"revolt/event-loop": "^1.0.9",
4646
"mnapoli/silly": "^1.10.0",
47-
"symfony/yaml": "^5.4|^7.0|^8.0.11"
47+
"symfony/yaml": "^5.4|^7.0|^8.0.12"
4848
},
4949
"config": {
5050
"sort-packages": true,
@@ -69,9 +69,9 @@
6969
"pestphp/pest-plugin-drift": "^3.0",
7070
"pestphp/pest-plugin-type-coverage": "^3.6.1",
7171
"phpmd/phpmd": "^2.15",
72-
"phpstan/phpstan": "^2.1.54",
72+
"phpstan/phpstan": "^2.1.55",
7373
"rector/swiss-knife": "^2.3.5",
74-
"symfony/http-kernel": "^5.4|^6.0|^7.0|^8.0.11",
74+
"symfony/http-kernel": "^5.4|^6.0|^7.0|^8.0.12",
7575
"symfony/ux-twig-component": "^2.35",
7676
"symplify/easy-coding-standard": "^12.6.2"
7777
},

composer.lock

Lines changed: 33 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/template-generator/dest/Teaser-example.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* THIS FILE IS AUTOGENERATED. DO NOT EDIT IT.
33
*
4-
* @generated May 18, 2026 06:58:57
4+
* @generated May 21, 2026 07:25:27
55
* @description Generated document using pre-made @typesafe-html5/react templates
66
*/
77

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{{--
2+
This file is auto-generated.
3+
4+
Strict mode: include
5+
6+
@see src/TemplateGenerator/BladeGenerator.php
7+
--}}
8+
@php(ob_start())
9+
@php(ob_start())
10+
@php(ob_start())
11+
Headline
12+
$__bladeContent1 = ob_get_clean();
13+
@endphp
14+
@include('blade.block.h3', ['content' => $__bladeContent1])
15+
@php(ob_start())
16+
Subheadline
17+
$__bladeContent2 = ob_get_clean();
18+
@endphp
19+
@include('blade.block.h4', ['content' => $__bladeContent2])
20+
$__bladeContent3 = ob_get_clean();
21+
@endphp
22+
@include('blade.block.hgroup', ['content' => $__bladeContent3])
23+
@php(ob_start())
24+
Description
25+
$__bladeContent4 = ob_get_clean();
26+
@endphp
27+
@include('blade.block.p', ['content' => $__bladeContent4])
28+
@include('blade.inline.img', ['src' => 'https://picsum.photos/340/140', 'alt' => 'Image description', 'width' => '340', 'height' => '140'])
29+
@php(ob_start())
30+
Read more
31+
$__bladeContent5 = ob_get_clean();
32+
@endphp
33+
@include('blade.inline.a', ['role' => 'button', 'href' => '#', 'content' => $__bladeContent5])
34+
$__bladeContent6 = ob_get_clean();
35+
@endphp
36+
@include('blade.block.div', ['class' => 'teaser', 'content' => $__bladeContent6])

examples/template-generator/dest/teaser-example.blade.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33
44
@see src/TemplateGenerator/BladeComponentGenerator.php
55
--}}
6-
<x-block.div.div class="teaser">
7-
<x-block.hgroup.hgroup>
8-
<x-block.h3.h3>
6+
<x-block.div class="teaser">
7+
<x-block.hgroup>
8+
<x-block.h3>
99
Headline
10-
</x-block.h3.h3>
11-
<x-block.h4.h4>
10+
</x-block.h3>
11+
<x-block.h4>
1212
Subheadline
13-
</x-block.h4.h4>
14-
</x-block.hgroup.hgroup>
15-
<x-block.p.p>
13+
</x-block.h4>
14+
</x-block.hgroup>
15+
<x-block.p>
1616
Description
17-
</x-block.p.p>
18-
<x-inline.img.img src="https://picsum.photos/340/140" alt="Image description" width="340" height="140" />
19-
<x-inline.a.a role="button" href="#">
17+
</x-block.p>
18+
<x-inline.img src="https://picsum.photos/340/140" alt="Image description" width="340" height="140" />
19+
<x-inline.a role="button" href="#">
2020
Read more
21-
</x-inline.a.a>
22-
</x-block.div.div>
21+
</x-inline.a>
22+
</x-block.div>

examples/template-generator/dest/teaser-example.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* THIS FILE IS AUTOGENERATED. DO NOT EDIT IT.
33
*
4-
* @generated May 18, 2026 06:58:57
4+
* @generated May 21, 2026 07:25:28
55
* @description Generated component using pre-made @typesafe-html5/typescript templates
66
*/
77

src/Command/BatchGeneratorCommand.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@ public function __invoke(
9393
continue;
9494
}
9595
$elementShortName = (new ReflectionClass($className))->getShortName();
96-
$fileName = $elementInstance::getQualifiedName() . '.' . $generatorInstance->getExtension();
96+
$fileName = str_replace(
97+
['{component}', '{extension}'],
98+
[$elementInstance::getQualifiedName(), $generatorInstance->getExtension()],
99+
$generatorInstance->getNamePattern()
100+
);
97101
$level = $this->determineLevel($className);
98102

99103
// For twig-component, use bundle structure: src/{Twig|Resources}/{Block|Inline|Void}

src/TemplateGenerator/BladeComponentGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ private function resolveComponentTag(string $tagName): ?string
170170
return null;
171171
}
172172

173-
return 'x-' . $this->determineLevel($className) . '.' . $tagName . '.' . $tagName;
173+
return 'x-' . $this->determineLevel($className) . '.' . $tagName;
174174
}
175175

176176
private function determineLevel(string $className): string

0 commit comments

Comments
 (0)