Skip to main content

KSS (Kinetic Style Sheets) core framework

Project description

KSS is an Ajax framework that allows UI development without writing any Javascript. It uses style sheets with CSS-compliant syntax to declare and bind dynamic behaviors in the browser. The engine supports a set of generic DOM-like commands; they are computed on the server and sent back to manipulate the HTML page.

What is KSS?

KSS is an AJAX framework. KSS has both a client-side Javascript library and server-side support.

The client-side Javascript library needs to be included in your page. It fetches Kinetic style sheets from the server, parses them and binds a set of action to browser events and/or page elements. It is clean Javascript code that can peacefully coexist with other clean Javascript librarys like JQuery or ExtJS. It is about 100k in production mode. You can integrate your own Javascript code by using its extension mechanism through plugins.

Server-side code is currently available for Zope (2 and 3, which includes Plone). The kss.base egg (which is currently in alpha) brings server-side support to other pythonic platforms, such as:

  • pylons

  • django

  • grok

The Javascript client-side code can be used independently of existing server-side support. In other words, it is usable on platforms where we have not built server-side support like PHP, Ruby or Java. (If you have interest in porting KSS to the server environment you use and need help, please contact us !)

Homepage

More information and documentation can be found on the KSS project homepage.

Recently changed

Known problems

Safari 3.1 fails to run with KSS. The problem is with base2, that fails selecting any selector that contains capital letters.

Example for header of browser version that experiences the problem:

User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_2; en-us) AppleWebKit/525.13 (KHTML, like Gecko) Version/3.1 Safari/525.13

Old cssQuery.js works for this browser, so a workaround is to ensure that Safari 3.1 gets the cssQuery.js resource and not the base2.

For example, in ResourceRegistries, the following changes are needed:

Resource: cssQuery.js

  • Enable

  • Change condition to: here/@@kss_devel_mode/needs_old_cssquery

Resource: ++resource++base2-dom-fp.js

  • Change condition to: not: here/@@kss_devel_mode/needs_old_cssquery

This enables the correct behaviour, since KSS always uses the library it founds (in the priority of base2 and the old cssquery).

Deprecated in kss 1.4

form() and currentForm() in normal value providers

currentForm()

You must change rules that use currentForm() in a normal value provider:

action-server:                     myServerAction;
myServerAction-data:               currentForm();

to:

action-server:                     myServerAction currentForm();

Or, if you want to keep compatibility with kss 1.2:

action-server:                     myServerAction;
myServerAction-kssSubmitForm:      currentForm();

form()

Similarly, for form(), you must change the following:

action-server:                     myServerAction;
myServerAction-data:               form();

to:

action-server:                     myServerAction form();

Or, if you want to keep compatibility with kss 1.2:

action-server:                     myServerAction;
myServerAction-kssSubmitForm:      form();

Necessary server side changes

On the server side, the method that received the form as a dictionary in one parameter, must define the values directly in the method signature, or access them from the form directly.

So the following old code:

def method(self, data):
    field1 = data['field1']
    field2 = data.get('field2', None)

must be changed in one of the two ways shown in the following examples:

def method(self, field1, field2=None):
    ...

An alternate way is to get them from the request:

def method(self):
    request = self.request
    field1 = request.form['field1']
    field2 = request.form.get('field2', None)

New in kss 1.4

  • Major code refactoring, for better readibility and speedups.

  • Lots and lots of ecma unittests and selenium tests that test kss.core and the core plugin, are added. All are checkable from a single click from any browser.

  • New and improved demos

  • Base2 is used for css selection, instead of the original cssQuery (if present). Significantly faster page load.

  • multiple selectors in the same rule are allowed, ie.:

    selector1:click selector2:click { ... }

    or even:

    selector1:keyup selector2:keydown { ... }
  • Value providers can be recursive, ie.:

    nodeAttr(kssAttr(blah))

    is allowed.

  • added url() special value provider, the first is alternate syntax for:

    action-server: blah;
    blah-kssUrl: "http://foo.bar/blahblah";

    you can now say in one line:

    action-server: blah url(http://foo.bar/blahblah);

    This may be handy if you want to call @@ url-s.

  • added alias() special value provider, this enables using more client actions on the same node:

    action-client: setAttribute;
    setAttribute-key: foo;
    setAttribute-value: bar;
    action-client: setAttribute alias(other);
    other-key: foo2;
    other-value: bar2;
  • enable node selection in the same line as the action specification, ie. instead of:

    action-client: foo;
    foo-kssSelector: css(div.klass);

    you can also say:

    action-client: foo css(div.klass);
  • enable full form submits in the same line as the action specification, ie. instead of:

    action-server: foo;
    foo-kssSubmitForm: currentForm();

    you can also say:

    action-server: foo currentForm();
  • Value providers can be used also in the “event binder id”, eg. instead of the static binder id:

    xxxxx:click(blah) { ... }

    a dynamic binder id can also be used:

    xxxxx:click(kssAttr(blah)) { ... }

    This feature is needed for upcoming use cases like drag and drop.

  • Remove previously deprecated form() and currentForm() value providers from normal action parameters (remark: they should now be used with xxx-kssSelector or directly on the action-client line as described above, and they properly support Zope multiform fields like :list, :record, :records.)

  • Demos and selenium tests are removed from kss.demo and are now placed together with the plugin in kss.core. This means, all 3rdparty plugins should now have a zope-only demo page with a selenium test, if the plugin is loaded the demo appears in the index and the test is run together with all tests. (Demos can be viewed and tested by kss.demo.) We also have kss.template that creates a skeleton kss plugin with all bells and whistles.

  • Implement loglevels based on cookies (also backported to 1.2.)

  • Other fixes (also backported to 1.2):

    • Fix error fallback handling

    • Fix multiple selection form fields marshalling on Safari and IE

    • Fix setKssAttribute action and command

    • fix action-cancel

Download

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kss.core-1.4.7.tar.gz (401.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page