-
Exadel Smart Library
Presentation by @exadel/esl-team
-
What is ESL?
ESL is an open-source UI component library that simplifies routine tasks, enabling efficient website creation with flexible components.
With ESL, you can easily implement popular UX patterns such as popups, tabs, embedded videos/audio, and more.
Use these web components to enhance existing projects or build your infrastructure from scratch with ESL.
-
Goals and Anti-Goals of ESL
- ESL is developed to universally cover the most common web UX patterns.
- ESL does not provide specific CSS, allowing usage with any project style guide.
- ESL components have built-in a11y (accessibility) support.
- ESL provides base classes and utilities for creating custom tags or custom attributes.
-
ESL is Tiny and Efficient
ESL is designed to work quickly and efficiently in browsers, minimizing unnecessary code and ensuring optimal website performance.
The ESL package is independent of third-party libraries, relying on built-in browser functionality like Web API and ECMAScript 6.
Written in TypeScript and compiled to ES6 JavaScript, ESL is fully tree-shakable, so your bundle includes only the components you use.
Currently, ESL uses TS decorators for some syntax sugar, with plans to complement these with native ES decorators in the future.
-
Cross-Browser Support
ESL uses built-in browser functionality like Web API and ECMAScript 6.
Fully supported by modern browsers (Chrome, Firefox, Safari, Edge). For older browsers, light or full polyfills can be used.
-
ESL Compatibility
ESL is a framework-agnostic library, it can be used with any modern framework or vanilla JS.
Built-in ESL components have proper type definitions for TSX (JSX) syntax and accept arguments both as attributes and properties.
-
ESL Core Components
ESL gives a wide range of base features and components to build your application.
-
Custom Tags
The primary technology of ESL is web components. ESLBaseElement is a base class for custom tag components.
ESLBaseElement extends HTMLElement and provides a set of useful features:
- simplified classes/attributes management
- out of the box event listeners management life-cycle
- static API for component registration
<my-custom-tag attr="world"></my-custom-tag> -
Custom Attributes
In addition to custom tags powered by web components standard, ESL UI library provides a way to create components based on custom attributes.
ESLMixinElement is a base class for such components and it gives you this capability in almost the same way as ESLBaseElement does for custom tags.
Same as ESLBaseElement, ESLMixinElement's instances are created automatically when the attribute is found in the DOM, and destroyed when the attribute is removed.
<div my-custom-attr="world"></div> -
ESL Event Listeners
ESL Event Listener is an embedded ESL module that takes care of the event listeners management and provide extended utilities to work with events. Module supports event delegation, custom event targets. Listeners registration works on the "host" concept that allows you to link the listener to the specific component instance (to manage subscriptions automatically).
BeforeconnectedCallback() { this.onBtnClick = this.onBtnClick.bind(this); this.addEventListener('click', this.onBtnClick); this.onResize = this.onResize.bind(this); this._resizeObserver = new ResizeObserver(this.onResize); this._resizeObserver.observe(this); } disconnectedCallback() { this.removeEventListener('click', this.onBtnClick); this._resizeObserver.disconnect(); } onBtnClick(event) { if (event.target.closest('button')) {/* Btn click */} } onResize() {/* Resize subscription for component */}With ESL@listen({event: 'click', selector: 'button'}) onBtnClick(event) {/* Click subscription with delegation */} @listen({event: 'resize', target: ESLResizeObserverTarget.for}) onResize(event) {/* Resize subscription for component */} -
ESL Utils and syntax sugar
ESL Core provides big amount of utils and syntax sugar to simplify development process.
-
Extended Media Query Syntax
Extended syntax for media queries allows to use breakpoint aliases and extended boolean logic.
(min-width: 600px) and (max-width: 1200px)->@SM -
Extended Media Conditions Mapping
Ability to map extended media conditions to values.
@XS => accordion | @+SM => tabs -
Extended Traversing Syntax
Extended syntax for DOM traversing, very similar to jQuery, with support for relative selectors.
::parent::next(esl-toggleable)
-
-
ESL Built-in Components
In addition to the core ESL library, ESL provides a set of built-in components.
These components are designed to be used in a wide range of applications and are fully customizable to fit your needs.
-
Here is a list of all component modules available in ESL:
-
ESL components are designed to be flexible and can be combined in various ways to create complex interfaces.
Here are some examples of how ESL components can be combined to create common UI patterns.
-
Built-In Responsiveness and Flexibility
ESL components can adapt their behavior based on environment (device type, screen size, etc).
The same ESL components can be used to display both Tab and Accordion design patterns, depending on the screen size.
See Example -
UI Playground
The UI Playground is a separate project that allows you to see the components in action and test them in different scenarios.
The UI Playground is a great tool for developers who want to see how the components work and how they can be customized.
-
UIP Isolated & Embedded content
The main feature of UIP is the ability to render demo content in one of two modes: isolated or embedded.
<uip-root class="uip-theme-esl"> <script type="text/html" label="Embedded content" uip-snippet> ... </script> <script type="text/html" label="Content isolated" uip-snippet uip-isolated> ... </script> <uip-snippets class="uip-toolbar" dropdown-view="@xs"></uip-snippets> <uip-preview></uip-preview> </uip-root> -
UIP Editors
UI Playground allows you to see and edit source code of example and see changes in real time.
-
UI Playground - Quick Settings plugin
UI Playground allows you to add quick options to manipulate your demo content.
- Thanks for your attention!