@xiee/utils 1.14.61 → 1.14.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/css/lt.css CHANGED
@@ -1,17 +1,17 @@
1
1
  th, td{ padding: 5px; }
2
2
  .lt-table {
3
3
  --bg: 4px solid transparent;
4
+ --bd: 1.5px solid #888;
4
5
 
5
6
  border-collapse: separate;
6
7
  caption-side: top;
7
8
  margin: 1em auto;
8
9
  border-spacing: 0;
9
- border-top: 1.5px solid #888;
10
- border-bottom: 1.5px solid #888;
10
+ border-top: var(--bd);
11
+ border-bottom: var(--bd);
11
12
 
12
13
  caption {
13
- padding: .5em;
14
- text-align: center;
14
+ padding: .5em; text-align: center; border-top: var(--bd);
15
15
  .lt-title { font-size: 1.2em; }
16
16
  .lt-subtitle { font-size: 0.9em; }
17
17
  }
@@ -41,7 +41,7 @@ th, td{ padding: 5px; }
41
41
  .lt-source-note td { font-style: italic; }
42
42
  }
43
43
 
44
- .al-r { text-align: right; white-space: nowrap; }
44
+ .al-r { text-align: right; }
45
45
  .al-c { text-align: center; }
46
46
 
47
47
  .lt-fnref {
@@ -50,3 +50,8 @@ th, td{ padding: 5px; }
50
50
  &::after { content: "]"; }
51
51
  }
52
52
  }
53
+ .lt-raw [title]::after {
54
+ content: " (" attr(title) ")";
55
+ background: lightyellow;
56
+ font-size: 0.85em;
57
+ }
package/css/lt.min.css CHANGED
@@ -1,2 +1,2 @@
1
- th,td{padding:5px}.lt-table{--bg:4px solid transparent;border-collapse:separate;caption-side:top;border-spacing:0;border-top:1.5px solid #888;border-bottom:1.5px solid #888;margin:1em auto;& caption{text-align:center;padding:.5em;& .lt-title{font-size:1.2em}& .lt-subtitle{font-size:.9em}}& th{font-weight:400}& tbody{& :not(:last-child) :is(td,th){border-bottom:1px solid #ddd}& .lt-row-group :is(td,th){border-bottom:1.5px solid #ddd}& .lt-row-group{text-align:left;vertical-align:top}}& thead th{border-bottom:1px solid #888;&:not(:first-child){border-left:var(--bg)}&:not(:last-child){border-right:var(--bg)}}& .lt-indent{padding-left:1em}& .lt-spanner-row{& .lt-spanner{text-align:center;border-bottom:1px solid #bbb}& .lt-spanner-empty{border-bottom:none}}& .lt-footer{font-size:.85em;& .lt-footnote:first-child td{border-top:1px solid #aaa}& .lt-source-note:first-child td{border-top:1px dashed #aaa}& .lt-source-note td{font-style:italic}}& .al-r{text-align:right;white-space:nowrap}& .al-c{text-align:center}& .lt-fnref{color:#06c;&:before{content:" ["}&:after{content:"]"}}}
1
+ th,td{padding:5px}.lt-table{--bg:4px solid transparent;--bd:1.5px solid #888;border-collapse:separate;caption-side:top;border-spacing:0;border-top:var(--bd);border-bottom:var(--bd);margin:1em auto;& caption{text-align:center;border-top:var(--bd);padding:.5em;& .lt-title{font-size:1.2em}& .lt-subtitle{font-size:.9em}}& th{font-weight:400}& tbody{& :not(:last-child) :is(td,th){border-bottom:1px solid #ddd}& .lt-row-group :is(td,th){border-bottom:1.5px solid #ddd}& .lt-row-group{text-align:left;vertical-align:top}}& thead th{border-bottom:1px solid #888;&:not(:first-child){border-left:var(--bg)}&:not(:last-child){border-right:var(--bg)}}& .lt-indent{padding-left:1em}& .lt-spanner-row{& .lt-spanner{text-align:center;border-bottom:1px solid #bbb}& .lt-spanner-empty{border-bottom:none}}& .lt-footer{font-size:.85em;& .lt-footnote:first-child td{border-top:1px solid #aaa}& .lt-source-note:first-child td{border-top:1px dashed #aaa}& .lt-source-note td{font-style:italic}}& .al-r{text-align:right}& .al-c{text-align:center}& .lt-fnref{color:#06c;&:before{content:" ["}&:after{content:"]"}}}.lt-raw [title]:after{content:" (" attr(title) ")";background:#ffffe0;font-size:.85em}
2
2
  /*# sourceMappingURL=lt.min.css.map */
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAAA,kBACA,2KAUE,yCAGE,4BACA,+BAGF,qBACA,QACE,4DACA,0DACA,oDAGF,wCAEE,0CACA,2CAEF,8BACA,kBACE,6DACA,wCAGF,6BAEE,wDACA,4DACA,wCAGF,4CACA,0BAEA,uBAEE,sBACA","sources":["lt.css"],"sourcesContent":["th, td{ padding: 5px; }\n.lt-table {\n --bg: 4px solid transparent;\n\n border-collapse: separate;\n caption-side: top;\n margin: 1em auto;\n border-spacing: 0;\n border-top: 1.5px solid #888;\n border-bottom: 1.5px solid #888;\n\n caption {\n padding: .5em;\n text-align: center;\n .lt-title { font-size: 1.2em; }\n .lt-subtitle { font-size: 0.9em; }\n }\n\n th { font-weight: normal; }\n tbody {\n :not(:last-child) :is(td, th) { border-bottom: 1px solid #ddd; }\n .lt-row-group :is(td, th) { border-bottom: 1.5px solid #ddd; }\n .lt-row-group { text-align: left; }\n .lt-row-group { vertical-align: top; }\n }\n thead th {\n border-bottom: 1px solid #888;\n &:not(:first-child) { border-left: var(--bg); }\n &:not(:last-child) { border-right: var(--bg); }\n }\n .lt-indent { padding-left: 1em; }\n .lt-spanner-row {\n .lt-spanner { border-bottom: 1px solid #bbb; text-align: center; }\n .lt-spanner-empty { border-bottom: none; }\n }\n\n .lt-footer {\n font-size: 0.85em;\n .lt-footnote:first-child td { border-top: 1px solid #aaa; }\n .lt-source-note:first-child td { border-top: 1px dashed #aaa; }\n .lt-source-note td { font-style: italic; }\n }\n\n .al-r { text-align: right; white-space: nowrap; }\n .al-c { text-align: center; }\n\n .lt-fnref {\n color: #06c;\n &::before { content: \" [\"; }\n &::after { content: \"]\"; }\n }\n}\n"],"names":[]}
1
+ {"version":3,"mappings":"AAAA,kBACA,mLAWE,8DAEE,4BACA,+BAGF,qBACA,QACE,4DACA,0DACA,oDAGF,wCAEE,0CACA,2CAEF,8BACA,kBACE,6DACA,wCAGF,6BAEE,wDACA,4DACA,wCAGF,yBACA,0BAEA,uBAEE,sBACA,sBAGJ","sources":["lt.css"],"sourcesContent":["th, td{ padding: 5px; }\n.lt-table {\n --bg: 4px solid transparent;\n --bd: 1.5px solid #888;\n\n border-collapse: separate;\n caption-side: top;\n margin: 1em auto;\n border-spacing: 0;\n border-top: var(--bd);\n border-bottom: var(--bd);\n\n caption {\n padding: .5em; text-align: center; border-top: var(--bd);\n .lt-title { font-size: 1.2em; }\n .lt-subtitle { font-size: 0.9em; }\n }\n\n th { font-weight: normal; }\n tbody {\n :not(:last-child) :is(td, th) { border-bottom: 1px solid #ddd; }\n .lt-row-group :is(td, th) { border-bottom: 1.5px solid #ddd; }\n .lt-row-group { text-align: left; }\n .lt-row-group { vertical-align: top; }\n }\n thead th {\n border-bottom: 1px solid #888;\n &:not(:first-child) { border-left: var(--bg); }\n &:not(:last-child) { border-right: var(--bg); }\n }\n .lt-indent { padding-left: 1em; }\n .lt-spanner-row {\n .lt-spanner { border-bottom: 1px solid #bbb; text-align: center; }\n .lt-spanner-empty { border-bottom: none; }\n }\n\n .lt-footer {\n font-size: 0.85em;\n .lt-footnote:first-child td { border-top: 1px solid #aaa; }\n .lt-source-note:first-child td { border-top: 1px dashed #aaa; }\n .lt-source-note td { font-style: italic; }\n }\n\n .al-r { text-align: right; }\n .al-c { text-align: center; }\n\n .lt-fnref {\n color: #06c;\n &::before { content: \" [\"; }\n &::after { content: \"]\"; }\n }\n}\n.lt-raw [title]::after {\n content: \" (\" attr(title) \")\";\n background: lightyellow;\n font-size: 0.85em;\n}\n"],"names":[]}
package/js/lt.js CHANGED
@@ -494,12 +494,14 @@
494
494
  }
495
495
  const ind = indent[r - 1] || 0;
496
496
  for (let ci = 0; ci < cols.length; ci++) {
497
- const k = `${r},${ci}`,
497
+ const k = `${r},${ci}`, c = cols[ci],
498
498
  m = bodyMarks[k], cc = classMap[k],
499
499
  cls = [colCls[ci], cc].filter(Boolean).join(" ");
500
500
  let s = styleMap[k] || "";
501
501
  if (ci === 0 && ind) s = (s ? s + ";" : "") + `padding-left:${ind + 1}em`;
502
- out.push(`<td${attr("class", cls)}${attr("style", s)}>${esc(cell(cols[ci], r))}${m ? sup(m) : ""}</td>`);
502
+ const raw = str(data[c][r - 1]), disp = display[c][r - 1],
503
+ tip = raw !== disp ? ` title="${esc(raw)}"` : "";
504
+ out.push(`<td${attr("class", cls)}${attr("style", s)}${tip}>${esc(disp)}${m ? sup(m) : ""}</td>`);
503
505
  }
504
506
  out.push(`</tr>`);
505
507
  };
@@ -531,7 +533,13 @@
531
533
  return out.join("");
532
534
  }
533
535
 
534
- const mount = (s, spec) => s.insertAdjacentHTML("afterend", buildHtml(spec));
536
+ const mount = (s, spec) => {
537
+ s.insertAdjacentHTML("afterend", buildHtml(spec));
538
+ const tbl = s.nextElementSibling,
539
+ raw = (e, el) => e.altKey && el.classList.toggle("lt-raw");
540
+ tbl.onclick = e => e.detail === 1 && raw(e, tbl);
541
+ tbl.ondblclick = e => raw(e, tbl.ownerDocument.documentElement);
542
+ };
535
543
  // q.push renders immediately; replay any entries queued before we loaded.
536
544
  const q = { push: e => mount(e.s, e.d) };
537
545
  (root.LT?.q || []).forEach(q.push);
package/js/lt.min.js CHANGED
@@ -1,2 +1,2 @@
1
- (t=>{"use strict";if(t.LT?.buildHtml)return;const o=t=>String(t).replace(/&/g,"&amp;").replace(/[<]/g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),n=t=>`<sup class="lt-fnref">${t}</sup>`,e=t=>String(t??""),s=t=>"number"==typeof t&&!isNaN(t),l=t=>t?.length&&"number"==typeof t.find(t=>null!=t);function r(t,o,n){if(!s(t))return null;let e=null!=o?t.toFixed(o):String(t);if(/^-0(\.0+)?$/.test(e)&&(e=e.slice(1)),n){const t=e.split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,n),e=t.join(".")}return"-"===e[0]&&(e="−"+e.slice(1)),null!=o||n?e:null}function c(t,o){if(!o)return t.filter(t=>""!==t).join(" ");let n=o,e="";for(;n;){const o=n.match(/<<(.*?)>>/);if(!o){e+=a(n,t);break}o.index>0&&(e+=a(n.slice(0,o.index),t));const s=o[1],l=[...s.matchAll(/\{(\d+)\}/g)].map(t=>+t[1]);l.length&&!l.every(o=>""!==t[o-1])||(e+=a(s,t)),n=n.slice(o.index+o[0].length)}return e}function a(t,o){for(let n=0;n<o.length;n++)t=t.split("{"+(n+1)+"}").join(o[n]);return t}function i(t){const o=t.data||{},n=t.ops||[],a=Object.keys(o),i=a.length?o[a[0]].length:0,f={};for(const t of a)f[t]=o[t].map(e);!function(t,o,n){if(!1===t.auto_format)return;const e=t.data||{},c=t.ops||[],a=Object.keys(e),i=new Set;for(const t of c)if("fmt_number"===t.type)for(const o of t.columns||a)i.add(o);const f=t=>{for(const o of c)if("label"===o.type&&null!=o.labels?.[t])return o.labels[t];return t};for(const t of a){if(i.has(t))continue;const c=e[t];if(!l(c))continue;const a=f(t),u=/%|[ _](pct|percent)$/i.test(a);if(/year/i.test(a)&&c.every(t=>null==t||/^\d{4}$/.test(String(t))))continue;let p=0,h=0;for(const t of c){if(!s(t))continue;const o=Math.abs(u?100*t:t),n=o<1?0:Math.floor(Math.log10(o))+1;n>p&&(p=n);const e=String(t).match(/\.(\d+)/);if(!e)continue;const l=e[1].replace(/0+$/,"").length-(u?2:0);l>h&&(h=l)}h=Math.min(h,Math.max(4-p,0));for(let e=0;e<n;e++){const n=c[e];if(!s(n))continue;const l=r(u?100*n:n,h," ");null!=l&&(o[t][e]=l+(u?"%":""))}}}(t,f,i);const u=(t,n)=>{for(const e of t)if(o[e])for(let t=0;t<i;t++)n(e,t,o[e][t])};for(const t of n){const o=t.columns||a;switch(t.type){case"fmt_number":u(o,(o,n,e)=>{if(!s(e))return;const l=!0===t.percent?100*e:e,c=t.percent?"%":"",a=r(l,t.decimals,t.big_mark??""),i=t.prefix||"",u=(t.suffix||"")+c;null!=a?f[o][n]=i+a+u:(i||u)&&(f[o][n]=i+String(l)+u)});break;case"fmt_date":u(o,(o,n,e)=>{if(null==e)return;const s=e instanceof Date?e:new Date(e);isNaN(s)||(f[o][n]=t.method?s[t.method]():t.options?s.toLocaleDateString(t.locale,t.options):s.toLocaleDateString(t.locale))});break;case"sub":u(o,(o,n,e)=>{null!=t.small&&s(e)&&0!==e&&Math.abs(e)<t.small?f[o][n]=t.small_text??"<"+t.small:null!=t.zero&&0===e?f[o][n]=t.zero:null!=t.missing&&null==e&&(f[o][n]=t.missing)});break;case"merge":{const o=t.columns;if(!o||o.length<2)break;const n=o[0];for(let e=0;e<i;e++){const s=o.map(t=>f[t]?.[e]??"");f[n][e]=c(s,t.pattern)}break}}}return{display:f,nRow:i}}function f(t){!function(t){if(!1===t.sort||!t.row_group)return;const o=t.data||{},n=[].concat(t.row_group),e=Object.keys(o),s=e.length?o[e[0]].length:0;if(!s)return;const l=Array.from({length:s},(t,o)=>o);l.sort((t,e)=>{for(const s of n){const n=o[s]?.[t],l=o[s]?.[e];if(n!=l){if(null==n)return 1;if(null==l)return-1;if(n<l)return-1;if(n>l)return 1}}return 0});for(const t of e)o[t]=l.map(n=>o[t][n]);const r=new Array(s);for(let t=0;t<s;t++)r[l[t]]=t+1;for(const o of t.ops||[])o.rows&&(o.rows=o.rows.map(t=>r[t-1]))}(t);const s=t.data||{},{display:r,nRow:c}=i(t),{visible:a,align:f,colLabels:u,colWidths:p,indent:h,groups:g,rowSpans:d,styles:m,spanners:b,footnotes:w,notes:$,header:y}=function(t){const o=t.data||{},n=t.ops||[],s=Object.keys(o),r=s.length?o[s[0]].length:0,c=(t,o)=>{for(const e of n)e.type===t&&o(e)};let a="string"==typeof t.row_group;const i=Array.isArray(t.row_group)?t.row_group:t.row_group?[t.row_group]:[];a||1!==i.length||!1===t.auto_sep||l(o[i[0]])||!o[i[0]]?.some(t=>(t+"").length>20)||(a=!0);const f=new Set;for(const t of i)f.add(t);c("merge",t=>{!1!==t.hide&&t.columns&&t.columns.slice(1).forEach(t=>f.add(t))});let u=s.filter(t=>!f.has(t));c("move",t=>{const o=(t.columns||[]).filter(t=>u.includes(t));if(!o.length)return;const n=u.filter(t=>!o.includes(t));if(null==t.after)u=[...o,...n];else{const e=n.indexOf(t.after);e>=0&&(u=[...n.slice(0,e+1),...o,...n.slice(e+1)])}});const p=(t,o,n)=>{const e=u.indexOf(o);e>=0&&(t[e]=n)},h=u.map(t=>l(o[t])?"right":"left");c("align",t=>{for(const o of t.columns||[])p(h,o,t.align)});const g=o=>!1===t.auto_label?o:o.replace(/[._]/g," "),d=u.map(g);c("label",t=>{for(const[o,n]of Object.entries(t.labels||{}))p(d,o,n)});let m=null;c("width",t=>{if(t.widths){m||(m=u.map(()=>""));for(const[o,n]of Object.entries(t.widths))p(m,o,n)}});const b=new Array(r).fill(0);c("indent",t=>{if(t.rows)for(const o of t.rows)b[o-1]=t.level??1});const w=t=>{const o=[];for(let n=0;n<r;){const s=e(t[n]),l=[n+1];for(;++n<r&&e(t[n])===s;)l.push(n+1);o.push({label:s,rows:l})}return o};let $=[];a&&i.length&&o[i[0]]&&$.push(...w(o[i[0]])),c("row_group",t=>$.push({label:t.label,rows:t.rows})),c("group_order",t=>{if(!$.length)return;const o=[],n=[];for(const n of t.order||[]){const t=$.find(t=>t.label===n);t&&o.push(t)}for(const t of $)o.includes(t)||n.push(t);$=[...o,...n]});const y=[];if(!a&&i.length)for(const t of i){const n=new Array(r).fill(0);for(const e of w(o[t]||[]))n[e.rows[0]-1]=e.rows.length;let e=t;c("label",o=>{null!=o.labels?.[t]&&(e=o.labels[t])}),y.push({col:t,label:e,spans:n})}const _=n.filter(t=>"style"===t.type);let x=t.spanners||[];if(t.auto_span){const o="string"==typeof t.auto_span?new RegExp(t.auto_span):/[._]/;x=[...x];for(let t=0;t<u.length;){const n=u[t].match(o);if(!n){t++;continue}const e=u[t].slice(0,n.index);let s=t+1;for(;s<u.length;){const t=u[s].match(o);if(!t||u[s].slice(0,t.index)!==e)break;s++}if(s-t>=2){x.push({label:e,columns:u.slice(t,s)});for(let n=t;n<s;n++){const t=u[n].match(o);t&&(d[n]=g(u[n].slice(t.index+t[0].length)))}}t=s}}return{visible:u,align:h,colLabels:d,colWidths:m,indent:b,groups:$,rowSpans:y,styles:_,spanners:x,footnotes:t.footnotes||[],notes:t.notes||[],header:t.header||{},nRow:r}}(t),_=function(t){const o=[],n={};return t.forEach(t=>{null==n[t.text]&&(n[t.text]=o.length+1,o.push(t.text))}),{order:o,idx:n}}(w),x=((t,o)=>(n,e)=>{for(const s of t){const t=s.location;if(t.type!==n)continue;const l=o[s.text];if("title"===n&&t.group===e)return l;if("column_labels"===n&&t.columns.includes(e))return l;if("column_spanners"===n&&t.spanners.includes(e))return l;if("row_groups"===n){if("all"===t.match)return l;if("exact"===t.match&&t.values.includes(e))return l;if("starts_with"===t.match&&e.startsWith(t.value))return l}}return 0})(w,_.idx),S=d.length,j=a.length+S,k=['<table class="lt-table">'],v=(t,o)=>{const e=x(t,o);return e?n(e):""},O=(t,o)=>r[t]?.[o-1]??"",A=(t,o)=>o?` ${t}="${o}"`:"",L=a.map((t,o)=>((0===o&&g.length?"lt-indent ":"")+({right:"al-r",center:"al-c"}[f[o]]||"")).trimEnd()),M=(t,o,n)=>{for(let e=1;e<=c;e++)if(!t||t.includes(e))for(const t of o||a){const o=a.indexOf(t);o>=0&&n(`${e},${o}`,t,e)}},E={},D={},N=(t,o,n,e)=>{t[o]=t[o]?t[o]+e+n:n};for(const t of m)M(t.rows,t.columns?[].concat(t.columns):null,(o,n,e)=>{t.test&&!t.test(s[n][e-1])||(t.css&&N(E,o,t.css,";"),t.class&&N(D,o,t.class," "))});if(p&&p.some(t=>t)){k.push("<colgroup>");for(let t=0;t<a.length;t++)k.push(`<col${A("style",p[t]?"width:"+p[t]:"")}>`);k.push("</colgroup>")}const R=[["title","lt-title"],["subtitle","lt-subtitle"]].filter(([t])=>null!=y[t]&&""!==y[t]).map(([t,n])=>`<div class="${n}">${o(y[t])}${v("title",t)}</div>`);if(R.length&&k.push('<caption class="lt-caption">',...R,"</caption>"),k.push("<thead>"),b.length){const t='<th class="lt-spanner-empty"></th>';k.push('<tr class="lt-spanner-row">'),k.push(t.repeat(S));for(let n=0;n<a.length;){const e=b.find(t=>t.columns[0]===a[n]);e?(k.push(`<th colspan="${e.columns.length}" scope="colgroup" class="lt-spanner">${o(e.label)}${v("column_spanners",e.label)}</th>`),n+=e.columns.length):(k.push(t),n++)}k.push("</tr>")}k.push("<tr>");for(const t of d)k.push(`<th scope="col">${o(t.label)}</th>`);for(let t=0;t<a.length;t++)k.push(`<th scope="col"${A("class",L[t])}>${o(u[t])}${v("column_labels",a[t])}</th>`);k.push("</tr></thead>");const T={};for(const t of w){if("body"!==t.location.type)continue;const o=_.idx[t.text];M(t.location.rows,t.location.columns||[],t=>{T[t]=o})}const q=t=>{k.push("<tr>");for(const n of d){const e=n.spans[t-1];e>0&&k.push(`<th scope="row" class="lt-row-group"${A("rowspan",e>1?e:0)}>${o(O(n.col,t))}</th>`)}const e=h[t-1]||0;for(let s=0;s<a.length;s++){const l=`${t},${s}`,r=T[l],c=D[l],i=[L[s],c].filter(Boolean).join(" ");let f=E[l]||"";0===s&&e&&(f=(f?f+";":"")+`padding-left:${e+1}em`),k.push(`<td${A("class",i)}${A("style",f)}>${o(O(a[s],t))}${r?n(r):""}</td>`)}k.push("</tr>")};if(k.push("<tbody>"),g.length){const t={};for(const n of g){k.push(`<tr class="lt-row-group"><th colspan="${j}" scope="colgroup">${o(n.label)}${v("row_groups",n.label)}</th></tr>`);for(const o of n.rows)t[o]=1,q(o)}for(let o=1;o<=c;o++)t[o]||q(o)}else for(let t=1;t<=c;t++)q(t);if(k.push("</tbody>"),_.order.length||$.length){const t=(t,o)=>`<tr class="${t}"><td colspan="${j}">${o}</td></tr>`;k.push('<tfoot class="lt-footer">'),_.order.forEach((e,s)=>k.push(t("lt-footnote",`${n(s+1)} ${o(e)}`)));for(const n of $)k.push(t("lt-source-note",o(n)));k.push("</tfoot>")}return k.push("</table>"),k.join("")}const u=(t,o)=>t.insertAdjacentHTML("afterend",f(o)),p={push:t=>u(t.s,t.d)};(t.LT?.q||[]).forEach(p.push),t.LT={build:t=>u(document.currentScript,t),buildHtml:f,q:p}})(window);
1
+ (t=>{"use strict";if(t.LT?.buildHtml)return;const o=t=>String(t).replace(/&/g,"&amp;").replace(/[<]/g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),n=t=>`<sup class="lt-fnref">${t}</sup>`,e=t=>String(t??""),s=t=>"number"==typeof t&&!isNaN(t),l=t=>t?.length&&"number"==typeof t.find(t=>null!=t);function r(t,o,n){if(!s(t))return null;let e=null!=o?t.toFixed(o):String(t);if(/^-0(\.0+)?$/.test(e)&&(e=e.slice(1)),n){const t=e.split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,n),e=t.join(".")}return"-"===e[0]&&(e="−"+e.slice(1)),null!=o||n?e:null}function c(t,o){if(!o)return t.filter(t=>""!==t).join(" ");let n=o,e="";for(;n;){const o=n.match(/<<(.*?)>>/);if(!o){e+=i(n,t);break}o.index>0&&(e+=i(n.slice(0,o.index),t));const s=o[1],l=[...s.matchAll(/\{(\d+)\}/g)].map(t=>+t[1]);l.length&&!l.every(o=>""!==t[o-1])||(e+=i(s,t)),n=n.slice(o.index+o[0].length)}return e}function i(t,o){for(let n=0;n<o.length;n++)t=t.split("{"+(n+1)+"}").join(o[n]);return t}function a(t){const o=t.data||{},n=t.ops||[],i=Object.keys(o),a=i.length?o[i[0]].length:0,u={};for(const t of i)u[t]=o[t].map(e);!function(t,o,n){if(!1===t.auto_format)return;const e=t.data||{},c=t.ops||[],i=Object.keys(e),a=new Set;for(const t of c)if("fmt_number"===t.type)for(const o of t.columns||i)a.add(o);const u=t=>{for(const o of c)if("label"===o.type&&null!=o.labels?.[t])return o.labels[t];return t};for(const t of i){if(a.has(t))continue;const c=e[t];if(!l(c))continue;const i=u(t),f=/%|[ _](pct|percent)$/i.test(i);if(/year/i.test(i)&&c.every(t=>null==t||/^\d{4}$/.test(String(t))))continue;let p=0,h=0;for(const t of c){if(!s(t))continue;const o=Math.abs(f?100*t:t),n=o<1?0:Math.floor(Math.log10(o))+1;n>p&&(p=n);const e=String(t).match(/\.(\d+)/);if(!e)continue;const l=e[1].replace(/0+$/,"").length-(f?2:0);l>h&&(h=l)}h=Math.min(h,Math.max(4-p,0));for(let e=0;e<n;e++){const n=c[e];if(!s(n))continue;const l=r(f?100*n:n,h," ");null!=l&&(o[t][e]=l+(f?"%":""))}}}(t,u,a);const f=(t,n)=>{for(const e of t)if(o[e])for(let t=0;t<a;t++)n(e,t,o[e][t])};for(const t of n){const o=t.columns||i;switch(t.type){case"fmt_number":f(o,(o,n,e)=>{if(!s(e))return;const l=!0===t.percent?100*e:e,c=t.percent?"%":"",i=r(l,t.decimals,t.big_mark??""),a=t.prefix||"",f=(t.suffix||"")+c;null!=i?u[o][n]=a+i+f:(a||f)&&(u[o][n]=a+String(l)+f)});break;case"fmt_date":f(o,(o,n,e)=>{if(null==e)return;const s=e instanceof Date?e:new Date(e);isNaN(s)||(u[o][n]=t.method?s[t.method]():t.options?s.toLocaleDateString(t.locale,t.options):s.toLocaleDateString(t.locale))});break;case"sub":f(o,(o,n,e)=>{null!=t.small&&s(e)&&0!==e&&Math.abs(e)<t.small?u[o][n]=t.small_text??"<"+t.small:null!=t.zero&&0===e?u[o][n]=t.zero:null!=t.missing&&null==e&&(u[o][n]=t.missing)});break;case"merge":{const o=t.columns;if(!o||o.length<2)break;const n=o[0];for(let e=0;e<a;e++){const s=o.map(t=>u[t]?.[e]??"");u[n][e]=c(s,t.pattern)}break}}}return{display:u,nRow:a}}function u(t){!function(t){if(!1===t.sort||!t.row_group)return;const o=t.data||{},n=[].concat(t.row_group),e=Object.keys(o),s=e.length?o[e[0]].length:0;if(!s)return;const l=Array.from({length:s},(t,o)=>o);l.sort((t,e)=>{for(const s of n){const n=o[s]?.[t],l=o[s]?.[e];if(n!=l){if(null==n)return 1;if(null==l)return-1;if(n<l)return-1;if(n>l)return 1}}return 0});for(const t of e)o[t]=l.map(n=>o[t][n]);const r=new Array(s);for(let t=0;t<s;t++)r[l[t]]=t+1;for(const o of t.ops||[])o.rows&&(o.rows=o.rows.map(t=>r[t-1]))}(t);const s=t.data||{},{display:r,nRow:c}=a(t),{visible:i,align:u,colLabels:f,colWidths:p,indent:h,groups:g,rowSpans:d,styles:m,spanners:b,footnotes:w,notes:$,header:y}=function(t){const o=t.data||{},n=t.ops||[],s=Object.keys(o),r=s.length?o[s[0]].length:0,c=(t,o)=>{for(const e of n)e.type===t&&o(e)};let i="string"==typeof t.row_group;const a=Array.isArray(t.row_group)?t.row_group:t.row_group?[t.row_group]:[];i||1!==a.length||!1===t.auto_sep||l(o[a[0]])||!o[a[0]]?.some(t=>(t+"").length>20)||(i=!0);const u=new Set;for(const t of a)u.add(t);c("merge",t=>{!1!==t.hide&&t.columns&&t.columns.slice(1).forEach(t=>u.add(t))});let f=s.filter(t=>!u.has(t));c("move",t=>{const o=(t.columns||[]).filter(t=>f.includes(t));if(!o.length)return;const n=f.filter(t=>!o.includes(t));if(null==t.after)f=[...o,...n];else{const e=n.indexOf(t.after);e>=0&&(f=[...n.slice(0,e+1),...o,...n.slice(e+1)])}});const p=(t,o,n)=>{const e=f.indexOf(o);e>=0&&(t[e]=n)},h=f.map(t=>l(o[t])?"right":"left");c("align",t=>{for(const o of t.columns||[])p(h,o,t.align)});const g=o=>!1===t.auto_label?o:o.replace(/[._]/g," "),d=f.map(g);c("label",t=>{for(const[o,n]of Object.entries(t.labels||{}))p(d,o,n)});let m=null;c("width",t=>{if(t.widths){m||(m=f.map(()=>""));for(const[o,n]of Object.entries(t.widths))p(m,o,n)}});const b=new Array(r).fill(0);c("indent",t=>{if(t.rows)for(const o of t.rows)b[o-1]=t.level??1});const w=t=>{const o=[];for(let n=0;n<r;){const s=e(t[n]),l=[n+1];for(;++n<r&&e(t[n])===s;)l.push(n+1);o.push({label:s,rows:l})}return o};let $=[];i&&a.length&&o[a[0]]&&$.push(...w(o[a[0]])),c("row_group",t=>$.push({label:t.label,rows:t.rows})),c("group_order",t=>{if(!$.length)return;const o=[],n=[];for(const n of t.order||[]){const t=$.find(t=>t.label===n);t&&o.push(t)}for(const t of $)o.includes(t)||n.push(t);$=[...o,...n]});const y=[];if(!i&&a.length)for(const t of a){const n=new Array(r).fill(0);for(const e of w(o[t]||[]))n[e.rows[0]-1]=e.rows.length;let e=t;c("label",o=>{null!=o.labels?.[t]&&(e=o.labels[t])}),y.push({col:t,label:e,spans:n})}const _=n.filter(t=>"style"===t.type);let x=t.spanners||[];if(t.auto_span){const o="string"==typeof t.auto_span?new RegExp(t.auto_span):/[._]/;x=[...x];for(let t=0;t<f.length;){const n=f[t].match(o);if(!n){t++;continue}const e=f[t].slice(0,n.index);let s=t+1;for(;s<f.length;){const t=f[s].match(o);if(!t||f[s].slice(0,t.index)!==e)break;s++}if(s-t>=2){x.push({label:e,columns:f.slice(t,s)});for(let n=t;n<s;n++){const t=f[n].match(o);t&&(d[n]=g(f[n].slice(t.index+t[0].length)))}}t=s}}return{visible:f,align:h,colLabels:d,colWidths:m,indent:b,groups:$,rowSpans:y,styles:_,spanners:x,footnotes:t.footnotes||[],notes:t.notes||[],header:t.header||{},nRow:r}}(t),_=function(t){const o=[],n={};return t.forEach(t=>{null==n[t.text]&&(n[t.text]=o.length+1,o.push(t.text))}),{order:o,idx:n}}(w),x=((t,o)=>(n,e)=>{for(const s of t){const t=s.location;if(t.type!==n)continue;const l=o[s.text];if("title"===n&&t.group===e)return l;if("column_labels"===n&&t.columns.includes(e))return l;if("column_spanners"===n&&t.spanners.includes(e))return l;if("row_groups"===n){if("all"===t.match)return l;if("exact"===t.match&&t.values.includes(e))return l;if("starts_with"===t.match&&e.startsWith(t.value))return l}}return 0})(w,_.idx),k=d.length,S=i.length+k,j=['<table class="lt-table">'],v=(t,o)=>{const e=x(t,o);return e?n(e):""},L=(t,o)=>r[t]?.[o-1]??"",O=(t,o)=>o?` ${t}="${o}"`:"",A=i.map((t,o)=>((0===o&&g.length?"lt-indent ":"")+({right:"al-r",center:"al-c"}[u[o]]||"")).trimEnd()),E=(t,o,n)=>{for(let e=1;e<=c;e++)if(!t||t.includes(e))for(const t of o||i){const o=i.indexOf(t);o>=0&&n(`${e},${o}`,t,e)}},M={},D={},N=(t,o,n,e)=>{t[o]=t[o]?t[o]+e+n:n};for(const t of m)E(t.rows,t.columns?[].concat(t.columns):null,(o,n,e)=>{t.test&&!t.test(s[n][e-1])||(t.css&&N(M,o,t.css,";"),t.class&&N(D,o,t.class," "))});if(p&&p.some(t=>t)){j.push("<colgroup>");for(let t=0;t<i.length;t++)j.push(`<col${O("style",p[t]?"width:"+p[t]:"")}>`);j.push("</colgroup>")}const R=[["title","lt-title"],["subtitle","lt-subtitle"]].filter(([t])=>null!=y[t]&&""!==y[t]).map(([t,n])=>`<div class="${n}">${o(y[t])}${v("title",t)}</div>`);if(R.length&&j.push('<caption class="lt-caption">',...R,"</caption>"),j.push("<thead>"),b.length){const t='<th class="lt-spanner-empty"></th>';j.push('<tr class="lt-spanner-row">'),j.push(t.repeat(k));for(let n=0;n<i.length;){const e=b.find(t=>t.columns[0]===i[n]);e?(j.push(`<th colspan="${e.columns.length}" scope="colgroup" class="lt-spanner">${o(e.label)}${v("column_spanners",e.label)}</th>`),n+=e.columns.length):(j.push(t),n++)}j.push("</tr>")}j.push("<tr>");for(const t of d)j.push(`<th scope="col">${o(t.label)}</th>`);for(let t=0;t<i.length;t++)j.push(`<th scope="col"${O("class",A[t])}>${o(f[t])}${v("column_labels",i[t])}</th>`);j.push("</tr></thead>");const T={};for(const t of w){if("body"!==t.location.type)continue;const o=_.idx[t.text];E(t.location.rows,t.location.columns||[],t=>{T[t]=o})}const q=t=>{j.push("<tr>");for(const n of d){const e=n.spans[t-1];e>0&&j.push(`<th scope="row" class="lt-row-group"${O("rowspan",e>1?e:0)}>${o(L(n.col,t))}</th>`)}const l=h[t-1]||0;for(let c=0;c<i.length;c++){const a=`${t},${c}`,u=i[c],f=T[a],p=D[a],h=[A[c],p].filter(Boolean).join(" ");let g=M[a]||"";0===c&&l&&(g=(g?g+";":"")+`padding-left:${l+1}em`);const d=e(s[u][t-1]),m=r[u][t-1],b=d!==m?` title="${o(d)}"`:"";j.push(`<td${O("class",h)}${O("style",g)}${b}>${o(m)}${f?n(f):""}</td>`)}j.push("</tr>")};if(j.push("<tbody>"),g.length){const t={};for(const n of g){j.push(`<tr class="lt-row-group"><th colspan="${S}" scope="colgroup">${o(n.label)}${v("row_groups",n.label)}</th></tr>`);for(const o of n.rows)t[o]=1,q(o)}for(let o=1;o<=c;o++)t[o]||q(o)}else for(let t=1;t<=c;t++)q(t);if(j.push("</tbody>"),_.order.length||$.length){const t=(t,o)=>`<tr class="${t}"><td colspan="${S}">${o}</td></tr>`;j.push('<tfoot class="lt-footer">'),_.order.forEach((e,s)=>j.push(t("lt-footnote",`${n(s+1)} ${o(e)}`)));for(const n of $)j.push(t("lt-source-note",o(n)));j.push("</tfoot>")}return j.push("</table>"),j.join("")}const f=(t,o)=>{t.insertAdjacentHTML("afterend",u(o));const n=t.nextElementSibling,e=(t,o)=>t.altKey&&o.classList.toggle("lt-raw");n.onclick=t=>1===t.detail&&e(t,n),n.ondblclick=t=>e(t,n.ownerDocument.documentElement)},p={push:t=>f(t.s,t.d)};(t.LT?.q||[]).forEach(p.push),t.LT={build:t=>f(document.currentScript,t),buildHtml:u,q:p}})(window);
2
2
  //# sourceMappingURL=lt.min.js.map
package/js/lt.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["root","LT","buildHtml","esc","s","String","replace","sup","i","str","v","isNum","isNaN","numCol","col","length","find","fmtNumber","decimals","bigMark","toFixed","test","slice","parts","split","join","mergeVals","vals","pattern","filter","remaining","result","m","match","subRefs","index","block","refs","matchAll","map","x","every","applyOps","spec","data","ops","colNames","Object","keys","nRow","display","c","auto_format","fmtCols","Set","op","type","columns","add","getLabel","labels","has","lbl","pct","maxInt","n","a","Math","abs","intW","floor","log10","d","min","max","autoFmt","eachCell","cols","fn","raw","percent","psfx","f","big_mark","pfx","prefix","sfx","suffix","Date","method","options","toLocaleDateString","locale","small","small_text","zero","missing","mCols","target","sort","row_group","concat","idx","Array","from","_","b","va","vb","newPos","rows","r","sortByGroups","visible","align","colLabels","colWidths","indent","groups","rowSpans","styles","spanners","footnotes","fns","notes","header","hdr","onOp","t","rowGroupSep","rowGroupCols","isArray","auto_sep","some","hidden","g","hide","forEach","toMove","includes","rest","after","pos","indexOf","setByCol","arr","val","autoLbl","auto_label","entries","widths","w","fill","level","runs","out","label","push","ordered","order","gc","spans","auto_span","sep","RegExp","j","m2","k","mk","resolveSpec","reg","text","indexFootnotes","fIdx","loc","location","hit","group","values","startsWith","value","matcher","nGrp","nCol","mark","cell","attr","colCls","right","center","trimEnd","eachLoc","locCols","ci","styleMap","classMap","addTo","key","css","class","caption","cls","emptyTh","repeat","sp","rs","bodyMarks","fi","pushRow","span","ind","cc","Boolean","seen","footRow","html","txt","mount","insertAdjacentHTML","q","e","build","document","currentScript","window"],"sources":["lt.js"],"mappings":"AAIA,CAACA,IACC,aACA,GAAIA,EAAKC,IAAIC,UAAW,OAGxB,MAAMC,EAAMC,GAAKC,OAAOD,GACrBE,QAAQ,KAAM,SAASA,QAAQ,OAAQ,QACvCA,QAAQ,KAAM,QAAQA,QAAQ,KAAM,UACjCC,EAAMC,GAAK,yBAAyBA,UAEpCC,EAAMC,GAAKL,OAAOK,GAAK,IAGvBC,EAAQD,GAAkB,iBAANA,IAAmBE,MAAMF,GAE7CG,EAASC,GAAOA,GAAKC,QAA8C,iBAA7BD,EAAIE,KAAKN,GAAU,MAALA,GAE1D,SAASO,EAAUP,EAAGQ,EAAUC,GAC9B,IAAKR,EAAMD,GAAI,OAAO,KACtB,IAAIN,EAAgB,MAAZc,EAAmBR,EAAEU,QAAQF,GAAYb,OAAOK,GAExD,GADI,cAAcW,KAAKjB,KAAIA,EAAIA,EAAEkB,MAAM,IACnCH,EAAS,CACX,MAAMI,EAAQnB,EAAEoB,MAAM,KACtBD,EAAM,GAAKA,EAAM,GAAGjB,QAAQ,wBAAyBa,GACrDf,EAAImB,EAAME,KAAK,IACjB,CAEA,MADa,MAATrB,EAAE,KAAYA,EAAI,IAAMA,EAAEkB,MAAM,IACjB,MAAZJ,GAAoBC,EAAUf,EAAI,I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E,EAthBD,CAshBGK","ignoreList":[]}
1
+ {"version":3,"names":["root","LT","buildHtml","esc","s","String","replace","sup","i","str","v","isNum","isNaN","numCol","col","length","find","fmtNumber","decimals","bigMark","toFixed","test","slice","parts","split","join","mergeVals","vals","pattern","filter","remaining","result","m","match","subRefs","index","block","refs","matchAll","map","x","every","applyOps","spec","data","ops","colNames","Object","keys","nRow","display","c","auto_format","fmtCols","Set","op","type","columns","add","getLabel","labels","has","lbl","pct","maxInt","n","a","Math","abs","intW","floor","log10","d","min","max","autoFmt","eachCell","cols","fn","raw","percent","psfx","f","big_mark","pfx","prefix","sfx","suffix","Date","method","options","toLocaleDateString","locale","small","small_text","zero","missing","mCols","target","sort","row_group","concat","idx","Array","from","_","b","va","vb","newPos","rows","r","sortByGroups","visible","align","colLabels","colWidths","indent","groups","rowSpans","styles","spanners","footnotes","fns","notes","header","hdr","onOp","t","rowGroupSep","rowGroupCols","isArray","auto_sep","some","hidden","g","hide","forEach","toMove","includes","rest","after","pos","indexOf","setByCol","arr","val","autoLbl","auto_label","entries","widths","w","fill","level","runs","out","label","push","ordered","order","gc","spans","auto_span","sep","RegExp","j","m2","k","mk","resolveSpec","reg","text","indexFootnotes","fIdx","loc","location","hit","group","values","startsWith","value","matcher","nGrp","nCol","mark","cell","attr","colCls","right","center","trimEnd","eachLoc","locCols","ci","styleMap","classMap","addTo","key","css","class","caption","cls","emptyTh","repeat","sp","rs","bodyMarks","fi","pushRow","span","ind","cc","Boolean","disp","tip","seen","footRow","html","txt","mount","insertAdjacentHTML","tbl","nextElementSibling","e","el","altKey","classList","toggle","onclick","detail","ondblclick","ownerDocument","documentElement","q","build","document","currentScript","window"],"sources":["lt.js"],"mappings":"AAIA,CAACA,IACC,aACA,GAAIA,EAAKC,IAAIC,UAAW,OAGxB,MAAMC,EAAMC,GAAKC,OAAOD,GACrBE,QAAQ,KAAM,SAASA,QAAQ,OAAQ,QACvCA,QAAQ,KAAM,QAAQA,QAAQ,KAAM,UACjCC,EAAMC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G,GAK1C,GAHA4C,EAAIE,KAAK,YAGLa,EAAIX,MAAMhJ,QAAU6G,EAAM7G,OAAQ,CACpC,MAAMyM,EAAU,CAACf,EAAKgB,IAAS,cAAchB,mBAAqBlB,MAASkC,cAC3E9D,EAAIE,KAAK,6BACTa,EAAIX,MAAMtB,QAAQ,CAACiF,EAAKlN,IAAMmJ,EAAIE,KAAK2D,EAAQ,cAAe,GAAGjN,EAAIC,EAAI,MAAML,EAAIuN,QACnF,IAAK,MAAMzJ,KAAK2D,EAAO+B,EAAIE,KAAK2D,EAAQ,iBAAkBrN,EAAI8D,KAC9D0F,EAAIE,KAAK,WACX,CAGA,OADAF,EAAIE,KAAK,YACFF,EAAIlI,KAAK,GAClB,CAEA,MAAMkM,EAAQ,CAACvN,EAAGuC,KAChBvC,EAAEwN,mBAAmB,WAAY1N,EAAUyC,IAC3C,MAAMkL,EAAMzN,EAAE0N,mBACR/I,EAAM,CAACgJ,EAAGC,IAAOD,EAAEE,QAAUD,EAAGE,UAAUC,OAAO,UACvDN,EAAIO,QAAUL,GAAkB,IAAbA,EAAEM,QAAgBtJ,EAAIgJ,EAAGF,GAC5CA,EAAIS,WAAaP,GAAKhJ,EAAIgJ,EAAGF,EAAIU,cAAcC,kBAG3CC,EAAI,CAAE5E,KAAMkE,GAAKJ,EAAMI,EAAE3N,EAAG2N,EAAEvJ,KACnCxE,EAAKC,IAAIwO,GAAK,IAAIhG,QAAQgG,EAAE5E,MAC7B7J,EAAKC,GAAK,CAAEyO,MAAO/L,GAAQgL,EAAMgB,SAASC,cAAejM,GAAOzC,YAAWuO,IAC5E,EA9hBD,CA8hBGI","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiee/utils",
3
- "version": "1.14.61",
3
+ "version": "1.14.63",
4
4
  "description": "Miscellaneous tools and utilities to manipulate HTML pages",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/lt.css DELETED
@@ -1,57 +0,0 @@
1
- th, td{ padding: 5px; }
2
- .lt-table {
3
- --bg: 4px solid transparent;
4
-
5
- border-collapse: separate;
6
- caption-side: top;
7
- margin: 1em auto;
8
- border-spacing: 0;
9
- border-top: 1.5px solid #888;
10
- border-bottom: 1.5px solid #888;
11
-
12
- caption {
13
- padding: .5em;
14
- text-align: center;
15
- .lt-title { font-size: 1.2em; }
16
- .lt-subtitle { font-size: 0.9em; }
17
- }
18
-
19
- th { font-weight: normal; }
20
- tbody {
21
- :not(:last-child) :is(td, th) { border-bottom: 1px solid #ddd; }
22
- .lt-row-group :is(td, th) { border-bottom: 1.5px solid #ddd; }
23
- .lt-row-group { text-align: left; }
24
- .lt-row-group { vertical-align: top; }
25
- }
26
- thead th {
27
- border-bottom: 1px solid #888;
28
- &:not(:first-child) { border-left: var(--bg); }
29
- &:not(:last-child) { border-right: var(--bg); }
30
- }
31
- .lt-indent { padding-left: 1em; }
32
- .lt-spanner-row {
33
- .lt-spanner { border-bottom: 1px solid #bbb; text-align: center; }
34
- .lt-spanner-empty { border-bottom: none; }
35
- }
36
-
37
- .lt-footer {
38
- font-size: 0.85em;
39
- .lt-footnote:first-child td { border-top: 1px solid #aaa; }
40
- .lt-source-note:first-child td { border-top: 1px dashed #aaa; }
41
- .lt-source-note td { font-style: italic; }
42
- }
43
-
44
- .al-r { text-align: right; }
45
- .al-c { text-align: center; }
46
-
47
- .lt-fnref {
48
- color: #06c;
49
- &::before { content: " ["; }
50
- &::after { content: "]"; }
51
- }
52
- }
53
- .lt-raw [title]::after {
54
- content: " (" attr(title) ")";
55
- background: lightyellow;
56
- font-size: 0.85em;
57
- }
package/lt.js DELETED
@@ -1,547 +0,0 @@
1
- /* lt.js — build a semantic <table> from a JSON spec.
2
- * Call LT.build(spec) from an inline <script> to render a table in place.
3
- * One runtime per page renders any number of tables.
4
- */
5
- (root => {
6
- "use strict";
7
- if (root.LT?.buildHtml) return; // duplicate inclusion is a no-op
8
-
9
- // `[<]` (not `<`) avoids `</…` so this file is safe to inline in <script>.
10
- const esc = s => String(s)
11
- .replace(/&/g, "&amp;").replace(/[<]/g, "&lt;")
12
- .replace(/>/g, "&gt;").replace(/"/g, "&quot;");
13
- const sup = i => `<sup class="lt-fnref">${i}</sup>`;
14
- // Stringify, mapping null/undefined to "" (0 and false stringify normally).
15
- const str = v => String(v ?? "");
16
-
17
- // --- Number formatting ---
18
- const isNum = v => typeof v === "number" && !isNaN(v);
19
- // A column is "numeric" if its first non-null value is a number.
20
- const numCol = col => col?.length && typeof col.find(v => v != null) === "number";
21
-
22
- function fmtNumber(v, decimals, bigMark) {
23
- if (!isNum(v)) return null;
24
- let s = decimals != null ? v.toFixed(decimals) : String(v);
25
- if (/^-0(\.0+)?$/.test(s)) s = s.slice(1);
26
- if (bigMark) {
27
- const parts = s.split(".");
28
- parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, bigMark);
29
- s = parts.join(".");
30
- }
31
- if (s[0] === "-") s = "−" + s.slice(1);
32
- return decimals != null || bigMark ? s : null;
33
- }
34
-
35
- // --- Pattern merge ---
36
- function mergeVals(vals, pattern) {
37
- if (!pattern) return vals.filter(v => v !== "").join(" ");
38
- let remaining = pattern, result = "";
39
- while (remaining) {
40
- const m = remaining.match(/<<(.*?)>>/);
41
- if (!m) { result += subRefs(remaining, vals); break; }
42
- if (m.index > 0) result += subRefs(remaining.slice(0, m.index), vals);
43
- const block = m[1],
44
- refs = [...block.matchAll(/\{(\d+)\}/g)].map(x => +x[1]);
45
- if (!refs.length || refs.every(i => vals[i - 1] !== ""))
46
- result += subRefs(block, vals);
47
- remaining = remaining.slice(m.index + m[0].length);
48
- }
49
- return result;
50
- }
51
- function subRefs(s, vals) {
52
- for (let i = 0; i < vals.length; i++)
53
- s = s.split("{" + (i + 1) + "}").join(vals[i]);
54
- return s;
55
- }
56
-
57
- // --- Auto-format numeric columns ---
58
- function autoFmt(spec, display, nRow) {
59
- if (spec.auto_format === false) return;
60
- const data = spec.data || {}, ops = spec.ops || [],
61
- colNames = Object.keys(data);
62
-
63
- const fmtCols = new Set();
64
- for (const op of ops) {
65
- if (op.type === "fmt_number") for (const c of (op.columns || colNames)) fmtCols.add(c);
66
- }
67
-
68
- const getLabel = c => {
69
- for (const op of ops) {
70
- if (op.type === "label" && op.labels?.[c] != null) return op.labels[c];
71
- }
72
- return c;
73
- };
74
-
75
- for (const c of colNames) {
76
- if (fmtCols.has(c)) continue;
77
- const col = data[c];
78
- if (!numCol(col)) continue;
79
-
80
- const lbl = getLabel(c),
81
- pct = /%|[ _](pct|percent)$/i.test(lbl);
82
-
83
- if (/year/i.test(lbl) && col.every(v => v == null || /^\d{4}$/.test(String(v)))) continue;
84
-
85
- // Determine decimal places: find max significant decimals across column,
86
- // then cap dynamically based on the largest integer-part width (targeting
87
- // ~4 total significant digits): e.g., values <1 get up to 4 decimals,
88
- // 10-99 get 2, >=1000 get 0.
89
- let maxInt = 0, n = 0;
90
- for (const v of col) {
91
- if (!isNum(v)) continue;
92
- // Number of digits before the decimal point
93
- const a = Math.abs(pct ? v * 100 : v),
94
- intW = a < 1 ? 0 : Math.floor(Math.log10(a)) + 1;
95
- if (intW > maxInt) maxInt = intW;
96
- // Significant decimals (strip trailing zeros; adjust for pct *100)
97
- const m = String(v).match(/\.(\d+)/);
98
- if (!m) continue;
99
- const d = m[1].replace(/0+$/, "").length - (pct ? 2 : 0);
100
- if (d > n) n = d;
101
- }
102
- // Cap: 4 decimals max, minus integer width (so large numbers get fewer).
103
- // n is already >= 0, so only the upper cap is needed.
104
- n = Math.min(n, Math.max(4 - maxInt, 0));
105
-
106
- for (let i = 0; i < nRow; i++) {
107
- const v = col[i];
108
- if (!isNum(v)) continue;
109
- const s = fmtNumber(pct ? v * 100 : v, n, " ");
110
- if (s != null) display[c][i] = s + (pct ? "%" : "");
111
- }
112
- }
113
- }
114
-
115
- // --- Apply ops to data columns, return display strings per column ---
116
- function applyOps(spec) {
117
- const data = spec.data || {},
118
- ops = spec.ops || [],
119
- colNames = Object.keys(data),
120
- nRow = colNames.length ? data[colNames[0]].length : 0;
121
-
122
- // Working copy: display[col][row] = string
123
- const display = {};
124
- for (const c of colNames) {
125
- display[c] = data[c].map(str);
126
- }
127
-
128
- autoFmt(spec, display, nRow);
129
-
130
- // Run fn(col, row, rawValue) over each existing cell of the given columns.
131
- const eachCell = (cols, fn) => {
132
- for (const c of cols) {
133
- if (!data[c]) continue;
134
- for (let i = 0; i < nRow; i++) fn(c, i, data[c][i]);
135
- }
136
- };
137
-
138
- for (const op of ops) {
139
- const cols = op.columns || colNames;
140
- switch (op.type) {
141
- case "fmt_number":
142
- eachCell(cols, (c, i, raw) => {
143
- if (!isNum(raw)) return;
144
- const v = op.percent === true ? raw * 100 : raw,
145
- psfx = op.percent ? "%" : "",
146
- f = fmtNumber(v, op.decimals, op.big_mark ?? ""),
147
- pfx = op.prefix || "", sfx = (op.suffix || "") + psfx;
148
- if (f != null) display[c][i] = pfx + f + sfx;
149
- else if (pfx || sfx) display[c][i] = pfx + String(v) + sfx;
150
- });
151
- break;
152
- case "fmt_date":
153
- eachCell(cols, (c, i, raw) => {
154
- if (raw == null) return;
155
- const d = raw instanceof Date ? raw : new Date(raw);
156
- if (isNaN(d)) return;
157
- display[c][i] = op.method ? d[op.method]() :
158
- op.options ? d.toLocaleDateString(op.locale, op.options) :
159
- d.toLocaleDateString(op.locale);
160
- });
161
- break;
162
- case "sub":
163
- eachCell(cols, (c, i, raw) => {
164
- if (op.small != null && isNum(raw) && raw !== 0 &&
165
- Math.abs(raw) < op.small) {
166
- display[c][i] = op.small_text ?? ("<" + op.small);
167
- } else if (op.zero != null && raw === 0) {
168
- display[c][i] = op.zero;
169
- } else if (op.missing != null && raw == null) {
170
- display[c][i] = op.missing;
171
- }
172
- });
173
- break;
174
- case "merge": {
175
- const mCols = op.columns;
176
- if (!mCols || mCols.length < 2) break;
177
- const target = mCols[0];
178
- for (let i = 0; i < nRow; i++) {
179
- const vals = mCols.map(c => display[c]?.[i] ?? "");
180
- display[target][i] = mergeVals(vals, op.pattern);
181
- }
182
- break;
183
- }
184
- }
185
- }
186
- return { display, nRow };
187
- }
188
-
189
- // --- Resolve structural spec fields from ops + data ---
190
- function resolveSpec(spec) {
191
- const data = spec.data || {},
192
- ops = spec.ops || [],
193
- colNames = Object.keys(data),
194
- nRow = colNames.length ? data[colNames[0]].length : 0,
195
- // Run fn on each op of the given type, in document order.
196
- onOp = (t, fn) => { for (const op of ops) if (op.type === t) fn(op); };
197
-
198
- // row_group: array → rowspan mode; string → separator-row mode
199
- let rowGroupSep = typeof spec.row_group === "string";
200
- const rowGroupCols = Array.isArray(spec.row_group) ? spec.row_group
201
- : (spec.row_group ? [spec.row_group] : []);
202
- if (!rowGroupSep && rowGroupCols.length === 1 && spec.auto_sep !== false &&
203
- !numCol(data[rowGroupCols[0]]) &&
204
- data[rowGroupCols[0]]?.some(v => (v + "").length > 20)) rowGroupSep = true;
205
-
206
- // Hidden columns: row_group, merge sources
207
- const hidden = new Set();
208
- for (const g of rowGroupCols) hidden.add(g);
209
- onOp("merge", op => {
210
- if (op.hide !== false && op.columns)
211
- op.columns.slice(1).forEach(c => hidden.add(c));
212
- });
213
-
214
- // Visible columns after hiding
215
- let visible = colNames.filter(c => !hidden.has(c));
216
-
217
- // Apply move
218
- onOp("move", op => {
219
- const toMove = (op.columns || []).filter(c => visible.includes(c));
220
- if (!toMove.length) return;
221
- const rest = visible.filter(c => !toMove.includes(c));
222
- if (op.after == null) {
223
- visible = [...toMove, ...rest];
224
- } else {
225
- const pos = rest.indexOf(op.after);
226
- if (pos >= 0) visible = [...rest.slice(0, pos + 1), ...toMove, ...rest.slice(pos + 1)];
227
- }
228
- });
229
-
230
- // Set arr[i] = val where i is the position of column c in `visible`.
231
- const setByCol = (arr, c, val) => { const i = visible.indexOf(c); if (i >= 0) arr[i] = val; };
232
-
233
- // Alignment: default from data type (number→right, else left), then overrides
234
- const align = visible.map(c => numCol(data[c]) ? "right" : "left");
235
- onOp("align", op => { for (const c of (op.columns || [])) setByCol(align, c, op.align); });
236
-
237
- // Column labels
238
- const autoLbl = s => spec.auto_label === false ? s : s.replace(/[._]/g, " ");
239
- const colLabels = visible.map(autoLbl);
240
- onOp("label", op => {
241
- for (const [c, lbl] of Object.entries(op.labels || {})) setByCol(colLabels, c, lbl);
242
- });
243
-
244
- // Column widths
245
- let colWidths = null;
246
- onOp("width", op => {
247
- if (!op.widths) return;
248
- if (!colWidths) colWidths = visible.map(() => "");
249
- for (const [c, w] of Object.entries(op.widths)) setByCol(colWidths, c, w);
250
- });
251
-
252
- // Indent
253
- const indent = new Array(nRow).fill(0);
254
- onOp("indent", op => {
255
- if (op.rows) for (const r of op.rows) indent[r - 1] = op.level ?? 1;
256
- });
257
-
258
- // Runs of equal consecutive values in col → [{ label, rows (1-based) }].
259
- // Used for both separator-row groups and rowspan span sizes.
260
- const runs = col => {
261
- const out = [];
262
- for (let i = 0; i < nRow;) {
263
- const label = str(col[i]), rows = [i + 1];
264
- while (++i < nRow && str(col[i]) === label) rows.push(i + 1);
265
- out.push({ label, rows });
266
- }
267
- return out;
268
- };
269
-
270
- // Row groups from data column (separator-row mode only)
271
- let groups = [];
272
- if (rowGroupSep && rowGroupCols.length && data[rowGroupCols[0]])
273
- groups.push(...runs(data[rowGroupCols[0]]));
274
- // Manual groups
275
- onOp("row_group", op => groups.push({ label: op.label, rows: op.rows }));
276
- // Group ordering
277
- onOp("group_order", op => {
278
- if (!groups.length) return;
279
- const ordered = [], rest = [];
280
- for (const lbl of (op.order || [])) {
281
- const g = groups.find(x => x.label === lbl);
282
- if (g) ordered.push(g);
283
- }
284
- for (const g of groups) if (!ordered.includes(g)) rest.push(g);
285
- groups = [...ordered, ...rest];
286
- });
287
-
288
- // Rowspan groups: compute span sizes for each group column
289
- const rowSpans = [];
290
- if (!rowGroupSep && rowGroupCols.length) {
291
- for (const gc of rowGroupCols) {
292
- const spans = new Array(nRow).fill(0);
293
- for (const r of runs(data[gc] || [])) spans[r.rows[0] - 1] = r.rows.length;
294
- // Resolve display label from label ops (last wins)
295
- let hdr = gc;
296
- onOp("label", op => { if (op.labels?.[gc] != null) hdr = op.labels[gc]; });
297
- rowSpans.push({ col: gc, label: hdr, spans });
298
- }
299
- }
300
-
301
- // Styles: the style ops are consumed directly (css/class/columns/rows/test).
302
- const styles = ops.filter(op => op.type === "style");
303
-
304
- // Auto-spanners: split column names on separator, group contiguous prefixes
305
- let spanners = spec.spanners || [];
306
- if (spec.auto_span) {
307
- const sep = typeof spec.auto_span === "string" ? new RegExp(spec.auto_span) : /[._]/;
308
- spanners = [...spanners];
309
- for (let i = 0; i < visible.length;) {
310
- const m = visible[i].match(sep);
311
- if (!m) { i++; continue; }
312
- const prefix = visible[i].slice(0, m.index);
313
- let j = i + 1;
314
- while (j < visible.length) {
315
- const m2 = visible[j].match(sep);
316
- if (!m2 || visible[j].slice(0, m2.index) !== prefix) break;
317
- j++;
318
- }
319
- if (j - i >= 2) {
320
- spanners.push({ label: prefix, columns: visible.slice(i, j) });
321
- for (let k = i; k < j; k++) {
322
- const mk = visible[k].match(sep);
323
- if (mk) colLabels[k] = autoLbl(visible[k].slice(mk.index + mk[0].length));
324
- }
325
- }
326
- i = j;
327
- }
328
- }
329
-
330
- return {
331
- visible, align, colLabels, colWidths, indent,
332
- groups, rowSpans, styles, spanners,
333
- footnotes: spec.footnotes || [],
334
- notes: spec.notes || [],
335
- header: spec.header || {},
336
- nRow
337
- };
338
- }
339
-
340
- // Footnotes: dedup by text, assign 1..N in first-seen order.
341
- function indexFootnotes(fns) {
342
- const order = [], idx = {};
343
- fns.forEach(f => {
344
- if (idx[f.text] == null) { idx[f.text] = order.length + 1; order.push(f.text); }
345
- });
346
- return { order, idx };
347
- }
348
-
349
- // Find the footnote index for a (type, value) location; 0 if none.
350
- // `val` is a scalar: the title group, a single column, a spanner label,
351
- // or a row-group label, depending on `type`.
352
- const matcher = (fns, idx) => (type, val) => {
353
- for (const f of fns) {
354
- const loc = f.location;
355
- if (loc.type !== type) continue;
356
- const hit = idx[f.text];
357
- if (type === "title" && loc.group === val) return hit;
358
- if (type === "column_labels" && loc.columns.includes(val)) return hit;
359
- if (type === "column_spanners" && loc.spanners.includes(val)) return hit;
360
- if (type === "row_groups") {
361
- if (loc.match === "all") return hit;
362
- if (loc.match === "exact" && loc.values.includes(val)) return hit;
363
- if (loc.match === "starts_with" && val.startsWith(loc.value)) return hit;
364
- }
365
- }
366
- return 0;
367
- };
368
-
369
- function sortByGroups(spec) {
370
- if (spec.sort === false || !spec.row_group) return;
371
- const data = spec.data || {},
372
- cols = [].concat(spec.row_group),
373
- colNames = Object.keys(data),
374
- nRow = colNames.length ? data[colNames[0]].length : 0;
375
- if (!nRow) return;
376
- const idx = Array.from({length: nRow}, (_, i) => i);
377
- idx.sort((a, b) => {
378
- for (const c of cols) {
379
- const va = data[c]?.[a], vb = data[c]?.[b];
380
- if (va == vb) continue;
381
- if (va == null) return 1;
382
- if (vb == null) return -1;
383
- if (va < vb) return -1;
384
- if (va > vb) return 1;
385
- }
386
- return 0;
387
- });
388
- for (const c of colNames) data[c] = idx.map(i => data[c][i]);
389
- // Remap 1-based row indices in ops to reflect the new order
390
- const newPos = new Array(nRow);
391
- for (let i = 0; i < nRow; i++) newPos[idx[i]] = i + 1;
392
- for (const op of (spec.ops || [])) {
393
- if (op.rows) op.rows = op.rows.map(r => newPos[r - 1]);
394
- }
395
- }
396
-
397
- function buildHtml(spec) {
398
- sortByGroups(spec);
399
- const data = spec.data || {},
400
- { display, nRow } = applyOps(spec),
401
- { visible: cols, align, colLabels, colWidths, indent,
402
- groups, rowSpans, styles, spanners, footnotes: fns, notes, header: hdr } = resolveSpec(spec),
403
- reg = indexFootnotes(fns),
404
- fIdx = matcher(fns, reg.idx),
405
- nGrp = rowSpans.length,
406
- nCol = cols.length + nGrp,
407
- out = [`<table class="lt-table">`];
408
- const mark = (type, val) => { const i = fIdx(type, val); return i ? sup(i) : ""; };
409
- const cell = (c, r) => display[c]?.[r - 1] ?? "";
410
- // ` name="val"` for a truthy val, else "" — for optional HTML attributes.
411
- const attr = (n, v) => v ? ` ${n}="${v}"` : "";
412
- // Plain class names per column (alignment + leading-indent), "" if none.
413
- const colCls = cols.map((_, i) => (
414
- (i === 0 && groups.length ? "lt-indent " : "") +
415
- ({right: "al-r", center: "al-c"}[align[i]] || "")
416
- ).trimEnd());
417
-
418
- // Visit each cell at (rows × cols) that exists in the table, calling
419
- // fn(key, c, r). rows null = all rows; cols falls back to all columns.
420
- const eachLoc = (rows, locCols, fn) => {
421
- for (let r = 1; r <= nRow; r++) {
422
- if (rows && !rows.includes(r)) continue;
423
- for (const c of (locCols || cols)) {
424
- const ci = cols.indexOf(c);
425
- if (ci >= 0) fn(`${r},${ci}`, c, r);
426
- }
427
- }
428
- };
429
-
430
- // Style map: accumulate css (";") and class (" ") per cell.
431
- const styleMap = {}, classMap = {};
432
- const addTo = (map, key, val, sep) => { map[key] = map[key] ? map[key] + sep + val : val; };
433
- for (const s of styles)
434
- eachLoc(s.rows, s.columns ? [].concat(s.columns) : null, (key, c, r) => {
435
- if (s.test && !s.test(data[c][r - 1])) return;
436
- if (s.css) addTo(styleMap, key, s.css, ";");
437
- if (s.class) addTo(classMap, key, s.class, " ");
438
- });
439
-
440
- // <colgroup>
441
- if (colWidths && colWidths.some(w => w)) {
442
- out.push(`<colgroup>`);
443
- for (let i = 0; i < cols.length; i++)
444
- out.push(`<col${attr("style", colWidths[i] ? "width:" + colWidths[i] : "")}>`);
445
- out.push(`</colgroup>`);
446
- }
447
-
448
- // <caption>: title + subtitle, each a <div> rendered only when non-empty.
449
- const caption = [["title", "lt-title"], ["subtitle", "lt-subtitle"]]
450
- .filter(([g]) => hdr[g] != null && hdr[g] !== "")
451
- .map(([g, cls]) => `<div class="${cls}">${esc(hdr[g])}${mark("title", g)}</div>`);
452
- if (caption.length)
453
- out.push(`<caption class="lt-caption">`, ...caption, `</caption>`);
454
-
455
- // <thead>
456
- out.push(`<thead>`);
457
- if (spanners.length) {
458
- const emptyTh = `<th class="lt-spanner-empty"></th>`;
459
- out.push(`<tr class="lt-spanner-row">`);
460
- out.push(emptyTh.repeat(nGrp));
461
- for (let k = 0; k < cols.length;) {
462
- const sp = spanners.find(s => s.columns[0] === cols[k]);
463
- if (sp) {
464
- out.push(`<th colspan="${sp.columns.length}" scope="colgroup" class="lt-spanner">${esc(sp.label)}${mark("column_spanners", sp.label)}</th>`);
465
- k += sp.columns.length;
466
- } else {
467
- out.push(emptyTh);
468
- k++;
469
- }
470
- }
471
- out.push(`</tr>`);
472
- }
473
- out.push(`<tr>`);
474
- for (const rs of rowSpans) out.push(`<th scope="col">${esc(rs.label)}</th>`);
475
- for (let i = 0; i < cols.length; i++)
476
- out.push(`<th scope="col"${attr("class", colCls[i])}>${esc(colLabels[i])}${mark("column_labels", cols[i])}</th>`);
477
- out.push(`</tr></thead>`);
478
-
479
- // Body footnote markers
480
- const bodyMarks = {};
481
- for (const f of fns) {
482
- if (f.location.type !== "body") continue;
483
- const fi = reg.idx[f.text];
484
- eachLoc(f.location.rows, f.location.columns || [], key => { bodyMarks[key] = fi; });
485
- }
486
-
487
- // Row rendering
488
- const pushRow = r => {
489
- out.push(`<tr>`);
490
- // Rowspan group cells
491
- for (const rs of rowSpans) {
492
- const span = rs.spans[r - 1];
493
- if (span > 0) out.push(`<th scope="row" class="lt-row-group"${attr("rowspan", span > 1 ? span : 0)}>${esc(cell(rs.col, r))}</th>`);
494
- }
495
- const ind = indent[r - 1] || 0;
496
- for (let ci = 0; ci < cols.length; ci++) {
497
- const k = `${r},${ci}`, c = cols[ci],
498
- m = bodyMarks[k], cc = classMap[k],
499
- cls = [colCls[ci], cc].filter(Boolean).join(" ");
500
- let s = styleMap[k] || "";
501
- if (ci === 0 && ind) s = (s ? s + ";" : "") + `padding-left:${ind + 1}em`;
502
- const raw = str(data[c][r - 1]), disp = display[c][r - 1],
503
- tip = raw !== disp ? ` title="${esc(raw)}"` : "";
504
- out.push(`<td${attr("class", cls)}${attr("style", s)}${tip}>${esc(disp)}${m ? sup(m) : ""}</td>`);
505
- }
506
- out.push(`</tr>`);
507
- };
508
-
509
- // <tbody>
510
- out.push(`<tbody>`);
511
- if (groups.length) {
512
- const seen = {};
513
- for (const g of groups) {
514
- out.push(`<tr class="lt-row-group"><th colspan="${nCol}" scope="colgroup">${esc(g.label)}${mark("row_groups", g.label)}</th></tr>`);
515
- for (const r of g.rows) { seen[r] = 1; pushRow(r); }
516
- }
517
- for (let r = 1; r <= nRow; r++) if (!seen[r]) pushRow(r);
518
- } else {
519
- for (let r = 1; r <= nRow; r++) pushRow(r);
520
- }
521
- out.push(`</tbody>`);
522
-
523
- // <tfoot>: footnotes then source notes, each a full-width row.
524
- if (reg.order.length || notes.length) {
525
- const footRow = (cls, html) => `<tr class="${cls}"><td colspan="${nCol}">${html}</td></tr>`;
526
- out.push(`<tfoot class="lt-footer">`);
527
- reg.order.forEach((txt, i) => out.push(footRow("lt-footnote", `${sup(i + 1)} ${esc(txt)}`)));
528
- for (const n of notes) out.push(footRow("lt-source-note", esc(n)));
529
- out.push(`</tfoot>`);
530
- }
531
-
532
- out.push(`</table>`);
533
- return out.join("");
534
- }
535
-
536
- const mount = (s, spec) => {
537
- s.insertAdjacentHTML("afterend", buildHtml(spec));
538
- const tbl = s.nextElementSibling,
539
- raw = (e, el) => e.altKey && el.classList.toggle("lt-raw");
540
- tbl.onclick = e => e.detail === 1 && raw(e, tbl);
541
- tbl.ondblclick = e => raw(e, tbl.ownerDocument.documentElement);
542
- };
543
- // q.push renders immediately; replay any entries queued before we loaded.
544
- const q = { push: e => mount(e.s, e.d) };
545
- (root.LT?.q || []).forEach(q.push);
546
- root.LT = { build: spec => mount(document.currentScript, spec), buildHtml, q };
547
- })(window);