SlideShare a Scribd company logo
1 of 65
YUI3 e AlloyUI

  Eduardo Lundgren
     Liferay Inc.
    @eduardolundgren
Pontos principais


1. Introdução YUI e AlloyUI
2. Primeiros Passos
3. Por que utilizar YUI?
4. Exemplos
5. Conclusão
YUI3
and Alloy.
O que é AlloyUI?

• Extensão para YUI
• Open Source (BSD)
YUI: Componentes

• Utilities
• Selectors
• DOM
• Events
• Effects
• Ajax / pjax
• Muito mais
Alloy: Componentes

• Calendário
• Carousel
• Image Gallery
• Progress Bar
• Resize
• Scheduler
• Muito mais
YUI: Primeiros passos

<!doctype html>
<html>
  <head>
    <title>Demo</title>

    <script src="http://yui.yahooapis.com/3.5.0/build/yui/yui-min.js">

  </head>
  <body>
    <script>
          // Your code here!
    </script>
  </body>
</html>
YUI: Primeiros passos

<!doctype html>
<html>
  <head>
    <title>Demo</title>

    <script src="http://yui.yahooapis.com/3.5.0/build/yui/yui-min.js">

  </head>
  <body>
    <script>
          // Your code here!
    </script>




                 20KB!
  </body>
</html>
YUI: Primeiros passos
jQuery
 $(document).ready(function(){
   // Your code here
 });



YUI3
YUI().use(‘widget’, function(Y) {
    // Your code here
});
YUI: Primeiros passos
YUI Sandbox

YUI().use(‘widget’, function(Y) {
    // Your code here
    var widget = new Y.Widget();
});
YUI: Primeiros passos
YUI Sandbox

YUI().use(‘widget’, function(Y) {
    // Your code here
    var widget = new Y.Widget();
});

Alloy Sandbox
AUI().use(‘widget’, function(A) {
    // Your code here
    var widget = new A.Widget();
});
YUI3
vs jQuery.
YUI: Primeiros passos
jQuery vs. YUI
jQuery:

$.foo.bar()




YUI3:

YUI().use('node', 'module2', function (Y) {
  Y.foo.bar()
});
YUI: Primeiros passos
jQuery vs. YUI

jQuery:

$('div.foo:first')



YUI3:

Y.one('div.foo')
YUI: Primeiros passos
jQuery vs. YUI

jQuery:

var foo = $('div.foo:first');
foo.someMethod();


YUI3:

var foo = Y.one('div.foo');
if (foo) { foo.someMethod(); }
YUI: Primeiros passos
jQuery vs. YUI

jQuery:

$('div.foo')



YUI3:

Y.all('div.foo')
YUI: Primeiros passos
jQuery vs. YUI

jQuery:

.find('p.foo:first')
.find('p.foo')


YUI3:

.one('p.foo')
.all('p.foo')
YUI: Primeiros passos
jQuery vs. YUI

jQuery:

$('<div/>')



YUI3:

Y.Node.create('<div/>')
YUI: Primeiros passos
jQuery vs. YUI

jQuery:

.html('foo')
.text('foo')
.val('foo')



YUI3:

.setHTML('foo')
.set('text', 'foo')
.set('value', 'foo')
YUI: Primeiros passos
jQuery vs. YUI

jQuery:

.html()
.text()
.val()



YUI3:

.getHTML()
.get('text')
.get('value')
YUI: Primeiros passos
jQuery vs. YUI

jQuery:

parent.append('<div/>');
child.appendTo(parent);




YUI3:

parent.append('<div/>');
child.appendTo(parent);
YUI: Primeiros passos
jQuery vs. YUI
jQuery:

.click(fn)
.focus(fn)
.blur(fn)
.mouseout(fn)
.mouseover(fn)


YUI3:

.on('click', fn)
.on('focus', fn)
.on('blur', fn)
.on('mouseout', fn)
.on('mouseover', fn)
YUI: Primeiros passos
jQuery vs. YUI

jQuery:

$('#message').load('/ajax/test.html');



YUI3:

Y.one('#message').load('/ajax/test.html');
Y.one('#message').load('/ajax/test.html', '#foo');
YUI: Primeiros passos
jQuery vs. YUI
jQuery:                   YUI3:

$('#foo').animate(        Y.one('#foo').transition({
   {                        width: 100,
      width:   100,         opacity: 0.5,
      opacity: 0.5          duration: 0.6
   },                     });
   {
      duration: 600,
      easing:   'swing'
   }
);
Por que usar YUI3?
Por que usar YUI3?

• Built-in Lazy Loading
• Base
• Widget
• Graphics
• Custom Events
• Muito mais
Por que usar YUI3?
Loader Module

YUI().use(‘mod1’,‘mod2’, function(Y) {
    // Your code here
    var widget = new Y.Widget();
});


                             Scripts block downloads in
                            IE6&7, Firefox 2&3.0, Safari
                              3, Chrome 1, and Opera




                 Scripts downloads in parallel
Por que usar YUI3?
Y.Base
Y.User = A.Component.create({
    NAME: 'User',                           var user1 = new Y.User({
                                                nome: ‘Eduardo’
      ATTRS: {                              });
          nome: { value: 'Default name' }
      },

      EXTENDS: Y.Base,

      prototype: {
          initializer: function() {}
      }
});
Por que usar YUI3?
Y.Widget
Por que usar YUI3?
Y.Widget
A.Calendario = A.Component.create({
    NAME: 'Calendario',                 var c1 = new Y.Calendario({
                                            date: ’10/10/2012’
      ATTRS: {                          });
          date: { value: '' }
      },                                c1.render();

      EXTENDS: A.Widget,

      prototype: {
          initializer: function() {},
          renderUI: function() {},
          bindUI: function() {},
          syncUI: function() {},
          destroy: function() {}
      }
});
Exemplos
Liferay Portal
1
Workflow Designer
O que queríamos?
O que queríamos?




•   Como expressar ideias mais eficientemente?
•   Construir visualmente um fluxo para a engine de
    workflow do Liferay
Workflow
Definição
 <?xml version="1.0"?>

 <workflow-definition>
     <name>Single Approver</name>
     <description>A single approver can approve a workflow content.</
 description>
     <version>1</version>
     <state>
          <name>created</name>
          <metadata>
              <![CDATA[{"xy":[78,53]}]]>
          </metadata>
          <initial>true</initial>
          <transitions>
              <transition>
                   <name>review</name>
                   <target>review</target>
              </transition>
          </transitions>
Protótipo (sem YUI)
O que realmente queríamos?
Diagram Builder


• Drag-and-drop interface
• HTML5 and web standards (no flash)
• Support modern browsers and devices
• HTML vs Graphic API
• Flexible and extensible API
Diagram Builder (with YUI)
Arquitetura
Diagram Builder   Y.DiagramBuilder
Diagram Builder

      Y.Widget


Y.DiagramBuilderBase   Y.FieldSupport
                       ‣ addField(field, index);
                       ‣ removeField(field);
  Y.DiagramBuilder
Diagram Builder

            Available Fields
Diagram Builder
     Y.AvailableField
Available Fields

       Y.Base


   Y.AvailableField

                      Y.AvailableField
Diagram Builder
          Y.DiagramNode
Arquitetura: Node         Y.Overlay


                       Y.DiagramNode


                    Y.DiagramNodeState


                          Y.DiagramStart

                          Y.DiagramEnd

                          Y.DiagramJoin

                          Y.DiagramFork

                          Y.DiagramTask

                        Y.DiagramCondition
Arquitetura: Node



 .yui3-widget .aui-diagram-node
  .aui-diagram-node-content



                   <svg:svg />
Diagram Builder

                  Y.Connector
Connector Architecture

      Y.Base


    Y.Connector          Y.Connector
Diagram Builder   Canvas === Y.Graphic
Exemplos
2
Scheduler
O que queríamos?
google calendar
Calendário



• Serviço de agenda e calendário on-line
• Adicionar, controlar eventos,
  compromissos, compartilhar
  programação
Y.Scheduler
Perguntas?
Obrigado!



•   Pernambuco.JS
•   Liferay Inc.
•   YAHOO!
•   YUI Team
Referências

•   Liferay Portal http://github.com/liferay/liferay-portal
•   AlloyUI http://github.com/liferay/alloy-ui
•   AlloyUI API http://deploy.alloyui.com/api


•   Twitter: @eduardolundgren
•   E-Mail: eduardo.lundgren@liferay.com
•   Github: http://github.com/eduardolundgren

•   YUI3 vs. jQuery? http://www. jsrosettastone.com

More Related Content

What's hot

How to build a html5 websites.v1
How to build a html5 websites.v1How to build a html5 websites.v1
How to build a html5 websites.v1
Bitla Software
 
Exploring Canvas
Exploring CanvasExploring Canvas
Exploring Canvas
Kevin Hoyt
 
ECMAScript 6 major changes
ECMAScript 6 major changesECMAScript 6 major changes
ECMAScript 6 major changes
hayato
 
Webgl para JavaScripters
Webgl para JavaScriptersWebgl para JavaScripters
Webgl para JavaScripters
gerbille
 
Beautiful Development ブレイクスルー体験記
Beautiful Development ブレイクスルー体験記Beautiful Development ブレイクスルー体験記
Beautiful Development ブレイクスルー体験記
kentaro watanabe
 
Aho-Corasick string matching algorithm
Aho-Corasick string matching algorithmAho-Corasick string matching algorithm
Aho-Corasick string matching algorithm
Takatoshi Kondo
 

What's hot (20)

I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)
 
Lenses
LensesLenses
Lenses
 
How to build a html5 websites.v1
How to build a html5 websites.v1How to build a html5 websites.v1
How to build a html5 websites.v1
 
Exploring Canvas
Exploring CanvasExploring Canvas
Exploring Canvas
 
ECMAScript 6 major changes
ECMAScript 6 major changesECMAScript 6 major changes
ECMAScript 6 major changes
 
Functional "Life": parallel cellular automata and comonads
Functional "Life": parallel cellular automata and comonadsFunctional "Life": parallel cellular automata and comonads
Functional "Life": parallel cellular automata and comonads
 
The Ring programming language version 1.2 book - Part 35 of 84
The Ring programming language version 1.2 book - Part 35 of 84The Ring programming language version 1.2 book - Part 35 of 84
The Ring programming language version 1.2 book - Part 35 of 84
 
Idioms in swift 2016 05c
Idioms in swift 2016 05cIdioms in swift 2016 05c
Idioms in swift 2016 05c
 
ES6(ES2015) is beautiful
ES6(ES2015) is beautifulES6(ES2015) is beautiful
ES6(ES2015) is beautiful
 
20180721 code defragment
20180721 code defragment20180721 code defragment
20180721 code defragment
 
Webgl para JavaScripters
Webgl para JavaScriptersWebgl para JavaScripters
Webgl para JavaScripters
 
HTML5って必要?
HTML5って必要?HTML5って必要?
HTML5って必要?
 
SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)
 
Python speleology
Python speleologyPython speleology
Python speleology
 
Beautiful Development ブレイクスルー体験記
Beautiful Development ブレイクスルー体験記Beautiful Development ブレイクスルー体験記
Beautiful Development ブレイクスルー体験記
 
Cocos2dを使ったゲーム作成の事例
Cocos2dを使ったゲーム作成の事例Cocos2dを使ったゲーム作成の事例
Cocos2dを使ったゲーム作成の事例
 
QML\Qt Quick на практике
QML\Qt Quick на практикеQML\Qt Quick на практике
QML\Qt Quick на практике
 
Scala.io
Scala.ioScala.io
Scala.io
 
Aho-Corasick string matching algorithm
Aho-Corasick string matching algorithmAho-Corasick string matching algorithm
Aho-Corasick string matching algorithm
 
Functional microscope - Lenses in C++
Functional microscope - Lenses in C++Functional microscope - Lenses in C++
Functional microscope - Lenses in C++
 

Similar to YUI3 and AlloyUI Introduction for Pernambuco.JS 2012

Y hack-china-2013
Y hack-china-2013Y hack-china-2013
Y hack-china-2013
Syu-jhih Wu
 
Server Side JavaScript - You ain't seen nothing yet
Server Side JavaScript - You ain't seen nothing yetServer Side JavaScript - You ain't seen nothing yet
Server Side JavaScript - You ain't seen nothing yet
Tom Croucher
 

Similar to YUI3 and AlloyUI Introduction for Pernambuco.JS 2012 (20)

Running YUI 3 on Node.js - JSConf 2010
Running YUI 3 on Node.js - JSConf 2010Running YUI 3 on Node.js - JSConf 2010
Running YUI 3 on Node.js - JSConf 2010
 
yui3 is Sexy - 使用 YUI 3 的 Sexy Part !
yui3 is Sexy - 使用 YUI 3 的 Sexy Part !yui3 is Sexy - 使用 YUI 3 的 Sexy Part !
yui3 is Sexy - 使用 YUI 3 的 Sexy Part !
 
Running YUI 3 on Node.js - BayJax
Running YUI 3 on Node.js - BayJaxRunning YUI 3 on Node.js - BayJax
Running YUI 3 on Node.js - BayJax
 
Y hack-china-2013
Y hack-china-2013Y hack-china-2013
Y hack-china-2013
 
JavaScript Everywhere! Creating a 100% JavaScript web stack
JavaScript Everywhere! Creating a 100% JavaScript web stackJavaScript Everywhere! Creating a 100% JavaScript web stack
JavaScript Everywhere! Creating a 100% JavaScript web stack
 
Creating custom modules using YUI3
Creating custom modules using YUI3Creating custom modules using YUI3
Creating custom modules using YUI3
 
Server Side JavaScript - You ain't seen nothing yet
Server Side JavaScript - You ain't seen nothing yetServer Side JavaScript - You ain't seen nothing yet
Server Side JavaScript - You ain't seen nothing yet
 
YUI open for all !
YUI open for all !YUI open for all !
YUI open for all !
 
Build your web apps with yql and yui
Build your web apps with yql and yuiBuild your web apps with yql and yui
Build your web apps with yql and yui
 
Hack with YUI
Hack with YUIHack with YUI
Hack with YUI
 
YUI for your Hacks
YUI for your Hacks YUI for your Hacks
YUI for your Hacks
 
Introduction to YUI - IIT Kharagpur
Introduction to YUI - IIT KharagpurIntroduction to YUI - IIT Kharagpur
Introduction to YUI - IIT Kharagpur
 
YUI 3
YUI 3YUI 3
YUI 3
 
Let's run JavaScript Everywhere
Let's run JavaScript EverywhereLet's run JavaScript Everywhere
Let's run JavaScript Everywhere
 
Yui intro
Yui introYui intro
Yui intro
 
Introduction to YUI
Introduction to YUIIntroduction to YUI
Introduction to YUI
 
YUI on the go
YUI on the goYUI on the go
YUI on the go
 
Jquery
JqueryJquery
Jquery
 
Jqueryforbeginnersjqueryconference2009 090914063709 Phpapp02
Jqueryforbeginnersjqueryconference2009 090914063709 Phpapp02Jqueryforbeginnersjqueryconference2009 090914063709 Phpapp02
Jqueryforbeginnersjqueryconference2009 090914063709 Phpapp02
 
ITB2019 ColdBox APIs + VueJS - powering Mobile, Desktop and Web Apps with 1 V...
ITB2019 ColdBox APIs + VueJS - powering Mobile, Desktop and Web Apps with 1 V...ITB2019 ColdBox APIs + VueJS - powering Mobile, Desktop and Web Apps with 1 V...
ITB2019 ColdBox APIs + VueJS - powering Mobile, Desktop and Web Apps with 1 V...
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 

YUI3 and AlloyUI Introduction for Pernambuco.JS 2012

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n