<img src="media/banner-docs.svg" alt="ApplicationPrototype Thirdparty Documentation">

ApplicationPrototype Thirdparty

SGApps.IO products

Original software developed in-house by SGApps.IO. They load nothing but the application-prototype framework (also ours) and, to pack their exports, the Packer. Proprietary, source-available: the source is published for evaluation and reference; using them in a product needs a written agreement -- sgapps.io/contact. Line counts are wc -l over the product files; grep -rn &#x22;require(&#x22; modules/editors modules/archiver/packer.js shows the only loads are the framework built-ins and the Packer.

Product Path What we built Size Docs
Spreadsheet editors/spreadsheet Own formula tokenizer, recursive-descent parser and AST evaluator with 130+ functions; dependency-ordered recalculation with #CIRC! detection; command-pattern undo/redo with batching; DOM virtual-scroll grid with freeze panes, split view and zoom; own SVG bar / line / pie / area / scatter charts (no chart library); conditional formatting, validation, named ranges, autofill, sort / filter, find / replace, version snapshots; own XLSX / ODS readers (own ZIP central-directory parser + native DecompressionStream) and writers, CSV with RFC-4180 quoting; editor, viewer, minimal modes ~13,000 JS + 2,900 CSS editors/spreadsheet
Writer editors/writer Paginated A4 / Letter layout with headers, footers, sections and rulers, or fluid inline layout; WYSIWYG, Markdown and HTML source modes; own OOXML reader (paragraphs, run formatting resolved against styles.xml, tables, images) and writer (document, styles, header / footer parts, relationships, inline pictures, hyperlinks); own HTML <-> JSON and Markdown parsers / serializers; paste cleaner; image crop with export-time rasterisation; 6,600-line JSON document-model engine with snapshot undo/redo; toolbar, format bar, slash menu, find / replace, page-setup and styles dialogs. Imports DOCX, ODT, HTML, Markdown, text; exports DOCX, HTML, Markdown, text, JSON, PDF via print ~19,400 JS + 5,800 CSS editors/writer
Packer archiver/packer Creates and extracts ZIP, TAR (POSIX ustar), GZIP, TAR.GZ and 7z (7z reader: single-folder archives with plain headers, LZMA1 or Copy codec); reads RAR v4 / v5 (listing + stored entries); magic-byte format detection. Own ZIP writer / reader (local headers, central directory, EOCD, DOS timestamps, Unix modes), ustar writer / reader with checksums and long-name prefixes, 7z property-block header writer / parser, RAR4 / RAR5 header walkers, CRC-32 -- and a complete LZMA range-coder encoder and decoder. DEFLATE / GZIP through the browser's native CompressionStream, UTF-8 through TextEncoder / TextDecoder. Output verified with unzip -t, GNU tar, gzip -t, 7z t and unrar 1,642 lines, one file archiver/packer

Why application-prototype-thirdparty?

Quick Example

// App = a booted ApplicationBuilder on which the framework's lib() has run (see Getting Started)
App.require('/application-prototype-thirdparty/modules/lib.js').then(function (loader) {
    loader(); // Application.moduleRegister('/application-prototype-thirdparty/modules', ['archiver/zip', 'archiver/packer', ...])

    App.require('archiver/packer').then(function (Packer) {
        var pack = Packer('zip');                       // 'zip' | 'tar' | 'gzip' | 'tar.gz' | '7z'
        pack.addFile('hello.txt', 'Hello World!');
        pack.addFile('data/report.json', JSON.stringify({ ok: true }));
        pack.generate('blob').then(function (blob) {
            var a = document.createElement('a');
            a.href = URL.createObjectURL(blob);
            a.download = 'archive.zip';
            a.click();
        });
    });

    App.require('editors/spreadsheet').then(function (Spreadsheet) {
        var sheet = Spreadsheet({ container: document.getElementById('sheet'), rows: 100, cols: 26 });
        sheet.whenLoaded().then(function () {
            sheet.value('A1', 'Total');
            sheet.value('B1', '=SUM(B2:B10)');
        });
    });
});

Module Overview

Module Path required What it does Built on Docs
Wrapper gadgets/wrapper Same-origin Blob-URL iframe sandbox written from scratch (86 lines, no dependencies): node(), container(), document(), window(), whenLoaded() -- the isolation host of the heavy modules -- gadgets/wrapper
Code Editor gadgets/code-editor Our loader, lifecycle and API (value(), theme(), syntax(), height(), event:change) around the vendored CodeMirror, sandboxed in a Wrapper iframe; 31 addons booted in order, 70 syntax modes and 23 themes loaded lazily CodeMirror 3.15 (MIT) gadgets/code-editor
code-pretty custom-elements/code-pretty &#x3C;code-pretty language=&#x22;js&#x22; theme=&#x22;monokai&#x22;&#x3E; -- 14 attributes mapped to a syntax-highlighted block rendered by the Code Editor, progressive enhancement, dedent normaliser the Code Editor custom-elements/code-pretty
ZIP archiver/zip A 68-line ApplicationPrototype facade: addFile(), folder(), getFile(), generate(&#x27;blob&#x27;). For an archive engine written by us, use the Packer JSZip 3.5 (MIT / GPL-3.0) archiver/zip

Wrapper Path required What the library does Library (licence) Docs
JSZip thirdparty/archive/jszip The raw JSZip constructor JSZip 3.5 (MIT / GPL-3.0) thirdparty/archive/jszip
LZ-String thirdparty/archive/lz-string String compression for localStorage and URLs lz-string 1.4 (WTFPL) thirdparty/archive/lz-string
amCharts 4 thirdparty/charts/amcharts4 Loads core.js, charts.js and the animated theme, resolves with &#x7B; am4core, am4charts, am4themes_animated &#x7D; amCharts 4.10 (free linkware licence) thirdparty/charts/amcharts4
QR Generator thirdparty/convert/image/qrcode/generator QR codes as &#x3C;img&#x3E;, SVG, table or data URL qrcode-generator (MIT) qrcode-generator
QR Reader thirdparty/convert/image/qrcode/reader Decodes QR codes from images, canvases and video frames jsQR 1.3 (Apache-2.0) qrcode-reader
Barcode Generator thirdparty/convert/image/barcode/generator 1D barcodes -- CODE128, EAN / UPC, CODE39 / 93, ITF, MSI, Pharmacode, Codabar -- into &#x3C;svg&#x3E;, &#x3C;canvas&#x3E; or &#x3C;img&#x3E; JsBarcode 3.12 (MIT) barcode-generator
Barcode Reader thirdparty/convert/image/barcode/reader Multi-format reader: 1D (EAN, UPC, Code 39 / 93 / 128, ITF, Codabar, RSS) and 2D (QR, Data Matrix, PDF417, Aztec) from images, canvases, video or the camera ZXing for JS 0.23 (Apache-2.0) barcode-reader
Tesseract OCR thirdparty/convert/image/ocr/tesseract Text recognition in the browser, 100+ languages Tesseract.js 3.0 (Apache-2.0) tesseract
EXIF Reader thirdparty/convert/image/exif/reader Camera, GPS and orientation metadata from JPEG / TIFF exif.js 2.3 (MIT) exif-reader
Jimp thirdparty/convert/image/editor/jimp Resize, crop, rotate, filter and compose images in memory Jimp 0.22 (MIT) jimp
Potrace thirdparty/convert/image/vectorize/potrace Bitmap to vector SVG paths, black and white potrace 2.1 (GPL-2.0) potrace
ImageTracer thirdparty/convert/image/vectorize/imagetracer Colour raster to SVG tracing imagetracerjs 1.2 (Unlicense) imagetracer
SVG Path Commander thirdparty/convert/image/vectorize/svg/path-commander Parse, normalise, transform and optimise SVG path data svg-path-commander 2.0 (MIT) path-commander
PDF Reader thirdparty/convert/pdf/reader Render pages and extract text from PDF documents inside a Wrapper iframe PDF.js 2.7 (Apache-2.0) pdf/reader
LESS Compiler thirdparty/convert/less/css/less Compile LESS to CSS in the browser less 3.11 (Apache-2.0) less/compiler
html2canvas thirdparty/convert/web/canvas/html2canvas Screenshot DOM elements to a canvas html2canvas 1.4 (MIT) web/html2canvas
Xterm.js thirdparty/emulators/terminal/xterm Terminal emulator with the attach, fit, fullscreen, linkify and terminado addons xterm 2.2 (MIT) emulators/xterm
OpenCV.js thirdparty/emulators/image/opencv Computer vision compiled to JavaScript (asm.js build) OpenCV (BSD-3-Clause; vendored through node-opencv, MIT) emulators/opencv
SQL.js thirdparty/emulators/databases/sql.js A complete SQLite engine compiled to JavaScript (asm.js build) sql.js 1.8 (MIT) emulators/sql-js
Animate.css thirdparty/gui/animations/animate-css The stylesheet plus its animation catalogue Animate.css 3.7 (MIT) gui/animate-css
dat.GUI thirdparty/gui/controls/dat-gui Lightweight parameter panels dat.gui 0.7 (Apache-2.0) gui/dat-gui
SVG Editor thirdparty/gui/image/svg/editor Vector drawing application inside a Wrapper iframe: svgSource(), zoom(), getSelectedElement() SVG-Edit (MIT) gui/svg-editor
CKEditor 4 thirdparty/gui/wysiwyg/html/ckeditor4 The classic WYSIWYG editor CKEditor 4.14 (GPL / LGPL / MPL) wysiwyg/ckeditor4
CKEditor 5 thirdparty/gui/wysiwyg/html/ckeditor5 (+ /classic, /inline, /balloon, /balloon-block, /document) The five builds, one module each CKEditor 5 (GPL-2.0-or-later or commercial) wysiwyg/ckeditor5

All 36 names are registered by modules/lib.js:

// modules/lib.js -- module.exports = loader
loader.list = [{
    path: __dirname,                       // the folder lib.js was loaded from
    modules: [
        'archiver/zip', 'archiver/packer',
        'editors/spreadsheet', 'editors/writer',
        'custom-elements/code-pretty',
        'gadgets/code-editor', 'gadgets/wrapper',
        'thirdparty/archive/jszip', 'thirdparty/archive/lz-string',
        'thirdparty/charts/amcharts4',
        'thirdparty/convert/image/qrcode/generator', 'thirdparty/convert/image/qrcode/reader',
        'thirdparty/convert/image/barcode/generator', 'thirdparty/convert/image/barcode/reader',
        'thirdparty/convert/image/ocr/tesseract', 'thirdparty/convert/image/exif/reader',
        'thirdparty/convert/image/vectorize/potrace', 'thirdparty/convert/image/vectorize/svg/path-commander',
        'thirdparty/convert/image/vectorize/imagetracer', 'thirdparty/convert/image/editor/jimp',
        'thirdparty/convert/less/css/less', 'thirdparty/convert/pdf/reader',
        'thirdparty/convert/web/canvas/html2canvas',
        'thirdparty/emulators/terminal/xterm', 'thirdparty/emulators/image/opencv', 'thirdparty/emulators/databases/sql.js',
        'thirdparty/gui/animations/animate-css', 'thirdparty/gui/controls/dat-gui',
        'thirdparty/gui/wysiwyg/html/ckeditor4',
        'thirdparty/gui/wysiwyg/html/ckeditor5', 'thirdparty/gui/wysiwyg/html/ckeditor5/classic',
        'thirdparty/gui/wysiwyg/html/ckeditor5/inline', 'thirdparty/gui/wysiwyg/html/ckeditor5/balloon',
        'thirdparty/gui/wysiwyg/html/ckeditor5/balloon-block', 'thirdparty/gui/wysiwyg/html/ckeditor5/document',
        'thirdparty/gui/image/svg/editor'
    ]
}];

Every module page has a Use Cases section and can be opened in the playground (the play button in the corner lists them by category); the two editors also have a workflow document each (Workflow_SpreadSheet.md, Workflow_Writer.md) at the repository root.

Getting Started

The modules need the framework and a static server. Serve this repository next to your site (git clone, here at /application-prototype-thirdparty/) and register the modules with a root-relative path or an absolute URL -- modules/lib.js registers the module names under its own folder (__dirname), and every module loads its sub-files (editors/spreadsheet/engine.js, ../thirdparty/xterm/dist/xterm.js, ...) relative to its own file with 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');
            App.debugEnabled(true); // app-prototype 1.25.9-1.25.15 throw on the first require() unless this was called (later versions do not)

            // 1. the framework's built-in modules (async, request, uri-load, custom-elements, ...) by name
            App.require(['extensions/prototype', 'lib'], function (libs) {
                libs.lib();

                // 2. the thirdparty modules by name: modules/lib.js -> Application.moduleRegister('/application-prototype-thirdparty/modules', [...])
                App.require('/application-prototype-thirdparty/modules/lib.js').then(function (loader) {
                    loader();

                    // 3. any module
                    App.require('editors/writer').then(function (Writer) {
                        var editor = Writer({ container: document.getElementById('editor'), layoutMode: 'document', theme: 'light' });
                        editor.whenLoaded().then(function () {
                            editor.setContent('<h1>Hello</h1><p>The document editor is ready.</p>');
                        });
                    }, console.error);
                }, console.error);
            });
        }
    });
</script>

The playground pages boot the same way (the framework from https://cdn.sgapps.io/components/application-prototype, the modules and the vendored libraries from ../modules and ../thirdparty of the served repository -- or from the CDN copy of this repository 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

License

This repository has three licensing tiers (the LICENSE file at the repository root spells them out):

  1. SGApps.IO products -- proprietary, source-available. modules/editors/spreadsheet.js + modules/editors/spreadsheet/, modules/editors/writer.js + modules/editors/writer/ and modules/archiver/packer.js are original products of SGApps.IO, Copyright 2019-2026 Sergiu Gordienco Vasile / SGApps.IO, all rights reserved. The source is published for evaluation and reference; copying, modifying, redistributing or using them in a product requires a written agreement -- see the LICENSE inside each folder and sgapps.io/contact.
  2. Everything else written for this repository -- Apache License 2.0: modules/lib.js, the gadgets, &#x3C;code-pretty&#x3E;, archiver/zip, the wrappers, the documentation and scripts. Redistributions must keep the attribution in NOTICE (Section 4(d)).
  3. Vendored third-party libraries -- their own licences. thirdparty/, thirdparty-builds/, the CodeMirror copy under modules/gadgets/code-editor/ and the Docsify and Prism copies under docs/vendor/ are distributed under the licence of each upstream project: amCharts 4 (free linkware licence -- the branding link on the charts must stay), Animate.css (MIT), CKEditor 4 (GPL-2.0-or-later / LGPL-2.1 / MPL-1.1), CKEditor 5 (GPL-2.0-or-later or a commercial licence), CodeMirror (MIT), dat.GUI (Apache-2.0), Docsify (MIT), exif.js (MIT), html2canvas (MIT), imagetracerjs (Unlicense), Jimp (MIT), JsBarcode (MIT), JSZip (MIT or GPL-3.0), LESS (Apache-2.0), lz-string (WTFPL), OpenCV (BSD-3-Clause for the vendored asm.js build; the node-opencv tree it ships in is MIT -- verify before redistributing), PDF.js 2.7 (Apache-2.0), potrace (GPL-2.0), Prism (MIT), qrcode-generator (MIT), jsQR (Apache-2.0), SQL.js (MIT), SVG-Edit (MIT), svg-path-commander (MIT), Tesseract.js (Apache-2.0), Xterm.js (MIT), ZXing for JS (Apache-2.0). Check the LICENSE file inside each directory before redistributing.

package.json therefore says &#x22;license&#x22;: &#x22;SEE LICENSE IN LICENSE&#x22;.
By Sergiu Gordienco | sgapps.io

Open Playground

Archiver · Packer (SGApps.IO product) and ZIP (SGApps.IO module on JSZip, Apache-2.0)

Third-party · Archive & Compression

sgapps.io