Skip to content

Commit 9070347

Browse files
committed
Build and changelog
1 parent 1f6cc13 commit 9070347

File tree

2 files changed

+76
-35
lines changed

2 files changed

+76
-35
lines changed

build/jsroot.js

Lines changed: 71 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// https://root.cern/js/ v7.7.6
1+
// https://root.cern/js/ v7.7.7
22
(function (global, factory) {
33
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
44
typeof define === 'function' && define.amd ? define(['exports'], factory) :
@@ -8,11 +8,11 @@ typeof define === 'function' && define.amd ? define(['exports'], factory) :
88
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
99
/** @summary version id
1010
* @desc For the JSROOT release the string in format 'major.minor.patch' like '7.0.0' */
11-
const version_id = '7.7.6',
11+
const version_id = '7.7.x',
1212

1313
/** @summary version date
1414
* @desc Release date in format day/month/year like '14/04/2022' */
15-
version_date = '26/03/2025',
15+
version_date = '21/10/2025',
1616

1717
/** @summary version id and date
1818
* @desc Produced by concatenation of {@link version_id} and {@link version_date}
@@ -2611,7 +2611,7 @@ function compareValue(compare) {
26112611
}
26122612

26132613
function chord() {
2614-
return chord$1(false);
2614+
return chord$1(false, false);
26152615
}
26162616

26172617
function chord$1(directed, transpose) {
@@ -2628,7 +2628,9 @@ function chord$1(directed, transpose) {
26282628
groups = new Array(n),
26292629
k = 0, dx;
26302630

2631-
matrix = Float64Array.from({length: n * n}, (_, i) => matrix[i / n | 0][i % n]);
2631+
matrix = Float64Array.from({length: n * n}, transpose
2632+
? (_, i) => matrix[i % n][i / n | 0]
2633+
: (_, i) => matrix[i / n | 0][i % n]);
26322634

26332635
// Compute the scaling factor from value to angle in [0, 2pi].
26342636
for (let i = 0; i < n; ++i) {
@@ -2645,7 +2647,20 @@ function chord$1(directed, transpose) {
26452647
if (sortGroups) groupIndex.sort((a, b) => sortGroups(groupSums[a], groupSums[b]));
26462648
for (const i of groupIndex) {
26472649
const x0 = x;
2648-
{
2650+
if (directed) {
2651+
const subgroupIndex = range$1(~n + 1, n).filter(j => j < 0 ? matrix[~j * n + i] : matrix[i * n + j]);
2652+
if (sortSubgroups) subgroupIndex.sort((a, b) => sortSubgroups(a < 0 ? -matrix[~a * n + i] : matrix[i * n + a], b < 0 ? -matrix[~b * n + i] : matrix[i * n + b]));
2653+
for (const j of subgroupIndex) {
2654+
if (j < 0) {
2655+
const chord = chords[~j * n + i] || (chords[~j * n + i] = {source: null, target: null});
2656+
chord.target = {index: i, startAngle: x, endAngle: x += matrix[~j * n + i] * k, value: matrix[~j * n + i]};
2657+
} else {
2658+
const chord = chords[i * n + j] || (chords[i * n + j] = {source: null, target: null});
2659+
chord.source = {index: i, startAngle: x, endAngle: x += matrix[i * n + j] * k, value: matrix[i * n + j]};
2660+
}
2661+
}
2662+
groups[i] = {index: i, startAngle: x0, endAngle: x, value: groupSums[i]};
2663+
} else {
26492664
const subgroupIndex = range$1(0, n).filter(j => matrix[i * n + j] || matrix[j * n + i]);
26502665
if (sortSubgroups) subgroupIndex.sort((a, b) => sortSubgroups(matrix[i * n + a], matrix[i * n + b]));
26512666
for (const j of subgroupIndex) {
@@ -2915,7 +2930,12 @@ function ribbon(headRadius) {
29152930
context.moveTo(sr * cos$1(sa0), sr * sin$1(sa0));
29162931
context.arc(0, 0, sr, sa0, sa1);
29172932
if (sa0 !== ta0 || sa1 !== ta1) {
2918-
{
2933+
if (headRadius) {
2934+
var hr = +headRadius.apply(this, arguments), tr2 = tr - hr, ta2 = (ta0 + ta1) / 2;
2935+
context.quadraticCurveTo(0, 0, tr2 * cos$1(ta0), tr2 * sin$1(ta0));
2936+
context.lineTo(tr * cos$1(ta2), tr * sin$1(ta2));
2937+
context.lineTo(tr2 * cos$1(ta1), tr2 * sin$1(ta1));
2938+
} else {
29192939
context.quadraticCurveTo(0, 0, tr * cos$1(ta0), tr * sin$1(ta0));
29202940
context.arc(0, 0, tr, ta0, ta1);
29212941
}
@@ -2926,6 +2946,10 @@ function ribbon(headRadius) {
29262946
if (buffer) return context = null, buffer + "" || null;
29272947
}
29282948

2949+
if (headRadius) ribbon.headRadius = function(_) {
2950+
return arguments.length ? (headRadius = typeof _ === "function" ? _ : constant$4(+_), ribbon) : headRadius;
2951+
};
2952+
29292953
ribbon.radius = function(_) {
29302954
return arguments.length ? (sourceRadius = targetRadius = typeof _ === "function" ? _ : constant$4(+_), ribbon) : sourceRadius;
29312955
};
@@ -9814,7 +9838,7 @@ function createDefaultPalette(grayscale) {
98149838
if (t < 2 / 3) return p + (q - p) * (2/3 - t) * 6;
98159839
return p;
98169840
}, HLStoRGB = (h, l, s) => {
9817-
const q = l + s - l * s,
9841+
const q = (l < 0.5) ? l * (1 + s) : l + s - l * s,
98189842
p = 2 * l - q,
98199843
r = hue2rgb(p, q, h + 1/3),
98209844
g = hue2rgb(p, q, h),
@@ -13553,23 +13577,24 @@ function drawRawText(dom, txt /* , opt */) {
1355313577
let txt = (this.txt._typename === clTObjString) ? this.txt.fString : this.txt.value;
1355413578
if (!isStr(txt)) txt = '<undefined>';
1355513579

13556-
const mathjax = this.txt.mathjax || (settings.Latex === constants$1.Latex.AlwaysMathJax);
13557-
13558-
if (!mathjax && !('as_is' in this.txt)) {
13559-
const arr = txt.split('\n'); txt = '';
13560-
for (let i = 0; i < arr.length; ++i)
13561-
txt += `<pre style='margin:0'>${arr[i]}</pre>`;
13562-
}
13563-
13564-
const frame = this.selectDom();
13580+
const mathjax = this.txt.mathjax || (settings.Latex === constants$1.Latex.AlwaysMathJax),
13581+
frame = this.selectDom();
1356513582
let main = frame.select('div');
1356613583
if (main.empty())
1356713584
main = frame.append('div').attr('style', 'max-width:100%;max-height:100%;overflow:auto');
13568-
main.html(txt);
13585+
else
13586+
main.html('');
1356913587

1357013588
// (re) set painter to first child element, base painter not requires canvas
1357113589
this.setTopPainter();
1357213590

13591+
if (!mathjax && !('as_is' in this.txt)) {
13592+
const arr = txt.split('\n');
13593+
for (let i = 0; i < arr.length; ++i)
13594+
main.append('pre').style('margin', '0').text(arr[i]);
13595+
} else
13596+
main.text(txt);
13597+
1357313598
if (mathjax)
1357413599
typesetMathjax(frame.node());
1357513600

@@ -56026,6 +56051,13 @@ function getMaterialArgs(color$1, args) {
5602656051
}
5602756052

5602856053
function createSVGRenderer(as_is, precision, doc) {
56054+
if (as_is) {
56055+
if (doc !== undefined)
56056+
globalThis.docuemnt = doc;
56057+
const rndr = new SVGRenderer();
56058+
rndr.setPrecision(precision);
56059+
return rndr;
56060+
}
5602956061

5603056062
const excl_style1 = ';stroke-opacity:1;stroke-width:1;stroke-linecap:round',
5603156063
excl_style2 = ';fill-opacity:1',
@@ -56429,7 +56461,7 @@ async function createRender3D(width, height, render3d, args) {
5642956461

5643056462
if (render3d === rc.SVG) {
5643156463
// SVG rendering
56432-
const r = createSVGRenderer(false, 0);
56464+
const r = createSVGRenderer(false, 0, doc);
5643356465
r.jsroot_dom = doc.createElementNS('http://www.w3.org/2000/svg', 'svg');
5643456466
promise = Promise.resolve(r);
5643556467
} else if (isNodeJs()) {
@@ -61430,7 +61462,7 @@ class StandaloneMenu extends JSRootMenu {
6143061462
text.style.display = 'flex';
6143161463

6143261464
const chk = doc.createElement('span');
61433-
chk.innerHTML = d.checked ? '\u2713' : '';
61465+
chk.innerText = d.checked ? '\u2713' : '';
6143461466
chk.style.display = 'inline-block';
6143561467
chk.style.width = '1em';
6143661468
text.appendChild(chk);
@@ -61443,7 +61475,7 @@ class StandaloneMenu extends JSRootMenu {
6144361475
} else {
6144461476
if (need_check_area) {
6144561477
const chk = doc.createElement('span');
61446-
chk.innerHTML = d.checked ? '\u2713' : '';
61478+
chk.innerText = d.checked ? '\u2713' : '';
6144761479
chk.style.display = 'inline-block';
6144861480
chk.style.width = '1em';
6144961481
text.appendChild(chk);
@@ -61691,14 +61723,14 @@ class StandaloneMenu extends JSRootMenu {
6169161723
* menu.addchk(flag, 'Checked', arg => console.log(`Now flag is ${arg}`));
6169261724
* menu.show(); */
6169361725
function createMenu(evnt, handler, menuname) {
61694-
const menu = new StandaloneMenu(handler, 'root_ctx_menu', evnt);
61726+
const menu = new StandaloneMenu(handler, menuname || 'root_ctx_menu', evnt);
6169561727
return menu.load();
6169661728
}
6169761729

6169861730
/** @summary Close previousely created and shown JSROOT menu
6169961731
* @param {string} [menuname] - optional menu name */
6170061732
function closeMenu(menuname) {
61701-
const element = getDocument().getElementById('root_ctx_menu');
61733+
const element = getDocument().getElementById(menuname || 'root_ctx_menu');
6170261734
element?.remove();
6170361735
return !!element;
6170461736
}
@@ -67014,10 +67046,12 @@ class FlexibleDisplay extends MDIDisplay {
6701467046
main = top.append('div');
6701567047

6701667048
main.html('<div class=\'jsroot_flex_header\' style=\'height: 23px; overflow: hidden; background-color: lightblue\'>' +
67017-
`<p style='margin: 1px; float: left; font-size: 14px; padding-left: 5px'>${title}</p></div>`+
67018-
`<div id='${this.frameid}_cont${this.cnt}' class='jsroot_flex_draw' style='overflow: hidden; width: 100%; height: calc(100% - 24px); background: white'></div>`+
67049+
'<p style=\'margin: 1px; float: left; font-size: 14px; padding-left: 5px\'></p></div>' +
67050+
`<div id='${this.frameid}_cont${this.cnt}' class='jsroot_flex_draw' style='overflow: hidden; width: 100%; height: calc(100% - 24px); background: white'></div>` +
6701967051
'<div class=\'jsroot_flex_resize\' style=\'position: absolute; right: 3px; bottom: 1px; overflow: hidden; cursor: nwse-resize\'>&#x25FF;</div>');
6702067052

67053+
main.select('.jsroot_flex_header p').text(title);
67054+
6702167055
main.attr('class', 'jsroot_flex_frame')
6702267056
.style('position', 'absolute')
6702367057
.style('left', Math.round(w * (this.cnt % 5)/10) + 'px')
@@ -79019,7 +79053,7 @@ function render3D(tmout) {
7901979053
if (tmout === -1111) {
7902079054
// special handling for direct SVG renderer
7902179055
const doc = getDocument(),
79022-
rrr = createSVGRenderer(false, 0);
79056+
rrr = createSVGRenderer(false, 0, doc);
7902379057
rrr.setSize(this.scene_width, this.scene_height);
7902479058
rrr.render(this.scene, this.camera);
7902579059
if (rrr.makeOuterHTML) {
@@ -101309,7 +101343,7 @@ class TDrawSelector extends TSelector {
101309101343
res.k = res.nbins / (res.max - res.min);
101310101344

101311101345
res.GetBin = function(value) {
101312-
const bin = this.lbls?.indexOf(value) ?? Number.isFinite(value) ? Math.floor((value - this.min) * this.k) : this.nbins + 1;
101346+
const bin = this.lbls?.indexOf(value) ?? (Number.isFinite(value) ? Math.floor((value - this.min) * this.k) : this.nbins + 1);
101313101347
return bin < 0 ? 0 : ((bin > this.nbins) ? this.nbins + 1 : bin + 1);
101314101348
};
101315101349

@@ -101838,7 +101872,7 @@ async function treeProcess(tree, selector, args) {
101838101872
default: return null;
101839101873
}
101840101874
const elem = createStreamerElement(name || leaf.fName, datakind);
101841-
if (leaf.fLen > 1) {
101875+
if ((leaf.fLen > 1) && (datakind !== kTString)) {
101842101876
elem.fType += kOffsetL;
101843101877
elem.fArrayLength = leaf.fLen;
101844101878
}
@@ -104254,7 +104288,7 @@ function objectHierarchy(top, obj, args = undefined) {
104254104288
item._vclass = 'h_value_num';
104255104289
} else if (isStr(fld)) {
104256104290
simple = true;
104257-
item._value = '&quot;' + fld.replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;') + '&quot;';
104291+
item._value = '"' + fld + '"';
104258104292
item._vclass = 'h_value_str';
104259104293
} else if (typeof fld === 'undefined') {
104260104294
simple = true;
@@ -105020,8 +105054,10 @@ class HierarchyPainter extends BasePainter {
105020105054

105021105055
if ('_value' in hitem) {
105022105056
const d3p = d3line.append('p');
105023-
if ('_vclass' in hitem) d3p.attr('class', hitem._vclass);
105024-
if (!hitem._isopen) d3p.html(hitem._value);
105057+
if ('_vclass' in hitem)
105058+
d3p.attr('class', hitem._vclass);
105059+
if (!hitem._isopen)
105060+
d3p.text(hitem._value);
105025105061
}
105026105062

105027105063
if (has_childs && (isroot || hitem._isopen)) {
@@ -107521,7 +107557,7 @@ class HierarchyPainter extends BasePainter {
107521107557
const layout = main.select('.gui_layout');
107522107558
if (!layout.empty()) {
107523107559
['simple', 'vert2', 'vert3', 'vert231', 'horiz2', 'horiz32', 'flex', 'tabs',
107524-
'grid 2x2', 'grid 1x3', 'grid 2x3', 'grid 3x3', 'grid 4x4'].forEach(kind => layout.append('option').attr('value', kind).html(kind));
107560+
'grid 2x2', 'grid 1x3', 'grid 2x3', 'grid 3x3', 'grid 4x4'].forEach(kind => layout.append('option').attr('value', kind).text(kind));
107525107561

107526107562
layout.on('change', ev => {
107527107563
const kind = ev.target.value || 'flex';
@@ -107561,7 +107597,7 @@ class HierarchyPainter extends BasePainter {
107561107597
}
107562107598
if (!found) {
107563107599
const opt = document.createElement('option');
107564-
opt.innerHTML = opt.value = this.getLayout();
107600+
opt.innerText = opt.value = this.getLayout();
107565107601
selects.appendChild(opt);
107566107602
selects.selectedIndex = selects.options.length - 1;
107567107603
}
@@ -116462,7 +116498,7 @@ class TASImagePainter extends ObjectPainter {
116462116498

116463116499
this.selectCurrentPad(prev_name);
116464116500
// mark painter as secondary - not in list of TCanvas primitives
116465-
pal_painter.setSecondary(this);
116501+
pal_painter.setSecondaryId(this);
116466116502

116467116503
// make dummy redraw, palette will be updated only from histogram painter
116468116504
pal_painter.redraw = function() {};
@@ -120980,7 +121016,7 @@ class Sha256 {
120980121016
function sha256(message, as_hex) {
120981121017
const m = new Sha256(false);
120982121018
m.update(message);
120983-
return m.digest();
121019+
return as_hex ? m.hex() : m.digest();
120984121020
}
120985121021

120986121022
function sha256_2(message, arr, as_hex) {

changes.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# JSROOT changelog
22

3+
## Changes in 7.7.x
4+
1. Fix - prevent JS code injection via `TObjString` drawing
5+
2. Fix - reduce use of HTML in hpainter, display and menu components
6+
7+
38
## Changes in 7.7.6
49
1. Fix - latex super-script without leading symbol, https://root-forum.cern.ch/t/63114/
510
2. Fix - correctly read std::pair<> without dictionary, https://root-forum.cern.ch/t/63114/

0 commit comments

Comments
 (0)