====== Vibemosphere JavaScript Libraries ====== jQuery, React, Vue and cloccojs in several versions, served to every web application below /resources// (default version or /resources///). ^ Id | ''js-libraries'' | ^ Role | ''rfc'' - needed for the page and the REST API (administrators always may) | ^ Page | **Plugins > Open** (overlay with an X at the top right) or ''/plugins/js-libraries/'' | ^ REST | ''/api/plugins/js-libraries/...'' and, for callers with the role, ''/plugins/js-libraries/...'' | ===== Open the configuration ===== In the administration open **Plugins**, select the row of this plug-in and press **Open**. The page opens in an overlay dialog: close it with the **X** at the top right, with Esc or by clicking outside; //Open in a new tab// next to the title shows it full size. {{vibecat:plugin-js-libraries.png?900|Vibemosphere JavaScript Libraries: the plug-in page in its overlay dialog}} ===== Step by step ===== - For each library (jQuery, React, Vue, cloccojs) pick the **default version**; every web application can load it from ''/resources//'' or a fixed version from ''/resources///''. ===== The page in detail ===== {{vibecat:plugin-js-libraries-full.png?900|js-libraries: first tab, Libraries}} ===== Tabs ===== The page is divided into the tabs **Libraries**, **Add a version**, **Settings**. ==== Add a version ==== {{vibecat:plugin-js-libraries-tab2.png?900|js-libraries: tab Add a version}} ==== Settings ==== {{vibecat:plugin-js-libraries-tab3.png?900|js-libraries: tab Settings}} ===== Fields and columns ===== ^ Label ^ Meaning ^ | URL prefix | | | Library | | | Version | | | File name | | ===== Actions ===== * **Save** * **Reload** * **Upload** ===== Notes from the page ===== * jQuery, React, Vue, cloccojs and more, in several versions, served to every web application below /resources // on the ports of the web applications. Documentation * A ZIP file becomes a whole version (when all files lie in one folder, that folder is dropped: dist/ or package/ ). A single file needs its file name ( jquery.min.js ) and is added to the version. An own version replaces a shipped one with the same number. ===== Reference ===== One place for the JavaScript and CSS libraries of all web applications of this Vibecat. The plug-in puts a **valve** into the request pipeline of the host, so the files are served on every port of the web applications, before any web application sees the request. The libraries ship with the plug-in; more versions (and more libraries) are added on its page. ==== What ships ==== ^ Library ^ Version ^ Files ^ | ''jquery'' | 4.0.0 (MIT) | ''jquery.min.js'', ''jquery.js'', ''jquery.slim.min.js'', ''jquery.slim.js'', source maps | | ''react'', ''react-dom'' | 19.3.1 (MIT) | React 19 has no browser build of its own any more, so the plug-in ships bundles of the npm package: ''react.min.js'' / ''react.js'' (global ''React'') and ''react-dom.min.js'' / ''react-dom.js'' (global ''ReactDOM'' with ''createRoot'', load React first), and ES modules ''react.esm.min.js'', ''react-dom.esm.min.js'' (import map: ''{"imports":{"react":"/resources/react/react.esm.min.js"}}''). No JSX: use ''React.createElement'', or a JSX compiler of your own. | | ''vue'' | 3.5.45 (MIT) | ''vue.min.js'' (= ''vue.global.prod.js''), ''vue.js'' (development build with warnings), ''vue.esm-browser.js'', ''vue.esm-browser.prod.js'' | | ''qrcode'' | 2.0.4 (MIT, qrcode-generator) | ''qrcode.min.js'', ''qrcode.js'', ''qrcode.mjs'': QR codes in the browser (used by the sample for the Girocode) | | ''cloccojs'' | the version of the playground (see the folder name) | data grid (with master / detail rows), overlay, pickers, tree, navigation, code editor and the theme (''theme.css'', ''theme-init.js'') | ==== URLs ==== ^ URL ^ Answers with ^ | ''/resources/jquery/jquery.min.js'' | the **default** version of the library (the file name ''jquery-min.js'' works as well) | | ''/resources/jquery/current/jquery.min.js'' | the default version, spelled out (''latest'' and ''default'' are the same) | | ''/resources/jquery/4.0.0/jquery.min.js'' | exactly this version | | ''/resources/jquery/4/jquery.min.js'' | the highest 4.x | | ''/resources/jquery/'', ''/resources/jquery/4.0.0/'' | JSON: the versions and files | | ''/resources/index.json'' | JSON: all libraries, versions, files and the defaults | Use the **fixed** URL when a page depends on a version, the default URL when it should follow the choice of the administrator. A fixed version is cached by the browser for a day, the default for five minutes; all answers carry an ETag, so a changed file is fetched again. The files may be used from other sites (CORS ''*''). A request below the prefix whose first segment is no library is not touched: a web application with its own ''/resources/...'' (JSF, for example) keeps working. Another prefix is set on the page (a library of the same name as such a folder wins, though). ==== Several versions, the default ==== A library can have any number of versions. The **default** is the one you choose with //Make default//; without a choice it is the highest version. Own versions are kept in the data folder of the plug-in (''plugin-data\js-libraries\libs\\\''); a version with the same number as a shipped one replaces it as a whole; removing it brings the shipped one back. Shipped versions cannot be removed, only left alone. ==== Adding versions and libraries ==== On the page: library name, version and a **ZIP file** (a whole version; a single top folder such as ''dist/'' is dropped) or one file with its name. Any library name works (''bootstrap'', ''chart.js'' ...). From a script: curl -u user:password -X POST --data-binary @jquery-3.7.1.zip "http://host:8090/api/plugins/js-libraries/version?library=jquery&version=3.7.1" curl -u user:password -X POST -H "Content-Type: application/json" -d "{\"library\":\"jquery\",\"version\":\"3.7.1\"}" http://host:8090/api/plugins/js-libraries/default ==== REST (administration port, administrator) ==== ''GET /libraries'', ''PUT /settings'' (''{"prefix":"/resources"}''), ''POST /default'' (empty version = the highest), ''POST /version?library=&version=[&name=]'', ''DELETE /version?library=&version='', ''POST /reload'' - all below ''/api/plugins/js-libraries''. ==== Licences ==== jQuery, React, Vue and qrcode-generator are MIT licensed; the licence text is in every version folder (''LICENSE.txt''). cloccojs is MIT (alternatively GPL v3.0), (c) ISSP Software und Service GmbH. [[vibecat:plugins:start|All plug-ins]]