diff --git a/build/jsroot.js b/build/jsroot.js index 746511b73..ff9dbddaa 100644 --- a/build/jsroot.js +++ b/build/jsroot.js @@ -12,7 +12,7 @@ const version_id = 'dev', /** @summary version date * @desc Release date in format day/month/year like '14/04/2022' */ -version_date = '27/01/2025', +version_date = '30/01/2025', /** @summary version id and date * @desc Produced by concatenation of {@link version_id} and {@link version_date} @@ -61563,7 +61563,8 @@ class JSRootMenu { } this.add('endcolumn:'); - if (!this.native()) break; + if (!this.native()) + break; } this.endsub(); @@ -61576,7 +61577,8 @@ class JSRootMenu { let values = [], miss_current = false; if (isObject(step)) { - values = step; step = 1; + values = step; + step = 1; } else { for (let sz = min; sz <= max; sz += step) values.push(sz); @@ -61616,7 +61618,6 @@ class JSRootMenu { this.sub('Palette', () => this.input('Enter palette code [1..113]', curr, 'int', 1, 113).then(set_func)); this.add('column:'); - add(57, 'Bird', 'Default color palette', (curr > 113)); add(55, 'Rainbow'); add(51, 'Deep Sea'); @@ -61630,14 +61631,12 @@ class JSRootMenu { add(59, '', 'Green Red Violet'); add(60, '', 'Blue Red Yellow'); add(61, 'Ocean'); - this.add('endcolumn:'); if (!this.native()) return this.endsub(); this.add('column:'); - add(62, '', 'Color Printable On Grey'); add(63, 'Alpine'); add(64, 'Aquamarine'); @@ -61651,10 +61650,9 @@ class JSRootMenu { add(72, 'Brown Cyan'); add(73, 'CMYK'); add(74, 'Candy'); - this.add('endcolumn:'); - this.add('column:'); + this.add('column:'); add(75, 'Cherry'); add(76, 'Coffee'); add(77, '', 'Dark Rain Bow'); @@ -61668,10 +61666,9 @@ class JSRootMenu { add(85, 'Island'); add(86, 'Lake'); add(87, '', 'Light Temperature'); - this.add('endcolumn:'); - this.add('column:'); + this.add('column:'); add(88, '', 'Light Terrain'); add(89, 'Mint'); add(90, 'Neon'); @@ -61685,10 +61682,9 @@ class JSRootMenu { add(98, '', 'Sandy Terrain'); add(99, 'Sienna'); add(100, 'Solar'); - this.add('endcolumn:'); - this.add('column:'); + this.add('column:'); add(101, '', 'South West'); add(102, '', 'Starry Night'); add(103, '', 'Sunset'); @@ -61702,7 +61698,6 @@ class JSRootMenu { add(111, '', 'Gist Earth'); add(112, 'Viridis'); add(113, 'Cividis'); - this.add('endcolumn:'); this.endsub(); @@ -61812,7 +61807,8 @@ class JSRootMenu { supported.push(3144, 3244, 3344, 3305, 3315, 3325, 3490, 3481, 3472); for (let n = 0; n < supported.length; ++n) { - if (n % 7 === 0) this.add('column:'); + if (n % 7 === 0) + this.add('column:'); const selected = (value === supported[n]); @@ -61826,7 +61822,8 @@ class JSRootMenu { this.add(svgelement.node().outerHTML, supported[n], arg => set_func(parseInt(arg)), `Pattern : ${supported[n]}` + (selected ? ' Active' : '')); } else this.addchk(selected, supported[n].toString(), supported[n], arg => set_func(parseInt(arg))); - if (n % 7 === 6) this.add('endcolumn:'); + if (n % 7 === 6) + this.add('endcolumn:'); } this.endsub(); } @@ -62344,7 +62341,8 @@ class JSRootMenu { }, 'Store settings and gStyle in browser local storage'); this.add('Delete settings', () => { saveSettings(-1); saveStyle(-1); }, 'Delete settings and gStyle from browser local storage'); - if (!alone) this.endsub(); + if (!alone) + this.endsub(); } /** @summary Run modal dialog @@ -62566,6 +62564,9 @@ class StandaloneMenu extends JSRootMenu { _buildContextmenu(menu, left, top, loc) { const doc = getDocument(), outer = doc.createElement('div'), + clname = 'jsroot_ctxt_container', + clfocus = 'jsroot_ctxt_focus', + clcolumn = 'jsroot_ctxt_column', container_style = 'position: absolute; top: 0; user-select: none; z-index: 100000; background-color: rgb(250, 250, 250); margin: 0; padding: 0px; width: auto;'+ 'min-width: 100px; box-shadow: 0px 0px 10px rgb(0, 0, 0, 0.2); border: 3px solid rgb(215, 215, 215); font-family: Arial, helvetica, sans-serif, serif;'+ @@ -62573,23 +62574,23 @@ class StandaloneMenu extends JSRootMenu { // if loc !== doc.body then its a submenu, so it needs to have position: relative; if (loc === doc.body) { - // delete all elements with className jsroot_ctxt_container - const deleteElems = doc.getElementsByClassName('jsroot_ctxt_container'); - while (deleteElems.length > 0) - deleteElems[0].parentNode.removeChild(deleteElems[0]); + // delete all elements with menu className + const deleteElems = doc.getElementsByClassName(clname); + for (let k = deleteElems.length - 1; k >= 0; --k) + deleteElems[k].parentNode.removeChild(deleteElems[k]); - outer.className = 'jsroot_ctxt_container'; + outer.className = clname; outer.style = container_style; outer.style.position = 'fixed'; outer.style.left = left + 'px'; outer.style.top = top + 'px'; } else if ((left < 0) && (top === left)) { // column - outer.className = 'jsroot_ctxt_column'; + outer.className = clcolumn; outer.style.float = 'left'; outer.style.width = (100/-left).toFixed(1) + '%'; } else { - outer.className = 'jsroot_ctxt_container'; + outer.className = clname; outer.style = container_style; outer.style.left = -loc.offsetLeft + loc.offsetWidth + 'px'; } @@ -62708,12 +62709,12 @@ class StandaloneMenu extends JSRootMenu { function changeFocus(item, on) { if (on) { - item.classList.add('jsroot_ctxt_focus'); + item.classList.add(clfocus); item.style['background-color'] = 'rgb(220, 220, 220)'; - } else if (item.classList.contains('jsroot_ctxt_focus')) { + } else if (item.classList.contains(clfocus)) { item.style['background-color'] = null; - item.classList.remove('jsroot_ctxt_focus'); - item.querySelector('.jsroot_ctxt_container')?.remove(); + item.classList.remove(clfocus); + item.querySelector(`.${clname}`)?.remove(); } } @@ -62728,7 +62729,7 @@ class StandaloneMenu extends JSRootMenu { extraText.addEventListener('click', evnt => { evnt.preventDefault(); evnt.stopPropagation(); - const was_active = item.parentNode.querySelector('.jsroot_ctxt_focus'); + const was_active = item.parentNode.querySelector(`.${clfocus}`); if (was_active) changeFocus(was_active, false); @@ -62787,7 +62788,7 @@ class StandaloneMenu extends JSRootMenu { // Does contextmenu overflow window height? outer.style.top = (docHeight - outer.offsetHeight) + 'px'; } - } else if (outer.className !== 'jsroot_ctxt_column') { + } else if (outer.className !== clcolumn) { // if its sub-contextmenu const dimensionsLoc = loc.getBoundingClientRect(), dimensionsOuter = outer.getBoundingClientRect(); @@ -62821,15 +62822,15 @@ class StandaloneMenu extends JSRootMenu { async show(event) { this.remove(); - if (!event && this.show_evnt) event = this.show_evnt; + if (!event && this.show_evnt) + event = this.show_evnt; const doc = getDocument(), woffset = typeof window === 'undefined' ? { x: 0, y: 0 } : { x: window.scrollX, y: window.scrollY }; doc.body.addEventListener('click', this.remove_handler); - const oldmenu = doc.getElementById(this.menuname); - if (oldmenu) oldmenu.remove(); + doc.getElementById(this.menuname)?.remove(); this.element = this._buildContextmenu(this.code, (event?.clientX || 0) + woffset.x, (event?.clientY || 0) + woffset.y, doc.body); @@ -62840,9 +62841,11 @@ class StandaloneMenu extends JSRootMenu { /** @summary Run modal elements with standalone code */ createModal(title, main_content, args) { - if (!args) args = {}; + if (!args) + args = {}; - if (!args.Ok) args.Ok = 'Ok'; + if (!args.Ok) + args.Ok = 'Ok'; const modal = { args }, dlg_id = (this?.menuname ?? sDfltName) + sDfltDlg; select(`#${dlg_id}`).remove(); @@ -62909,8 +62912,10 @@ class StandaloneMenu extends JSRootMenu { }); let f = modal.element.select('.jsroot_dialog_content').select('input'); - if (f.empty()) f = modal.element.select('.jsroot_dialog_footer').select('button'); - if (!f.empty()) f.node().focus(); + if (f.empty()) + f = modal.element.select('.jsroot_dialog_footer').select('button'); + if (!f.empty()) + f.node().focus(); return modal; } @@ -101856,9 +101861,11 @@ class TFile { obj_name = obj_name.slice(0, pos); } - if (typeof cycle !== 'number') cycle = -1; + if (typeof cycle !== 'number') + cycle = -1; // remove leading slashes - while (obj_name.length && (obj_name[0] === '/')) obj_name = obj_name.slice(1); + while (obj_name.length && (obj_name[0] === '/')) + obj_name = obj_name.slice(1); // one uses Promises while in some cases we need to // read sub-directory to get list of keys @@ -101923,8 +101930,8 @@ class TFile { try { buf.classStreamer(lst, clTList); } catch (err) { - console.error('Fail extract streamer infos', err); - return; + console.error('Fail extract streamer infos', err); + return; } lst._typename = clTStreamerInfoList; @@ -101939,7 +101946,8 @@ class TFile { if (!si.fElements) continue; for (let l = 0; l < si.fElements.arr.length; ++l) { const elem = si.fElements.arr[l]; - if (!elem.fTypeName || !elem.fType) continue; + if (!elem.fTypeName || !elem.fType) + continue; let typ = elem.fType, typname = elem.fTypeName; @@ -102025,7 +102033,8 @@ class TFile { nbytes += 4; // fDatimeM.Sizeof(); nbytes += 18; // fUUID.Sizeof(); // assume that the file may be above 2 Gbytes if file version is > 4 - if (this.fVersion >= 40000) nbytes += 12; + if (this.fVersion >= 40000) + nbytes += 12; // this part typically read from the header, no need to optimize return this.readBuffer([this.fBEGIN, Math.max(300, nbytes)]); @@ -102048,7 +102057,7 @@ class TFile { }).then(blobs => { const buf4 = new TBuffer(blobs[0], 0, this); - buf4.readTKey(); // + buf4.readTKey(); const nkeys = buf4.ntoi4(); for (let i = 0; i < nkeys; ++i) this.fKeys.push(buf4.readTKey()); @@ -102082,7 +102091,8 @@ class TFile { * @param {number} [checksum] - streamer info checksum, have to match when specified * @private */ findStreamerInfo(clname, clversion, checksum) { - if (!this.fStreamerInfos) return null; + if (!this.fStreamerInfos) + return null; const arr = this.fStreamerInfos.arr, len = arr.length; @@ -102090,7 +102100,8 @@ class TFile { let cache = this.fStreamerInfos.cache; if (!cache) cache = this.fStreamerInfos.cache = {}; let si = cache[checksum]; - if (si !== undefined) return si; + if (si !== undefined) + return si; for (let i = 0; i < len; ++i) { si = arr[i]; @@ -102103,7 +102114,8 @@ class TFile { } else { for (let i = 0; i < len; ++i) { const si = arr[i]; - if ((si.fName === clname) && ((si.fClassVersion === clversion) || (clversion === undefined))) return si; + if ((si.fName === clname) && ((si.fClassVersion === clversion) || (clversion === undefined))) + return si; } } @@ -102122,7 +102134,8 @@ class TFile { if (ver) { fullname += (ver.checksum ? `$chksum${ver.checksum}` : `$ver${ver.val}`); streamer = this.fStreamers[fullname]; - if (streamer !== undefined) return streamer; + if (streamer !== undefined) + return streamer; } const custom = CustomStreamers[clname]; @@ -102175,9 +102188,11 @@ class TFile { /** @summary Here we produce list of members, resolving all base classes * @private */ getSplittedStreamer(streamer, tgt) { - if (!streamer) return tgt; + if (!streamer) + return tgt; - if (!tgt) tgt = []; + if (!tgt) + tgt = []; for (let n = 0; n < streamer.length; ++n) { const elem = streamer[n]; @@ -102193,7 +102208,8 @@ class TFile { buf.ntoi2(); // read version, why it here?? obj.fUniqueID = buf.ntou4(); obj.fBits = buf.ntou4(); - if (obj.fBits & kIsReferenced) buf.ntou2(); // skip pid + if (obj.fBits & kIsReferenced) + buf.ntou2(); // skip pid } }); continue; diff --git a/modules/core.mjs b/modules/core.mjs index 4550847c9..4e25f927d 100644 --- a/modules/core.mjs +++ b/modules/core.mjs @@ -4,7 +4,7 @@ const version_id = 'dev', /** @summary version date * @desc Release date in format day/month/year like '14/04/2022' */ -version_date = '27/01/2025', +version_date = '30/01/2025', /** @summary version id and date * @desc Produced by concatenation of {@link version_id} and {@link version_date}