<img src="media/banner-docs.svg" alt="ApplicationPrototype Modules Documentation">
alert, confirm, prompt, custom popups), toast notifications with ten screen positions, a context menu with sub-lists, collapsible side-by-side panels, an org-chart tree, a transform-based scroll area, a tiled dashboard layout editor, a Blob-URL iframe sandbox -- plus a static routing pattern (routes, components, resources) for single-page applications. Every module is a plain ES5 file resolved by name through the framework's module loader -- Application.require('elements/popup') -- with no build step and no bundler.extensions/prototype, uri-load, request, custom-elements, async)ApplicationPrototype instances, so each has the same on(), once(), off(), emit(), bind() surface, node() for its root element and the framework's before / on / after hooks on every bound methodlib.js maps the 10 module names to files with Application.moduleRegister(); from then on App.require('elements/notify'), App.require('gadgets/grid-panel'), ... resolve by name, are downloaded on first use and cachedstyle.css through uri-load when it loads; the dialogs, notifications and the context menu use the class names of the SGApps RegalRoyal theme (rr-button, rr-block-space, rr-menu, ...) and take its look when the theme is on the page, and the browser's defaults when it is notcustomElements.define() -- <sgapps-scroller> is registered through the framework's MutationObserver-based custom-elements module and lazy-loaded the first time the tag appearsplayground.html: an editable page per module that runs on the working copy of the modules and the CDN build of the framework (9 examples)var and function, plain <script> tags; works with application-prototype 1.31.0, the version the playground loads from the SGApps CDN// App = a booted ApplicationBuilder on which the framework's lib() has run (see Getting Started)
App.require('/application-prototype-modules/lib.js').then(function (loader) {
loader(); // Application.moduleRegister('/application-prototype-modules', ['custom-elements/lib', 'elements/popup', ...])
App.require(['popup :: elements/popup', 'notify :: elements/notify']).then(function (libs) {
var notify = libs.notify(); // one notification container
document.body.appendChild(notify.node());
notify.position('top', 'right');
libs.popup.confirm('Publish the article?', function (answer) {
if (answer) notify.info('Published', 'The article is now public');
else notify.warn('Not published');
});
});
});| Module | Path required | What it does | Size | Docs |
|---|---|---|---|---|
| Popup | elements/popup | alert(), confirm(), prompt() and bare popup() dialogs over a full-screen overlay: title, text, websymbols icon, buttons with callbacks, light / dark / clean themes, outside-click handling, animated classes | 526 JS + 189 CSS | elements/popup |
| Notify | elements/notify | Toast notification manager: log / info / warn / error / debug rows with a message and detail lines, per-type auto-expiry, click callbacks, one container positioned at any of ten places; forwards alert / confirm / prompt / popup to the Popup | 360 JS + 855 CSS | elements/notify |
| Notify Service | elements/notify-service | Ten Notify managers, one per position (top, bottom, top left, ..., left, right), attached to document.body; position('top', 'right') picks one, the service itself proxies the bottom-left manager | 121 JS | elements/notify-service |
| Context Menu | elements/context-menu | Absolutely positioned menu built from an options array: text, icon, action (function or URL), nested list, per-item render, style classes, a draggable "headbar" item; show(true) at the mouse, 'mouse-viewport' keeps it on screen; auto-hides on the next mouseup | 390 JS + 101 CSS | elements/context-menu |
| Crop Sections | elements/crop-sections | Side-by-side panels that share the free width: fixed-width or fluid sections, collapse to a 48 px vertical tab with a CSS 3D rotation, header + scrolling articles, attach / detach, lookup by name, re-layout every 500 ms | 287 JS + 310 CSS | elements/crop-sections |
| Tree Node | elements/tree-node | Org-chart style tree of <tree-node> elements: append(), remove(), parent(), parents(), childs(), siblings(); connectors drawn in CSS, highlighted on hover | 87 JS + 168 CSS | elements/tree-node |
| custom-elements/lib | custom-elements/lib | Registers the custom elements of this repository for lazy loading (<sgapps-scroller> -> custom-elements/scroller) through the framework's custom-elements module | 12 JS | custom-elements/lib |
| sgapps-scroller | custom-elements/scroller | <sgapps-scroller>: a zero-size marker that turns an overflow: hidden box into a wheel- and drag-scrollable area by translating its siblings with a generated transform rule; limits, speeds, axis flags, synchronised boxes, a bubbling sgapps-scroll event | 643 JS + 7 CSS | custom-elements/scroller |
| Grid Panel | gadgets/grid-panel | Tiled dashboard layout editor: click two cells (or double-click one) to place a block, a self-growing cell grid, blocks with a content container and x() / y() / width() / height() setters, settings() snapshot and restore | 642 JS + 98 CSS | gadgets/grid-panel |
| Wrapper | gadgets/wrapper | Same-origin Blob-URL iframe sandbox (86 lines, no dependencies beyond extensions/prototype): node(), container(), document(), window(), whenLoaded(); header / code / base options for the generated document | 86 JS | gadgets/wrapper |
Routing (not in lib.js) | application-patterns/routing | Static routing pattern: an array of routes (string, RegExp or function path) mapped to component modules and shared resource modules; components(routes).load() resolves the current URL, loads the resources once and renders the components in order | 421 JS | application-patterns/routing |
lib.js at the repository root:// lib.js -- module.exports = loader
loader.list = [{
path: __dirname, // the folder lib.js was loaded from
modules: [
'custom-elements/lib',
'custom-elements/scroller',
'elements/context-menu',
'elements/crop-sections',
'elements/tree-node',
'elements/popup',
'elements/notify',
'elements/notify-service',
'gadgets/wrapper',
'gadgets/grid-panel'
]
}];application-patterns/routing is a separate mini-framework with its own package.json; it is loaded by path (see its page) and is not part of the lib.js list. elements/popup/user/login and elements/popup/user/registration are application-specific sign-in / sign-up forms built on the Popup that require modules not shipped here (elements/google-re-capcha, resources/user); they are described on the Popup page as examples.
Every module page has a Use Cases (or Code Examples) section and can be opened in the playground (the play button in the corner lists them by category).
The modules need the framework and a static server. Serve this repository next to your site (git clone, here at /application-prototype-modules/) and register the modules with a root-relative path or an absolute URL -- lib.js registers the module names under its own folder (__dirname), and every module loads its sub-files (elements/popup/style.css, elements/crop-sections/template.tpl, gadgets/grid-panel/grid.js, ...) relative to its own file with module.resourceUrl() / module.require().
<!-- Browser: the framework's two script tags -->
<script src="/application-prototype/ApplicationPrototype.js"></script>
<script src="/application-prototype/ApplicationBuilder.js"></script>
<script>
var App = new ApplicationBuilder({
onready: function () {
var App = this;
App.modulePath('/application-prototype/constructors');
// 1. the framework's built-in modules (extensions/prototype, uri-load, request, custom-elements, async, ...) by name
App.require(['extensions/prototype', 'lib'], function (libs) {
libs.lib();
// 2. the modules of this repository by name: lib.js -> Application.moduleRegister('/application-prototype-modules', [...])
App.require('/application-prototype-modules/lib.js').then(function (loader) {
loader();
// 3. any module
App.require('elements/notify-service').then(function (NotifyService) {
var notifications = NotifyService();
notifications.position('top', 'right').info('Ready', 'All modules registered');
}, console.error);
}, console.error);
});
}
});
</script>The playground pages boot the same way (the framework from the SGApps CDN, https://cdn.sgapps.io/components/application-prototype, and the modules from the working copy above docs/ -- or from https://cdn.sgapps.io/components/application-prototype-modules when only docs/ is served), so every snippet on the module pages can be pasted into a page booted like the one above.
Full Getting Started Guide | Playground
The modules are original work of SGApps.IO, Copyright 2020-2026 Sergiu Gordienco Vasile, published under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International licence (the LICENSE file at the repository root): you may use and redistribute them with attribution for non-commercial purposes, without modification. Commercial use or derivative work needs a written agreement -- sgapps.io/contact.
The documentation site vendors Docsify (MIT), Prism (MIT) and, for the playground editor only, CodeMirror 3.15 (MIT) under docs/vendor/; none of them is loaded by the modules themselves.
By Sergiu Gordienco | sgapps.io