Skip to content

Exponential UI 1.0.0.0

Choose a tag to compare

@se7enxweb se7enxweb released this 01 Oct 14:44
· 105 commits to main since this release

Exponential UI 1.0.0.0

jQuery 4 and a modern, friendly UI API for Exponential — the first public release.

Exponential UI (expui) brings Exponential's interactive features onto
jQuery 4, and gives you Exp, a small API for what every Exponential
page needs: the right addresses, the form token, translations, user
preferences, and talking to the server. It replaces YUI — a library whose
development stopped in 2014 — feature by feature, without removing a single
one
.

This release already moves the whole admin onto one jQuery 4 per page, in every
admin design (admin, admin2, admin3), and ships the first two rebuilt
features. Install it, open one page, and you'll see it working.


Why you'll want it

  • One modern jQuery. jQuery 4.0.0, jQuery UI 1.14.2 and jQuery Migrate 4.0.2
    instead of jQuery 3 side by side with YUI 2.8 and YUI 3.17.
  • Write less, do more. A server call is one line and a Promise. A behaviour
    you write once is switched on in any template with an HTML attribute. A panel
    remembers how each user left it, with one option.
  • Nothing breaks. Your jQuery 3 code keeps running under jQuery Migrate,
    which names every old call in the browser's console so you know exactly what
    to change. $.ez() keeps working on top of the new server calls. YUI stays
    loaded until each of its features has been rebuilt.
  • Proven, not promised. 43 browser unit tests and 38 PHPUnit tests ship
    with it, and every rebuilt admin feature was tested by use in each admin
    design, on Exponential Velocity and on PHP-FPM.
  • Built to last. Accessible, translated (English and German), themeable
    with CSS custom properties, safe under a strict Content Security Policy, and
    free software under the GPL.

Install in two minutes

composer require se7enxweb/expui:^1.0

If your Composer does not find the package, add this repository to your
project's composer.json once and run the command again:

"repositories": [ { "type": "vcs", "url": "https://github.com/se7enxweb/expui" } ]

Activate it in settings/override/site.ini.append.php, before ezjscore:

[ExtensionSettings]
ActiveExtensions[]=expui
ActiveExtensions[]=ezjscore

Refresh:

php bin/php/ezpgenerateautoloads.php --extension
php bin/php/ezcache.php --clear-all

Restart persistent workers if you run them (Exponential Velocity:
php bin/php/velocity.php restart). Then open /expui/test in your admin:
it runs every unit test on a real page and should say 43 passed, 0 failed.

Your first page, in one minute

{exp_config()}
{ezscript_require( array( 'exp::core', 'exp::io' ) )}

<button type="button" id="what-time">What time is it on the server?</button>
<p id="the-time"></p>

<script>
{literal}
Exp.ready(function ($) {
    $('#what-time').on('click', function () {
        Exp.io.call('ezjsc::time').then(function (seconds) {
            $('#the-time').text(new Date(seconds * 1000).toLocaleString());
        });
    });
});
{/literal}
</script>

Click the button and the server's time appears. That is the whole pattern:
everything else is more of the same.

What's inside

Packer key Gives you
exp::core jQuery 4 (as Exp.$), Exp.ready(), Exp.config, Exp.i18n(), page-wide events, modules started from data-exp-* attributes, Exp.prefs (user preferences), Exp.keys (keyboard shortcuts), Exp.reducedMotion
exp::io Exp.io.call(), .form(), .poll(), .url(): server calls through ezjscore, Promise based, with clear errors (signedout, refused, server, network, timeout, invalid)
exp::compat $.ez() on top of the new calls, for older code
exp::collapse menus and panels that collapse and expand, remembered per user — the configuration of YUI's Y.eZ.CollapsibleMenu, so moving over is one changed line
exp::sticky a toolbar that stays in view while scrolling, and a "go to the top" link
{exp_config()} the page's configuration, translations and preferences, in one small JSON block
exp/core.css design tokens (--exp-accent, --exp-ok, --exp-radius …) every module uses

A taste of the module system — write it once:

Exp.register('copy', function ($el, options) {
    $el.on('click', function () {
        navigator.clipboard.writeText(Exp.$(options.value).val());
    });
});

and switch it on anywhere, as often as you like, also in HTML that arrives
later:

<button type="button" data-exp-copy="#share-link">Copy the link</button>

The admin, now on jQuery 4

With Exponential UI active, every admin design runs on one jQuery 4 per page:

  • the right menu and the edit page's object menu collapse on
    exp::collapse and remember their state per user;
  • the edit forms' toolbar stays in view on exp::sticky;
  • the configuration reaches every admin page through Exponential's
    page_head_exp.tpl head hook — no template of yours is overridden.

Moved to jQuery 4 and tested by use, with no error and no jQuery Migrate warning:
the node tabs and their on/off switch, the header search, the class and
extension lists, the tags dashboard and tag fields (suggestions while typing),
the rich text editor's link popup (it validates and inserts the link),
collapsible attribute groups, and the image editor (a server-side tool, undo,
the selection tool, quitting without saving).

Which jQuery your pages get

Your ezjscore expui before ezjscore (recommended) expui after ezjscore
ezjscore 1.4.0 and later (ships jQuery 4) jQuery 4.0.0 with the reporting Migrate, which names every old call in the console jQuery 4.0.0 with ezjscore's quiet Migrate
older ezjscore (ships jQuery 3) not recommended: jQuery 4 without Migrate ezjscore's jQuery 3; the API runs next to it on its own jQuery 4

To see which ezjscore you have:

grep -h '^LocalScripts\[jquery\]' extension/ezjscore/settings/ezjscore.ini

Moving older code

Most sites have nothing to do. If your own extensions and designs do not
use YUI, the admin's move is invisible to you. One command tells you; the
converting guide
then walks anyone, at any level of experience, through each YUI call and each
jQuery 3 → 4 change step by step, with before/after examples and tested
commands.

Documentation

Requirements

  • Exponential 6 (an Exponential legacy kernel with ezjscore); ezjscore 1.4.0 or
    later is recommended
  • PHP 7.4 or later (tested on PHP 8.5)
  • Any current browser

What comes next

The roadmap
rebuilds the rest of YUI, release by release: the admin's tables, date fields,
uploads, dialogs and autosave; ezflow's landing page tools; the site designs'
galleries and fly-outs; then YUI is removed. Each module arrives with its
documentation and its tests.

Get involved

Questions, ideas and pull requests are welcome — see
CONTRIBUTING.md.
Stuck converting YUI code? Open an issue with the code: the answer goes into
the converting guide for everyone.

Exponential UI is free software under the GNU General Public License v2.0 or
later, made by 7x. If it saves you time, you can support
its development through GitHub Sponsors.