Skip to main content

KSS (Kinetic Style Sheets) core framework

Project description

Kinetic Style Sheets (KSS) kss.core

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

New in kss 1.4.8

  • new client action setActionServerTimeout

    It allows to setup timeout separately for each server action. You call it in the stylesheet just before the server action. It has a value parameter where you specify the timeout in milliseconds:

    div.timeout:click {
        action-client: setActionServerTimeout;
        setActionServerTimeout-value: 10000;
        action-server: bla;
    }

    You can also use it to change the global default timeout value at body load time:

    body:load {
        action-client: setActionServerTimeout;
        setActionServerTimeout-value: 5000;
    }

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

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)

Changelog for kss.core

1.6.3 (2011-07-29)

  • Correct BrowserView import failures to use zope.publisher instead of zope.app.publisher [kleist]

1.6.2 (2011-07-19)

1.6.1 (2011-01-05)

1.6.0 (2010-07-05)

  • Avoid deprecation warnings under Zope 2.13. [hannosch]

  • Avoid some really old Zope 2.9 compatibility code. [hannosch]

1.6.0.a3 (2010-04-27)

  • Add BeforeRenderKSSCommandsEvent notification. [gotcha]

1.6.0.a2 (2010-03-09)

  • Made GenericResource declare that it implements IResource. [optilude]

  • Add timeout tests in error handling demo [gotcha, jfroche]

  • Add SetActionServerTimeout client action [gotcha, jfroche]

1.6.0.a1 (2009-11-19)

  • adjust ISite import to work in Zope 2.12 [davisagli]

  • call cleanup when the test layer is torn down to avoid polluting the test environment [davisagli]

  • Avoid dependency on zope.app.zapi package. [hannosch]

  • Specify package dependencies. [hannosch]

1.4.7 (2009-05-11)

1.4.6 (2009-04-10)

  • fix RequestManager’s handling of the sendingTimeout parameter, to enable setting the timeout globally from custom code, if needed. [ree]

1.4.5 (2009-02-02)

  • Added kss.blur action. [simon]

1.4.4 (2009-01-05)

  • Fix the ca_cancel (action-cancel) test that was broken on IE7 because it contained the same id more times. [ree]

  • Fix or improve calculateAbsoluteURL to handle absolute and relative urls correctly, as well as get rid of the double slash (//) issue. It also satisfies the tests kss_url_param and kss_url_param_multiprop, that now work as intended, with previous workaround removed. [ree]

  • Use the real request in the json logic so skin layers, request parmeters, etc. are available. [wichert]

1.4.3 (2008-08-18)

  • Replaced license header of third-party sarissa.js to workaround the license detection of ohloh. sarissa.js is redistributed under GNU GPL v2 as previously. [ree]

  • Fix cssQuery-compat.js to use newest base2 api. [ree]

1.4.2 (2008-07-06)

  • Include meta.zcml from configure.zcml, in order to allow easier loading of dependent zcml during unittests [gotcha, jfroche]

1.4.1 (2008-06-02)

  • Add @@kss_devel_mode/needs_old_cssquery, to enable a workaround for Safari 3.1 to work. [ree]

  • Fix a typo that caused an exception instead of logging an error message, this happened when an action was registered twice with the same name. [ree]

1.4 (2008-04-21)

  • Updated base2-dom-fp.js with newest version. [ree]

  • Change concatresource to accept resources with “application/x-javascript” content type only [ree]

  • DONE ONLY ON BRANCH 1.4 !!! Add improved demos (insertions in tbody is not included : that demo is still broken in IE6) [cryu, jone, gotcha]

  • fix setKssAttribute action and command (closes bug 8048 from plone.org) [gotcha]

  • fix action-cancel [gotcha]

1.4-rc1 (2008-03-25)

  • disabled input values should not be submitted with the form [gotcha]

  • Updated base2-don-fp.js with newest version. This fixes breakage on FireFox 3. [ree]

1.4-alpha1 (2008-03-09)

  • refactor the value provider registry to use a single registry in place of 3. This will enable to define value providers that recieve non-string parameters like a node selection. [ree]

  • Remove previously deprecated form() and currentForm() value providers from normal action parameters (remark: they should be used with kssSelector.) They now give a parsing error. [ree]

  • Implement multiproperties in action-client and action-server [ree]

  • add url() and alias() providers [ree]

  • Change develui.css to have its style inline with kssproject.org. [gotcha]

  • Add some tests for binder classes. [ree]

  • Improve some of the demos to make them Selenium testable under both dev and prod mode, fix their tests. [gotcha]

  • Use functions in token table instead of code strings that were evaluated. ‘eval’ is very slow. in kukit.js [gotcha]

  • Refactor code towards module and class closures. in kukit.js [gotcha]

  • Fix multiple selection form fields marshalling on Safari (fixes #22 in kssproject) and on IE. [ree]

  • Fix error fallback handling [ree]

  • Implement loglevels based on cookies Add handling of log levels to the kss mode view [ree]

  • Moved the core demos to this package from kss.demo. They are now located under the core plugin. [ree]

  • Implement event binding based on the ids fetched dynamically from the dom, by value providers. [ree]

  • Changed kukit payload to encode HTML content of CDATA. This was necessary because us a supposed bug in FF, that prevented us to use base2 (xpath selection did not work on inserted elements, due to namespace issues.) Get rid of forceToDom, make sure all plugins accept html parameters as strings. [ree]

1.2 (2007-08-17)

  • Refactored js code. [gotcha]

1.2-rc2 (2007-07-27)

  • Prepare for release. [ree]

  • when attrname is kssattr:xxx, IE chokes on certain nodes [gotcha]

  • fix form marshalling [gotcha]

1.2-rc1.1

  • Prepare for release. Identical with 1.2-rc1, just created for consistent versions. [ree]

1.2-rc1

  • Deprecated addClassName, removeClassName actions and commands in favour of addClass and removeClass. Deprecated “name” and “classname” parameter in addClass, removeClass, toggleClass actions and commands in favour of “value”. [ree]

  • implement new packing directives and two disctint versions of the javascript (development and production), this is achieved from javascript with the ;;; marker Also add the @@kss_devel_mode/ui view for changing the development mode from the browser. [ree]

  • Add the passnode selector that can be used to access the value of a default parm passed programmatically from the event (via makeActionOper) [ree]

  • Add action moveNodeAsLastChild [ree]

  • Death to Azax (… long live KSS)! Removing last traces of the old name from the sources [gotcha]

  • Changed querying for css selectors to base2 instead of cssQuery. Base2 is supposed to be a lot faster than the old cssQuery. Usage is alternating, if base2 is present that one is used, otherwise it uses the old cssQuery code which stays the default. [jvloothuis, ree]

  • Add moveNodeBefore action (presumably missing) [ree]

  • Refactor load event, separate iload and load events. The new event binder handles both events together. A new parameter, evt-iload-autodetect is introduced, if this is false we don’t use detection but the iframe must cooperate on telling us wnen we are done. There is deprecation warning issued for the load events, if bound on an iframe, in which case an iload event must be used. [ree]

  • refactor event binding to allow different iterators to bind events in a binder instance, matching the need of the events. [ree]

1.2-beta2

  • Make the binding of the nodes together in one batch [ree]

  • added kssSubmitForm action parameter and deprecation [ree]

1.2-beta1

  • Prepare for release [ree]

1.2-alpha2

  • Merge in Philikon’s refactorization Move docs to doc/ [ree]

  • Initial package structure. [zopeskel]

Changelog for kukit.js

1.6.2 (unreleased)

1.6.1 (unreleased)

  • Nothing changed yet.

1.6.0 (2010-07-05)

  • Nothing changed yet.

1.6.0.a3 (2010-04-27)

  • nothing changed.

1.6.0a2 (09-03-2010)

  • add SetActionServerTimeout client action. [gotcha, jfroche]

1.6.0a1 (19-11-2009)

  • fix RequestManager’s handling of the sendingTimeout parameter, to enable setting the timeout globally from custom code, if needed. [ree]

  • Added blur action (which, as it doesn’t need a parameter, requires the deactivation of the args.length check in selectorreg.js.) [simon]

  • Fix or improve calculateAbsoluteURL to handle absolute and relative urls correctly, as well as get rid of the double slash (//) issue. It also satisfies the tests kss_url_param and kss_url_param_multiprop, that now work as intended, with previous workaround removed. [ree]

  • Replaced license header of third-party sarissa.js to workaround the license detection of ohloh. sarissa.js is redistributed under GNU GPL v2 as previously. [ree]

  • Fix cssQuery-compat.js to use newest base2 api. [ree]

  • Fix a typo that caused an exception instead of logging an error message, this happened when an action was regitered twice with the same name. [ree]

1.4 (2008-04-21)

  • Updated base2-dom-fp.js with newest version. [ree]

  • fix setKssAttribute action and command (closes bug 8048 from plone.org) [gotcha]

  • fix action-cancel [gotcha]

  • disabled input values should not be submitted with the form [gotcha]

  • Updated base2-dom-fp.js with newest version. This fixes breakage on FireFox 3. [ree]

  • refactor the value provider registry to use a single registry in place of 3. This will enable to define value providers that recieve non-string parameters like a node selection. [ree]

  • Remove previously deprecated form() and currentForm() value providers from normal action parameters (remark: they should be used with kssSelector.) They now give a parsing error. [ree]

  • Implement multiproperties in action-client and action-server [ree]

  • add url() and alias() providers [ree]

  • Use functions in token table instead of code strings that were evaluated. ‘eval’ is very slow. [gotcha]

  • Refactor code towards module and class closures. [gotcha]

  • Fix multiple selection form fields marshalling on Safari (fixes #22 in kssproject) and on IE.

  • Fix multiple selection form fields marshalling on Safari (fixes #22 in kssproject) and on IE. [ree]

  • Fix error fallback handling [ree]

  • Implement loglevels based on cookies Add cookie handling code to kss.dom Change logging on FireBug to avoid line info in debug level messages [ree]

  • Implement event binding based on the ids fetched dynamically from the dom, by value providers. [ree]

  • Store some data on HTML nodes for FireKiss [gotcha]

  • Enhance javascript exception, they now properly show the place where the exception generated, and also the annotated error reasons of kss. [jvloothuis, ree]

  • Allow multiple selectors separated with commas for a single set of property in a rule [gotcha, laz, jfroche]

  • Changed kukit payload to encode HTML content of CDATA. This was necessary because us a supposed bug in FF, that prevented us to use base2 (xpath selection did not work on inserted elements, due to namespace issues.) Get rid of forceToDom, make sure all plugins accept html parameters as strings. [ree, jvloothuis]

1.2 (2007-08-17)

  • Move ;;; markers to first columns. [gotcha]

  • Fix credits. [gotcha]

  • Fix identifiers to have coherent styling (CamelCase). [gotcha]

  • Some refactoring to allow Firekiss plugin. [gotcha]

  • Fit code on 80 columns. [gotcha]

  • Cleaned up error messages. [gotcha]

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.6.3.zip (554.9 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