[mochikit] Re: MochiKit Extensions

2008-09-10 Thread Amit Mendapara

Hello Everyone,

I have just published the initial source of MochiKit Extensions at
Launchpad.net (https://launchpad.net/mochikit-ext). At the moment it
only contains the MochiKit.Query module. To obtain the source, you
require Bazaar vcs tools from (http://bazaar-vcs.org).

bzr branch lp:mochikit-ext

Regards
--
Amit Mendapara
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~--~~~~--~~--~--~---



[mochikit] Re: MochiKit Extensions

2008-09-05 Thread Amit Mendapara

Well, the MochiKit.Query module is almost finished. Actually, it only
provides DOM related functions. I too don't like chained API for
general development, but I think it's much more natural for DOM
related operations.

Here are what it provides (see jQuery documentation ;) )

Core functions:

- length
- size()
- get(index)
- index(nodeObj)

Iter/Traversing functions:

- each(callback[, self])
- map(callback[, self])
- filter(callback[, self])
- is(expr)
- not(expr)
- eq(expr)
- slice(start[, end])
- children([expr])
- contents([expr])
- find(expr)
- next([expr])
- nextAll([expr])
- prev([expr])
- prevAll([expr])
- siblings([expr])
- andSelf()
- end()

DOM  Style functions:

- attr([value])
- removeAttr(name)
- addClass(name)
- hasClass(name)
- removeClass(name)
- toggleClass(name)
- html([value])
- text([value])
- val([value])
- css(name[, value])
- position([options])
- offset()
- height()
- width()
- outerHeight()
- outerWidth()
- append(...)
- appendTo(...)
- prepend(...)
- prenendTo(...)
- after(...)
- insertAfter(...)
- before(...)
- insertBefore(...)
- wrap(content)
- wrapAll(content)
- wrapInner(content)
- replaceWith(content)
- replaceAll(content)
- empty()
- remove([expr])
- clone([events])

Event binding:

- bind(type, callback[, self])
- unbind(type[, callback, self])
- trigger(type[, event])

+ shortcut functions to common DOM events like `click, mouseover
etc`

Effect functions:

- animate(how[, options])
- hide(how[, options])
- show(how[, options])
- hover(fnOver, fnOut)
- hoverClass(name)

+ shortcut functions to all MochiKit.Visual effects

* jQuery calls the callback in the context of current element while
MochiKit.Query invokes the callback in it's original context. So the
callback signature are different then jQuery. Also, the effect
functions are totally different then jQuery, uses MochiKit.Visual
effects.

  jQuery('div').each(function(i, elem){
// this refers to the current dom element
  });

  MochiKit.Query('div').each(function(elem, i) {
// this refers to the callback function or object to which it's
bound
  });

  jQuery('div').click(function(evt){
// this refers to the current dom element
  });

  MochiKit.Query('div').click(function(evt){
// this refers to the callback function or object to which it's
bound
  });

The proposed MochiKit.Remote will provide much more clear API and will
allow much better control on the requests.

1. MochiKit.Remote.request(options)

options.url - the url
options.data - the request params
options.type = GET or POST
options.contentType - the datatype of request contents
options.async = default true, false for sync request
options.queue = queue management options for async requests

2. MochiKit.Remote.get(url[, data, options])
3. MochiKit.Remote.post(url[, data, options])
4. MochiKit.Remote.JSON.get(url[, data, options])
5. MochiKit.Remote.JSON.post(url[, data, options])

All these functions are similar to MochiKit.Async functions and
returns MochiKit.Async.Deferred.

Regards
..
Amit Mendapara

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~--~~~~--~~--~--~---



[mochikit] Re: MochiKit Extensions

2008-09-04 Thread Per Cederberg

It is a bit hard to comment this without seeing the API:s or so.
Personally, I'm not a fan of chained API:s, so other people are sure
to value that more than me. But what would be interesting is a jQuery
compability module, mapping jQuery calls into MochiKit ones. At least
so that some jQuery plug-ins would be usable with MochiKit.

What are the use cases for the proposed MochiKit.Remote module? What
would the API look like? Why isn't the Async module sufficient? (What
is missing in your opinion?)

Cheers,

/Per

On Tue, Sep 2, 2008 at 8:53 AM, Amit Mendapara [EMAIL PROTECTED] wrote:

 Hello Everyone,

 As said before, I'm working on some extension modules for MochiKit.
 Those are..

 1) MochiKit.Query - provides jQuery style DOM manipulation/traversing
 functionality
 2) MochiKit.Remote - an implementation of MochiKit.Async
 3) MochiKit.Extensions - extension helpers

 The Query module is based on MochiKit.Selector so selector features
 are limited then the jQuery. The Query module provides almost
 identical API to jQuery but using MochiKit. Yes, there are few
 differences also including callback function invocation, event
 handling, effects and some iteration functions.

 The MochiKit.Remote module is still under consideration but it will
 provide much better control over the requests, including...

 1) Async/Sync requests
 2) JavaScript evaluation  JSON
 3) Queue of Requests
 5) Global Notifications

 The MochiKit.Extensions module provides some helper functions to
 register new Extension modules or classes, taking care of dependencies
 and existing names...

 MochiKit.Extensions.registerModule('MochiKit.MyModule', {version: 1.4,
 depends: ['Base', 'Iter']});

 Which is similar to MochiKit.Base._deps

 MochiKit.Extensions.registerClass('MochiKit.MyClass', {version: 1.4,
 depends: ['Base', 'Iter']});

 It will register Class (object) under the MochiKit namespace.

 MochiKit.MyClass = function(...) {
  ...
 }

 IMHO registering classes to MochiKit namespace will make it truly
 Pythonic ;)

 Though, the MochiKit.Query and MochiKit.Extensions modules are almost
 finished, I haven't released the code yet due to some licensing
 issues. It contains some GPL code and portions from jQuery. So I'm
 thinking of releasing the code under MIT + GPL licenses, and thus may
 not get merged with the official MochiKit library but will remain as
 separate project.

 Any suggestions are welcome...

 Regards
 ..
 Amit Mendapara
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~--~~~~--~~--~--~---



[mochikit] Re: MochiKit Extensions

2008-09-04 Thread Jason Bunting


I haven't had time to respond to Amit's post, but I thought I would take the
time now to indirectly respond via Per's comments...

 Per Cederberg said:
 
snip
 what would be interesting is a jQuery compability module,
 mapping jQuery calls into MochiKit ones. At least
 so that some jQuery plug-ins would be usable with MochiKit.

Perhaps that might be a worthwhile idea...very interesting...I wonder how
much work that would be. Anyone have an idea?

 What are the use cases for the proposed MochiKit.Remote module? What
 would the API look like? Why isn't the Async module sufficient? (What
 is missing in your opinion?)

I was wondering the same thing...

Jason Bunting


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~--~~~~--~~--~--~---