The essential news about content management systems and mobile technology. Powered by Perfect Publisher and XT Search for Algolia.
The News Site publishes posts to the following channels: Facebook, Instagram, Twitter, Telegram, Web Push, Tumblr, and Blogger.
Read more https://build.prestashop-project.org/news/2023/hummingbird-theme-hooks/
This week, the Laravel team released v10.38 with a
fromRoute()
testing helper, a Blade
@session
directive, basic
whereJsonContains
support for SQLite, and more.
As part of Laravel's weekly releases, the team also rolled out
Vite 5 support to all first-party Laravel
packages. For example, when you run laravel new
to
create a new Laravel application or you install Breeze, you will be
using Vite 5 out of the box!
Here is a bit more info about the new features introduced in Laravel 10.38 this week:
@fragkp contributed a fromRoute()
testing
helper to assert a redirect response in a feature test. This method
is syntactic sugar for passing a route to the from()
test case method:
// Using the `from()` method
$this->from(route('index'))
->get(route('language', ['language' => 'de']))
->assertRedirectToRoute('index');
You can now pass a string to the fromRoute()
method
for convenience:
$this->fromRoute('index') // changed
->get(route('language', ['language' => 'de']))
->assertRedirectToRoute('index');
charset
and collation
method to
Blueprint
@gcazin contributed two new methods to the schema Blueprint class for defining charset and collation:
// via property
Schema::table('foo', function (Blueprint $table) {
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_unicode_ci';
// ...
});
// New methods
Schema::table('foo', function (Blueprint $table) {
$table->charset('utf8mb4');
$table->collation('utf8mb4_unicode_ci');
// ...
});
These are new methods, so the existing property assignment will still work as expected.
@session
directiveJared Lewis contributed a @session
blade
directive for checking if a session value exists. It supports
embedded @session
usage as well:
{{-- Before --}}
@if(session('status'))
<div class="alert alert-success" role="alert">
{{ session('status') }}
</div>
@endif
{{-- After --}}
@session('status')
<div class="alert alert-success" role="alert">
{{ $value }}
</div>
@endsession
whereJsonContains
Daniele Ambrosino contributed support for
whereJsonContains
using the SQLite database:
SQLite added JSON support by default as of version 3.38.0. Nonetheless, the SQLiteGrammar does not currently support
whereJsonContains
andwhereJsonDoesntContain
methods regardless of the SQLite version.
Here's an example from the pull request description:
$users = DB::table('users')
->whereJsonContains('options->languages', 'en')
->get();
/*
select * from "users"
where exists (select 1 from json_each("options", '$."languages"') where "json_each"."value" is ?)
*/
//
$users = DB::table('users')
->whereJsonContains('options->languages', false);
// the `where` part would look like: `where "json_each"."value" is false`
@shane-zeng contributed adding the
Conditionable
trait to pipelines, which gives you the
ability to write pipelines without weird conditions between
them.
Here's how we might have to write a pipeline with conditions before Laravel 10.38:
$pipeline = Pipeline::send($user)
->through([
GenerateProfilePhoto::class,
]);
if (! $user->isAdmin) {
$pipeline->pipe([
SendWelcomeEmail::class,
ActivateSubscription::class,
]);
}
$user = $pipeline->then(fn (User $user) => $user);
Now, you can use the Conditionable
's
when
and unless
methods to chain pipeline
logic seamlessly:
$user = Pipeline::send($user)
->through([
GenerateProfilePhoto::class,
])
->when(! $user->isAdmin, function (Pipeline $pipeline) {
$pipeline->pipe([
SendWelcomeEmail::class,
ActivateSubscription::class,
]);
})
->then(fn (User $user) => $user);
@bastien-phi contributed an update that improves
Arr::dot()
performance; in some cases, it seems like
it improves things quite drastically as the number of array items
increases. See Pull Request #49386 for further details.
You can see the complete list of new features and updates below and the diff between 10.37.0 and 10.38.0 on GitHub. The following release notes are directly from the changelog:
false
values in
db:table
command by @PerryvanderMeer in https://github.com/laravel/framework/pull/49379sql_require_primary_key
enabled by @mtawil in
https://github.com/laravel/framework/pull/49374charset
and collation
method to Blueprint
by @gcazin in https://github.com/laravel/framework/pull/49396about
command on Octane by
@josecl in https://github.com/laravel/framework/pull/49387[@session](https://github.com/session)
Directive by
@jrd-lewis in https://github.com/laravel/framework/pull/49339Arr::dot
performance by @bastien-phi in https://github.com/laravel/framework/pull/49386defaultCasters
if not previously
set by @inxilpro in https://github.com/laravel/framework/pull/49402ManagesFrequencies
by @Lucas-Schmukas in https://github.com/laravel/framework/pull/49399whereJsonContains
method by @danieleambrosino in https://github.com/laravel/framework/pull/49401isEmpty
and
isNotEmpty
to ComponentAttributeBag
by
@devajmeireles in https://github.com/laravel/framework/pull/49408getColumns()
method
by @hafezdivandari in https://github.com/laravel/framework/pull/49416MailMessage
helpers for plain text
email notifications by @onlime in https://github.com/laravel/framework/pull/49407The post Laravel 10.38 Released appeared first on Laravel News.
Join the Laravel Newsletter to get all the latest Laravel articles like this directly in your inbox.
Read more https://laravel-news.com/laravel-10-38-0
Tailwind v3.4 is now released with dynamic viewport units, :has() support, balanced headlines, subgrid, and more!
In the release announcement, Adam Wathan mentions that many of these features are directly related to them building a new Catalyst UI kit:
There’s nothing like building a major new product for finding all the features you wish you had in your own tools, so we capitalized on some of that inspiration and turned it into this — Tailwind CSS v3.4.
As always the improvements range from things you’ve been angry about for years, to supporting CSS features you’ve never even heard of and probably can’t even use at work.
The highlights include:
See the full announcement for all the details on this new release and you can start using it today by running:
npm install tailwindcss@latest
The post TailwindCSS now with dynamic viewport units, :has() support, balanced headlines, subgrid, and more! appeared first on Laravel News.
Join the Laravel Newsletter to get all the latest Laravel articles like this directly in your inbox.
Read more https://laravel-news.com/tailwind-3-4
This year has been a big year for domains on WordPress.com, from offering free transfers for Google customers to an all-new dashboard for managing your domains. We have one more bit of good cheer to spread before the year is through: today we’re excited to share the addition of two new country-specific domain extensions to our domain offerings on WordPress.com.
Now, you can elevate your online presence with the official domain extensions of two of the most important and influential countries in the world: Brazil’s .com.br and Germany’s .de. Country-code domains like .com.br and .de resonate with local consumers, bringing both authenticity and authority to your online presence.
For both of these newly available extensions, we provide our own trustee, so you don’t need to be physically located in Brazil or Germany to register either of these country-level domain names.
The official .com.br domain extension is now available for purchase on WordPress.com for just R$ 99 a year (US$20). Business owners, students, artists, and bloggers alike can harness the power of .com.br to connect directly with Brazilian consumers in one of the Americas’ fastest-growing economies.
With millions of .com.br domains already registered, it’s one of the booming country-level domain extensions in the Western hemisphere.
Get your .com.br domainLet’s depart Brazil for now and head north and east across the Atlantic. The official .de domain extension is now available on WordPress.com for just 8€ a year (US$8). Whether you’re a business owner or a content creator, a .de domain is the perfect choice to appeal to German consumers in one of Europe’s strongest economies.
With tens of millions of .de domains already in use, it stands as one of the most popular and respected domain extensions in the world.
Get your .de domainEvery single day, our team is working hard to ensure that there’s no better place on the internet to purchase and manage your domain(s). Here are a few reasons to choose us:
Elevate your online presence with these impactful domain extensions. Register your new .com.br and .de domain names at WordPress.com today.
Read more https://wordpress.com/blog/2023/12/19/country-code-domains-brazil-germany/
There’s nothing like building a major new product for finding all the features you wish you had in your own tools, so we capitalized on some of that inspiration and turned it into this — Tailwind CSS v3.4.
There’s nothing like building a major new product for finding all the features you wish you had in your own tools, so we capitalized on some of that inspiration and turned it into this — Tailwind CSS v3.4.
As always the improvements range from things you’ve been angry about for years, to supporting CSS features you’ve never even heard of and probably can’t even use at work.
:has()
variant:
Style parent elements based on their children.*
variant: We’ll probably regret giving you this
one.size-*
utilities:
Set width and height at the same time, finally.text-wrap
utilities: No more max-width
tweaking or responsive line breaks.min-w-12
is a real
class.grid-rows-*
scale: Might as well make it match the column
scale.forced-colors
variant: Easily fine-tune your site for forced colors
mode.forced-color-adjust
utilities: For even more forced colors
fine-tuning.All the good stuff is in that list, but check out the release notes for a couple more details that weren’t exciting enough to earn a spot in this post.
Upgrade your projects by installing the latest version of
tailwindcss
from npm:
$ npm install tailwindcss@latest
Or try out all of the new features on Tailwind Play, right in your browser.
When the vh
unit was added to browsers we all got
so excited — finally a way to build full-height application layouts
and stuff without drilling height: 100%
through 17
layers of DOM! But mobile devices and their damn disappearing menu
bars spoiled all the fun, effectively making the vh
unit just a cruel reminder of a future that could’ve been so
great.
Well we’ve got a new future now — dvh
,
lvh
, and svh
are designed to accommodate
that disappearing browser chrome and Tailwind CSS v3.4 supports
them out of the box:
Scroll up and down in the viewport to hide/show the browser UI
h-dvh
<div class="h-dvh">
<!-- ... -->
</div>
We’ve added the following new classes by default:
Class | CSS |
---|---|
h-svh |
height: 100svh |
h-lvh |
height: 100lvh |
h-dvh |
height: 100dvh |
min-h-svh |
min-height: 100svh |
min-h-lvh |
min-height: 100lvh |
min-h-dvh |
min-height: 100dvh |
max-h-svh |
max-height: 100svh |
max-h-lvh |
max-height: 100lvh |
max-h-dvh |
max-height: 100dvh |
If you need other values, you can always use arbitrary values
too like min-h-[75dvh]
.
Browser support is pretty great for these nowadays, so unless you need to support Safari 14 you can start using these right away.
:has()
variant
New The :has()
pseudo-class is the most powerful
thing that’s been added to CSS since flexbox. For the first time
ever, you can style an element based on its children, not
just based on its parents. It even makes it possible to style based
on subsequent siblings.
Here’s an example where the parent gets a colored ring if the radio button inside of it is checked:
<label class="has-[:checked]:ring-indigo-500 has-[:checked]:text-indigo-900 has-[:checked]:bg-indigo-50 ..">
<svg fill="currentColor">
<!-- ... -->
</svg>
Google Pay
<input type="radio" class="accent-indigo-500 ..." />
</label>
I feel like I’ve found a new use-case for :has()
every week while working on this new UI kit we’ve been building for
the last few months, and it’s replaced a crazy amount of JavaScript
in our code.
For example, our text inputs are pretty complicated design-wise
and require a little wrapper element to build. Without
:has()
, we had no way of styling the wrapper based on
things like the :disabled
state of the input, but now
we can:
export function Input({ ... }) {
return (
<span className="has-[:disabled]:opacity-50 ...">
<input ... />
</span>
)
}
This one is pretty bleeding edge but as of literally today it’s now supported in the latest version of all major browsers. Give it a few weeks for any Firefox users to install today’s update and we should be able to go wild with it.
*
variant
Style children with the Here’s one people have wanted for literally ever — a way to style children from the parent using utility classes.
We’ve added a new *
variant that targets direct
children, letting you do stuff like this:
<div>
<h2>Categories:<h2>
<ul class="*:rounded-full *:border *:border-sky-100 *:bg-sky-50 *:px-2 *:py-0.5 dark:text-sky-300 dark:*:border-sky-500/15 dark:*:bg-sky-500/10 ...">
<li>Sales</li>
<li>Marketing</li>
<li>SEO</li>
<!-- ... -->
</ul>
</div>
Generally I’d recommend just styling the children directly, but this can be useful when you don’t control those elements or need to make a conditional tweak because of the context the element is used in.
It can be composed with other variants too, for instance
hover:*:underline
will style any child when the child
is hovered.
Here’s a cool way we’re using that to conditionally add layout styles to different child elements in the new UI kit we’re working on:
function Field({ children }) {
return (
<div className="data-[slot=description]:*:mt-4 ...">
{children}
</div>
)
}
function Description({ children }) {
return (
<p data-slot="description" ...>{children}</p>
)
}
function Example() {
return (
<Field>
<Label>First name</Label>
<Input />
<Description>Please tell me you know your own name.</Description>
</Field>
)
}
See that crazy data-[slot=description]:*:mt-4
class? It first targets all direct children (that’s the
*:
part), then filters them down to just items with a
data-slot="description"
attribute using
data-[slot=description]
.
This makes it easy to target only specific children, without having to drop all the way down to a raw arbitrary variant.
Looking forward to seeing all the horrible stuff everyone does to make me regret adding this feature.
size-*
utilities
New You’re sick of typing h-5 w-5
every time you need
to size an avatar, you know it and I know it.
In Tailwind CSS v3.4 we’ve finally added a new
size-*
utility that sets width and height at the same
time:
<div>
<img class="h-10 w-10" ...>
<img class="h-12 w-12" ...>
<img class="h-14 w-14" ...>
<img class="size-10" ...>
<img class="size-12" ...>
<img class="size-14" ...>
</div>
We’ve wanted to add this forever but have always been hung up on
the exact name — size-*
felt like so much to type
compared to w-*
or h-*
and
s-*
felt way too cryptic.
After using it for a few weeks though I can say decisively that even with the longer name, it’s way better than separate width and height utilities. Super convenient, especially if you’re combining it with variants or using a complex arbitrary value.
text-wrap
utilities
Balanced headlines with How much time have you spent fiddling with
max-width
or inserting responsive line breaks to try
and make those little section headings wrap nicely on your landing
pages? Well now you can spend zero time on it, because the browser
can do it for you with text-wrap: balance
:
New Yorkers are facing the winter chill with less warmth this year as the city's most revered soup stand unexpectedly shutters, following a series of events that have left the community puzzled.
<article>
<h3 class="text-balance ...">Beloved Manhattan soup stand closes<h3>
<p>New Yorkers are facing the winter chill...</p>
</article>
We’ve also added text-pretty
which tries to avoid
orphaned words at the end of paragraphs using text-wrap:
pretty
:
New Yorkers are facing the winter chill with less warmth this year as the city's most revered soup stand unexpectedly shutters, following a series of events that have left the community puzzled.
<article class="text-pretty ...">
<h3>Beloved Manhattan soup stand closes<h3>
<p>New Yorkers are facing the winter chill...</p>
</article>
The nice thing about these features is that even if someone visits your site with an older browser, they’ll just fallback to the regular wrapping behavior so it’s totally safe to start using these today.
Subgrid is a fairly recent CSS feature that lets an element sort of inherit the grid columns or rows from its parent, make it possible to place its child elements in the parent grid.
<div class="grid grid-cols-4 gap-4">
<!-- ... -->
<div class="grid grid-cols-subgrid gap-4 col-span-3">
<div class="col-start-2">06</div>
</div>
<!-- ... -->
</div>
We’re using subgrid in the new UI kit we’re working on for example in dropdown menus, so that if any item has an icon, all of the other items are indented to keep the text aligned:
<div role="menu" class="grid grid-cols-[auto_1fr]">
<a href="#" class="grid-cols-subgrid col-span-2">
<svg class="mr-2">...</svg>
<span class="col-start-2">Account</span>
</a>
<a href="#" class="grid-cols-subgrid col-span-2">
<svg class="mr-2">...</svg>
<span class="col-start-2">Settings</span>
</a>
<a href="#" class="grid-cols-subgrid col-span-2">
<span class="col-start-2">Sign out</span>
</a>
</div>
When none of the items have an icon, the first column shrinks to 0px and the text is aligned all the way to left.
Check out the MDN documentation on subgrid for a full primer — it’s a bit of a tricky feature to wrap your head around at first, but once it clicks it’s a game-changer.
We’ve finally extended the min-width
,
max-width
, and min-height
scales to
include the full spacing scale, so classes like
min-w-12
are actually a real thing now:
<div class="min-w-12">
<!-- ... -->
</div>
We should’ve just done this for v3.0 but never really got around to it — I’m sorry and you’re welcome.
We’ve also extended the opacity scale to include every step of 5 out of the box:
<div class="opacity-35">
<!-- ... -->
</div>
Hopefully that means a few less arbitrary values in your markup. I’m coming for you next 2.5%.
grid-rows-*
scale
Extended We’ve also bumped the baked-in number of grid rows from 6 to 12 because why not:
<div class="grid grid-rows-9">
<!-- ... -->
</div>
Maybe we’ll get even crazier and bump it to 16 in the next release.
forced-colors
variant
New Ever heard of forced colors mode? Your site probably looks pretty bad in it.
Well now you can’t blame us at least, because Tailwind CSS v3.4
includes a forced-colors
variant for adjusting styles
for forced colors mode:
<form>
<input type="checkbox" class="appearance-none forced-colors:appearance-auto ...">
</form>
It’s really useful for fine-tuning totally custom controls, especially combined with arbitrary values and a working knowledge of CSS system colors.
forced-color-adjust
utilities
New We’ve also added new forced-color-adjust-auto
and
forces-color-adjust-none
utilities to control how
forced colors mode affects your design:
<fieldset>
<legend>Choose a color</legend>
<div class="forced-color-adjust-none ...">
<label>
<input class="sr-only" type="radio" name="color-choice" value="white" />
<span class="sr-only">White</span>
<span class="size-6 rounded-full bg-white"></span>
</label>
<label>
<input class="sr-only" type="radio" name="color-choice" value="gray" />
<span class="sr-only">Gray</span>
<span class="size-6 rounded-full bg-gray-300"></span>
</label>
<!-- ... -->
</div>
</fieldset>
These should be used pretty sparingly, but they can be useful when it’s critical that something is rendered in a specific color no matter what, like choosing the color of something someone is buying in an online store.
To learn more about all this forced colors stuff, I recommend reading “Forced colors explained: A practical guide” on the Polypane blog — by far the most useful post I’ve found on this topic.
If you’ve been paying close attention, you might be wondering about Oxide, the engine improvements we previewed at Tailwind Connect this summer.
We’d originally slated those improvements for v3.4, but we have a few things still to iron out and so many of these other improvements had been piling up that we felt it made sense to get it all out the door instead of holding it back. The Oxide stuff is still coming, and will be the headlining improvement for the next Tailwind CSS release in the new year.
In the mean time, dig in to Tailwind CSS v3.4 by updating to the latest version with npm:
$ npm install tailwindcss@latest
With :has()
and the new *
variant,
your HTML is about get more out of control than ever.
(The post Tailwind CSS v3.4: Dynamic viewport units, :has() support, balanced headlines, subgrid, and more appeared first on Tailwind CSS Blog.)
Read more https://tailwindcss.com/blog/tailwindcss-v3-4