views:

656

answers:

6

Is there a project (open source) that takes the widgets and plugins for jQuery UI but allows us to use them without setting up any HTML?

Kinda like Ext-js and Sproutcore, but without the acidental complexity and lack of fluidity, and more like Cappuccino, but without requiring a Mac and the horrible load times from Objective-j (which also has no IDE support). Also, more like Ukijs, but with more widgets. And kinda like Pyjamas and GWT, but without the lack of widgets, pre-compiling step, and/or Java. For example:

uki({
  view: "Button", text: "Hello world!",
  rect: "120 80 180 24",
  click: function() { alert(this.text());
}).attachTo( document.getElementById("test") );

The reason I'm taking jQuery is because it is the only web framework that supports all 30 essential controls (given with enough plugins).

A: 

What's stopping you from using JavaScript and jQuery UI like this right now?

To the best of my knowledge, loading a web page in a current-generation web browser requires an (X)HTML document, but nothing's preventing you from making that document a stub and building your application entirely in JavaScript.

Sidnicious
You are right that this is not impossible. The question is: has someone else wrapped all the said jquery plugins/jquery ui components in such way? Look for the source ukijs' wave example (http://ukijs.org/examples/core-examples/wave/) to understand better what I mean.
Daniel Ribeiro
+1  A: 

Let's see if I understand the question. Instead of

<script>
  $(function(){
    $('a').button();
  });
</script>
<body>
  <button id="foo">Foo</button>
  <button id="bar">Bar</button>
</body>

You want

<script>
  $(function(){
    $('body').append($('<button>').attr('{ id: "foo" }').html('Foo').button());
    $('body').append($('<button id="bar">Bar</button>').button());
  });
</script>
<body>
</body>

Does that meet your needs? At the end of the day you'll still need to specify the details of the button (where it goes, its text, what happens when you click it) no matter what the syntax is.

Mr. Shiny and New
Actually, I am thinking more in the dsl style of uki.js I've edited the post to make it clearer
Daniel Ribeiro
A: 

DHTMLX is similar to ExtJS, which unfortunately includes sharing some of its disadvantages.

Onestone
Interesting. I did now know DHTMLX. But for a toolkit with paid features, it has almost as many widgets as uki (which is not a lot). There is also TIBCO, which i did not mention as it has more accidental complexity than Sproutcore (which is one of the few js frameworks that is more complex than GWT).
Daniel Ribeiro
+2  A: 

I don't think a suitable DSL exists at the moment, the closest thing I can think of is CoffeeScript

http://jashkenas.github.com/coffee-script/

It would also be a good starting point to build from.

slomojo
Coffescript is a whole new language the "source" compiles to javascript. It is not even remotely related to UI or Jquery. And building on Coffescript would be delightful, but Javascript people have seen this show already: Java with GWT, Objective-J with Cappuccino, and all web frameworks on server with all other languages. I'd not mind using one written in coffescript, but writting one in it would make the entry barrier for other developers higher (and we need to break down walls amongst us, not create them).
Daniel Ribeiro
Contrary to this...>> but writting one in it would make the entry barrier for other developers higher (and we need to break down walls amongst us, not create them). <<The point of CoffeeScript is to ease barrier to entry, improve code clarity, and provide a syntactic model which is cleaner than the mush that is JS/ECMA.But regardless, it's an option that is merely blue sky for your original question. I just thought I'd give you a thinking point.
slomojo
The biggest issue with coffescript at the moment is its ide support. Javascript has one of the best refactoring and type inference tool among dynamic languages. This is due mostly to lack of method_missing, doesnNotUnderstand, missing_method, equivalent, which makes this things much easier to do. Coffescript has syntax highlighting only (it is too early, for a still developing language). And coffescript, although not as foreign to most JS programmers as java or objective-j, would impose a learning barrier. I root for it, but its to early to jump on its bandwagon, at least for frameworks.
Daniel Ribeiro
Ok. We are seriously considering coffescript. It is just so much nicer. And we will support javascript libraries as well, so it is a win-win.
Daniel Ribeiro
I could be all, told you so, but instead... good idea!
slomojo
A: 

As "Mr. Shiny and New" pointed out the following code would work:

$('body').append($('<button>').attr('{ id: "foo" }').html('Foo').button());

However the style you are looking for can be accieved by using the appendTo() function:

$('<button id="foo"></button>')
    .button({
        label: "Hello world!",
    }).click(function () {
        //doSomething

    }).appendTo('#test');

Furthermore the code above returns the "button" object which allows you to assign the object to a variable for future reuse:

// set up the button
var a = $('<button/>').button({
    label: 'Hello world!'
}).offset({
    top: 80,
    left: 120
}).width(180).height(24)
.click(function () {
    // dosomething
}).appendTo('body');

// hide then show and rename (if it takes your fancy)
a.hide(300, function () {
    a.show(300, function () {
        a.button( "option" , {
            label: 'Hello to the world again!'
        });
    });
});
The question reads: "takes the widgets and plugins for jQuery UI". Therefore, I am not asking if it is possible. I know it is possible. I have done it over and over again. I am interested if someone else already released a library that does *ALL* of this for all jquery ui widgets and the most important plugins. If it doesn't exists, as soon as my solution matures, I'll open source it. But i thought it was unnecessary for the community to have 2 of such projects.
Daniel Ribeiro
A: 

The closets thing that I found is ActiveView builder from ActiveJs. No widget supoport though

Daniel Ribeiro