<?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 Fran Dios on Medium]]></title>
        <description><![CDATA[Stories by Fran Dios on Medium]]></description>
        <link>https://medium.com/@frandiox?source=rss-96a776272e5c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*G_pKCtVn-h0WZSHu.</url>
            <title>Stories by Fran Dios on Medium</title>
            <link>https://medium.com/@frandiox?source=rss-96a776272e5c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 09 Jun 2026 11:10:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@frandiox/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[Serverless Vue.js with GraphQL]]></title>
            <link>https://medium.com/the-web-tub/serverless-vue-js-with-graphql-76a1ba4ceb1e?source=rss-96a776272e5c------2</link>
            <guid isPermaLink="false">https://medium.com/p/76a1ba4ceb1e</guid>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[auth0]]></category>
            <category><![CDATA[appsync]]></category>
            <dc:creator><![CDATA[Fran Dios]]></dc:creator>
            <pubDate>Thu, 29 Mar 2018 11:19:01 GMT</pubDate>
            <atom:updated>2018-07-11T05:25:49.178Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*CTOa_b20nwKjPnMnJAJQ-A.png" /><figcaption>Vue — GraphQL — AWS Lambda</figcaption></figure><p><strong>UPDATE</strong>: The provided Vue <a href="https://github.com/frandiox/vue-graphql-enterprise-boilerplate">boilerplate</a> is now using Prisma and Auth0!</p><p>The serverless architecture is gaining more and more followers as new frameworks and services appear in the market. The most common monolith architecture was replaced by micro-services in many projects, which improved scalability but raised complexity. Recently, the latter gave way to the so-called serverless architecture.</p><p>Rather than deploying a whole server, now it is possible to worry only about custom code that runs at specific timing during the application. For instance, whenever a new user is registered in the DB, there will be a hook or event where a “send verification email” function can be called. All the backend code is split in functions (sometimes called cloud functions or lambda functions) that are managed and scaled automatically by third-party services.</p><p>This “new” tech has some huge advantages such as reducing cost or making traditional dev-ops almost unnecessary. However, it brings some drawbacks that not everybody is willing to face yet. As mentioned by <a href="https://medium.com/u/63a761e7cf69">Dmitri Zimine</a> in his article “<a href="https://medium.freecodecamp.org/serverless-is-cheaper-not-simpler-a10c4fc30e49">Serverless is cheaper, not simpler</a>”, there is still a lot of wiring among serverless functions that increases complexity. That said, it is just a matter of time that new commercial services and best practices come up to fight back this complexity.</p><p>Apart from that, GraphQL has shown that it is here to stay and many big companies such as GitHub itself are switching their APIs from REST. GraphQL is a very expressive query language that can be sent directly from the client side. Instead of using different API endpoints to get chunks of data — from what we might only need a few lines — , GraphQL tools (e.g. <a href="https://www.apollographql.com/">Apollo</a>) will send back the exact data that was specifically asked for in the query. It doesn’t necessarily replace REST but it is surely a technology you’d want to evaluate when starting a new project.</p><p>In this article, we will have a brief overview on existing serverless GraphQL solutions and how they can be combined with Vue.js to kick-start new projects.</p><h3>Vue.js boilerplate</h3><p>If you have read any of my previous articles you can already guess I love Vue.js (<em>I lovue?</em>). Recently, I found a very opinionated enterprise boilerplate made by <a href="https://medium.com/u/498f8fe0ad12">Chris Fritz</a> — who, by the way, recently launched a <a href="https://www.patreon.com/chrisvuefritz">Patreon campaign</a> — and thought it was pure gold. <a href="https://github.com/chrisvfritz/vue-enterprise-boilerplate/">Check it out</a> if you are a Vue developer and don’t know it yet.</p><p>I’ve made another repo starting from Chris’ project in order to add my own opinionated code such as components inside folders and some file distribution changes, including also template generators and docs. It can load components in plain files like my-menu.vue or inside their own directories like my-menu/index.vue without changing the import statement: import MyMenu from ‘@components/my-menu&#39;. If you like that idea, you might want to <a href="https://github.com/frandiox/vue-graphql-enterprise-boilerplate">have a look at it here</a>. Again, props to Chris and the other contributors for this awesome project.</p><p>This version also includes GraphQL features such as query template generators and a way to easily organize and import queries. These changes are located in the <a href="https://github.com/frandiox/vue-graphql-enterprise-boilerplate/tree/appsync">appsync branch</a>. Sneak peek here:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R-OoM9yDqCLsVsmPIXx-UA.png" /></figure><p>As you can see, queries and mutations can be imported just like an ES module (thanks to graphql-tag/loader).</p><p>It is still a work in progress and eventually I’d like to add better examples and use other cloud services. And also resolve some existential questions such as <em>“To Vuex or not to Vuex”</em> — there is already another state management solution for remote data provided by Apollo which can handle local state <a href="https://www.apollographql.com/docs/link/links/state.html">thanks to </a><a href="https://www.apollographql.com/docs/link/links/state.html">apollo-link-stat</a>e. Check this <a href="https://dev-blog.apollodata.com/the-future-of-state-management-dd410864cae2?_ga=2.219951066.2107521083.1520564428-1367667880.1516902205">introduction article</a> by <a href="https://medium.com/u/c827782c6410">Peggy Rayzis</a> for more information.</p><h3>Serverless GraphQL solutions</h3><p>As aforementioned, there are more and more commercial products — some of them open source! — that are coming up to deal with the serverless complexity.</p><h4>Graphcool</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YEFMSz3OGdcpgUM74zArzw.png" /><figcaption>Graphcool Cloud Dashboard</figcaption></figure><p>The <a href="https://www.graph.cool/">Graphcool</a> project has been around for a while. It provides open source tools to easily create a managed backend that can be deployed using a CLI.</p><p>We just need to write a minimum GraphQL schema and Graphcool will create CRUD operations for us. It provides a set of hooks where we can call Lambda functions or webhooks whenever a mutation or query is performed. It can be deployed to the <a href="https://www.graph.cool/cloud/">Graphcool cloud</a> for a fully managed backend development.</p><h4>Prisma</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ysnB2gQ8Zup_EYdT69QWNQ.png" /><figcaption>Prisma Cloud Dashboard</figcaption></figure><p>The Graphcool guys are recently focusing more on this product, <a href="https://www.prismagraphql.com/">Prisma</a>, and just a few days ago they released an interesting <a href="https://blog.graph.cool/introducing-prisma-cloud-a-graphql-database-platform-ed591baa8737">cloud solution</a>. Prisma will eventually become the core of the previous Graphcool project as well but, for now, it implements features that the other one doesn’t. Prisma is not a real serverless solution itself — it is just a layer that adds GraphQL to our DB — unless it is deployed by something like the <a href="https://serverless.com/framework/">Serverless Framework</a>.</p><p>Therefore, it provides high flexibility that may be suitable for more projects. I̶ ̶h̶a̶v̶e̶n̶’̶t̶ ̶p̶l̶a̶y̶e̶d̶ ̶t̶o̶o̶ ̶m̶u̶c̶h̶ ̶w̶i̶t̶h̶ ̶i̶t̶ ̶m̶y̶s̶e̶l̶f̶ ̶y̶e̶t̶ ̶b̶u̶t̶ it certainly looks promising. And the best feature, it is also open source!</p><p>If you are interested in this, you can check <a href="https://github.com/frandiox/vue-graphql-enterprise-boilerplate">this template</a> which provides Vue integration with Prisma.</p><h4>AWS AppSync</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ex8k20OlajhubbfhnFKKvQ.png" /><figcaption>AWS AppSync Dashboard</figcaption></figure><p>Amazon didn’t want to be late to the party and released a preview version of their own managed GraphQL solution last year: <a href="https://aws.amazon.com/appsync/">AWS AppSync</a>. This product became publicly available very recently so there are still not many examples or articles about it.</p><p>Just like Graphcool and Prisma, AppSync also takes a schema and creates CRUD operations and subscriptions for us. Amazon, however, takes a slightly different approach here and uses its own client library rather than relying on other community tools (although it still uses Apollo internally). Thanks to that, they provide seamless integration with other AWS products like Cognito, DynamoDB or Lambda functions. If you are one of those AWS lovers this is great news for you, but it might be a drawback for some developers who prefer a different stack.</p><p>Since AppSync is quite new, let’s show here how we can easily add it to our Vue app.</p><h3>Adding AWS AppSync to the stack</h3><p>The Vue template provided <a href="https://github.com/frandiox/vue-enterprise-boilerplate/tree/appsync">here</a> already includes AppSync and an example that uses it. However, it is easy to remove AppSync code and add plain apollo-client while still reusing all the structure and features included in the template. You just need to replace src/apollo.js file with your own setup. Also, beware that, since the queries and mutations are automatically generated by AppSync, your new service might use different naming conventions (e.g. getNotes instead of listNotes ).</p><p>To get started with AppSync you need an <a href="https://aws.amazon.com/account/">AWS account</a>. Select AWS AppSync in the available products and you’ll be able to create a new API in just 1 click. Download the AppSync.json file provided in the main page of your newly created API and put it under src/AppSync.json after cloning the Vue template.</p><p>After that, change to the “Schema” section and add something like this:</p><pre>type Note {<br> id: ID!<br> title: String!<br> description: String<br>}</pre><pre>type Query {<br> fetchNote(id: ID!): Note<br>}</pre><pre>schema {<br> query: Query<br>}</pre><p>This just created a very simple type Note and a query for it. Save this and click on “Create Resources”. This step will automatically spawn more queries, mutations and subscriptions for our schema and add DynamoDB tables for it. After creating them, you just need to modify the new schema and connect the new mutations and subscriptions:</p><pre>schema {<br> query: Query<br> mutation: Mutation<br> subscription: Subscription<br>}</pre><p>Optionally, fetchNote query can be removed since AppSync generates a getNote query that does the same. Remember pressing “Save” again after these modifications.</p><p>That should be all the steps needed to get started with Vue + AppSync. If you correctly replaced the AppSync.json file in your project, you should be able to run yarn &amp;&amp; yarn dev and play with it. All the queries are located in src/gql/note.gql , which you can also copy and use in AppSync online playground (under the “Queries” section). In case you want to add new queries, just run yarn new gql and input the name and location.</p><p>Extra resources:</p><ul><li>Video: <a href="https://www.youtube.com/watch?v=0Xbt7VqkJNc">AWS AppSync — Creating a Serverless GraphQL Backend</a></li><li>Article: <a href="https://hackernoon.com/full-stack-vue-with-graphql-aws-appsync-adc5af474dc9">Full Stack Vue with GraphQL &amp; AWS AppSync</a></li></ul><h3>Conclusion</h3><p>Serverless and GraphQL are relatively new technologies that are progressively taking over. It doesn’t mean they are the right choices for everybody but it’s certainly worth it having a look at them before starting new projects.</p><p>I think this might be particularly useful for mobile apps with a rather simple backend that mostly relies on database mutations and real time subscriptions. It can reduce costs for the backend and reduce the bandwidth required by the application, apart from providing a presumably faster development.</p><p>Huge corporations like Facebook or Amazon are betting already on it. It is still a challenging field but, as it gets more attention, its complexity should be reduced.</p><p>I hope you found something of this useful. Thanks for reading and happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76a1ba4ceb1e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-web-tub/serverless-vue-js-with-graphql-76a1ba4ceb1e">Serverless Vue.js with GraphQL</a> was originally published in <a href="https://medium.com/the-web-tub">The Web Tub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Onsen UI Dark & Theme Customization]]></title>
            <link>https://medium.com/the-web-tub/onsen-ui-dark-theme-customization-f4780e71746e?source=rss-96a776272e5c------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4780e71746e</guid>
            <category><![CDATA[onsen-ui]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[theme-customization]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Fran Dios]]></dc:creator>
            <pubDate>Wed, 17 Jan 2018 06:18:03 GMT</pubDate>
            <atom:updated>2018-01-17T06:18:03.482Z</atom:updated>
            <content:encoded><![CDATA[<p>In case you didn’t know, Onsen UI’s dark theme was released some time ago. Either if you want to make an app for hackers or simply a night mode of your existing app, you should check it out!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ItjRJ-fgXR1qzD_3KZuY7A.png" /><figcaption>Onsen UI Dark Theme</figcaption></figure><p>It is provided as onsenui/css/dark-onsen-css-components.css in versions ≥ 2.7.0. CSS variables are located in onsenui/css/dark-theme.css .</p><h3>Theme Roller</h3><p>The new Onsen UI Theme Roller app is alive! Make your own theme or just tweak the existing ones easily with this new online tool. It is <a href="https://onsen.io/theme-roller/?customize">available here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uCqEJflFx60g-BlVFKmXhA.png" /><figcaption>Onsen UI Theme Roller</figcaption></figure><p>The new Theme Roller is compatible with Onsen UI v2.6.0 and up, you just need to choose your desired version in the drop-down. The old Theme Roller is still available for versions equal or older than v2.1.0 (using Stylus). Versions in between won’t be supported by this new app due to some errors in the CSS components in those versions. However, updating to +2.6.0 should not be hard!</p><p>Colors can be modified variable by variable through a Color Picker or all together with the bulk editor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EHqChIyCtx-9a82TZzHeXg.png" /><figcaption>Onsen UI Theme Roller — Bulk Edit</figcaption></figure><p>The latter also allows importing your current theme for further customization by copy-pasting your variables (theme.css file) and pressing “Save changes”. Any color feature supported by <a href="https://cssnext.io">cssnext</a> is available here.</p><p>Once your custom theme is finished, you can download the result in the “Download” section. Furthermore, you can even remove elements that you don’t need from your theme in order to reduce the size.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*44dFDg0JGap83b_OsAqMkQ.png" /><figcaption>Onsen UI Theme Roller — Selecting Components</figcaption></figure><p>Elements can be added back at any time by just importing the previous theme and generating a new one.</p><h3>Bonus: Resources Loader</h3><p>In Webpack applications, you can use <a href="https://github.com/shakacode/sass-resources-loader">sass-resources-loader</a> to share your CSS variables across your app. Even though it’s originally made for SASS, it actually works well with other preprocessors and with cssnext features.</p><p>I personally use it to provide common CSS variables in every &lt;style scoped&gt; block in my Vue.js apps, but it can be used in other ways and with other frameworks as well. For example, in the Theme Roller app, any of <a href="https://github.com/OnsenUI/theme-roller/blob/master/src/styles/resources.css">these variables, mixins and media queries</a> can be used in any component’s style block.</p><p>In mobile apps, you can share Onsen UI theme variables and access them in any other CSS module. I hope you find it useful as well!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4780e71746e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-web-tub/onsen-ui-dark-theme-customization-f4780e71746e">Onsen UI Dark &amp; Theme Customization</a> was originally published in <a href="https://medium.com/the-web-tub">The Web Tub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[New in Onsen UI 2.8: App size is much smaller than before!]]></title>
            <link>https://medium.com/the-web-tub/new-in-onsen-ui-2-8-app-size-is-much-smaller-than-before-d2b99e594aef?source=rss-96a776272e5c------2</link>
            <guid isPermaLink="false">https://medium.com/p/d2b99e594aef</guid>
            <category><![CDATA[es6]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[onsen-vue]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[onsen-ui]]></category>
            <dc:creator><![CDATA[Fran Dios]]></dc:creator>
            <pubDate>Thu, 30 Nov 2017 10:08:24 GMT</pubDate>
            <atom:updated>2017-11-30T10:08:24.325Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xqgC1omIbIA2prknysW8zw.png" /><figcaption>From Onsen UI 2.8, the app size will be much smaller than before!</figcaption></figure><p>The new version of Onsen UI (2.8.x) was released some days ago with some interesting changes:</p><h4>Bundle Size 50% Down!</h4><p>Since v2.2.0 we have been refactoring all the code (class inheritance, etc.) in order to reduce the size of Onsen UI. Thanks to this, the size did not increment too much even though we were adding new components and features in every release. However, the overall size was still high.</p><p>In version 2.8, we have <strong>reduced the bundle size by more than 50%</strong>. From 657kB in 2.7.2 to 327kB in 2.8.0 (onsenui.min.js) . The main reason was switching the bundling tool from Webpack to Rollup. If you are creating a library, seriously consider <a href="https://github.com/rollup/rollup">Rollup</a> for your project. <a href="https://medium.com/u/a11f7c00cbbe">Rich Harris</a> and the community have made an incredible job!</p><h4>Self-Contained ES Modules - Import Components Separately</h4><p>Our Custom Elements and Vue Components are now self-contained (JS wise) and can be imported separately. This means that you can further reduce your app’s size by just importing the necessary components. It requires an environment that supports ES Modules (e.g. by using Webpack or Rollup) but it is <strong>not</strong> necessary to compile/transpile them (already provided in pure ES5).</p><p>Even though this was theoretically possible before, it relied on tree shaking algorithms to drop the non imported components. Based on some tests, these algorithms still struggle with features like Object.defineProperty (which is automatically added by ES2015 transpilers) and will end up bundling all the components instead. Therefore, let’s take tree shaking algorithms out of the equation for now and import the components we need manually.</p><p>For pure JavaScript projects, simply import the components from the new onsenui/esm directory:</p><pre>// main.js</pre><pre>import ons from &#39;onsenui/esm&#39;; // ons object</pre><pre>// Custom Elements<br>import &#39;onsenui/esm/elements/ons-page&#39;;<br>import &#39;onsenui/esm/elements/ons-toolbar&#39;;</pre><p>The previous code imports the ons object and only two Custom Elements that will automatically be available as ons-page and ons-toolbar.</p><p>In <strong>Vue apps</strong> it is only necessary to import from vue-onsenui/esm (nothing from onsenui):</p><pre>// main.js</pre><pre>import Vue from &#39;vue&#39;;<br>import VueOnsen from &#39;vue-onsenui/esm&#39;;</pre><pre>// Vue Components<br>import VOnsPage from &#39;vue-onsenui/esm/components/VOnsPage&#39;;<br>import VOnsToolbar from &#39;vue-onsenui/esm/components/VOnsToolbar&#39;;</pre><pre>Vue.use(VueOnsen); // Register $ons object in Vue&#39;s prototype<br>Vue.component(VOnsPage.name, VOnsPage); // Register component<br>Vue.component(VOnsToolbar.name, VOnsToolbar); // Register component</pre><p>Since this can become a bit verbose if we import many components, the recommended way is to create a separate file which re-exports all the necessary components:</p><pre>// vue-ons-components.js</pre><pre>export { default as VOnsPage } from &#39;vue-onsenui/esm/components/VOnsPage&#39;;<br>export { default as VOnsToolbar } from &#39;vue-onsenui/esm/components/VOnsToolbar&#39;;<br>export { default as VOnsButton } from &#39;vue-onsenui/esm/components/VOnsButton&#39;;</pre><p>And then register all of them:</p><pre>// main.js</pre><pre>// ... import Vue and VueOnsen<br>import * as VOns from &#39;./vue-ons-components.js&#39;;</pre><pre>Object.values(VOns).forEach(comp =&gt; Vue.component(comp.name, comp));</pre><p>In addition, the <a href="https://github.com/OnsenUI/vue-pwa-webpack">Vue PWA template</a> has also been updated to take advantage of these changes. You can start a new app by running:</p><pre>vue init OnsenUI/vue-pwa-webpack myProject</pre><h4>Custom Icon Packs</h4><p>Originally, Onsen UI used to bundle Font Awesome, Ionicons and Material Design Icons. These icon packs are not precisely small and chances are that you only need one or two of them (or even none) in your app. Since v2.8.0, it is possible to leave them out of your app by importing onsenui-core.css file instead of onsenui.css.</p><pre>&lt;link rel=&quot;stylesheet&quot; href=&quot;https://unpkg.com/onsenui/css/onsenui-core.css&quot;&gt;<br>&lt;link rel=&quot;stylesheet&quot; href=&quot;https://unpkg.com/onsenui/css/onsen-css-components.min.css&quot;&gt;</pre><p>You will need to import any custom icon pack that you want manually (e.g. <a href="https://icomoon.io/">Icomoon</a>). Also, for custom icon packs you will need to call ons.disableIconAutoPrefix() in order to avoid adding fa- prefix automatically to your icons. More information <a href="https://onsen.io/v2/guide/faq.html#how-can-i-use-custom-icon-packs">here</a>.</p><h3>Conclusion</h3><p>Even though there are no new components or visible features added in 2.8, we regard this as one of the most important releases. The app’s size (UI wise) has been halved while still maintaining the same functionality! We hope you enjoy these changes and share with us your thoughts.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2b99e594aef" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-web-tub/new-in-onsen-ui-2-8-app-size-is-much-smaller-than-before-d2b99e594aef">New in Onsen UI 2.8: App size is much smaller than before!</a> was originally published in <a href="https://medium.com/the-web-tub">The Web Tub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Improve UX with Swiping Tab Bar Using Onsen UI for Vue]]></title>
            <link>https://medium.com/the-web-tub/improve-ux-with-swiping-tab-bar-using-onsen-ui-for-vue-4c7d0e5171f0?source=rss-96a776272e5c------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c7d0e5171f0</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[onsen-vue]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[onsen-ui]]></category>
            <dc:creator><![CDATA[Fran Dios]]></dc:creator>
            <pubDate>Thu, 05 Oct 2017 04:59:50 GMT</pubDate>
            <atom:updated>2017-10-05T04:59:50.586Z</atom:updated>
            <content:encoded><![CDATA[<h4>Vue’s declarative nature in action</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*LOxwj15LmbJtyDtU0s93MQ.gif" /><figcaption>Swiping Tab Bar</figcaption></figure><p>Cordova apps and Progressive Web Apps targeting mobile devices are very trendy nowadays. Delivering a native look and feel is key to improve user experience and engagement but is not always an easy task. Sure thing, creating styled checkboxes and radio buttons is not an issue at all but the real features that provide <strong>the quality jump we seek are based on user interaction</strong>.</p><p>A swiping tab bar splits the content into different pages and allows the user bringing the desired page into view <strong>with his/her own finger</strong>. What if, at the same time as the user drags the page, the app gradually changes its appearance with it? Does it sound cool but hard? Let’s see how simple it actually is with Vue.js.</p><h3>Getting Started</h3><p>First of all, we need an actual swiping tab bar component. There is a bunch of alternatives out there offering different features. Here, we’ll use the tab bar provided by <a href="https://onsen.io/vue/">Onsen UI</a>, which allows performing custom actions while swiping. In case you don’t know about it, <strong>Onsen UI has a set of iOS and Android components for Vue apps</strong>. For existing projects, it can be installed with NPM or Yarn:</p><pre>$&gt; npm install onsenui vue-onsenui --save-dev<br>$&gt; yarn add onsenui vue-onsenui -D</pre><p>Some necessary files must be included in the app:</p><pre>import &#39;onsenui/css/onsenui.css&#39;; // Webpack CSS import<br>import &#39;onsenui/css/onsen-css-components.css&#39;; // Webpack CSS import</pre><pre>import VueOnsen from &#39;vue-onsenui&#39;;<br>Vue.use(VueOnsen);</pre><p>Otherwise, new projects can be <strong>started right away via Vue CLI</strong>. It can optionally add Vuex and some other features:</p><pre>$&gt; vue init OnsenUI/vue-cordova-webpack # For Cordova apps<br>$&gt; vue init OnsenUI/vue-pwa-webpack # For PWA</pre><p>After this, &lt;v-ons-tabbar&gt; (among other components) should be available in the app.</p><h3>Swiping Tab Bar in Vue</h3><p>Adding a minimum swiping tab bar is very simple in Vue templates with Onsen UI. It can be defined as follows:</p><pre>&lt;v-ons-tabbar swipeable :tabs=&quot;tabs&quot; /&gt;</pre><p>The swipeable attribute can be toggled to allow or avoid swipes at different moments of the app, if necessary. tabs is a simple array of objects describing every tab appearance and content with page, label and icon properties. A full reference page for this component can be found <a href="https://onsen.io/v2/api/vue/v-ons-tabbar.html">here</a>.</p><p>On top of this, more props can be used to modify the default behavior, add some extra customization and obtain a unique app style. Let’s see, for example, how the on-swipe prop can be used to <strong>gradually change the interface colors while swiping</strong> in order to differentiate sections within the app (link to the real app at the end of the article).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*4W-8qv7e3exqjNhlWIqfRw.gif" /><figcaption>Color Interpolation</figcaption></figure><p>Code snippet:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4f1a71f666e0a26ac28e08308721213b/href">https://medium.com/media/4f1a71f666e0a26ac28e08308721213b/href</a></iframe><p>This code creates a page with a simple toolbar and tab bar using v-ons-page, v-ons-toolbar and v-ons-tabbar components. The tabs property contains an array of tabs. Both page and label properties will be used by the tab bar component itself to describe the tab content and appearance, but it doesn’t stop us from providing custom properties like theme or anything else. These themes are simple arrays of RGB colors. We’ll see in a moment why this format is good to describe themes.</p><p>Notice how theswipeTheme computed property is passed to the toolbar (via style prop) and the tab bar (via tabbar-style prop). Whenever this property is changed, the style of those two components will be updated. There is also the onSwipe method provided in on-swipe prop, which will be called whenever the user moves the finger on the screen. But how do we now change the interface colors appropriately?</p><h3>Linear Interpolation</h3><p>Simply put, a <a href="https://en.wikipedia.org/wiki/Linear_interpolation">linear interpolation</a> (“lerp” in computer graphics) is a <strong>formula that generates middle points between two data values</strong> (like colors) based on some input. Say, for instance, we want to move a dot on the screen from an origin point <em>x0</em> to an end point <em>x1</em> gradually. We just need to provide both points to the formula together with the “completion ratio” in order to get the position where the dot should be placed in a specific instant. In other words, a ratio (or alpha value) describing how close we are to reach the end point.</p><pre>const lerp = (x0, x1, r) =&gt; (1 — r) * x0 + r * x1;</pre><p>For example, if we want to generate 3 points from <em>x0</em> to <em>x1</em> (excluding both of them), the first step will need r = 0.25 (25% complete); the second step r = 0.5 (50% complete, i.e. in the middle); and the third step r = 0.75 (75% complete). Of course, it can generate as many middle points as we want by just providing different ratios.</p><p>This is not only applicable to physical distances. In the previous code, we want to gradually transform a color into another based on the swipe position. In order to achieve this, we need to represent colors as discrete values and know the swipe ratio between two pages. Precisely, <strong>RGB colors are composed of 3 values</strong> that can be separately interpolated. <a href="http://www.alanzucconi.com/2016/01/06/colour-interpolation/">Other representations can also be interpolated</a> but they imply more complex code.</p><p>Apart from that, the swiping tab bar component provides the <strong>decimal index</strong> of the current page in onSwipe hook. An index of 1.65, for instance, means that the current swipe is 65% of the way between page 1 and page 2 (r = 0.65).</p><p>Therefore, if a different RGB color array is assigned to each tab, we’ll be able to interpolate each of these values based on the current swipe:</p><pre>onSwipe(index, animationOptions) {<br>  this.animationOptions = animationOptions;</pre><pre>  const x0 = Math.floor(index),<br>    x1 = Math.ceil(index),<br>    ratio = index % 1;</pre><pre>  this.colors = this.colors.map((c, i) =&gt;<br>    lerp(<br>      this.tabs[x0].theme[i],<br>      this.tabs[x1].theme[i],<br>      ratio<br>    )<br>  );<br>}</pre><p>This assigns a new color array to this.colors, which is reactively used by this.swipeTheme computed property to create valid CSS syntax based on these colors.</p><p>Notice that animationOptions is also provided as the second parameter. It will be empty while swiping but, when releasing the swipe, <strong>the tab bar will use the finger velocity to finish the swipe animation</strong>. This velocity is given as duration and timing (<a href="http://cubic-bezier.com">Cubic Bezier curves</a>) in this parameter and can be used to create a CSS transition. This way, all the animations (pages, tab bar border, and colors) will be synchronized.</p><h3>What’s Next</h3><p>As you can see, Vue’s declarative nature keeps all of this really simple. We can just update a specific property instead of grabbing elements from the DOM and changing styles manually.</p><p>A complete Cordova app with the previous (and more) code <a href="https://onsenui.github.io/vue-onsenui-kitchensink/">can be found here</a>. It adds more interpolations following the same concept. In case you want to know more about Onsen UI for Vue, have a look at the <a href="https://onsen.io/vue/">official site</a>.</p><p>I invite you to try out different animations and share them with us on <a href="https://twitter.com/Onsen_UI">Twitter</a> :)</p><p>Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c7d0e5171f0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-web-tub/improve-ux-with-swiping-tab-bar-using-onsen-ui-for-vue-4c7d0e5171f0">Improve UX with Swiping Tab Bar Using Onsen UI for Vue</a> was originally published in <a href="https://medium.com/the-web-tub">The Web Tub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating Custom Modifiers]]></title>
            <link>https://medium.com/the-web-tub/creating-custom-modifiers-dffc3490309f?source=rss-96a776272e5c------2</link>
            <guid isPermaLink="false">https://medium.com/p/dffc3490309f</guid>
            <category><![CDATA[material-design]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[onsen-ui]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Fran Dios]]></dc:creator>
            <pubDate>Tue, 06 Jun 2017 12:00:00 GMT</pubDate>
            <atom:updated>2017-09-25T08:32:27.401Z</atom:updated>
            <content:encoded><![CDATA[<p>Onsen UI provides native-like styles for all the UI components that presumably work for most of the situations. However, sometimes we want to give our apps a personal touch in the shape of custom styles or animations. Let’s learn how to quickly implement custom “modifiers” to alter the style of our components in this article.</p><h3>About “modifier” attribute</h3><p>Every visual component in Onsen UI accepts a modifier attribute that alters its style. Modifiers are a cross-component way to provide visual customizability. A modifier is translated into a set of CSS classes not only for the own element but also for its children. This way, we don’t need to set CSS classes manually for every child element of our UI component or provide complex CSS selectors.</p><p>For example, using material modifier in ons-input element automatically sets .text-input--material and .text-input--material__label to its children, whereas underbar modifier sets .text-input--underbar and .text-input--underbar__label.</p><p>In order to see how any element sets these classes, you can have a look at the scheme object on each <a href="https://github.com/OnsenUI/OnsenUI/tree/master/core/src/elements">element’s declaration</a>. For example, an ons-back-button‘s scheme looks like <a href="https://github.com/OnsenUI/OnsenUI/blob/master/core/src/elements/ons-back-button.js#L26">this</a>. This means it will apply .back-button--modifier to the element itself and .back-button--modifier__icon and .back-button--modifier__label to its corresponding children.</p><h3>Custom modifier</h3><p>Let’s see a simple but useful example of how to create a custom modifier for one of our recent components, <a href="https://onsen.io/v2/docs/js/ons-toast.html">ons-toast</a>.</p><p>By default, ons-toast is displayed full-width at the bottom of the page. Let’s change it!</p><p>We simply need to check the DOM and play a bit with the CSS properties. With this simple CSS, we can make a right-aligned “danger” modifier:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dfe6eba6d4257efe66240880cd56e47f/href">https://medium.com/media/dfe6eba6d4257efe66240880cd56e47f/href</a></iframe><p>Or a centered and rounded “success” modifier:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/854b48ce478a25a4c1016ab27a9665ed/href">https://medium.com/media/854b48ce478a25a4c1016ab27a9665ed/href</a></iframe><p>And an extra modifier to change the font:</p><pre>.toast--thick__message, .toast--thick__button {<br>    font-weight: 700;<br>}</pre><p>Now we can apply all of this with a simple modifier=&quot;danger&quot;, modifier=&quot;success thick&quot; or any other combination.</p><p>Check the result here.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Ffrankdiox%2Fembed%2Fpreview%2FrwaGVr%3Fheight%3D600%26slug-hash%3DrwaGVr%26default-tabs%3Dhtml%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Ffrankdiox%2Fpen%2FrwaGVr&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F238581.rwaGVr.small.8db8c287-f6b4-420b-ab90-059448cbbd39.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/6d6c77ae46748669ea1309b8ec433e90/href">https://medium.com/media/6d6c77ae46748669ea1309b8ec433e90/href</a></iframe><p>For notifications, it is also possible to specify modifiers with the inline method:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8542b14ef4d1dbbe9151b0449697bf85/href">https://medium.com/media/8542b14ef4d1dbbe9151b0449697bf85/href</a></iframe><p>In case we only want to apply a specific modifier for a specific platform, we can use :not selector. For example, let’s say we want to exclude the material modifier for iOS, we can with :not selector as shown below:</p><pre>.toast--onlyios:not(.toast--material) {<br>    /* Only works when &#39;material&#39; modifier is not applied */<br>}</pre><p>Similarly, only for Android:</p><pre>.toast--onlyandroid.toast--material {<br>    /* Only works when &#39;material&#39; modifier is applied */<br>}</pre><p>Onsen UI is an open source library used to create the user interface of hybrid apps. You can find more information on our <a href="https://github.com/OnsenUI/OnsenUI">GitHub page</a>. If you like Onsen UI, please don’t forget to give us a star! ★★★★★</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dffc3490309f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-web-tub/creating-custom-modifiers-dffc3490309f">Creating Custom Modifiers</a> was originally published in <a href="https://medium.com/the-web-tub">The Web Tub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Onsen UI YouTube Jukebox with AngularJS]]></title>
            <link>https://medium.com/the-web-tub/onsen-ui-youtube-jukebox-with-angularjs-7e978a205dc7?source=rss-96a776272e5c------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e978a205dc7</guid>
            <category><![CDATA[youtube]]></category>
            <category><![CDATA[onsen-ui]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[angularjs]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Fran Dios]]></dc:creator>
            <pubDate>Thu, 24 Nov 2016 12:00:00 GMT</pubDate>
            <atom:updated>2017-09-25T09:01:46.057Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/632/0*zfyGES6MjZaI_OgI.png" /></figure><p>The YouTube Jukebox app has been updated to Onsen UI 2.0 + AngularJS and now includes a Material Design version. This app uses the YouTube Data API v3 to fetch videos and display them in our hybrid apps. Learn more about the included changes here.</p><p>YouTube Jukebox sample app was released some time ago for Onsen UI 1. It has a tutorial about how to use the YouTube Data API v3 with AngularJS in Onsen UI that is still completely valid for Onsen UI 2. You can <a href="http://onsen.io/blog/onsen-ui-youtube-api-v3/">check it out</a> for more details.</p><h3>YouTube Jukebox</h3><p>The source code of this application is <a href="https://github.com/frandiox/OnsenUI-YouTube">on Github</a>.</p><p>After the latest changes it now includes a Material Design version that will be displayed in Android devices. This version contains a modal that overlays a new ons-toolbar which includes a search input. This behavior is quite common in Material Design apps.</p><p>Another interesting change is that it now loads new videos when the scroll reaches the bottom of the page using <a href="http://onsen.io/v2/docs/angular1/ons-page.html#attributes">onInfiniteScroll</a> functionality instead of a “Load more” manual button.</p><p>This app is included in our <a href="http://onsen.io/samples">samples page</a> along with other useful samples. If you have any doubt about this app, please leave a comment or open an issue on Github.</p><p><em>Originally published at </em><a href="http://onsen.io/blog/onsen-youtube-sample/"><em>onsen.io</em></a><em> on November 24, 2016.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e978a205dc7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-web-tub/onsen-ui-youtube-jukebox-with-angularjs-7e978a205dc7">Onsen UI YouTube Jukebox with AngularJS</a> was originally published in <a href="https://medium.com/the-web-tub">The Web Tub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Comparing Frameworks: Hello World!]]></title>
            <link>https://medium.com/the-web-tub/comparing-frameworks-hello-world-506e641c2d9c?source=rss-96a776272e5c------2</link>
            <guid isPermaLink="false">https://medium.com/p/506e641c2d9c</guid>
            <category><![CDATA[angularjs]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[onsen-ui]]></category>
            <dc:creator><![CDATA[Fran Dios]]></dc:creator>
            <pubDate>Mon, 17 Oct 2016 12:00:00 GMT</pubDate>
            <atom:updated>2017-12-03T18:38:59.540Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*xgAjgTnGzUsksFdo.png" /></figure><p>The fact that Onsen UI is <a href="https://onsen.io/blog/create-reusable-future-proof-ui-components-with-custom-elements-v1-web-components/">built on top of Web Components</a> makes us proud to be framework agnostic. However, there are so many options out there that we can feel overwhelmed when it comes to choosing a front-end framework to develop with. Especially for those who don’t have a large background in web programming, deciding which framework works better for them could be a tedious task.</p><p>Have you already chosen your framework to work with Onsen UI? For those who still don’t have a preference, in this article we show how to make a simple Hello World app with some of the existing alternatives: <strong>Vanilla JavaScript, AngularJS, Angular 2+, React, Vue.js and Knockout.js</strong>.</p><h3>Hello World example</h3><p>The following are simple examples showing an alert dialog when clicking on a button. The solely purpose of this is showing the syntax and complexity differences between the included frameworks for a simple example. We are using the <a href="https://tutorial.onsen.io/">playground app</a> to show the previews and code. If you didn’t know about it go and check it out, you will find more examples there. Moreover, we invite you to play around with the code you see in the tuts and modify everything!</p><h3>Vanilla JavaScript</h3><p>Since Onsen UI components behave like native DOM elements (Custom Elements) it’s really simple to deal with them with <strong>pure JavaScript or jQuery</strong>. We just have events, DOM elements, attributes and properties. Good old and plain JavaScript.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fcodepen.io%2Ffrankdiox%2Fpen%2FaVXRxW%3Feditors%3D1010&amp;src=https%3A%2F%2Fcodepen.io%2Ffrankdiox%2Fembed%2Fpreview%2FaVXRxW%3Fheight%3D600%26slug-hash%3DaVXRxW%26default-tabs%3Dhtml%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/ba47a7170a2e887a1eb24c53cb771009/href">https://medium.com/media/ba47a7170a2e887a1eb24c53cb771009/href</a></iframe><p>In Onsen UI, the right place to initialize a page is in its init event. Simply set a listener and modify whatever you need. Follow <a href="https://tutorial.onsen.io/index.html?framework=vanilla&amp;category=Reference&amp;module=page">this link</a> to see the main view of the playground app and find more examples with Vanilla JavaScript using other components.</p><h3>AngularJS (1.x)</h3><p>For this example, we can set up an AngularJS controller linked to the main page. Our HTML behaves like a template accessing the scoped variables from the controller and thus displaying data. We use ons.bootstrap() shortcut syntax, what is equivalent to angular.module(&#39;myApp&#39;, [&#39;onsen&#39;]) (having ng-app=&quot;myApp&quot; set, of course).</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Ffrankdiox%2Fembed%2Fpreview%2FmqvzZz%3Fheight%3D600%26slug-hash%3DmqvzZz%26default-tabs%3Dhtml%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Ffrankdiox%2Fpen%2FmqvzZz%3F%26editors%3D101&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F238581.mqvzZz.small.053b6c0f-e028-4ed0-bf75-6d9258728386.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/2c8fc10383ffdb133f93d9d00c0500f3/href">https://medium.com/media/2c8fc10383ffdb133f93d9d00c0500f3/href</a></iframe><p><a href="https://tutorial.onsen.io/index.html?framework=angular1&amp;category=Reference&amp;module=page">Here</a> you can find more AngularJS + Onsen UI samples.</p><h3>Angular (2+)</h3><p>This is getting complex. We start using TypeScript now for Angular 2+. Here we must import our shopping list: platformBrowserDynamic, NgModule, OnsenModule, etc. Once we get all the ingredients we can safely start cooking our typed components.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Ffrankdiox%2Fembed%2Fpreview%2FmqvvRq%3Fheight%3D600%26slug-hash%3DmqvvRq%26default-tabs%3Dhtml%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Ffrankdiox%2Fpen%2FmqvvRq%3Feditors%3D1000&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F238581.mqvvRq.small.172e67a9-187b-4647-9a46-18b4fc18e457.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/e5e1b460f8f5ae9fdc27cd868923ed89/href">https://medium.com/media/e5e1b460f8f5ae9fdc27cd868923ed89/href</a></iframe><p><a href="https://tutorial.onsen.io/index.html?framework=angular2&amp;category=Reference&amp;module=page">This link</a> has more tuts using Angular 2+ with Onsen UI.</p><h3>React</h3><p>React has its own way of doing things. We are using <a href="https://reactjs.org/docs/introducing-jsx.html">JSX</a> syntax in this example and <a href="https://babeljs.io/">Babel</a> for compiling it. Even thought it may seem complex, I personally like the React approach since it enforces modularity and, thanks to JSX, the “template” and the logic is directly connected.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Ffrankdiox%2Fembed%2Fpreview%2FzPeMOZ%3Fheight%3D600%26slug-hash%3DzPeMOZ%26default-tabs%3Djs%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Ffrankdiox%2Fpen%2FzPeMOZ%3Feditors%3D1010&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F238581.zPeMOZ.small.b5b60c6b-5a4c-48b9-a28e-d55fb23667cc.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/0ec6a9e4930fe4fa4452407ac07f99bb/href">https://medium.com/media/0ec6a9e4930fe4fa4452407ac07f99bb/href</a></iframe><p>More examples with React Components for Onsen UI <a href="https://tutorial.onsen.io/index.html?framework=react&amp;category=Reference&amp;module=page">here</a>.</p><h3>Vue.js</h3><p>Vue is a very powerful framework that keeps things simple. Or at least simpler than the previous two, in my personal opinion. In Vue, we have access to $ons.notification instead of ons.notification object directly from the template.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Ffrankdiox%2Fembed%2Fpreview%2FaVXQby%3Fheight%3D600%26slug-hash%3DaVXQby%26default-tabs%3Dhtml%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Ffrankdiox%2Fpen%2FaVXQby%3Feditors%3D1010&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F238581.aVXQby.small.9420c7dc-87b7-4b99-a1b1-4cfdbd976cec.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/613df60033e6472a488a7c4b5e8493df/href">https://medium.com/media/613df60033e6472a488a7c4b5e8493df/href</a></iframe><p>More information about Vue bindings <a href="https://onsen.io/vue">here</a>.</p><h3>Knockout.js</h3><p>Another good option for simple (and maybe not so simple) apps. For basic Knockout.js usage, <strong>we don’t even need a bindings package </strong>since we can define the bindings as we want. In this case, we link a Knockout view model when a page is initialized directly in the init event based on the page’s ID.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Ffrankdiox%2Fembed%2Fpreview%2FPOVxwL%3Fheight%3D600%26slug-hash%3DPOVxwL%26default-tabs%3Djs%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Ffrankdiox%2Fpen%2FPOVxwL%3F%26editors%3D101&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F238581.POVxwL.small.6cfd51ed-b6ef-412b-89ce-38656252b72b.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/8ebcb896adc073ffaf5f4eeb6037da4b/href">https://medium.com/media/8ebcb896adc073ffaf5f4eeb6037da4b/href</a></iframe><p>Want more about Knockout.js + Onsen UI? Have a look at <a href="https://tutorial.onsen.io/index.html?external=https://tutorial.onsen.io/tutorial/other/knockout_bindings.html">this other example</a>. It’s a bit more complex since it’s using Navigator and Tabbar at the same time.</p><h3>Conclusion</h3><p>We have seen how easy is to plug Onsen UI with some of the most common frameworks nowadays. Some of them are complex frameworks that need a lot of “bootstrap” code but become very handy when the app gets bigger and need a robust way of organizing data and views. Other frameworks are quite straightforward with a gentle learning curve but possibly don’t offer so much help for organization in complex apps. At the end of the day, this is more a matter of opinion and every developer has his/her own preference. And you, what’s your choice to work with Onsen UI?</p><p>Stars on <a href="https://github.com/OnsenUI/OnsenUI">Github</a>, <a href="https://twitter.com/Onsen_UI">tweets</a> and comments are very appreciated. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=506e641c2d9c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-web-tub/comparing-frameworks-hello-world-506e641c2d9c">Comparing Frameworks: Hello World!</a> was originally published in <a href="https://medium.com/the-web-tub">The Web Tub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Inside Onsen UI: Web Components]]></title>
            <link>https://medium.com/the-web-tub/inside-onsen-ui-web-components-9d3adbcb432d?source=rss-96a776272e5c------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d3adbcb432d</guid>
            <category><![CDATA[web-components]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[onsen-ui]]></category>
            <category><![CDATA[angularjs]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Fran Dios]]></dc:creator>
            <pubDate>Fri, 09 Sep 2016 12:00:00 GMT</pubDate>
            <atom:updated>2017-09-25T08:53:34.435Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*WLD9sFHr-JnGYPcE.png" /></figure><p>Onsen UI 2.0 final release is around the corner. We’ve come a long way since we started implementing this version and we want to explain you here what were our reasons and issues. This is a short article that breaks down Onsen UI and some of the technologies behind it.</p><h3>From AngularJS directives to Web Components</h3><p>Onsen UI 1.x was built on top of AngularJS, a revolutionary framework for its time that is getting replaced nowadays by some more lightweight and newer ones. In AngularJS it is possible to define directives, markers on a DOM element (mostly as element names or attributes) that allows attaching a specified behavior to them. While this was great to make an HTML-Elements based framework, it carried a few drawbacks. Being built on top of AngularJS meant that every developer had to adapt to this framework in some way or another. Even if it was not used for the main part of the app, the dependency is still there running under the hood and compiling everything. Also, AngularJS is a great framework but we all know it doesn’t help too much with performance. Even though performance mostly depends on the app developer’s skills, <strong>dropping a few hundred milliseconds by removing dependencies is quite significant for hybrid apps</strong>.</p><p>Due to these and some other reasons we decided that Onsen UI 2.0 should move on and <strong>divorce from opinionated frameworks</strong>. At that time we found the <a href="https://developer.mozilla.org/en-US/docs/Web/Web_Components">Web Components</a> project and in the team we all agreed it would be interesting to try it out.</p><p>With this technology are able to <strong>create real and reusable HTML components</strong> that behave in the way we want. As everything, this technology also has some minor drawbacks such as not being able to create custom attributes. That’s the reason why we have now, for example, &lt;ons-lazy-repeat&gt; element instead of an attribute as we had before with the directives. However, over all of this, we thought the swap would still be worth it.</p><h3>Web Components standard</h3><p>Web Components is actually a set of different and separate technologies: Custom Elements, HTML Imports, Templates and Shadow DOM. These are <strong>browser standards still under development</strong> that hopefully soon will have a native implementation in every browser. Until then we just need a simple polyfill that implements the necessary features.</p><p>To be precise, we don’t need everything in the Web Components specification, just the <a href="https://w3c.github.io/webcomponents/spec/custom/">Custom Elements</a>. This is what allows us to create elements that inherits the original HTMLElement with extended behavior. Thanks to it we are able to get an element by ID, tag name or class and directly use it as a normal DOM element:</p><pre>var newItem = document.createElement(&#39;ons-list-item&#39;); document.getElementById(&#39;my-list&#39;).appendChild(newItem);</pre><p>We believe <strong>this makes Onsen UI super simple to use</strong> as you are working with real HTML Elements that have attributes, properties and methods just like in normal HTML5.They can be used with just pure JavaScript and it feels simple and easy.</p><p>Custom Elements reached its version 1.0 quite recently, improving their API and finalising some extra features. If you are curious about this technology you can read further about it <a href="https://developers.google.com/web/fundamentals/primers/customelements/">here</a>.</p><p>As a side note, Web Components is not the same as <a href="https://www.polymer-project.org/1.0/">Polymer</a>. This is just a project built on top of Web Components just like Onsen UI.</p><h3>Not an easy change</h3><p>While all of this sounds very cool, truth is that it was not a smooth change. We faced many issues that have been gradually fixed. Some of them still persist until now and force us to make adjustments to the core library from time to time.</p><p>At the beginning, Google Chrome was the only browser that natively supported Custom Elements and everything worked just right. However, other browsers without native implementation that were using the 0.x version of the polyfill presented several <strong>timing issues</strong>: Components were not loaded when they were supposed to be since they needed some extra cycles (remember that JavaScript is asynchronous). Fortunately, all of this was fixed with the version 1.0 of the polyfill (the one made by <a href="https://github.com/WebReflection/document-register-element">WebReflection</a>) and now every browser is consistent in terms of Web Components (cross browser CSS is a whole different topic).</p><p>Moreover, the biggest issue we had is likely related to <strong>DOM manipulations</strong>. Some components need to create inner elements and move their content around in order to work properly. For example, when you create &lt;ons-page&gt; with some content, another &lt;div class=&quot;page__content&quot;&gt; is actually created internally and the content is moved there. This allows us to provide a simple API and a way to use our components but it comes with a high trade off. This is just fine if we only use Custom Elements with Vanilla JavaScript or libraries like jQuery. However, more complex frameworks such as React or Angular 2 want to manage the DOM tree by themselves. Therefore, making any modification to the inner structure from the element itself is not very advisable.</p><p>In addition, every framework has its own peculiarities when it comes to element creation. Some of them allow creating elements directly with attributes on them whereas others will first create the element and then add the attributes afterwards. The same happens with the element content and some other things. We had a hard time resolving all of these problems and sometimes we still need to address related issues from time to time.</p><p>In any case, <strong>Onsen UI 2.0 has definitely improved in both performance and ease of use</strong> after all of these changes.</p><h3>Becoming framework agnostic</h3><p>Probably you have already heard about Onsen UI support for <a href="https://onsen.io/v2/react.html">React</a>, <a href="https://onsen.io/v2/angular2.html">Angular 1 &amp; 2</a> and recently <a href="https://onsen.io/blog/preview-vue-support-onsen-ui/">Vue.js</a>. For these frameworks we wanted to release a small wrapper that we call bindings. These small “add-ons” allow us to fix some timing issues described in the previous section and, most importantly, we can tailor our core library for specific groups of developers. For instance, nobody wants to do document.addEventListener(&#39;prepush&#39;, fn) in AngularJS if you can directly use an attribute &lt;... ons-prepush=&quot;fn&quot;&gt; in your element. This sort of features is what we implement in the bindings in order to make Onsen UI feel more natural for Angular, React or Vue.js developers.</p><h3>Still some work to do. But it looks good!</h3><p>We are aware of some parts that still need to improve. For example, we want to expose and document an API for extending the core library so everyone can easily create custom bindings for other frameworks. We are also working on exposing an API for animations in order to make it easier to plug an external router and let Onsen UI handle the page transition animations.</p><p>These are, however, changes that will come <strong>after the final release</strong> as we don’t consider them urgent enough to delay the big day anymore. Onsen UI is quite robust already and we consider it <strong>ready for real world apps</strong>. You can <strong>expect the final version to arrive quite soon</strong>.</p><p>We are very thankful for the feedback we get in our forum and Github repo. This allows us to keep improving and expanding Onsen UI. We’d like Onsen UI developers to spread the word about our framework now that we are about to release the final version. Let’s make this a big framework with a big community.</p><p>You can leave comments and questions on <a href="https://community.onsen.io/">our forum</a>; issues and 🌟 <a href="https://github.com/OnsenUI/OnsenUI">on Github</a>. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d3adbcb432d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-web-tub/inside-onsen-ui-web-components-9d3adbcb432d">Inside Onsen UI: Web Components</a> was originally published in <a href="https://medium.com/the-web-tub">The Web Tub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with Meteor and Onsen UI]]></title>
            <link>https://medium.com/the-web-tub/getting-started-with-meteor-and-onsen-ui-725eab52c69?source=rss-96a776272e5c------2</link>
            <guid isPermaLink="false">https://medium.com/p/725eab52c69</guid>
            <category><![CDATA[meteor]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[onsen-ui]]></category>
            <category><![CDATA[angularjs]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Fran Dios]]></dc:creator>
            <pubDate>Tue, 23 Aug 2016 12:00:00 GMT</pubDate>
            <atom:updated>2017-09-25T08:54:39.436Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/643/0*L3SzeWaeM6drtwBH.png" /></figure><p><a href="https://www.meteor.com/">Meteor</a> is very well known as a full-stack framework that tremendously simplifies the creation of web apps. Thanks to <a href="https://cordova.apache.org/">Cordova</a> we can also use Meteor for hybrid mobile apps and, after the last changes we made to our framework and bindings, we are excited to announce that you can find a robust Meteor Mobile UI framework in Onsen UI.</p><p>In this post we show you how to easily combine Meteor with Onsen UI to create beautiful looking mobile apps.</p><h3>Why Meteor + Onsen UI?</h3><p>Meteor is a great technology for web apps. It offers a high development efficiency by abstracting many aspects behind its client-server connection. For instance, you won’t need to worry about WebSockets, sending requests to modify your database or updating your local information. All of this is automatically handled by Meteor behind the scenes. It also supports several front-end frameworks, including <a href="https://facebook.github.io/react/">React</a> and <a href="https://angularjs.org/">AngularJS</a>, so you can choose your preferred client flavor and develop your app with a reduced learning curve.</p><p>This last characteristic is what makes it pluggable to Onsen UI. Being framework-agnostic, Onsen UI can easily play well with famous technologies such as Meteor. This way, we keep a quick learning curve as well as high efficiency since Onsen UI core is implemented in pure JavaScript. Moreover, it offers beautiful looking components that change style automatically depending on the platform (iOS flat design or Android’s Material Design), making cross-development truly possible with little to no effort.</p><h3>Onsen UI + Meteor Todo app</h3><p>As already mentioned, Meteor offers variety of frameworks for its front-end side. Two of them, React and AngularJS, are <strong>already tested and play nicely with Onsen UI</strong> since we released official components for them. Here we will show how easy is to integrate <a href="https://onsen.io/v2/react.html">React Components for Onsen UI</a> with your Meteor application.</p><p>We follow the Meteor’s official tutorial to make a <a href="https://www.meteor.com/tutorials/react/creating-an-app">React Todo app</a> and simply change the front end to use Onsen UI components. This app runs on <a href="https://onsenui-meteor-todos.herokuapp.com/">Heroku</a>.</p><ul><li><a href="https://onsenui-meteor-todos.herokuapp.com/">Todo List</a></li><li><a href="https://onsenui-meteor-todos.herokuapp.com/?platform=android">Todo List</a></li></ul><p>The source code of this application is <a href="https://github.com/frandiox/OnsenUI-Meteor-ToDo">on Github</a>.</p><p>As a side note, if you are curious about the React syntax used in this app, you can find some information <a href="https://facebook.github.io/react/docs/reusable-components.html#stateless-functions">here</a>.</p><h3>Troubleshooting</h3><p>There is only one tricky part we must understand to make Onsen UI work with Meteor. As of Meteor 1.4, we are able to import CSS from node_modules folder directly in a .js file:</p><pre>import ons from &#39;onsenui&#39;; <br>import &#39;onsenui/css/onsenui.css&#39;; <br>import &#39;onsenui/css/onsen-css-components.css&#39;;</pre><p>However, we must consider this information from their docs:</p><p>When importing CSS from a JavaScript file, that CSS is not bundled with the rest of the CSS processed with the Meteor Build tool, but instead is put in your app’s &lt;head&gt; tag inside &lt;style&gt;...&lt;/style&gt; after the main concatenated CSS file.</p><p>This actually means that <strong>CSS </strong><strong>@import lines within these files won’t be resolved</strong>. Fonts and icons won’t be loaded in the app since Onsen UI imports those in onsenui.css file.</p><p>A very simple fix is to copy the fonts CSS folders into Meteor’s public directory. You could also make sure that Meteor processes these files in other way, but this would depend on your project configuration.</p><p>After this is done, everything will be loaded in the app and you can continue as you’d normally do with Onsen UI and Meteor.</p><h3>What about AngularJS?</h3><p>So far we have only faced a minor problem that can be easily fixed as well. Due to some timing issues in Meteor’s import, we will need to include Onsen UI in our app using require instead, as follows:</p><pre>window.ons = require(&#39;onsenui&#39;); <br>require(&#39;onsenui/js/angular-onsenui&#39;);</pre><h3>Conclusion</h3><p>We hope Meteor users are happy to have an alternative such as Onsen UI for their mobile apps. If you have any doubt about this content or anything else, don’t hesitate to leave a comment here or in <a href="https://twitter.com/Onsen_UI">Twitter</a>. And don’t forget to 🌟 our <a href="https://github.com/OnsenUI/OnsenUI">GitHub repo</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=725eab52c69" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-web-tub/getting-started-with-meteor-and-onsen-ui-725eab52c69">Getting Started with Meteor and Onsen UI</a> was originally published in <a href="https://medium.com/the-web-tub">The Web Tub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Latest News in Onsen UI Environment]]></title>
            <link>https://medium.com/@frandiox/latest-news-in-onsen-ui-environment-9ef663193559?source=rss-96a776272e5c------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ef663193559</guid>
            <category><![CDATA[onsen-ui]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Fran Dios]]></dc:creator>
            <pubDate>Thu, 12 May 2016 12:00:00 GMT</pubDate>
            <atom:updated>2017-09-25T09:16:57.164Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*AxbvqYvI7CJdDfkQ.PNG" /></figure><p><a href="https://onsen.io/v2/">Onsen UI 2.0 Release Candidate</a> was released last week together with <a href="https://onsen.io/v2/react.html">React Components for Onsen UI</a>. Angular2 extension is on the way and at the same time we are focusing on improving Onsen UI development stack, e.g. tools and services complementing our framework that will make your development process much smoother. Here you have the latest news around Onsen UI.</p><p>We decided to improve Onsen UI’s development environment and community tools and few months ago we released <a href="https://community.onsen.io/">Onsen UI x Monaca Community Forum</a>. This forum has so far gathered, together with the already existing <a href="https://gitter.im/OnsenUI/OnsenUI">Gitter Chat</a>, a bunch of developers who can quickly solve their issues. We invite you to join if you haven’t yet.</p><h3>Interactive Tutorial</h3><p>Now we want to introduce a new tool that you’ll hopefully love: <a href="http://tutorial.onsen.io/">Onsen UI Interactive Tutorial</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*7it2x8VUlLnVGarm.PNG" /></figure><p>It’s self-explanatory. You have access to a -increasing- number of Onsen UI samples with a proper explanation about how it works, HTML &amp; JS code and a preview that supports both iOS and Android views. We want to collect here all our examples in order to have an updated index where our users can easily learn and bootstrap their apps. These tutorials are separated depending on the framework they are developed with (for now Angular1, Angular2, React and Vanilla JS — no framework). Thus, you can choose the framework your prefer and learn how to integrate Onsen UI with it.</p><p>Also, you can modify and test these samples within this app to later export and save them in Codepen or even generate a Cordova project from them.</p><p>In case you find any error or you want to submit your own tuts, please open issues or send PRs to the <a href="https://github.com/OnsenUI/tutorial">interactive tutorial repo</a>. We will be updating this tool and adding more tutorials in the upcoming weeks.</p><h3>$&gt; Onsen CLI ?</h3><p>Almost. As you may already know, Onsen UI is part of the <a href="https://monaca.io/">Monaca Toolkit</a>, a set of tools that provides a seamless hybrid mobile app development including user interface, debugger, remote build, back-end and more. In this section we’d like to focus on one of those tools: <strong>Monaca CLI</strong>.</p><p>Monaca CLI has been drastically improved and released under version 2.0 to accompany our beloved Onsen UI 2.0. This tool may well be called Onsen CLI since its tightly integrated with it, allowing you to generate apps much faster starting from prepared templates. Some of the new features include signing up from the CLI itself and creating Cordova projects directly with Angular1, Angular2 (coming soon) or React frameworks:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/412/0*zf9Ogwln3Hzv4fcZ.PNG" /></figure><p>Monaca CLI will automatically add the required libraries and external tools for your project to run. For example, if you choose a React template, you’ll get Babel and the necessary tools for transpiling and bundling the code. It will watch for your files and auto generate the bundle so you can easily preview your app in browser, emulator and devices.</p><p>Moreover, since we believe <a href="https://monaca.io/debugger.html"><strong>Monaca Debugger</strong></a> is a very useful tool for all Onsen UI developers, we made it now fully accessible from Monaca CLI. Yes, even <strong>for free</strong> licenses. Just run monaca debug and you’ll get your code transpiled + bundled (if necessary) and synchronized with all your connected devices through Monaca Debugger.</p><p>After you are done with the debugger, just run monaca remote build to get your app built in the cloud for you. Check our <a href="https://onsen.io/getting-started.html">getting started</a> page for more information and alternatives.</p><h3>Conclusion</h3><p>We are decided to improve Onsen UI environment and focus on the whole development stack. Monaca IDE, Visual Studio and Localkit users were already enjoying these tools and services and now with the improved Monaca CLI every Onsen UI developer will also have this possibility. If you are as excited as us about the incoming Onsen UI 2.0, you can <a href="https://community.onsen.io/">join our community</a>, star us on <a href="https://github.com/OnsenUI/OnsenUI">Github</a> and spread the word on <a href="https://twitter.com/Onsen_UI">Twitter</a>. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ef663193559" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>