<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Matheus Ale da Silva on Medium]]></title>
        <description><![CDATA[Stories by Matheus Ale da Silva on Medium]]></description>
        <link>https://medium.com/@matheus-ale?source=rss-f49cd0dbe2e3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*gzYEeacnJ0C2B3-5b6bYSQ.jpeg</url>
            <title>Stories by Matheus Ale da Silva on Medium</title>
            <link>https://medium.com/@matheus-ale?source=rss-f49cd0dbe2e3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 23:29:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@matheus-ale/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A New Way to Write Vuex Module]]></title>
            <link>https://matheus-ale.medium.com/a-new-way-to-write-vuex-module-db32d99f7938?source=rss-f49cd0dbe2e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/db32d99f7938</guid>
            <category><![CDATA[vuex]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[clean-code]]></category>
            <category><![CDATA[productivity]]></category>
            <dc:creator><![CDATA[Matheus Ale da Silva]]></dc:creator>
            <pubDate>Sat, 26 Jun 2021 14:11:50 GMT</pubDate>
            <atom:updated>2021-06-26T14:24:08.611Z</atom:updated>
            <content:encoded><![CDATA[<p>Since I have started using Vuex I feel that there is a big mistake in the modules feature. Let’s talk about it and what I have done about it.</p><blockquote>First of all, this post is to explore the reasons why I have written the <a href="https://github.com/matheusAle/vuex-tools">vue-tools</a> package.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wDv_YaLDS8bFYTmGJRSUsg.png" /></figure><h3>What I think is Wrong with Vuex Module?</h3><p>Into Vuex’s documentation page, to dispatch a module’s action we had to pass the module name and the action name as action type, like:</p><pre>store.dispatch(‘module/action’)</pre><p>Looks great and simple, right?! but there are some big issues:</p><ul><li>Wich argument that action is expecting?</li><li>Where is this action implementation?</li></ul><p>In the real world, with many developers working on a fast-growing project we have to rename modules; move codes and files; delete things that we don&#39;t need any longer. When dealing with code refactoring, we will find out that the hardest job is finding all references and uses of getters and actions. Even using typescript and modern code editors won’t help you in anything.</p><p>To work on those problems I have seen people creating modules like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4d6874320b9f37ddde8f429064403476/href">https://medium.com/media/4d6874320b9f37ddde8f429064403476/href</a></iframe><p>I agree that this solves the code reference problem, but it is ugly! I think so. Imagine that there are many actions and mutations in a real word module to change loading and errors flags.</p><p>With these problems in mind, I had started my research for packages that come up with a new approach to define the Vuex modules. I found just one: <a href="https://github.com/championswimmer/vuex-module-decorators">vuex-module-decorators</a>. It uses class and decorators to define modules. It&#39;s a good way to do it, but I don&#39;t like to use class. Personally, I prefer a functional style, even Vue 3 will use functional methods -the composition API- to create the component instance.</p><h3>My Proposal to Solve Those Problems</h3><p>My package <a href="https://github.com/matheusAle/vuex-tools">vuex-tools</a> solve it and also, make it easier to create modules. take a look:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ce17d6ebb53b7fbda91be6ba3ebb0ab2/href">https://medium.com/media/ce17d6ebb53b7fbda91be6ba3ebb0ab2/href</a></iframe><blockquote>Don&#39;t forget to read the comments. has a lot of explanations too.</blockquote><p>If you are fast, you already noticed that using typescript and a modern code editor is advantageous for you. let’s highlight some points:</p><ul><li>Easy goto implementation just by vscode control+clicking into the function name.</li><li>Easily find all uses of an action;</li><li>Type for actions arguments and mutations also getters (more about getter later);</li><li>All state type in just one place.</li></ul><p>As you have seen, my package just have two functions createModule and createState. The first one is the heart of this package because it implements the interface <a href="https://github.com/matheusAle/vuex-tools/blob/main/docs/interfaces/modulebuilder.md">ModuleBuilder</a>, it’s an API to create an module incrementally. And createState builds modules and creates an instance of the Vuex Store as you are used to.</p><p>The interface <a href="https://github.com/matheusAle/vuex-tools/blob/main/docs/interfaces/modulebuilder.md">ModuleBuilder</a> have 3 functions that you can use: action, mutation and getter. I think you know what they can do for you. action and mutation return another function that expects an argument (or not) and returns an object. This return is passed to store$dispatch or store$commit and Vuex will know what to do with it. getter is different, look how to use it:</p><pre>const getSortedItems = moduleBuilder.getter&lt;Item[]&gt;(<br>    &#39;sortedItems&#39;, <br>    (state) =&gt; [...state.items].sort(a, b) =&gt; a.order - b.order<br>);<br><br>// vue component<br>{<br>   computed: {<br>       sortedItems() {<br>           getSortedItems(this.$store.getters)<br>       }<br>   }<br>}</pre><p>We pass the store$getter to returned function of ModuleBuilder$getter call, and it returns the getter value.</p><p>If you have read this far, thank you very much! And I would be glad to have your clap and feedback about what I have done, also I am open to answer issues on Github and receive Pull Request of any kind.</p><p>My next steps for improving these libraries are:</p><ul><li>Remove from beta;</li><li>Refactor the code to a more readable one ( createModule is a mess I know);</li><li>Improve DOCS with more examples;</li><li>100% test coverage and add more cases;</li><li>Test with Vuex plugin;</li><li>Be referenced into Vuex documentation;</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db32d99f7938" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Como Passar Parâmetros para Animações no Angular]]></title>
            <link>https://matheus-ale.medium.com/como-criar-anima%C3%A7%C3%B5es-din%C3%A2micas-no-angular-d5b44650b436?source=rss-f49cd0dbe2e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5b44650b436</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[animation]]></category>
            <dc:creator><![CDATA[Matheus Ale da Silva]]></dc:creator>
            <pubDate>Fri, 27 Jul 2018 00:29:44 GMT</pubDate>
            <atom:updated>2018-08-12T13:47:21.856Z</atom:updated>
            <content:encoded><![CDATA[<p>Como Passar Parâmetros para Animações no Angular</p><p>O modulo <a href="https://angular.io/guide/animations">Animations</a> é uma das coisas mais legais do Angular, apenas lendo sua documentação, é possível fazer animações do cara#$o. Mas uma coisa que ela não ensina, “como passar parâmetros para Animações no Angular”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*1kMmmyvUR3BgrdVMb9OWhA.png" /></figure><p>Sim, hoje aprenderemos a passar paramentos para animações no Angular!</p><p>Você pode encontrar os exemplos rodando neste <a href="https://matheusale.github.io/angularDynamicAnimations/angularDynamicAnimations/">link</a> e o código fonte está disponível no <a href="https://github.com/matheusAle/angularDynamicAnimations/tree/master">github</a>.</p><h3>Então let’s bora!!</h3><p>Se olharmos a <a href="https://angular.io/api/animations/state">assinatura do método <em>state</em></a>, encontraremos options.params (só pelo nome já da para adivinhar pra que ele serve).</p><p>— Mas Como eu uso ele??? 🤔 🤔</p><p>Não tem segredo, passar parâmetros para uma animação é bem simples.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3bef6ddfc9a242585bea8749de4c5b8e/href">https://medium.com/media/3bef6ddfc9a242585bea8749de4c5b8e/href</a></iframe><p>Note que é um objeto (options), com o atributo params, que tem como valor um objeto com os parâmetros para o state. Note também, que o parâmetro color foi iniciado com uma string vazia, isso é necessário para o Angular não lançar uma exceção no momento em que animação for criada. Para informar ao Angular onde ele deve colocar o valor do parâmetro, use {{&lt;paramName&gt;}}, como está no exemplo.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dd1f66a9dc6a52715eaf73eb9bc31d81/href">https://medium.com/media/dd1f66a9dc6a52715eaf73eb9bc31d81/href</a></iframe><p>No template devemos passar para o <em>trigger </em>um objeto que tenha as chaves:</p><ul><li><strong>value</strong>: nome do <em>state </em>que o elemento deve assumir;</li><li><strong>params</strong>: objeto com os parâmetros para o <em>state</em>.</li></ul><p>Também é possível passar parâmetros para <a href="https://angular.io/api/animations/transition">transition</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c53a15d02fddae70d493bdd9c1d861df/href">https://medium.com/media/c53a15d02fddae70d493bdd9c1d861df/href</a></iframe><p>Perceba que o parâmetro delay está sendo calculado no template, se fosse na interpolação <em>(na linha 5 do controlador),</em> não funcionaria. Internamente o Angular apenas a substitui pelo valor do parâmetro, ou seja, nada de expressões js! 😑 😑</p><p>Vamos a outro exemplo, agora cada elemento vai sofrer uma transformação diferente quando for clicado. Para isso criamos o array nodes, que contém parâmetros diferentes para cada elemento.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d85556fdc01b4fb13d16c21c0bebbf15/href">https://medium.com/media/d85556fdc01b4fb13d16c21c0bebbf15/href</a></iframe><p>Note que o método toggle do controlador, substitui o objeto no index clicado mudando o value e copiando os params do objeto anterior, isso é necessário para que o Angular reconheça que ocorreu uma mudança no objeto. fazer (click)=”i = ‘change’” no template não funcionaria.</p><p>Apenas lembrando que: Você pode encontrar os exemplos rodando neste <a href="https://matheusale.github.io/angularDynamicAnimations/angularDynamicAnimations/">link </a>e o código fonte esta disponível no <a href="https://github.com/matheusAle/angularDynamicAnimations/tree/master">github</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*_AufvRlwnNlTaSoYsgk-JQ.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5b44650b436" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>