<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Angéllica Araujo</title>
    <description>The latest articles on DEV Community by Angéllica Araujo (@angellicaaraujo).</description>
    <link>https://dev.to/angellicaaraujo</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F830939%2F93bdd655-7ebe-4c3b-b0c2-01c63268b6e6.jpeg</url>
      <title>DEV Community: Angéllica Araujo</title>
      <link>https://dev.to/angellicaaraujo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/angellicaaraujo"/>
    <language>en</language>
    <item>
      <title>Sharing Modules Across Different Applications: Dynamic Module Federation with Nx Workspace</title>
      <dc:creator>Angéllica Araujo</dc:creator>
      <pubDate>Sun, 23 Apr 2023 11:20:10 +0000</pubDate>
      <link>https://dev.to/angellicaaraujo/sharing-modules-across-different-applications-dynamic-module-federation-with-nx-workspace-1j86</link>
      <guid>https://dev.to/angellicaaraujo/sharing-modules-across-different-applications-dynamic-module-federation-with-nx-workspace-1j86</guid>
      <description>&lt;p&gt;&lt;em&gt;Module federation&lt;/em&gt; allows developers to share modules between different applications, enabling them to build more modular and scalable systems allowing different applications to share modules dynamically at runtime. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Dynamic module federation&lt;/em&gt; takes module sharing to the next level by enabling applications to load and unload modules dynamically.&lt;/p&gt;

&lt;p&gt;The benefits of this approach include reduced code duplication and faster development cycles, making it an attractive option for developers to consider in their projects.&lt;/p&gt;

&lt;h3&gt;
  
  
  Practical example using the Nx workspace
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://nx.dev/recipes/module-federation/dynamic-module-federation-with-angular"&gt;Nx.dev delivers a practical example&lt;/a&gt; of how to implement dynamic module federation in an Angular application using the Nx workspace. &lt;/p&gt;

&lt;p&gt;The tutorial on provides a step-by-step guide which the key steps are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create an Nx workspace and an Angular application within it using the Nx CLI.&lt;/li&gt;
&lt;li&gt;Modify the &lt;code&gt;webpack.config.js&lt;/code&gt; file to enable module federation and define the shared modules.&lt;/li&gt;
&lt;li&gt;Define a &lt;code&gt;remoteEntry.js&lt;/code&gt; file in the remote application to expose the shared modules.&lt;/li&gt;
&lt;li&gt;Use the &lt;code&gt;loadRemoteModule&lt;/code&gt; function in the host application to dynamically load the remote module.&lt;/li&gt;
&lt;li&gt;Set up routing in the host application to load the remote module on demand.&lt;/li&gt;
&lt;li&gt;Test the implementation by running the applications and verifying that the module is loaded correctly.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The first step involves creating an Nx workspace and an Angular application within it using the Nx CLI and installing the necessary dependencies.&lt;/p&gt;

&lt;p&gt;In the second step, you need to modify the &lt;code&gt;webpack.config.js&lt;/code&gt; and define the shared modules. Then, you configure &lt;em&gt;module federation&lt;/em&gt; in the &lt;code&gt;webpack.config.js&lt;/code&gt; file by adding the &lt;code&gt;ModuleFederationPlugin&lt;/code&gt; to the plugins array and define the shared modules by adding them to the shared object.&lt;/p&gt;

&lt;p&gt;In the third step, you work on a file to expose the shared modules. This involves creating a &lt;code&gt;remoteEntry.js&lt;/code&gt; file in the remote application's &lt;code&gt;src&lt;/code&gt; directory and exporting the shared modules using the &lt;code&gt;__webpack_share_scopes__&lt;/code&gt; object.&lt;/p&gt;

&lt;p&gt;In step four, developers use the &lt;code&gt;loadRemoteModule&lt;/code&gt; function in the host application to dynamically load the remote module. They import the &lt;code&gt;loadRemoteModule&lt;/code&gt; function from &lt;code&gt;@angular-architects/module-federation&lt;/code&gt; in the host application and use the &lt;code&gt;loadRemoteModule&lt;/code&gt; function to dynamically load the remote module when needed.&lt;/p&gt;

&lt;p&gt;In step five, you set up routing to load the remote module on demand. It's done by defining a route for the remote module in the host application's &lt;code&gt;app-routing.module.ts&lt;/code&gt; file and use the &lt;code&gt;loadRemoteModule&lt;/code&gt; function to load the remote module in the route's component.&lt;/p&gt;

&lt;p&gt;Finally, in step six, you can test the implementation by running the applications and verifying that the module is loaded correctly. &lt;/p&gt;

&lt;p&gt;By following these steps, you can implement dynamic module federation in your Angular applications, allowing for the dynamic loading and unloading of modules at runtime.&lt;/p&gt;

&lt;p&gt;Image by &lt;a href="https://www.vecteezy.com"&gt;https://www.vecteezy.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>angular</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Tipos condicionais no TypeScript: exemplos práticos e uso avançado</title>
      <dc:creator>Angéllica Araujo</dc:creator>
      <pubDate>Tue, 18 Apr 2023 07:57:18 +0000</pubDate>
      <link>https://dev.to/angellicaaraujo/tipos-condicionais-no-typescript-exemplos-praticos-e-uso-avancado-3d5f</link>
      <guid>https://dev.to/angellicaaraujo/tipos-condicionais-no-typescript-exemplos-praticos-e-uso-avancado-3d5f</guid>
      <description>&lt;p&gt;Com os tipos condicionais, um recurso poderoso do TypeScript, é possível criar &lt;em&gt;tipos que dependem de outros tipos&lt;/em&gt;. Os tipos condicionais são avaliados em tempo de compilação e são definidos usando um operador ternário que especifica uma condição, e o ponto de interrogação indica que o tipo é condicional.&lt;/p&gt;

&lt;p&gt;A sintaxe para um tipo condicional é a seguinte:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;T&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nx"&gt;U&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;X&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Aqui, &lt;code&gt;T&lt;/code&gt; e &lt;code&gt;U&lt;/code&gt; são tipos, &lt;code&gt;X&lt;/code&gt; e &lt;code&gt;Y&lt;/code&gt; são tipos ou expressões de tipo, e &lt;code&gt;extends&lt;/code&gt; é uma palavra-chave que especifica uma restrição em &lt;code&gt;T&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Um caso de uso comum para tipos condicionais é extrair propriedades de objetos. Por exemplo, considere a seguinte interface:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;User&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Podemos criar um tipo que extrai as chaves de &lt;code&gt;User&lt;/code&gt; da seguinte forma:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;UserKeys&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kr"&gt;keyof&lt;/span&gt; &lt;span class="nx"&gt;User&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// "id" | "name" | "email"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Usando um tipo condicional, podemos criar uma versão mais flexível de &lt;code&gt;UserKeys&lt;/code&gt; que pode extrair chaves de qualquer tipo de objeto:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;KeysOfType&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;U&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;K&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="kr"&gt;keyof&lt;/span&gt; &lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt; &lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;K&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nx"&gt;U&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;K&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;never&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}[&lt;/span&gt;&lt;span class="kr"&gt;keyof&lt;/span&gt; &lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Aqui, &lt;code&gt;KeysOfType&lt;/code&gt; recebe dois parâmetros de tipo, &lt;code&gt;T&lt;/code&gt; e &lt;code&gt;U&lt;/code&gt;, e retorna uma união de chaves de &lt;code&gt;T&lt;/code&gt; cujos valores são do tipo &lt;code&gt;U&lt;/code&gt;. Por exemplo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;Car&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;make&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;year&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;StringKeys&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;KeysOfType&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// "make" | "model"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Esse tipo retorna "make" e "model", pois essas são as chaves de Car cujos valores são do tipo &lt;code&gt;string&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Outro caso de uso para tipos condicionais é verificar se um tipo é um array. O TypeScript fornece um tipo &lt;code&gt;Array&lt;/code&gt; integrado, mas às vezes precisamos verificar se um valor é um array em tempo de execução. Podemos criar um tipo que verifica se um tipo é um array da seguinte forma:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;IsArray&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;T&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="kr"&gt;any&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Aqui, &lt;code&gt;IsArray&lt;/code&gt; recebe um parâmetro de tipo &lt;code&gt;T&lt;/code&gt; e retorna um booleano indicando se &lt;code&gt;T&lt;/code&gt; é um tipo de array. Por exemplo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;A&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;IsArray&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;B&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;IsArray&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Os tipos condicionais também suportam a palavra-chave &lt;code&gt;infer&lt;/code&gt;, que nos permite inferir um tipo de outro tipo. Por exemplo, considere o seguinte tipo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;ReturnType&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;T&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="p"&gt;(...&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;any&lt;/span&gt;&lt;span class="p"&gt;[])&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;infer&lt;/span&gt; &lt;span class="nx"&gt;R&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;R&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;any&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Aqui, ReturnType recebe um tipo de função &lt;code&gt;T&lt;/code&gt; e retorna o tipo de retorno de &lt;code&gt;T&lt;/code&gt;. Por exemplo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;ReturnType&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;add&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// number&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Este tipo retorna &lt;code&gt;number&lt;/code&gt;, pois esse é o tipo de retorno da função &lt;code&gt;add&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Além disso, a página aborda como combinar tipos condicionais com outros recursos do TypeScript, como tipos genéricos e uniões de tipos. Por exemplo, podemos criar um tipo que verifica se um tipo é uma união de tipos de objeto da seguinte forma:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;IsObjectUnion&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;T&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nx"&gt;object&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kr"&gt;keyof&lt;/span&gt; &lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;never&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;ExampleUnion&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;IsObjectUnion&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ExampleUnion&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// string | number&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Este tipo retorna &lt;code&gt;string | number&lt;/code&gt;, pois &lt;code&gt;ExampleUnion&lt;/code&gt; é uma união de tipos de objeto que contém &lt;code&gt;a: string&lt;/code&gt; e &lt;code&gt;b: number&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusão
&lt;/h3&gt;

&lt;p&gt;Os tipos condicionais são uma ferramenta poderosa do TypeScript para tipos mais flexíveis e precisos. Com os tipos condicionais, é possível extrair propriedades de objetos, verificar se um tipo é um array e inferir tipos de outros tipos, além de combinar tipos condicionais com outros recursos do TypeScript para criar tipos mais complexos e úteis.&lt;/p&gt;

&lt;h3&gt;
  
  
  Referências
&lt;/h3&gt;

&lt;p&gt;Documentação oficial: &lt;a href="https://www.typescriptlang.org/"&gt;https://www.typescriptlang.org/&lt;/a&gt;&lt;br&gt;
Créditos da imagem: &lt;a href="https://brandontle.com/writing/why-typescript/"&gt;https://brandontle.com/writing/why-typescript/&lt;/a&gt;&lt;br&gt;
Introdução prática: &lt;a href="https://auth0.com/blog/working-with-typeScript-a-practical-introduction/"&gt;https://auth0.com/blog/working-with-typeScript-a-practical-introduction/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>braziliandevs</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Angular: Como o framework evoluiu para atender às demandas do desenvolvimento web</title>
      <dc:creator>Angéllica Araujo</dc:creator>
      <pubDate>Sun, 16 Apr 2023 14:02:27 +0000</pubDate>
      <link>https://dev.to/angellicaaraujo/angular-como-o-framework-evoluiu-para-atender-as-demandas-do-desenvolvimento-web-kfd</link>
      <guid>https://dev.to/angellicaaraujo/angular-como-o-framework-evoluiu-para-atender-as-demandas-do-desenvolvimento-web-kfd</guid>
      <description>&lt;h2&gt;
  
  
  Evolução, desempenho e funcionalidades para conquistar o futuro
&lt;/h2&gt;

&lt;p&gt;Desde sua primeira versão em 2010, o Angular da Google conquistou muitos corações de desenvolvedores web. Mas, como em toda evolução tecnológica, a transição do AngularJS para o Angular 2 não foi fácil e houve controvérsias. No entanto, a reescrita completa do framework e as introduções de novos conceitos, como componentes, módulos e serviços, provaram-se necessárias para atender às novas demandas do ecossistema da web.&lt;/p&gt;

&lt;p&gt;Com o lançamento do Angular 15 em abril de 2023, o framework continua evoluindo e trazendo melhorias significativas de desempenho, tornando mais fácil a escrita de aplicativos com código mais eficiente. Algumas das novas funcionalidades e melhorias incluem compilação mais rápida, melhor "tree shaking", injeção de dependência simplificada, tratamento de erros aprimorado, novos comandos CLI e suporte a internacionalização. &lt;/p&gt;

&lt;p&gt;Naturalmente, tais transições foram difíceis e trouxeram impactos, causando controvérsia entre os desenvolvedores. Para aqueles que viveram essa transição certamente se lembram que nem todos os colegas desenvolvedores foram convencidos pelas mudanças.&lt;/p&gt;

&lt;h3&gt;
  
  
  Funcionalidades e melhorias no Angular
&lt;/h3&gt;

&lt;p&gt;O Angular 9 introduziu o mecanismo de renderização Ivy, entregando melhorias significativas de desempenho e tornando mais fácil a escrita de aplicativos, com código menor e mais eficiente.&lt;/p&gt;

&lt;p&gt;É possível afirmar que o Angular é amplamente utilizado e continua sendo uma escolha popular para o desenvolvimento web. O framework continuou a evoluir e melhorar com a versão mais recente, Angular 15, lançado em abril de 2023. &lt;/p&gt;

&lt;p&gt;As novas funcionalidades e melhorias no Angular (v15) incluem:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Desempenho: O Angular 15 inclui várias melhorias de desempenho, como compilação mais rápida e melhor "tree shaking".&lt;/li&gt;
&lt;li&gt;Injeção de dependência simplificada: O novo decorador @Injectable permite uma injeção de dependência mais simples e eficiente.&lt;/li&gt;
&lt;li&gt;Melhoria no tratamento de erros: O Angular 15 inclui um tratamento de erros aprimorado, com mensagens de erro mais detalhadas.&lt;/li&gt;
&lt;li&gt;Novos comandos CLI: O CLI do Angular inclui vários novos comandos para um desenvolvimento mais fácil e eficiente, como ng run e ng lint.&lt;/li&gt;
&lt;li&gt;Suporte para internacionalização: O Angular 15 inclui várias melhorias no suporte à internacionalização, como melhor localização de datas e horários.&lt;/li&gt;
&lt;li&gt;Dependências atualizadas: O Angular 15 inclui atualizações em várias dependências principais, incluindo RxJS e a biblioteca de interface do usuário Angular Material.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Olhando para o futuro
&lt;/h3&gt;

&lt;p&gt;o Angular continuará evoluindo e caminha para ser uma escolha cada vez mais popular para o desenvolvimento web. O Google está comprometido em apoiar o framework e também há uma forte comunidade de desenvolvedores que contribuem ativamente para o seu desenvolvimento e manutenção.&lt;/p&gt;

</description>
      <category>angular</category>
      <category>webdev</category>
    </item>
    <item>
      <title>O Futuro do Gerenciamento de Dependências com Import Maps</title>
      <dc:creator>Angéllica Araujo</dc:creator>
      <pubDate>Mon, 10 Apr 2023 07:43:24 +0000</pubDate>
      <link>https://dev.to/angellicaaraujo/o-futuro-do-gerenciamento-de-dependencias-com-import-maps-5dg6</link>
      <guid>https://dev.to/angellicaaraujo/o-futuro-do-gerenciamento-de-dependencias-com-import-maps-5dg6</guid>
      <description>&lt;h2&gt;
  
  
  Um Olhar sobre os Import Maps e seu potencial
&lt;/h2&gt;

&lt;p&gt;Import maps está oficialmente disponível como recurso geral para sistemas que usam JavaScript. Import maps são uma maneira de controlar como dependências são carregadas, mapeando URLs para módulos JavaScript. &lt;/p&gt;

&lt;p&gt;Import maps podem simplificar o gerenciamento de dependências, reduzindo a necessidade de configuração manual, o que pode garantir um comportamento consistente em diferentes ambientes. &lt;/p&gt;

&lt;p&gt;Uma desvantagem do import maps é o risco de "dependency hell", onde a complexidade das configurações de mapeamento se torna muito grande e difícil de gerenciar tornando o recurso pouco eficaz.&lt;/p&gt;

&lt;p&gt;E como usar import maps na prática? Vamos verificar a sintaxe para definir esses mapeamentos e como eles podem ser usados em diferentes contextos.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "imports": {
    "lodash": "/node_modules/lodash-es/lodash.js",
    "lodash/": "/node_modules/lodash-es/",
    "lodash/forEach": "/node_modules/lodash-es/forEach.js"
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;O exemplo anterior define especificadores globalmente, usando a chave &lt;code&gt;imports&lt;/code&gt; no mapa de importação. A chave &lt;code&gt;scopes&lt;/code&gt; pode ser usada para fornecer mapeamentos em um escopo. Que se aplicam somente quando o módulo corresponde a um prefixo específico de URL.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "scopes": {
    "/a/" : {
      "moment": "/node_modules/moment/src/moment.js"
    },
    "/b/" : {
      "moment": "https://cdn.example.com/moment/src/moment.js"
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Direções futuras possíveis para import maps
&lt;/h2&gt;

&lt;p&gt;Alguns autores sugerem que o futuro para os import maps envolve uma integração mais próxima com gerenciadores de pacotes e ferramentas de build. &lt;/p&gt;

&lt;h3&gt;
  
  
  Integração com gerenciadores de pacotes
&lt;/h3&gt;

&lt;p&gt;Import maps poderiam ser integrados com gerenciadores de pacotes como o &lt;code&gt;npm&lt;/code&gt;, permitindo as dependências sejam gerenciadas com uma única ferramenta em vez de ter que usar ambos import maps quanto um gerenciador de pacotes. &lt;/p&gt;

&lt;p&gt;Isso também poderia permitir um controle mais sofisticado sobre as dependências, como especificar diferentes versões de uma biblioteca para diferentes partes de uma aplicação.&lt;/p&gt;

&lt;h3&gt;
  
  
  Integração com ferramentas de build
&lt;/h3&gt;

&lt;p&gt;Import maps também poderiam ser integrados com ferramentas como o Webpack e o Rollup, permitindo que os desenvolvedores especifiquem dependências diretamente nos arquivos de configuração de build, reduzindo a necessidade de configuração manual.&lt;/p&gt;

&lt;h3&gt;
  
  
  Suporte para importações dinâmicas
&lt;/h3&gt;

&lt;p&gt;Atualmente, os import maps suportam apenas importações estáticas, o que significa que as dependências são carregadas no momento em que a aplicação é iniciada. No futuro, os mapas de importação podem ser aprimorados para suportar importações dinâmicas. Permitindo que as dependências fossem carregadas sob demanda, conforme necessário.&lt;/p&gt;

&lt;h2&gt;
  
  
  Referências
&lt;/h2&gt;

&lt;p&gt;Imagem de capa tirada de "Dependencies Management" em &lt;a href="https://hygger.io/guides/agile/project-management/poject-dependencies/"&gt;https://hygger.io/guides/agile/project-management/poject-dependencies/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The official Import Maps specification from the W3C - &lt;a href="https://wicg.github.io/import-maps/"&gt;https://wicg.github.io/import-maps/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;How to Publish Web Components to NPM - &lt;a href="https://justinfagnani.com/2019/11/01/how-to-publish-web-components-to-npm/"&gt;https://justinfagnani.com/2019/11/01/how-to-publish-web-components-to-npm/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A especificação oficial dos mapas de importação da W3C: &lt;a href="https://github.com/WICG/import-maps"&gt;https://github.com/WICG/import-maps&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Building and delivering frontends at scale - &lt;a href="https://frontendmastery.com/posts/building-and-serving-frontends-at-scale/"&gt;https://frontendmastery.com/posts/building-and-serving-frontends-at-scale/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Desenvolvimento de aplicativos web com frameworks JavaScript e os princípios do PESPA</title>
      <dc:creator>Angéllica Araujo</dc:creator>
      <pubDate>Tue, 04 Apr 2023 07:26:33 +0000</pubDate>
      <link>https://dev.to/angellicaaraujo/desenvolvimento-de-aplicativos-web-com-frameworks-javascript-e-os-principios-do-pespa-j1</link>
      <guid>https://dev.to/angellicaaraujo/desenvolvimento-de-aplicativos-web-com-frameworks-javascript-e-os-principios-do-pespa-j1</guid>
      <description>&lt;p&gt;Neste artigo, falamos brevemente sobre os princípios &lt;em&gt;PESPA&lt;/em&gt; : Progressive Enhancement, Semantic HTML, Performance, Accessibility; e como aplicá-los ao desenvolvimento de aplicativos web com frameworks JavaScript modernos. Descubra como alcançar aprimoramento progressivo, melhorar a acessibilidade e desempenho do seu aplicativo e garantir a usabilidade para todos os usuários.&lt;/p&gt;

&lt;h2&gt;
  
  
  PESPA (Progressively Enhanced Single Page Apps)
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;PESPA&lt;/em&gt; é consolidado com base nos princípios: Aprimoramento Progressivo, HTML Semântico, Desempenho e Acessibilidade. Esses são quatro princípios fundamentais que devem ser considerados ao desenvolver aplicativos web com frameworks JavaScript.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Aprimoramento Progressivo&lt;/em&gt; garante que seu aplicativo seja acessível e utilizável por todos os usuários, independentemente das capacidades de seus dispositivos ou navegadores. &lt;/p&gt;

&lt;p&gt;Frameworks web JavaScript modernos, como Vue.js, React, Svelte e Angular, oferecem recursos integrados para ajudar a alcançar o aprimoramento progressivo, incluindo renderização no lado do servidor e otimização de tamanho.&lt;/p&gt;

&lt;p&gt;O segundo princípio, &lt;em&gt;HTML Semântico&lt;/em&gt;, implica em usar a semântica para melhorar a acessibilidade e a usabilidade do seu aplicativo. Isso significa usar as tags HTML corretas para o conteúdo, incluindo cabeçalhos e listas, para tornar o conteúdo mais fácil de ler e entender para usuários com deficiência visual ou cognitiva.&lt;/p&gt;

&lt;p&gt;Já o terceiro princípio, &lt;em&gt;Desempenho&lt;/em&gt;, significa otimizar seu aplicativo de modo que ele seja rápido e responsivo. Isso pode incluir otimização de tamanho de arquivo, minificação de código e uso de recursos como &lt;em&gt;lazy loading&lt;/em&gt; e &lt;em&gt;cache&lt;/em&gt; de recursos para acelerar o carregamento do aplicativo.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Acessibilidade&lt;/em&gt; é o quarto princípio, e significa garantir que seu aplicativo seja acessível a todos os usuários, independentemente de suas habilidades ou deficiências. Isso pode incluir fornecer conteúdo alternativo ou recursos de acessibilidade, como texto alternativo para imagens, para usuários com deficiência visual ou auditiva.&lt;/p&gt;

&lt;h3&gt;
  
  
  Frameworks e bibliotecas
&lt;/h3&gt;

&lt;p&gt;Os frameworks emergentes, incluindo React, Vue.js, Svelte e Angular, possuem características e benefícios que podem nos ajudar a construir aplicativos web modernos e eficientes.&lt;br&gt;
Esses novos frameworks ganham popularidade devido ao seu desempenho, simplicidade e facilidade de uso.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Progressive enhancement&lt;/em&gt; (aprimoramento progressivo) é uma consideração importante ao construir aplicativos web com frameworks web JavaScript. A abordagem envolve começar com um conjunto básico de recursos que funcionam em qualquer ambiente e, em seguida, adicionar recursos e aprimoramentos adicionais para usuários com dispositivos ou navegadores mais avançados.&lt;/p&gt;

&lt;p&gt;Aprimoramento progressivo garante que seus aplicativos sejam acessíveis e utilizáveis, independentemente das capacidades de seus dispositivos ou navegadores dos usuários.&lt;/p&gt;

&lt;p&gt;Vue.js e React fornecem suporte integrado para o aprimoramento progressivo por meio da renderização no lado do servidor ou da capacidade de renderizar componentes no cliente ou servidor. &lt;/p&gt;

&lt;p&gt;Outros frameworks, como o Svelte, enfatizam o desempenho e o minimalismo, o que pode ajudar a garantir que o aplicativo execute sem problemas, mesmo em dispositivos mais antigos com suporte limitado ao JavaScript.&lt;/p&gt;

&lt;h4&gt;
  
  
  Continue estudando o assunto
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;"Progressive Enhancement vs. Single-Page Applications" by Bramus Van Damme: &lt;a href="https://www.smashingmagazine.com/2020/09/progressive-enhancement-single-page-applications/"&gt;https://www.smashingmagazine.com/2020/09/progressive-enhancement-single-page-applications/&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;"Optimizing Performance in JavaScript Applications" by Ahmad Shadeed: &lt;a href="https://www.smashingmagazine.com/2020/06/optimization-performance-javascript-applications/"&gt;https://www.smashingmagazine.com/2020/06/optimization-performance-javascript-applications/&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;"Web Content Accessibility Guidelines (WCAG) 2.1" by the World Wide Web Consortium (W3C): &lt;a href="https://www.w3.org/TR/WCAG21/"&gt;https://www.w3.org/TR/WCAG21/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;"Top 5 JavaScript Frameworks to Learn in 2020" by Dusan Djukic: &lt;a href="https://hackernoon.com/top-5-javascript-frameworks-to-learn-in-2020-96m3wvrv"&gt;https://hackernoon.com/top-5-javascript-frameworks-to-learn-in-2020-96m3wvrv&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Hydration: what type of experience you are building</title>
      <dc:creator>Angéllica Araujo</dc:creator>
      <pubDate>Sat, 21 May 2022 22:53:31 +0000</pubDate>
      <link>https://dev.to/angellicaaraujo/hydration-and-the-experience-you-are-building-2j62</link>
      <guid>https://dev.to/angellicaaraujo/hydration-and-the-experience-you-are-building-2j62</guid>
      <description>&lt;p&gt;Hydration is a term used in computer programming when generally talking through the process of filling an object with data. &lt;/p&gt;

&lt;p&gt;An object is partially hydrated when &lt;em&gt;only some of the fields&lt;/em&gt; are loaded into it. One may want not to load data that is not going to be used to avoid wasting bandwidth, security pitfalls, CPU cycles loading, transferring, and setting routines. [3]&lt;/p&gt;

&lt;p&gt;When it comes to web development it usually means to fasten a loaded markup with functionality, using &lt;em&gt;client-side JavaScript&lt;/em&gt; to add application state and interactivity to &lt;em&gt;server-rendered HTML&lt;/em&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Hydration&lt;/strong&gt; (or rehydration) is a technique in which &lt;em&gt;client-side JavaScript&lt;/em&gt; converts a static HTML web page, delivered either through &lt;em&gt;static hosting&lt;/em&gt; or &lt;em&gt;server-side rendering&lt;/em&gt;, into a dynamic web page by attaching event handlers to the HTML elements. [2]&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rehydration&lt;/strong&gt;: “booting up” JavaScript views on the client such that they reuse the server-rendered HTML’s DOM tree and data. [1]&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Differences between rendering approaches on the web has implication in performance metrics. One must consider the trade-offs through the lens of experience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Server rendering&lt;/strong&gt; is a way to avoid additional round-trips for data fetching and templating on the client. The full HTML for a page is generated on the server in response to navigation. Server rendering produces: [1]&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fast First Paint (FP)&lt;/li&gt;
&lt;li&gt;Fast First Contentful Paint (FCP)&lt;/li&gt;
&lt;li&gt;Fast Time to Interactive (TTI)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is possible because you’re just sending text and links to the user’s browser and so, it works well for a large spectrum of device and network conditions.&lt;/p&gt;

&lt;p&gt;It sounds interesting, right? A faster TTI means a fully interactive page available to users asap. However, as with a lot of other things in development, we must consider the trade-off.&lt;/p&gt;

&lt;p&gt;The primary drawback to this approach: generating pages on the server takes time, which can often result in a slower Time to First Byte (TTFB). [1]&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Client-side rendering&lt;/strong&gt; relies on the browser to fully render pages using JavaScript. All logic, data fetching, templating, and routing are handled on the client rather than the server. [1]&lt;/p&gt;

&lt;p&gt;In terminology definitions presented in [1] Server-Side Rendering, Client-Side Rendering, and Rehydration are defined in separated bullets under the Rendering context. Still, they are bounded when it comes to application.&lt;/p&gt;

&lt;p&gt;It means that server rendering and client-side rendering can be combined through &lt;strong&gt;rehydration&lt;/strong&gt; in something called &lt;strong&gt;Universal Rendering&lt;/strong&gt; or simply &lt;strong&gt;SSR&lt;/strong&gt;. [1]&lt;/p&gt;

&lt;p&gt;One may consider performance drawbacks as the negative impact on Time To Interactive delaying interactivity due to JS due to no response to input until the client-side JS is executed and event handlers have been attached.&lt;/p&gt;

&lt;p&gt;Hydratation is related to the user experience through performance metrics. Not only a technique but also a strategy designed to deliver the expected interactivity experience to the user.&lt;/p&gt;

&lt;p&gt;An infographic is available in [1] showing the server-client spectrum:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pkdnrxfF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/did1xzfvj9b301qqhi78.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pkdnrxfF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/did1xzfvj9b301qqhi78.png" alt="infographic showing the server-client spectrum" width="880" height="581"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
In 2019, developers were encouraged by Jason Miller and Addy Osmani, to consider server rendering or static rendering over a full rehydration approach. One reason comes down to User Experience due to how extremely easy is to end up leaving users confused between pretense and reality.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Experiences with little or no interactivity, server rendering can represent a more scalable solution to these issues. Experiences built with CSR that rely on large JavaScript bundles should consider aggressive code-splitting, and be sure to lazy-load JavaScript - "serve only what you need, when you need it". [1]&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The "Hydration" term was removed from Angular docs in 2017. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;[1] &lt;a href="https://web.dev/rendering-on-the-web/"&gt;Rendering on the Web (Jason Miller, Addy Osmani) in web.dev - 2019&lt;/a&gt;&lt;br&gt;
[2] &lt;a href="https://en.wikipedia.org/wiki/Hydration_(web_development)"&gt;Hydration in web development - Wikipedia&lt;/a&gt;&lt;br&gt;
[3] &lt;a href="https://stackoverflow.com/questions/6991135/what-does-it-mean-to-hydrate-an-object"&gt;What does it mean to hydrate an object?&lt;/a&gt;&lt;br&gt;
[*] Cover image taken from &lt;a href="https://www.ironin.it/"&gt;https://www.ironin.it/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>performance</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Media Queries Level 5: the ability to respond to user needs</title>
      <dc:creator>Angéllica Araujo</dc:creator>
      <pubDate>Sat, 02 Apr 2022 21:32:20 +0000</pubDate>
      <link>https://dev.to/angellicaaraujo/media-queries-level-5-the-ability-to-respond-to-user-needs-2p68</link>
      <guid>https://dev.to/angellicaaraujo/media-queries-level-5-the-ability-to-respond-to-user-needs-2p68</guid>
      <description>&lt;p&gt;Recently, &lt;a href="https://web.dev/new-responsive/" rel="noopener noreferrer"&gt;web.dev Blog published a web article (by Una Kravets)&lt;/a&gt; presenting an in-depth view of the component-driven world aims in a new responsive era [1]. In what follows I will try to summarise it from my perspective, understanding how it is becoming easier to cover the end-user preferences, all of it with the new responsive approach.&lt;/p&gt;

&lt;p&gt;So, Web Components meaning relies on custom, reusable and encapsulated HTML tags. They can be used with any library or framework that works with HTML across modern browsers since they are built on solid standards.&lt;/p&gt;

&lt;p&gt;Someone once told me that "&lt;em&gt;when something takes an hour or more to be explained, it certainly cannot be sold easily&lt;/em&gt;". Well, it is becoming easier to find short good quality material about Web Components when searching for it. Take as example a video that length is half-hour explaining some specific concept in a hard scenario.&lt;/p&gt;

&lt;p&gt;It is important to you to know that those standards and APIs are made of big effort of engineers, responsible for prototyping, speccing, and starting the implementation for the next era of responsive design [1][4]. So, a good tutorial that may takes you half-hour to get completed certainly pays off.&lt;/p&gt;

&lt;p&gt;On going changes and updates includes user-preference based media features, container queries, and media queries for new screen types, such as foldable screens [1]. Let's have a  little of each topic and the main concepts involved while we understand how important it can be.&lt;/p&gt;

&lt;h2&gt;
  
  
  The ability to respond to user needs
&lt;/h2&gt;

&lt;p&gt;If you're not familiar with the concept of accessibility and user preferences then I recommend that you read the &lt;a href="https://www.w3.org/WAI/people-use-web/user-stories/" rel="noopener noreferrer"&gt;Stories of Web Users em Accessibility Fundamentals da W3 [2]&lt;/a&gt; as a more reliable way of introduction content.&lt;/p&gt;

&lt;p&gt;Well, when we talk about accessibility, we are talking about a set of preferences inherent by a group of users that need to be addressed. So, if they meet adherence to their needs then the content or service provided can successfully meet this audience.&lt;/p&gt;

&lt;p&gt;To get a little more familiar with who these users are and their needs, you can gather information at the CDC. I've chosen the following topic: "attention deficit hyperactivity disorder" (ADHD) which represents one of User Stories by W3. You can try doing the same with other topics.&lt;/p&gt;

&lt;p&gt;So, according to the CDC, at least a total of 3.3 million children aged 12–17 years were diagnosed with ADHD in the US in 2016 [3].  In addition to ADHD, according to the CDC, the diagnosis of ADHD can be followed by other disorders such as anxiety.: about 3 in 10 children with ADHD had anxiety [3].&lt;/p&gt;

&lt;p&gt;Now, we can start talking about Preety's User Story as an example, which is somewhat well-aligned with the CDC data on ADHD. Preety is a young person diagnosed with ADHD [2]. Preety's experience varies greatly depending on how well the content or service adheres to accessibility. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;(...) Preety’s experience with websites varies greatly from one site to another. Some sites use graphics and illustrations in a way that helps her to focus on the sections and content that she would like to read, while other sites have a lot of advertisements and moving content that is very distracting. - User Stories: Preety - WAI by W3 [3]&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If Preety was 17 years old in 2016, being a subject of the CDC research group and positively diagnosed, she would be an adult today (2022). During her school life, technologies were introduced and she somehow managed to overcome the difficulties with the help of appropriate tools.&lt;/p&gt;

&lt;p&gt;However, some of these preferences are set at the operating system level and are far from capture capability for some web APIs. In fact, some others preferences had the usage extended to users who do not see themselves in any of the User Stories at all. Do you need more examples? Preferences for light, dark, or auto themes. &lt;/p&gt;

&lt;p&gt;Whether to ensure that Preety's future could share of the same excellence as possible as her colleagues does, to save a device's battery or simply adapt the system just for the visual preferences, User Preferences are extremely relevant and are increasingly included in the new responsive era evolution loop.&lt;/p&gt;

&lt;h3&gt;
  
  
  Media Features
&lt;/h3&gt;

&lt;p&gt;It is common that a developer, frontend engineers in a special case, faces different behaviors implementation requests for elements given an interface depending on the user agent, display device or even the document being rendered.&lt;/p&gt;

&lt;p&gt;This is usually done through &lt;a href="https://drafts.csswg.org/mediaqueries-5/#media-query" rel="noopener noreferrer"&gt;Media Queries&lt;/a&gt;. Developers make usage of Media Queries as a method to access information about aspects related to the user agent that the document is being displayed [4].&lt;/p&gt;

&lt;p&gt;The method follows an interpretation path as shown in Figure 1 [5]. The syntax allows us to build modifiers according to the media type and other features, once the &lt;code&gt;media condition&lt;/code&gt; is met then the user will be able to experience features developed exclusively for the scenario.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm50wa840dabrr5wizm53.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm50wa840dabrr5wizm53.png" alt="Figure 1: The media query logical path"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  User-preference based media features
&lt;/h3&gt;

&lt;p&gt;Well, now we can start talking about the advances regarding the adoption of certain user preferences that in many ways are available at the operational system level. Consider an option for macOs [6]&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Stop or reduce the movement of some elements on the screen—for example, when you open apps, switch between desktops, or open and close Notification Center. This feature is especially useful for people who experience motion sickness or vertigo. - Reduce screen motion on Mac, by macOS User Guide&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The example above is a reference to the &lt;code&gt;prefers-reduced-motion&lt;/code&gt; option covered in the Media Queries Level 5 specification. The latest specification introduces so-called user preference media features, that is, a way for sites to detect the user's preferred way to display content [4].&lt;/p&gt;

&lt;p&gt;Therefore, considering the &lt;code&gt;prefers-reduced-motion&lt;/code&gt; preference in page design creates an inclusive environment for people like Preety, allowing your application to be instrumentalized at the level of preferences that come directly from the operational system [7].&lt;/p&gt;

&lt;p&gt;Additionally, in their operating system, whether it's on desktop or mobile, users can set a preference for light, dark, or auto themes [8]. According to the new specification you can use &lt;code&gt;prefers-color-scheme&lt;/code&gt; to customize your UI to it&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.w3.org/TR/mediaqueries-5/#mf-user-preferences" rel="noopener noreferrer"&gt;See specification for more options&lt;/a&gt;[4]:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Detecting the desire for less motion on the page: the &lt;code&gt;prefers-reduced-motion&lt;/code&gt; feature&lt;br&gt;
Detecting the desire for reduced transparency on the page: the &lt;code&gt;prefers-reduced-transparency&lt;/code&gt; feature&lt;br&gt;
Detecting the desire for increased or decreased color contrast from elements on the page: the &lt;code&gt;prefers-contrast feature&lt;/code&gt;&lt;br&gt;
Detecting Forced Colors Mode: the &lt;code&gt;forced-colors&lt;/code&gt; feature&lt;br&gt;
Detecting the desire for light or dark color schemes: the &lt;code&gt;prefers-color-scheme&lt;/code&gt; feature&lt;br&gt;
Detecting the desire for reduced data usage when loading a page: the &lt;code&gt;prefers-reduced-data&lt;/code&gt; feature - Media Queries Level 5, W3C&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Think of it as a further move into the new responsive era.&lt;br&gt;
The Component-driven approach from the developer's point of view is becoming the better way you project, build, and deploy a scalable Web application regarding new accessibility preferences.&lt;/p&gt;

&lt;h2&gt;
  
  
  Additional reading and tutorials
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://developers.google.com/web/fundamentals/web-components" rel="noopener noreferrer"&gt;Building Components, Web Fundamentals by developers.google&lt;/a&gt;&lt;br&gt;
&lt;a href="https://web.dev/prefers-color-scheme/" rel="noopener noreferrer"&gt;web.dev prefers-color-scheme: Hello darkness, my old friend&lt;/a&gt; by Thomas Steiner&lt;br&gt;
&lt;a href="https://drafts.csswg.org/mediaqueries-5/#media-query" rel="noopener noreferrer"&gt;What is Media Query, CSSWG (Draft) - W3C - Click here to learn more&lt;/a&gt;&lt;br&gt;
&lt;a href="https://css-tricks.com/a-complete-guide-to-css-media-queries/" rel="noopener noreferrer"&gt;A Complete Guide to CSS Media Queries - CSS Tricks&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;p&gt;[1] &lt;a href="https://web.dev/new-responsive/" rel="noopener noreferrer"&gt;web.dev Blog published a web article (by Una Kravets)&lt;/a&gt;&lt;br&gt;
[2] &lt;a href="https://www.w3.org/WAI/people-use-web/user-stories/" rel="noopener noreferrer"&gt;Accessibility Fundamentals - Stories of Web Users by W3&lt;/a&gt;&lt;br&gt;
[3] &lt;a href="https://www.cdc.gov/ncbddd/adhd/data.html#:~:text=Millions%20of%20US%20children%20have,children%20aged%206%E2%80%9311%20years" rel="noopener noreferrer"&gt;Attention-Deficit / Hyperactivity Disorder (ADHD) - Data and Statistics About ADHD by CDC&lt;/a&gt; &lt;br&gt;
[4] &lt;a href="https://drafts.csswg.org/mediaqueries-5/" rel="noopener noreferrer"&gt;Media Queries Level 5 - CSSWG - W3C - Editor’s Draft, 10 February 2022&lt;/a&gt;&lt;br&gt;
[5] Figure 1: Taken from CSSWG - W3 Website - &lt;a href="https://drafts.csswg.org/mediaqueries-5/#media-query" rel="noopener noreferrer"&gt;Click here for more&lt;/a&gt;&lt;br&gt;
[6] &lt;a href="https://support.apple.com/pt-br/guide/mac-help/mchlc03f57a1/mac" rel="noopener noreferrer"&gt;Reduce screen motion on Mac - Apple Support&lt;/a&gt;&lt;br&gt;
[7] &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion" rel="noopener noreferrer"&gt;&lt;code&gt;prefers-reduced-motion&lt;/code&gt; mdn web docs, Mozilla&lt;/a&gt;&lt;br&gt;
[8] &lt;a href="https://web.dev/prefers-color-scheme/" rel="noopener noreferrer"&gt;web.dev &lt;code&gt;prefers-color-scheme&lt;/code&gt;: Hello darkness, my old friend&lt;/a&gt; by Thomas Steiner&lt;/p&gt;

&lt;p&gt;Cover image was taken from &lt;a href="https://cavaon.com/user-experience-ux-the-importance-of-understanding-the-users-needs/" rel="noopener noreferrer"&gt;Cavaon - User Experience (UX) – The Importance of Understanding Users’ Needs&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>html</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>The reason why a new responsive web is emerging</title>
      <dc:creator>Angéllica Araujo</dc:creator>
      <pubDate>Wed, 16 Mar 2022 08:58:51 +0000</pubDate>
      <link>https://dev.to/angellicaaraujo/the-reason-why-a-new-responsive-web-is-emerging-51ha</link>
      <guid>https://dev.to/angellicaaraujo/the-reason-why-a-new-responsive-web-is-emerging-51ha</guid>
      <description>&lt;p&gt;User interfaces are built on the latest in web technology and with this in mind, new APIs emerge with the promise of increasing the ability to solve old problems, including coverage for new user preferences, and all of this streamlining the work of who works with the frontend.&lt;/p&gt;

&lt;h2&gt;
  
  
  The actual scenario for Responsive Design
&lt;/h2&gt;

&lt;p&gt;To better understand nothing fairer than understanding how things are currently done (from the developer's perspective). Well, it's 2022 and an ordinary Google search on "how to do responsive design" [ 3 ] has as main topics [ 1 ]:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Add responsive meta tags to your HTML document. Apply media queries to your layout. Make images and videos responsive, and finally, ensure your typography is easily readable on mobile devices.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now, in Mozilla itself [ 2 ], which even you can consider as an extremely reliable source to delve into this and other subjects, we have that the term Responsive Design (Ethan Marcotte in 2010) describes the use of three combined techniques:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Fluid Grids (see Gillenwater for the original reference) — can be read in Fluid Grids (published 2009, A List Apart).&lt;/p&gt;

&lt;p&gt;Fluid Images —allows an image to be scaled down to fit a flexible size column, preventing it from becoming distorted or pixelated if the column becomes wider than the image.&lt;/p&gt;

&lt;p&gt;The media query (see Cameron Adams for more information) — allows different types of layouts to be available using only CSS&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But we want an even more refined search for content published or edited in less than a year. So, you can find an article from web.dev (Google Developers, Una Kravets)[ 3 ] that gives a little introduction to what it means to use the term responsive design and gives us a careful look at how things are today.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Today, when using the term: “responsive design”, you are probably thinking of using media queries to change the layout when resizing a design from mobile size to tablet size to desktop size. But soon, this responsive design perception can be considered as outdated as using tables for page layout.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Building a new design perception
&lt;/h2&gt;

&lt;p&gt;Well, so the responsive web is about the combined use of technologies that make modern use of CSS and HTML, creating elegant elements and useful designs for our end-user, regardless of the device being used.&lt;/p&gt;

&lt;p&gt;But if the technology is stabilized and is considered modern, what are the novelties about? Well, the classic answer might come from the eternal cycle that exists to minimize the effort that technologies demand so that your skills continue to meet new devices and other needs.&lt;/p&gt;

&lt;p&gt;In this manner, depending on your experience with software engineering, the term Design System may sound strange and may not be so present in your day-to-day. However, even though it is not the primary objective of his work, it ends up being important many times, even if subtly, in the decision-making of direct business interest.&lt;/p&gt;

&lt;p&gt;So, take as an example Google's own Design System, better known as Material [ 4 ], which is the foundation for developing the best experience for users of Google's own products.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Material is a design system created by Google to help teams create high-quality digital experiences for Android, iOS, Flutter, and the web.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Well, at this point things should be a little better connected. We have on the one hand the practice of basing decisions and implementations on what current APIs (see Viewport [5] for more) offer us and on the other hand the continuous evolution of devices and the business decisions themselves.&lt;/p&gt;

&lt;p&gt;Hence, the terms Component-based and Page-based arise, which are part of discussions for different development approaches. It came across that the APIs have limitations that, as put by Una Kravets herself, make it increasingly difficult to extract the best of what they propose to offer.&lt;/p&gt;

&lt;p&gt;So, you can imagine that such issues technically affect the choice between development approaches (Component-based and Page-based), also affecting business performance in the end because it is in the general interest (or should be) that products continue to meet new requirements. devices and other technologies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Since the term Responsive Design was coined by Ethan Marcotte in 2010, it has been possible to see numerous advances that in some ways were determined by the needs that users have as new devices are introduced into the routine.&lt;/p&gt;

&lt;p&gt;Like many things in technology, today's APIs are modern, functional but lacking in much finesse. We are entering a world where micro and macro layouts are developed and current APIs do not have the (expected) ability to respond to the new needs required by components.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links and tutorials
&lt;/h2&gt;

&lt;p&gt;Visit &lt;a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Responsive_Design" rel="noopener noreferrer"&gt;https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Responsive_Design&lt;/a&gt; to learn about current responsive design techniques (Reference 2022)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://web.dev/new-responsive/" rel="noopener noreferrer"&gt;web.dev — The new responsive: Web design in a component-driven world&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;p&gt;[ 1 ] &lt;a href="https://catswhocode.com/how-to-make-a-responsive-website/" rel="noopener noreferrer"&gt;How to Make a Responsive Website in 3 Easy Steps (catswhocode.com) (may contain banners)&lt;/a&gt;&lt;br&gt;
[ 2 ] &lt;a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Responsive_Design" rel="noopener noreferrer"&gt;Responsive design (developer.mozilla.org/)&lt;/a&gt;&lt;br&gt;
[ 3 ] &lt;a href="https://web.dev/new-responsive/" rel="noopener noreferrer"&gt;web.dev — The new responsive: Web design in a component-driven world&lt;/a&gt;&lt;br&gt;
[ 4 ] &lt;a href="https://material.io/design/introduction" rel="noopener noreferrer"&gt;Material — Design System da Google&lt;/a&gt;&lt;br&gt;
[ 5 ] &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Visual_Viewport_API#interfaces" rel="noopener noreferrer"&gt;Viewport API — https://developer.mozilla.org/en-US/docs/Web/API/Visual_Viewport_API#interfaces&lt;/a&gt;&lt;br&gt;
[ 6 ] &lt;a href="https://ionicframework.com/blog/5-reasons-web-components-are-perfect-for-design-systems/" rel="noopener noreferrer"&gt;Cover image was taken from - 5 Reasons Web Components Are Perfect for Design Systems&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Related
&lt;/h2&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/angellicaaraujo" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F830939%2F93bdd655-7ebe-4c3b-b0c2-01c63268b6e6.jpeg" alt="angellicaaraujo"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/angellicaaraujo/media-queries-level-5-the-ability-to-respond-to-user-needs-2p68" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Media Queries Level 5: the ability to respond to user needs&lt;/h2&gt;
      &lt;h3&gt;Angéllica Araujo ・ Apr 2 '22&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#css&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#html&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#beginners&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>html</category>
      <category>css</category>
    </item>
  </channel>
</rss>
