yui3In the latest YUI preview release 3, many changes and improvements have been added such as the integration of Y.Tree in the framework, Normalize.css that replaced CSSBase, which is great for the future of CSS in YUI and helps web developers create beautiful and clean looking sites. Tripp Bridges added a feature to Graphics that allows you to chain drawing commands on a path. This may be a subtle change but it allows developers to write more human-readable code, and may allow the code to dynamically add paths.

Overall there were over 250 commits by 14 authors between 3.9.0pr2 and 3.9.0pr3. Changed components include Charts, Color, CSSNormalize, DataTable, Graphics, Handlebars, Number, Promise, ScrollView, Tree, and Uploader. More information and download of the preview release at the staging website http://stage.yuilibrary.com/

Below a sample usage of the method chaining :

YUI({
    filter:"raw"
}).use('graphics', function (Y) 
{ 
    var w = 300,
        h = 200,
        ew = 15,
        eh = 15,
        mygraphic = new Y.Graphic({
            render: "#mygraphiccontainer"
        }),
        mypath = mygraphic.addShape({
            type: "path",
            x: 50,
            y: 50,
            fill: {
                color: "#0f0"
            },
            stroke: {
                weight: 2,
                color: "#000"
            }
        });
    mypath.clear().
    moveTo(0, eh).
    lineTo(0, h - eh).
    quadraticCurveTo(0, h, ew, h).
    lineTo(w - ew, h).
    quadraticCurveTo(w, h, w, h - eh).
    lineTo(w, eh).
    quadraticCurveTo(w, 0, w - ew, 0).
    lineTo(ew, 0).
    quadraticCurveTo(0, 0, 0, eh).
    end();
});