Previewing AlloyUI, a YUI 3-based Component Library from Liferay

March 15, 2010 at 2:53 pm by Eric Miraglia | In Development | 1 Comment

Nate Cavanaugh and Eduardo Lundgren of Liferay have spent the last six months building out a new widget library, AlloyUI, based on YUI 3. Nate wrote about the project recently on his Liferay blog. AlloyUI is available as a preview release today and early April is the GA release target.

Widgets in the AlloyUI library.

AlloyUI comprises a wide array of components — more than 60 in all — that range from utilities to sugar layers to full-blown UI widgets. All of Alloy’s component’s are built on YUI 3; some of the widgets are based to some degree on YUI 2. All are free to use under an LGPL license. Nate and Eduardo intend to share AlloyUI components on the YUI 3 Gallery, making them as easy to use as any YUI 3, YUI 2, or other Gallery module; they hope to have more news on that effort soon.

AlloyUI components include:

  • AutoComplete
  • Calendar
  • Charts
  • ColorPicker
  • Dialog
  • Image Gallery
  • Paginator
  • Rating
  • Resize
  • Sortable
  • Tabs
  • TextBox List

Check out their demos page to explore all of these and many others.

If you’re pinching yourself and asking, “Are Nate, Eduardo and Liferay contributing dozens of components into the YUI ecosystem, core UI and utility elements that I can use in my everyday development?”, the answer is yes…that’s pretty much what they’re doing. Although we’ve known about the project since late last year, we had the chance to visit with Nate and Eduardo at Yahoo! today and we’re extremely impressed with the work they’ve done.

Eduardo Lundgren, Nate Cavanaugh and the YUI Team at Yahoo

Share and extend: Bookmark with Yahoo! My Web | Bookmark with del.icio.us | digg it! | reddit!

In the Wild for March 12, 2010

March 12, 2010 at 11:20 am by Eric Miraglia | In In the Wild | 1 Comment

Here at YUI HQ, we’re working toward the next major release of YUI, YUI 3.1.0. Yesterday we shared some YUI 3 loader work that Adam Moore has done for 3.1.0. His “YUI 2 in 3″ project allows you to use components like YUI 2 DataTable simply and efficiently in YUI 3. Meanwhile, his loader improvements also mean you can bring in YUI 3 Gallery modules like Storage Lite with the same ease and efficiency. 3.1.0 will also mark the GA release of Satyen Desai’s component/widget foundation for YUI 3.

We’re also running the YUI 3 Gallery Contest, the winner getting a JSConf conference pass and $500 at Expedia.com to help with travel. You’ve got two full weekends left of hacking before the deadline!

In the meantime, there’s been a lot going on in the community — here are a few of the things we’ve noted recently:

Share and extend: Bookmark with Yahoo! My Web | Bookmark with del.icio.us | digg it! | reddit!

YUI 2 in 3: Coming in YUI 3.1.0, a Simpler Way To Use YUI 2 Modules

March 11, 2010 at 12:44 pm by Eric Miraglia and Adam Moore | In Development | 5 Comments

Using YUI 2 components in the context of YUI 3 implementations is important for some implementers making the transition between YUI 2 and YUI 3. In some cases, we simply want to transition our code in stages, but we want to do so within the context of a YUI 3 implementation pattern. In other cases, we may be relying on high-level components like YUI DataTable that aren’t yet present in YUI 3.

As part of the upcoming 3.1.0 release, Adam has improved the experience of using YUI 2 components from within YUI 3. To this end, he’s added some intelligence to YUI 3’s loader that allows you to load YUI 2 modules directly from your YUI().use() statement:

YUI().use("yui2-button", function(Y) {
	
	//YAHOO is not a global object; it is sandboxed along
	//with the rest of your YUI 3 functionality.  This line
	//is necessary if you want to use existing implementation
        //code:
	var YAHOO = Y.YUI2;
	
	//YUI 2 implementation code
	var button = new YAHOO.widget.button("mybutton");
	
});

You’ll find this functionality in the YUI 3 codeline as of build 1933, and we’ve deployed an experimental YUI 3 build (nominally “yui3.1.0pr2″) and an early build of YUI 2.8.0 functionality wrapped for use in YUI 3.

When you download YUI 3’s latest source from GitHub you’ll find some working examples in sandbox/loader (look for files with the 2in3 prefix). These examples demonstrate the use of a number of YUI 2 modules. We’ve posted a simple live example that shows how to use YUI 2 DataTable within YUI 3, which is one of the most frequently requested transitional features.

Key points about the YUI 2 in 3 effort:

  • This work is available in the latest builds of the upcoming 3.1.0 release (build 1933 and later). It is not available in 3.0.0 or in the 3.1.0pr1 preview.
  • The project is in an experimental state. Neither the yui3.1.0pr2 build nor the wrapped YUI 2 builds from which it pulls have been extensively tested, although we’ve staged them on the CDN to make it convenient to explore the implementation.
  • Download the latest build for examples. You’ll find a few of Adam’s proof-of-concept files in sandbox/loader — other than the simple example above, those are the best code references available until the official 3.1.0 release (which is still about a month out).
  • Your feedback in the forums is welcome — and, if you find problems, we’re interested in hearing about them.
  • When used this way, YUI 2 does not create a global YAHOO object. YUI 2 components are wrapped in YUI 3 module definitions and they stay contained in the YUI 3 sandbox to which they’re attached. The line from the codesample above, var YAHOO = Y.YUI2;, is needed in order to cut and paste YUI 2-style implementation code — or you can change YAHOO references to Y.YUI2.
  • YUI 2 releases are supported back to 2.2.2 — the latest bug-fix release for every minor version is supported (2.2.2, 2.3.1, 2.4.1, 2.5.2, 2.6.0, 2.7.0, 2.8.0). You can specify the YUI 2 version to use as follows: YUI({yui2: '2.7.0'}).use('yui2-button', ...). The goal here is to allow you to avoid migrating to 2.8.0 (or later) prior to a YUI 3 migration.

Gallery Is Easier To Use, Too

Adam’s enhancements to YUI 3’s intrinsic loader have improved the experience of working with the rapidly growing YUI 3 Gallery, too. As of 3.1.0, you’ll be able to bring gallery modules into the page from the use() statement without additional configuration — the loader will be able to determine and resolve dependencies for you and will do the right thing with respect to combo’ing the gallery source code with other YUI files. Here’s an example Dav Glass put together for 3.1.0 that demonstrates the use of his YQL Query gallery module in combination with a pre-release build of 3.1.0.

Share and extend: Bookmark with Yahoo! My Web | Bookmark with del.icio.us | digg it! | reddit!

In the YUI 3 Gallery: Matt Snider’s Number Module

March 10, 2010 at 5:45 pm by Matt Snider | In Development, YUI 3 Gallery | No Comments

About the author: Matt SniderMatt Snider is the lead frontend engineer for Mint.com (now a part of Intuit), where he makes extensive use of YUI in the presentation layer. He is also the author of a popular blog on JavaScript. Matt contributed the YUI 2 Storage Utility to YUI and is an active community member; you can see his presentation from YUICONF 2009 on YUI Theater.

Natively, JavaScript has a very limited set of functions for working with numbers located on the global Math object. Mostly these functions are for working with exponents, trigonometry, and rounding. And while these functions are needed and efficient, the Math API has remained unchanged for years, and probably won’t be improved anytime in the near future. So it is up to the developers of JavaScript libraries to create and maintain a component for working with numbers.

The Number component in the YUI 3 Gallery, derived from work originally used on Mint.com, aims to fill in missing number-related functionality. It provides a light-weight set of static functions for working with numbers. The Number component weighs in at about 1.8kb after minification and before gzip; it’s supported by all A-grade browsers.

One of the features in Number that I use the most is the format() function, which injects a formatted number into a string by evaluating the format of the placeholder number in the string. (Note: This is similar to the formatting support Y.DataType.Number currently provides, but rolls up the separate configuration properties which Y.DataType.Number.format accepts into a single formatting pattern string.) The function works with all symbols, but it formats numbers according to the English standard. Here are a few example of how to use format() from its unit test:

var n = 1111.11,
	formatDollars = "$0,0.00'" // use comma and decimal when formatting
	formatPercent = "0.00%", // use decimal when formatting
	formatRound = "0,000", // use comma when formatting
	formatText = "Please add the $0,0.00 to my tab!";

Y.Assert.areEqual("$1,111.11", Y.Number.format(n, formatDollars));
Y.Assert.areEqual("1111.11%", Y.Number.format(n, formatPercent));
Y.Assert.areEqual("1,111", Y.Number.format(n, formatRound));
Y.Assert.areEqual("Please add the $1,111.11 to my tab!", Y.Number.format(n, formatText));

Other useful functions include:

  • random(): provides an easy API for getting random whole numbers;
  • isBetween()/isNotBetween(): simplifies the evaluation of number ranges;
  • radian()/degrees(): when working with the Math trigonometry functions (such as Math.cos()), which expect radians instead of degrees, both radian() and degrees() are useful for converting values.

To use the Number Gallery component, first include the script:

<script 
src="http://yui.yahooapis.com/combo?3.0.0/build/yui/yui-min.js&
gallery-2010.02.22-22/build/gallery-number/gallery-number-min.js"></script>

Then include 'gallery-number' in your use() function, to get the following functions:

YUI().use('gallery-number', function(Y) {
	Y.Number = {
		degrees(number),
		format(number, format),
		getPrecision(number),
		isNotBetween(number, number, number, boolean),
		isBetween(number, number, number, boolean),
		isPrime(number),
		radians(number),
		random(number, number),
		roundToPrecision(number, number)
	};
});

These functions were modeled after the native Math functions and, like the Math functions, the functions on Y.Number return NaN if the value provided is not a number. If you would like to contribute to the development of or require new features added to Number, please leave a message on the Forum.

Share and extend: Bookmark with Yahoo! My Web | Bookmark with del.icio.us | digg it! | reddit!

YUI Theater — Douglas Crockford: “Crockford on JavaScript — Episode IV: The Metamorphosis of Ajax” (93 min.)

March 9, 2010 at 12:40 pm by Eric Miraglia | In YUI Theater | 6 Comments

Douglas Crockford delivers the fourth lecture in his his Crockford on JavaScript lecture series at Yahoo on March 3, 2010.

Last week, Yahoo! JavaScript architect Douglas Crockford delivered the fourth installment of his Crockford on JavaScript series:

  1. Volume One: The Early Years
  2. Chapter 2: And Then There Was JavaScript
  3. Act III: Function the Ultimate
  4. Episode IV: The Metamorphosis of Ajax
  5. Part V: The End of All Things (March 31 — RSVP)

In this session, Douglas tackles the DOM. On the one hand there was JavaScript, he says, and JavaScript is “what made the browser work.”

On the other hand, there was the Document Object Model, also known affectionately as the DOM. It is what most people hate when they say they hate JavaScript. Most of the people who say they hate JavaScript don’t know JavaScript, might have never seen JavaScript, but they’ve felt the DOM alright. If you don’t know what the difference is and you say, “JavaScript is the stupidest thing I’ve ever seen,” you’re not talking about JavaScript, you’re talking about the DOM. The DOM is the browser’s API. It is the interface. It provides JavaScript for manipulating documents.

The DOM may be imperfect, but it’s nonetheless crucial to what frontend engineers do when they write web applications. In this talk, Douglas provides an overview, situated historically, of where the DOM came from, how it achieved ascendance with Ajax, and what the future might hold. In Douglas’s inimitable fashion, this history starts with Sir John Harrington and takes us up to the present day. A few choice words for CSS are among the many applause lines for veteran developers:

I find within the community of people who use CSS great affection for it. They’re totally invested in CSS, they love it. They can’t imagine any other way of doing formatting in a document. It’s it. It’s sort of like watching an episode of Cops where the cops come in and break up the family dispute, and there’s this “CSS ain’t bad, you just don’t understand it like I do. I know it hurts me, but I make mistakes, I’m wrong.” CSS is awful, and it amazes me the way people get invested in it. It’s like once you figure it out, kind of go “oh, OK, I see how I might be able to make it work,” then you flip from hating it to loving it, and despising anybody who hasn’t gone through what you’ve gone through. It doesn’t make sense to me.

If the video embed below doesn’t show up correctly in your RSS reader of choice, be sure to click through to watch the high-resolution version of the video on YUI Theater.

Other Recent YUI Theater Videos:

Subscribing to YUI Theater:

Share and extend: Bookmark with Yahoo! My Web | Bookmark with del.icio.us | digg it! | reddit!

YUI 3 Gallery Contest 2010 — Win a Ticket to JSConf 2010

March 5, 2010 at 2:12 pm by Eric Miraglia and Dav Glass | In Development, YUI 3 Gallery | 6 Comments

We’re pleased to announce the YUI 3 Gallery Contest 2010. Thanks to our friends at the Yahoo! Developer Network, we have a conference pass to the sold-out JSConf 2010 to offer. We’re pairing that with a $500 gift certificate to Expedia.com to help the prize winner get back and forth to Virginia for the conference.

The prize will go to the person who authors the best new YUI 3 Gallery module between March 5 and March 22 and submits it for community use under YUI’s BSD license. As with any contest, there are lots of rules. We’ve noted some of the big ones on the contest page and you can read the full legal writeup here.

We’re thrilled with what we all as a community have done since late 2009 to make the Gallery a hotbed for YUI 3 growth and innovation. Greg Hinch’s Form module (submitted hours after the Gallery opened), Ryan Grove’s excellent Storage and History modules, Ilyan Peychev’s über-popular Accordion, Julien Lecomte’s SimpleMenu, Stephen Woods’s Timepicker, Adam Moore’s TreeView, Jeff Craig’s Chromahash, Dav’s own YQL module…and dozens more.

We hope you’ll consider doing some YUI 3 hacking over the next few weeks to add to this collection. We’ve listed some resources on the contest page, and there’s a forum thread going with ideas for new modules (please weigh in there even if you’re not going to be writing a module for the contest yourself). And, of course, the current Gallery is a good source of inspiration.

Happy hacking, and we’re looking forward to seeing a YUI Gallery author head out to JSConf next month!

Share and extend: Bookmark with Yahoo! My Web | Bookmark with del.icio.us | digg it! | reddit!

Happy First Birthday, JSMag

March 3, 2010 at 7:27 pm by Tom Hughes-Croucher | In Miscellany | 3 Comments

Tom Hughes-Croucher is an evangelist for the Yahoo! Developer Network.

Our friends over at JSMag are celebrating their first birthday. If you haven’t read JSMag it’s a monthly PDF magazine that covers news on hot JavaScript topics and provides practical tutorials.

JSMag are giving away a free issue from their first year. Simply log into your JSMag account and use the code ‘oneyear’ to get a free issue.

When selecting your free issue, you may want to seek out the articles in JSMag written by Yahoos frontend engineers or about YUI over the last 12 months:

  • March 2009
    • Matt Henry on unit testing with YUI
  • April 2009
    • Yours truly on Profiling your JavaScript
  • June 2009
    • Yours truly on Build Scripts
  • July 2009
    • Stoyan Stefanov on Function Patterns
  • August 2009
    • Jon LeBlanc on YQL and browser MVC
  • August 2009
    • Stoyan Stefanov on function patterns
  • September 2009
    • Chistian Tiberg on using administration system with YUI
    • Stoyan Stefanov on more function patterns
  • October 2009
    • Chistian Tiberg on inline editing with YUI
    • Stoyan Stefanov on more constructor patterns
  • November 2009
    • Yours truly on Enhancing YQL with server-side JavaScript
    • Stoyan Stefanov on more inheritance patterns
  • December 2009
    • Christian Tiberg on using the YUI2 datatable and chart components
    • Stoyan Stefanov on more reuse patterns
  • January 2010
    • Christian Tiberg on using YUI to build desktop gadgets for Windows
    • Stoyan Stefanov on the sandbox pattern
  • February 2010
    • Stoyan Stefanov on the private members pattern
  • March 2010
    • Yours truly with an overview of server-side JavaScript
    • Stoyan Stefanov on currying

Happy Birthday, JSMag!

Share and extend: Bookmark with Yahoo! My Web | Bookmark with del.icio.us | digg it! | reddit!

Next Page »
Hosted by Yahoo!

Copyright © 2006-2010 Yahoo! Inc. All rights reserved. Privacy Policy - Terms of Service

Powered by WordPress on Yahoo! Web Hosting.