mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-13 15:07:49 +00:00
feat: add Browser viewport fallback to v1
This commit is contained in:
parent
29d1838690
commit
8791a5154e
3 changed files with 21 additions and 7 deletions
|
|
@ -345,6 +345,7 @@ class Plugin extends Model
|
||||||
if ($standalone) {
|
if ($standalone) {
|
||||||
return view('trmnl-layouts.single', [
|
return view('trmnl-layouts.single', [
|
||||||
'colorDepth' => $device?->deviceModel?->color_depth,
|
'colorDepth' => $device?->deviceModel?->color_depth,
|
||||||
|
'deviceVariant' => $device?->deviceModel?->name ?? 'og',
|
||||||
'slot' => $renderedContent,
|
'slot' => $renderedContent,
|
||||||
])->render();
|
])->render();
|
||||||
}
|
}
|
||||||
|
|
@ -356,6 +357,7 @@ class Plugin extends Model
|
||||||
if ($standalone) {
|
if ($standalone) {
|
||||||
return view('trmnl-layouts.single', [
|
return view('trmnl-layouts.single', [
|
||||||
'colorDepth' => $device?->deviceModel?->color_depth,
|
'colorDepth' => $device?->deviceModel?->color_depth,
|
||||||
|
'deviceVariant' => $device?->deviceModel?->name ?? 'og',
|
||||||
'slot' => view($this->render_markup_view, [
|
'slot' => view($this->render_markup_view, [
|
||||||
'size' => $size,
|
'size' => $size,
|
||||||
'data' => $this->data_payload,
|
'data' => $this->data_payload,
|
||||||
|
|
|
||||||
|
|
@ -44,13 +44,12 @@ class ImageGenerationService
|
||||||
$browserStage->html($markup);
|
$browserStage->html($markup);
|
||||||
|
|
||||||
if (config('app.puppeteer_window_size_strategy') === 'v1') {
|
if (config('app.puppeteer_window_size_strategy') === 'v1') {
|
||||||
|
// default behaviour for Framework v1
|
||||||
|
$browserStage->useDefaultDimensions();
|
||||||
|
} else {
|
||||||
$browserStage
|
$browserStage
|
||||||
->width($imageSettings['width'])
|
->width($imageSettings['width'])
|
||||||
->height($imageSettings['height']);
|
->height($imageSettings['height']);
|
||||||
} else {
|
|
||||||
$browserStage
|
|
||||||
->width(800)
|
|
||||||
->height(480);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config('app.puppeteer_wait_for_network_idle')) {
|
if (config('app.puppeteer_wait_for_network_idle')) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,20 @@
|
||||||
@props([
|
@props([
|
||||||
|
'noBleed' => false,
|
||||||
|
'darkMode' => false,
|
||||||
|
'deviceVariant' => 'og',
|
||||||
|
'deviceOrientation' => null,
|
||||||
'colorDepth' => '1bit',
|
'colorDepth' => '1bit',
|
||||||
|
'scaleLevel' => null,
|
||||||
])
|
])
|
||||||
|
|
||||||
<x-trmnl::screen colorDepth="{{$colorDepth}}">
|
@if(config('app.puppeteer_window_size_strategy') === 'v1')
|
||||||
{!! $slot !!}
|
<x-trmnl::screen colorDepth="{{$colorDepth}}">
|
||||||
</x-trmnl::screen>
|
{!! $slot !!}
|
||||||
|
</x-trmnl::screen>
|
||||||
|
@else
|
||||||
|
<x-trmnl::screen colorDepth="{{$colorDepth}}" no-bleed="{{$noBleed}}" dark-mode="{{$darkMode}}"
|
||||||
|
device-variant="{{$deviceVariant}}" device-orientation="{{$deviceOrientation}}"
|
||||||
|
scale-level="{{$scaleLevel}}">
|
||||||
|
{!! $slot !!}
|
||||||
|
</x-trmnl::screen>
|
||||||
|
@endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue