datalog-theme 0.6.1 → 0.7.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +50 -0
- data/CITATION.cff +2 -2
- data/README.md +3 -2
- data/_data/js_meta.json +29 -29
- data/_includes/components/author-bio.html +2 -2
- data/_includes/components/hero.html +19 -1
- data/_includes/head.html +5 -10
- data/_includes/header.html +1 -1
- data/_includes/meta/math-config.html +23 -1
- data/_includes/meta/scripts-loader.html +2 -1
- data/_includes/meta/syntax-config.html +19 -0
- data/_includes/scripts.html +1 -9
- data/_includes/search/index-data.json +156 -0
- data/_includes/search/page.html +136 -0
- data/_layouts/home.html +6 -0
- data/_plugins/math_preprocessor.rb +3 -0
- data/_plugins/notebook_converter.rb +0 -39
- data/_plugins/search_pages.rb +73 -0
- data/_sass/_base.scss +7 -1
- data/_sass/_components.scss +25 -3
- data/_sass/_font-fallbacks.scss +43 -0
- data/_sass/_header.scss +10 -0
- data/_sass/_layout.scss +17 -11
- data/_sass/_mathematical.scss +1 -1
- data/_sass/_phase1-enhancements.scss +45 -0
- data/_sass/_search.scss +1 -1
- data/_sass/_syntax-highlighting.scss +2 -2
- data/_sass/_theme.scss +14 -0
- data/_sass/_variables.scss +7 -4
- data/assets/img/hero-detail-640.webp +0 -0
- data/assets/img/hero-detail.webp +0 -0
- data/assets/img/social-card.png +0 -0
- data/assets/js/dist/academic.js +1 -0
- data/assets/js/dist/analytics-dashboard.js +1 -0
- data/assets/js/dist/core.js +1 -0
- data/assets/js/dist/loader.js +1 -0
- data/assets/js/dist/manifest.json +22 -0
- data/assets/js/dist/math.js +1 -0
- data/assets/js/dist/meta.json +371 -0
- data/assets/js/dist/notebook.js +1 -0
- data/assets/js/dist/search.js +1 -0
- data/assets/js/dist/visualizations.js +2 -0
- data/assets/js/search/filters.js +9 -2
- data/datalog-theme.gemspec +10 -2
- data/lib/datalog/cli.rb +19 -1
- data/lib/datalog/theme/version.rb +1 -1
- data/lib/datalog-theme.rb +16 -0
- metadata +34 -20
- data/_data/config/features.yml +0 -262
- data/_data/config/site.yml +0 -42
- data/_data/config/theme.yml +0 -181
- data/assets/img/20220607123041_detail.001.png +0 -0
data/_sass/_layout.scss
CHANGED
|
@@ -278,6 +278,12 @@ body.dark-mode .footer {
|
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
+
// body.dark-mode a outranks the rule above; on the navy footer the dark
|
|
282
|
+
// accent needs the lighter shade to reach 4.5:1 through the muted paragraphs.
|
|
283
|
+
body.dark-mode & a {
|
|
284
|
+
color: #93c5fd;
|
|
285
|
+
}
|
|
286
|
+
|
|
281
287
|
p {
|
|
282
288
|
margin: 0 0 map.get($spacing, 2);
|
|
283
289
|
}
|
|
@@ -359,7 +365,7 @@ body.dark-mode .footer {
|
|
|
359
365
|
|
|
360
366
|
.footer-privacy-note {
|
|
361
367
|
font-size: map.get($font-size-scale, xs);
|
|
362
|
-
opacity: 0.
|
|
368
|
+
opacity: 0.8;
|
|
363
369
|
margin-top: map.get($spacing, 1);
|
|
364
370
|
}
|
|
365
371
|
|
|
@@ -369,7 +375,7 @@ body.dark-mode .footer {
|
|
|
369
375
|
|
|
370
376
|
.footer-affiliation {
|
|
371
377
|
display: block;
|
|
372
|
-
opacity: 0.
|
|
378
|
+
opacity: 0.85;
|
|
373
379
|
font-size: map.get($font-size-scale, xs);
|
|
374
380
|
}
|
|
375
381
|
|
|
@@ -377,12 +383,12 @@ body.dark-mode .footer {
|
|
|
377
383
|
.footer-orcid,
|
|
378
384
|
.footer-contact {
|
|
379
385
|
font-size: map.get($font-size-scale, xs);
|
|
380
|
-
opacity: 0.
|
|
386
|
+
opacity: 0.85;
|
|
381
387
|
}
|
|
382
388
|
|
|
383
389
|
.footer-tagline {
|
|
384
390
|
font-style: italic;
|
|
385
|
-
opacity: 0.
|
|
391
|
+
opacity: 0.85;
|
|
386
392
|
}
|
|
387
393
|
|
|
388
394
|
.footer-feeds {
|
|
@@ -395,7 +401,7 @@ body.dark-mode .footer {
|
|
|
395
401
|
border-top: 1px solid rgba(#fff, 0.1);
|
|
396
402
|
text-align: center;
|
|
397
403
|
font-size: map.get($font-size-scale, xs);
|
|
398
|
-
opacity: 0.
|
|
404
|
+
opacity: 0.8;
|
|
399
405
|
|
|
400
406
|
p { margin: 0; }
|
|
401
407
|
}
|
|
@@ -470,7 +476,7 @@ body.dark-mode .research-metrics {
|
|
|
470
476
|
transition: border-color $transition-base;
|
|
471
477
|
|
|
472
478
|
h3 {
|
|
473
|
-
color: $color-accent-secondary;
|
|
479
|
+
color: $color-accent-secondary-text;
|
|
474
480
|
margin: 0;
|
|
475
481
|
}
|
|
476
482
|
|
|
@@ -480,7 +486,7 @@ body.dark-mode .research-metrics {
|
|
|
480
486
|
|
|
481
487
|
&:hover {
|
|
482
488
|
border-color: rgba($color-accent-secondary, 0.4);
|
|
483
|
-
h3 { color: $color-accent-secondary; }
|
|
489
|
+
h3 { color: $color-accent-secondary-text; }
|
|
484
490
|
}
|
|
485
491
|
}
|
|
486
492
|
|
|
@@ -640,7 +646,7 @@ body.dark-mode .author-profile__bio {
|
|
|
640
646
|
|
|
641
647
|
.skill-tag--framework {
|
|
642
648
|
background: rgba($color-accent-secondary, 0.08);
|
|
643
|
-
color: $color-accent-secondary;
|
|
649
|
+
color: $color-accent-secondary-text;
|
|
644
650
|
}
|
|
645
651
|
|
|
646
652
|
.skill-tag--tool {
|
|
@@ -926,7 +932,7 @@ body.dark-mode .post-meta {
|
|
|
926
932
|
padding: 0.1rem 0.5rem;
|
|
927
933
|
border-radius: map.get($radius, sm);
|
|
928
934
|
background: rgba($color-accent-secondary, 0.1);
|
|
929
|
-
color: $color-accent-secondary;
|
|
935
|
+
color: $color-accent-secondary-text;
|
|
930
936
|
}
|
|
931
937
|
|
|
932
938
|
body.dark-mode .post-meta__badge {
|
|
@@ -1066,7 +1072,7 @@ body.dark-mode .post-tag {
|
|
|
1066
1072
|
|
|
1067
1073
|
.post-category {
|
|
1068
1074
|
background: rgba($color-accent-secondary, 0.08);
|
|
1069
|
-
color: $color-accent-secondary;
|
|
1075
|
+
color: $color-accent-secondary-text;
|
|
1070
1076
|
|
|
1071
1077
|
&:hover { background: rgba($color-accent-secondary, 0.15); }
|
|
1072
1078
|
}
|
|
@@ -1166,7 +1172,7 @@ body.dark-mode .code-block-meta {
|
|
|
1166
1172
|
.code-language {
|
|
1167
1173
|
font-family: $font-family-mono;
|
|
1168
1174
|
font-weight: 600;
|
|
1169
|
-
color: $color-accent-secondary;
|
|
1175
|
+
color: $color-accent-secondary-text;
|
|
1170
1176
|
letter-spacing: 0.03em;
|
|
1171
1177
|
}
|
|
1172
1178
|
|
data/_sass/_mathematical.scss
CHANGED
|
@@ -545,6 +545,51 @@
|
|
|
545
545
|
}
|
|
546
546
|
}
|
|
547
547
|
|
|
548
|
+
// Dark mode previously darkened only the badge background, leaving the level
|
|
549
|
+
// colours (dark blue, dark green, dark red) on a near-black pill: the
|
|
550
|
+
// intermediate badge measured 1.93:1. These invert the pairing instead.
|
|
551
|
+
body.dark-mode .difficulty-badge {
|
|
552
|
+
&--beginner {
|
|
553
|
+
background-color: rgba(16, 185, 129, 0.15);
|
|
554
|
+
color: #6ee7b7;
|
|
555
|
+
border-color: rgba(16, 185, 129, 0.4);
|
|
556
|
+
|
|
557
|
+
&:hover {
|
|
558
|
+
background-color: rgba(16, 185, 129, 0.25);
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
&--intermediate {
|
|
563
|
+
background-color: rgba(59, 130, 246, 0.15);
|
|
564
|
+
color: #93c5fd;
|
|
565
|
+
border-color: rgba(59, 130, 246, 0.4);
|
|
566
|
+
|
|
567
|
+
&:hover {
|
|
568
|
+
background-color: rgba(59, 130, 246, 0.25);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
&--advanced {
|
|
573
|
+
background-color: rgba(249, 115, 22, 0.15);
|
|
574
|
+
color: #fdba74;
|
|
575
|
+
border-color: rgba(249, 115, 22, 0.4);
|
|
576
|
+
|
|
577
|
+
&:hover {
|
|
578
|
+
background-color: rgba(249, 115, 22, 0.25);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
&--expert {
|
|
583
|
+
background-color: rgba(239, 68, 68, 0.15);
|
|
584
|
+
color: #fca5a5;
|
|
585
|
+
border-color: rgba(239, 68, 68, 0.4);
|
|
586
|
+
|
|
587
|
+
&:hover {
|
|
588
|
+
background-color: rgba(239, 68, 68, 0.25);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
|
|
548
593
|
// ============================================================================
|
|
549
594
|
// Print Styles
|
|
550
595
|
// ============================================================================
|
data/_sass/_search.scss
CHANGED
|
@@ -460,7 +460,7 @@ body.dark-mode .search-result:focus-within .search-result__card {
|
|
|
460
460
|
padding: 0.1rem 0.5rem;
|
|
461
461
|
border-radius: map.get($radius, sm);
|
|
462
462
|
background: rgba($color-accent-secondary, 0.1);
|
|
463
|
-
color: $color-accent-secondary;
|
|
463
|
+
color: $color-accent-secondary-text;
|
|
464
464
|
font-weight: 600;
|
|
465
465
|
text-transform: capitalize;
|
|
466
466
|
}
|
|
@@ -44,7 +44,7 @@ pre[class*='language-'] {
|
|
|
44
44
|
|
|
45
45
|
.token.boolean,
|
|
46
46
|
.token.number {
|
|
47
|
-
color: $color-accent-secondary;
|
|
47
|
+
color: $color-accent-secondary-text;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
.token.selector,
|
|
@@ -66,7 +66,7 @@ pre[class*='language-'] {
|
|
|
66
66
|
.token.atrule,
|
|
67
67
|
.token.attr-value,
|
|
68
68
|
.token.keyword {
|
|
69
|
-
color: $color-accent-secondary;
|
|
69
|
+
color: $color-accent-secondary-text;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
.token.function,
|
data/_sass/_theme.scss
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
// Each partial below MUST import its own tokens if it references them.
|
|
9
9
|
// `@use` here does NOT leak variables into those files' scopes.
|
|
10
|
+
@use 'font-fallbacks';
|
|
10
11
|
@use 'base';
|
|
11
12
|
@use 'typography';
|
|
12
13
|
@use 'layout';
|
|
@@ -46,6 +47,14 @@
|
|
|
46
47
|
|
|
47
48
|
// Border colors
|
|
48
49
|
--color-border: #{$color-neutral-200};
|
|
50
|
+
// Aliases used by components written against a different token
|
|
51
|
+
// vocabulary. Without them every var() fell back to a light literal,
|
|
52
|
+
// which dark mode could not override.
|
|
53
|
+
--surface-card: #ffffff;
|
|
54
|
+
--surface-elevated: #{$color-surface-100};
|
|
55
|
+
--muted-foreground: #{$color-ink-500};
|
|
56
|
+
--accent: #{$color-accent-primary};
|
|
57
|
+
--accent-foreground: #ffffff;
|
|
49
58
|
|
|
50
59
|
// Typography
|
|
51
60
|
--max-width-reading: #{$max-width-reading};
|
|
@@ -76,4 +85,9 @@ body.dark-mode {
|
|
|
76
85
|
|
|
77
86
|
// Border colors
|
|
78
87
|
--color-border: #{$dark-surface-300};
|
|
88
|
+
--surface-card: #{$dark-surface-300};
|
|
89
|
+
--surface-elevated: #{$dark-surface-200};
|
|
90
|
+
--muted-foreground: #{$dark-ink-500};
|
|
91
|
+
--accent: #{$dark-accent-primary};
|
|
92
|
+
--accent-foreground: #{$dark-surface-100};
|
|
79
93
|
}
|
data/_sass/_variables.scss
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
// Font families
|
|
5
5
|
// IBM Plex — designed for technical and data-driven content
|
|
6
|
-
$font-family-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
|
|
7
|
-
$font-family-serif: 'IBM Plex Serif', Georgia, serif;
|
|
8
|
-
$font-family-mono: 'IBM Plex Mono', 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
|
|
6
|
+
$font-family-sans: 'IBM Plex Sans', 'IBM Plex Sans Fallback', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
|
|
7
|
+
$font-family-serif: 'IBM Plex Serif', 'IBM Plex Serif Fallback', 'IBM Plex Serif Fallback Times', Georgia, serif;
|
|
8
|
+
$font-family-mono: 'IBM Plex Mono', 'IBM Plex Mono Fallback', 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
|
|
9
9
|
$font-stack-code: $font-family-mono !default;
|
|
10
10
|
$font-stack-sans: $font-family-sans !default;
|
|
11
11
|
$font-stack-serif: $font-family-serif !default;
|
|
@@ -41,7 +41,10 @@ $color-ink-400: #a1a1aa !default;
|
|
|
41
41
|
$color-ink-600: #57534e !default;
|
|
42
42
|
$color-ink-800: #292524 !default;
|
|
43
43
|
$color-accent-primary: #2563eb; // vivid blue — links, primary actions
|
|
44
|
-
$color-accent-secondary: #0d9488; // teal —
|
|
44
|
+
$color-accent-secondary: #0d9488; // teal — fills, borders and other non-text accents
|
|
45
|
+
// #0d9488 reaches only 3.1:1 to 3.7:1 against white and against its own
|
|
46
|
+
// tinted backgrounds, so it fails WCAG AA wherever it is used as text.
|
|
47
|
+
$color-accent-secondary-text: #115e59; // teal — the same accent as readable text
|
|
45
48
|
$color-accent-tertiary: #7c3aed; // purple — charts, visual accents
|
|
46
49
|
$color-success: #16a34a;
|
|
47
50
|
$color-warning: #d97706;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function u(){let e=window.DatalogAcademic||{},a=window.DatalogPublications||{},t=a.metrics||(e.citations?e.citations.metrics:{})||{},o=a.yearly_totals||(e.citations?e.citations.yearly_totals:{})||{};document.querySelectorAll("[data-citation-metric]").forEach(i=>{let c=i.getAttribute("data-citation-metric");if(!c)return;let n;switch(c){case"total":n=t.total;break;case"h_index":case"h-index":n=t.h_index;break;case"i10_index":case"i10-index":n=t.i10_index;break;case"since_total":n=t.since_2019?t.since_2019.total:void 0;break;case"since_h_index":n=t.since_2019?t.since_2019.h_index:void 0;break;case"since_i10":n=t.since_2019?t.since_2019.i10_index:void 0;break;default:if(c.startsWith("year_")){let s=c.replace("year_","");n=o[s]}break}typeof n=="number"?i.textContent=n.toLocaleString():n&&(i.textContent=n)})}function f(){let e=window.DatalogAcademic||{},t=(window.DatalogPublications||{}).citation_totals||(e.citations?e.citations.per_publication:{})||{};document.querySelectorAll("[data-publication-citations]").forEach(o=>{let i=o.getAttribute("data-publication-citations");if(!i)return;let c=i.toLowerCase(),n;t[i]?n=t[i].total||t[i]:t[c]&&(n=t[c].total||t[c]),typeof n=="number"&&(o.textContent=n.toLocaleString())})}function p(){let e=window.DatalogAcademic||{},t=(window.DatalogPublications||{}).yearly_totals||(e.citations?e.citations.yearly_totals:{})||{},o=document.querySelector("[data-citation-timeline]");o&&t&&o.querySelectorAll("li[data-year]").forEach(c=>{let n=c.getAttribute("data-year");if(!n)return;let s=c.querySelector("[data-year-total]"),r=t[n];s&&typeof r!="undefined"&&(s.textContent=Number(r).toLocaleString(),c.style.setProperty("--timeline-value",Math.min(Number(r)/5,100)))})}function l(e,a){document.querySelectorAll(e).forEach(t=>{t.addEventListener("click",()=>{let o=typeof a=="function"?a(t):a;o&&navigator.clipboard&&navigator.clipboard.writeText&&navigator.clipboard.writeText(o).then(()=>{t.dataset.copied="true",t.textContent="Copied!",setTimeout(()=>{t.dataset.copied="false",t.textContent=t.dataset.originalText||"Copy"},2e3)}).catch(()=>{t.dataset.copied="error",t.textContent="Error"})}),t.dataset.originalText=t.textContent})}function y(){l("[data-copy-citation]",e=>{let a=e.getAttribute("data-target");if(!a)return"";let t=document.getElementById(a);return t?t.value:""}),l("[data-copy-bibliography]",e=>{let a=e.getAttribute("data-target");if(!a)return"";let t=document.getElementById(a);return t?t.value:""})}function b(){let e=document.querySelector("[data-submission-filter]");if(e){let a=document.querySelectorAll(".submission-card"),t=()=>{let o=e.value;a.forEach(i=>{if(!o){i.hidden=!1;return}let c=i.getAttribute("data-submission-status");i.hidden=c!==o})};e.addEventListener("change",t),t()}}function m(){let e=document.querySelector("[data-calendar-filter]"),a=document.querySelector("[data-academic-calendar]");if(e&&a){let t=a.querySelectorAll("li[data-event-type]"),o=()=>{let i=e.value;t.forEach(c=>{if(!i){c.hidden=!1;return}let n=c.getAttribute("data-event-type");c.hidden=n!==i})};e.addEventListener("change",o),o()}}function x(){document.querySelectorAll(".open-science-badge").forEach(a=>{let t=a.querySelector(".open-science-badge__description"),o=a.querySelector(".open-science-badge__criteria"),i=[];t&&i.push(t.textContent.trim()),o&&i.push(o.textContent.trim()),i.length&&a.setAttribute("title",i.join(" \u2022 "))})}function d(){u(),f(),p(),y(),b(),m(),x()}typeof window!="undefined"&&document.readyState!=="loading"?d():typeof window!="undefined"&&document.addEventListener("DOMContentLoaded",d);export{l as attachCopyHandler,d as initAcademicFeatures,m as initCalendarFilter,y as initCopyHandlers,x as initOpenScienceBadges,b as initSubmissionFilter,u as populateCitationMetrics,p as populateCitationTimeline,f as populatePublicationCitations};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function m(){return window.__DATALOG_ANALYTICS__||{}}function E(e){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):e()}function f(e){return!e||!Array.isArray(e.rows)?[]:e.rows}function d(e,a){return new Intl.NumberFormat(void 0,a||{maximumFractionDigits:0}).format(e||0)}function h(e,a,n){var r;if(!e)return;let c=n||((r=e.closest("table"))==null?void 0:r.querySelectorAll("th").length)||1,i=document.createElement("tr");i.className="placeholder";let s=document.createElement("td");s.setAttribute("colspan",c),s.textContent=a,i.appendChild(s),e.replaceChildren(i)}function v(){let e=document.getElementById("analytics-top-posts"),a=f(m().top_posts);if(e){if(!a.length){h(e,e.dataset.emptyMessage||"No data available",3);return}e.replaceChildren(),a.forEach(n=>{var b,y,C;let c=n.dimensionValues||[],i=n.metricValues||[],s=((b=c[0])==null?void 0:b.value)||"",r=Number(((y=i[0])==null?void 0:y.value)||0),t=Number(((C=i[1])==null?void 0:C.value)||0),o=document.createElement("tr"),l=document.createElement("a");l.href=s.startsWith("/")?s:`/${s}`,l.textContent=s||"\u2014",l.rel="noopener",l.className="analytics-link";let u=document.createElement("td");u.appendChild(l);let p=document.createElement("td");p.textContent=d(r);let g=document.createElement("td");g.textContent=d(t,{maximumFractionDigits:0}),o.append(u,p,g),e.appendChild(o)})}}function w(){let e=document.getElementById("analytics-search-terms");if(!e)return;let a=f(m().search_terms);if(!a.length){h(e,e.dataset.emptyMessage||"No search queries recorded",2);return}e.replaceChildren(),a.forEach(n=>{var u,p;let c=n.dimensionValues||[],i=n.metricValues||[],s=((u=c[0])==null?void 0:u.value)||"(not provided)",r=Number(((p=i[0])==null?void 0:p.value)||0),t=document.createElement("tr"),o=document.createElement("td");o.textContent=s;let l=document.createElement("td");l.textContent=d(r),t.append(o,l),e.appendChild(t)})}function N(e){return!e||e.includes("-")?e:e.length===8?`${e.slice(0,4)}-${e.slice(4,6)}-${e.slice(6,8)}`:e}function _(){let e=document.getElementById("analytics-visitors-chart");if(!e||typeof Chart=="undefined")return;let a=f(m().visitor_trends);if(!a.length)return;let n=a.map(t=>{var o,l;return N((l=(o=t.dimensionValues)==null?void 0:o[0])==null?void 0:l.value)}),c=a.map(t=>{var o,l;return Number(((l=(o=t.metricValues)==null?void 0:o[0])==null?void 0:l.value)||0)}),i=a.map(t=>{var o,l;return Number(((l=(o=t.metricValues)==null?void 0:o[1])==null?void 0:l.value)||0)}),s=a.map(t=>{var o,l;return Number(((l=(o=t.metricValues)==null?void 0:o[2])==null?void 0:l.value)||0)}),r=a.map(t=>{var o,l;return Number(((l=(o=t.metricValues)==null?void 0:o[3])==null?void 0:l.value)||0)});new Chart(e,{type:"line",data:{labels:n,datasets:[{label:"Total users",data:c,borderColor:"#2563eb",backgroundColor:"rgba(37, 99, 235, 0.15)",tension:.35,fill:!0},{label:"New users",data:i,borderColor:"#10b981",backgroundColor:"rgba(16, 185, 129, 0.12)",tension:.35,fill:!1},{label:"Sessions",data:s,borderColor:"#9333ea",backgroundColor:"rgba(147, 51, 234, 0.1)",tension:.35,fill:!1},{label:"Page views",data:r,borderColor:"#f97316",backgroundColor:"rgba(249, 115, 22, 0.1)",borderDash:[6,6],tension:.35,fill:!1}]},options:{responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},scales:{y:{beginAtZero:!0,ticks:{callback:t=>d(t)}}},plugins:{legend:{position:"top"}}}})}function A(){let e=document.getElementById("analytics-engagement-chart");if(!e||typeof Chart=="undefined")return;let a=f(m().engagement_by_page).slice(0,10);if(!a.length)return;let n=a.map(s=>{var r,t;return((t=(r=s.dimensionValues)==null?void 0:r[0])==null?void 0:t.value)||"\u2014"}),c=a.map(s=>{var r,t;return Number(((t=(r=s.metricValues)==null?void 0:r[2])==null?void 0:t.value)||0)}),i=a.map(s=>{var r,t;return Number(((t=(r=s.metricValues)==null?void 0:r[0])==null?void 0:t.value)||0)});new Chart(e,{type:"bar",data:{labels:n,datasets:[{label:"Engaged sessions",data:c,backgroundColor:"rgba(59, 130, 246, 0.7)"},{label:"Page views",data:i,backgroundColor:"rgba(14, 165, 233, 0.5)"}]},options:{responsive:!0,maintainAspectRatio:!1,indexAxis:"y",scales:{x:{beginAtZero:!0,ticks:{callback:s=>d(s)}}},plugins:{legend:{position:"top"}}}})}function k(){let e=document.getElementById("analytics-key-events");if(!e)return;let a=f(m().key_events);if(!a.length){let n=document.createElement("li");n.className="placeholder",n.textContent="No tracked events in the selected window.",e.replaceChildren(n);return}e.replaceChildren(),a.forEach(n=>{var t,o,l,u;let c=((o=(t=n.dimensionValues)==null?void 0:t[0])==null?void 0:o.value)||"event",i=Number(((u=(l=n.metricValues)==null?void 0:l[0])==null?void 0:u.value)||0),s=document.createElement("li"),r=document.createElement("strong");r.textContent=d(i),s.appendChild(r),s.appendChild(document.createTextNode(` ${c.replace(/_/g," ")}`)),e.appendChild(s)})}function x(){let e=m().scholar||{},a=document.querySelector('[data-field="scholar-total"]'),n=document.querySelector('[data-field="scholar-h-index"]'),c=document.querySelector('[data-field="scholar-i10-index"]');a&&(a.textContent=e.total?d(Number(e.total)):"\u2014"),n&&(n.textContent=e.h_index?d(Number(e.h_index)):"\u2014"),c&&(c.textContent=e.i10_index?d(Number(e.i10_index)):"\u2014");let i=document.getElementById("analytics-scholar-chart");if(!i||typeof Chart=="undefined")return;let s=e.yearly_totals||{},r=Object.entries(s).map(([t,o])=>[Number(t),Number(o)]).sort((t,o)=>t[0]-o[0]);r.length&&new Chart(i,{type:"bar",data:{labels:r.map(t=>t[0]),datasets:[{label:"Citations",data:r.map(t=>t[1]),backgroundColor:"rgba(99, 102, 241, 0.8)"}]},options:{responsive:!0,maintainAspectRatio:!1,scales:{y:{beginAtZero:!0,ticks:{callback:t=>d(t)}}}}})}function V(){let e=document.getElementById("analytics-monthly-reports");if(!e)return;let a=Array.isArray(m().monthly_reports)?m().monthly_reports:[];if(!a.length){h(e,e.dataset.emptyMessage||"No monthly reports available",5);return}e.replaceChildren(),a.forEach(n=>{let c=document.createElement("tr"),i=document.createElement("td");i.textContent=n.month||"\u2014";let s=document.createElement("td");s.textContent=d(n.total_users||0);let r=document.createElement("td");r.textContent=d(n.new_users||0);let t=document.createElement("td");t.textContent=d(n.sessions||0);let o=document.createElement("td");o.textContent=d(n.page_views||0),c.append(i,s,r,t,o),e.appendChild(c)})}function I(){if(m().status!=="ok"){["analytics-top-posts","analytics-search-terms","analytics-monthly-reports"].forEach(n=>{let c=document.getElementById(n);c&&h(c,m().message||"Analytics data unavailable.")});let a=document.getElementById("analytics-key-events");if(a){let n=document.createElement("li");n.className="placeholder",n.textContent=m().message||"Analytics data unavailable.",a.replaceChildren(n)}x();return}v(),w(),_(),A(),k(),x(),V()}typeof window!="undefined"&&!window.__VITEST__&&E(I);export{h as ensurePlaceholder,N as formatDateLabel,d as formatNumber,E as onReady,f as parseRows,I as render,A as renderEngagementChart,k as renderKeyEvents,V as renderMonthlyReports,x as renderScholar,w as renderSearchTerms,v as renderTopPosts,_ as renderVisitorChart};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var f="datalog-color-mode",u="dark-mode";function I(e){let t=localStorage.getItem(f);return t==="dark"?!0:t==="light"?!1:e.matches}function h(){let e=document.querySelector("[data-toggle-dark-mode]"),t=document.body,n=window.matchMedia("(prefers-color-scheme: dark)");I(n)&&t.classList.add(u);let r=()=>{let i=t.classList.contains(u)?"dark":"light";t.dataset.theme=i,document.documentElement.dataset.theme=i},o=()=>{r(),e&&e.setAttribute("aria-pressed",t.classList.contains(u))};o(),e&&e.addEventListener("click",()=>{let i=t.classList.toggle(u);e.setAttribute("aria-pressed",String(i)),localStorage.setItem(f,i?"dark":"light"),r()}),n.addEventListener("change",i=>{localStorage.getItem(f)||(i.matches?t.classList.add(u):t.classList.remove(u),o())})}var C="datalog-github-";function m(e,t){return`${C}${e}-${t}`}function N(e,t,n){try{let r=localStorage.getItem(m(e,t));if(!r)return null;let o=JSON.parse(r);return!o||typeof o!="object"?null:Date.now()-o.timestamp>n?(localStorage.removeItem(m(e,t)),null):o.data}catch(r){return null}}function P(e,t,n){try{localStorage.setItem(m(e,t),JSON.stringify({timestamp:Date.now(),data:n}))}catch(r){}}async function D(e,t,n,r){let o=N(e,t,r);if(o)return o;try{let i=await fetch(`${n}/${e}/${t}`);if(!i.ok)throw new Error(`GitHub API error: ${i.status}`);let c=await i.json();return P(e,t,c),c}catch(i){return null}}function G(e,t){e.querySelectorAll("[data-github-stat]").forEach(r=>{let o=r.getAttribute("data-github-stat");if(!o)return;let i=t[o];typeof i=="number"?r.textContent=i.toLocaleString():typeof i=="string"&&i.length>0&&(r.textContent=i)})}function p(){let e=document.querySelectorAll("[data-github-owner][data-github-repo]");if(!e.length)return Promise.resolve();let n=(window.DatalogIntegrations||{}).github||{};if(n.enabled===!1)return Promise.resolve();let r=n.api_base||"https://api.github.com/repos",o=Number(n.cache_ttl||43200)*1e3,i=Array.from(e).map(c=>{let l=c.getAttribute("data-github-owner"),d=c.getAttribute("data-github-repo");return!l||!d?Promise.resolve():D(l,d,r,o).then(a=>{a&&G(c,a)})});return Promise.all(i)}var H="[data-language-filter], [data-navigate-on-change]";function $(e){if(typeof e!="string")return null;let t=Array.from(e).filter(r=>{let o=r.codePointAt(0);return o>31&&o!==127}).join("").trim();if(!t)return null;let n=/^[a-z][a-z0-9+.-]*:/i.exec(t);return n&&!/^https?:$/i.test(n[0])?null:t}function y(){let e=document.querySelectorAll(H);e.length!==0&&e.forEach(t=>{t.addEventListener("change",n=>{let r=$(n.target&&n.target.value);r&&(window.location.href=r)})})}var q="(min-width: 48rem)",b="#site-nav",L=".nav-toggle",g="nav-open";function S(e){return e.replace(/index\.html$/,"").replace(/\/$/,"")}function O(e){let t=e.getAttribute("href");if(!t)return null;try{let n=new URL(t,window.location.origin);if(!n.hash)return null;let r=new URL(window.location.href);return S(n.pathname)!==S(r.pathname)?null:n.hash.replace("#","")}catch(n){return null}}function R(e){if(!e)return!1;let t=document.getElementById(e);return t?(t.scrollIntoView({behavior:"smooth",block:"start"}),!0):!1}function v(){let e=document.querySelector(b);if(!e)return;let t=document.querySelector(L),n=document.body,r=window.matchMedia(q),o=a=>{if(a){e.dataset.open="true",n.classList.remove(g),t&&(t.setAttribute("aria-expanded","false"),t.classList.remove("is-active"));return}let s=e.dataset.open==="true";s||(e.dataset.open="false"),t&&(t.setAttribute("aria-expanded",String(s)),t.classList.toggle("is-active",s))},i=({focusToggle:a=!1}={})=>{r.matches||(e.dataset.open="false",n.classList.remove(g),t&&(t.setAttribute("aria-expanded","false"),t.classList.remove("is-active"),a&&t.focus()))},c=()=>{r.matches||(e.dataset.open="true",n.classList.add(g),t&&(t.setAttribute("aria-expanded","true"),t.classList.add("is-active")))},l=()=>{r.matches||(e.dataset.open==="true"?i():c())};r.matches||(e.dataset.open="false"),o(r.matches),r.addEventListener("change",a=>{a.matches?o(!0):(i(),e.dataset.open="false",o(!1))}),e.querySelectorAll(".nav-link").forEach(a=>{let s=O(a);a.addEventListener("click",x=>{r.matches||i(),s&&R(s)&&x.preventDefault()})}),t&&t.addEventListener("click",()=>{l()}),document.addEventListener("keydown",a=>{a.key==="Escape"&&i({focusToggle:!0})}),document.addEventListener("click",a=>{if(r.matches||e.dataset.open!=="true")return;let s=a.target;!s||typeof s.closest!="function"||s.closest(b)||t&&s.closest(L)||i()})}function _(e,t){let n=window.pageYOffset||document.documentElement.scrollTop,r=document.documentElement.scrollHeight-window.innerHeight,o=r>0?Math.min(n/r*100,100):0;e.tagName==="PROGRESS"?e.setAttribute("value",String(o)):e.style.setProperty("--progress",`${o}%`),t&&(t.textContent=Math.round(o))}function E(){let e=document.querySelector("[data-scroll-progress]");if(!e)return;let t=document.querySelector("[data-scroll-progress-value]"),n=()=>_(e,t);n(),window.addEventListener("scroll",n,{passive:!0}),window.addEventListener("resize",n)}function k(e){if(!e)return;let t=e.querySelector("input[type='search']"),n=e.getAttribute("action");t?(t.focus(),t.select()):n&&(window.location.href=n)}function K(e){if(!e)return!1;if(e.isContentEditable)return!0;let t=e.tagName;return t==="INPUT"||t==="TEXTAREA"||t==="SELECT"}function w(){let e=document.querySelector(".site-search");e&&document.addEventListener("keydown",t=>{K(document.activeElement)||(t.key==="/"&&!t.ctrlKey&&!t.metaKey&&!t.altKey&&(t.preventDefault(),k(e)),(t.key==="k"||t.key==="K")&&(t.ctrlKey||t.metaKey)&&(t.preventDefault(),k(e)))})}function M(e){if(!e)return;e.getAttribute("tabindex")===null&&(e.setAttribute("tabindex","-1"),e.dataset.skipLinkTempTabindex="true"),e.addEventListener("blur",()=>{e.dataset.skipLinkTempTabindex&&(e.removeAttribute("tabindex"),delete e.dataset.skipLinkTempTabindex)},{once:!0}),e.focus()}function A(){let e=document.querySelectorAll(".skip-link[href^='#']");e.length&&e.forEach(t=>{t.addEventListener("click",n=>{let o=(t.getAttribute("href")||"").slice(1);if(!o)return;let i=document.getElementById(o);i&&(n.preventDefault(),M(i))})})}function T(){A(),v(),h(),y(),E(),w(),p()}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",T):T();export{T as initializeCore};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function y(){let e=document.getElementById("datalog-js-manifest");if(!e||!e.textContent)return{};try{return JSON.parse(e.textContent)}catch(n){return{}}}function l(e){return`feature${e.replace(/(^|-)([a-z])/g,(n,o,s)=>s.toUpperCase())}`}function r(e,n){let o=document.body;if(!o)return;let s=`${l(e)}State`;o.dataset[s]=n}async function d(e){return import(e)}var p=[{name:"search",test:()=>document.querySelector("[data-search-app]")||document.querySelector(".site-search")},{name:"visualizations",test:()=>document.querySelector("[data-viz-type]")},{name:"math",test:()=>{var e;return((e=document.body)==null?void 0:e.dataset.featureMath)==="true"}},{name:"academic",test:()=>document.querySelector("[data-citation-metric], [data-citation-table], [data-citation-chart]")},{name:"notebook",test:()=>{var e;return((e=document.body)==null?void 0:e.dataset.featureNotebook)==="true"||document.querySelector(".notebook-output")}}];async function i(e){let n=e||y(),{core:o,features:s={}}=n;if(!o)return;try{r("core","loading"),await d(o),r("core","ready")}catch(t){r("core","error");return}let u=document.body;if(!u)return;let m=p.filter(t=>{let c=l(t.name),a=u.dataset[c];return a==="true"||a==="auto"?a==="auto"&&typeof t.test=="function"?!!t.test():!0:!1}).map(async({name:t,test:c})=>{let a=s[t];if(a){r(t,"loading");try{if(typeof c=="function"&&!c()){r(t,"skipped");return}await d(a),r(t,"ready")}catch(f){r(t,"error")}}});await Promise.all(m)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>i()):i();export{i as bootstrapFeatures};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"core": "/assets/js/dist/core.js",
|
|
3
|
+
"loader": "/assets/js/dist/loader.js",
|
|
4
|
+
"features": {
|
|
5
|
+
"search": "/assets/js/dist/search.js",
|
|
6
|
+
"math": "/assets/js/dist/math.js",
|
|
7
|
+
"visualizations": "/assets/js/dist/visualizations.js",
|
|
8
|
+
"notebook": "/assets/js/dist/notebook.js",
|
|
9
|
+
"academic": "/assets/js/dist/academic.js",
|
|
10
|
+
"analytics-dashboard": "/assets/js/dist/analytics-dashboard.js"
|
|
11
|
+
},
|
|
12
|
+
"entrypoints": {
|
|
13
|
+
"core": "/assets/js/dist/core.js",
|
|
14
|
+
"loader": "/assets/js/dist/loader.js",
|
|
15
|
+
"search": "/assets/js/dist/search.js",
|
|
16
|
+
"math": "/assets/js/dist/math.js",
|
|
17
|
+
"visualizations": "/assets/js/dist/visualizations.js",
|
|
18
|
+
"notebook": "/assets/js/dist/notebook.js",
|
|
19
|
+
"academic": "/assets/js/dist/academic.js",
|
|
20
|
+
"analytics-dashboard": "/assets/js/dist/analytics-dashboard.js"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){let u={init(e){this.MathJax=e,this.displayCounter=0,this.anchorCounter=0,this.equationMap=new Map,this.editor=null,this.editorOpen=!1,this.messageTimeout=null,this.initialized=!0,this.pendingTypeset=[],this.setupEditor(),e.startup.promise.then(()=>{if(this.decorateExisting(e.startup.document.math||[]),this.updateEquationReferences(),this.pendingTypeset.length>0){let t=[...this.pendingTypeset];this.pendingTypeset=[],t.forEach(a=>{this.renderLatex(a.target,a.latex,a.options||{})})}}).catch(t=>{}),document.addEventListener("click",t=>this.handleClick(t)),document.addEventListener("keydown",t=>this.handleKeydown(t))},onPageReady(){this.updateEquationReferences()},decorateExisting(e){!e||e.length===0||(this.displayCounter=0,this.anchorCounter=0,this.equationMap.clear(),e.forEach(t=>{try{this.decorateMathItem(t)}catch(a){}}))},decorateMathItem(e){if(!e||!e.typesetRoot)return;let t=e.typesetRoot,a=e.math||"",i=t.closest("[data-math-alt]")||t,n=this.resolveAltText(i,a);t.dataset.mathLatex=a,t.setAttribute("tabindex","0"),t.setAttribute("role","math"),this.syncAltAttributes(i,t,n),e.display?this.decorateDisplay(t,a):this.decorateInline(t,a)},decorateInline(e,t){e&&(e.classList.contains("math-expression__inline")||e.classList.add("math-expression__inline"),e.dataset.mathLatexClean=this.cleanLatex(t))},decorateDisplay(e,t){if(!e)return;let i=e.parentElement&&e.parentElement.classList.contains("math-expression")?e.parentElement:null;i||(i=document.createElement("figure"),i.className="math-expression math-expression--display",e.parentNode.insertBefore(i,e),i.appendChild(e));let n=this.extractEquationInfo(t);this.anchorCounter+=1;let r=`eq:auto-${this.anchorCounter}`,s=n.tag||"";n.skipNumber||(this.displayCounter+=1,s||(s=String(this.displayCounter)));let o=s?`(${s})`:"",l=this.buildAnchorId(n.label,r);if(i.dataset.mathLatex=t,i.dataset.mathLatexClean=this.cleanLatex(t),e.dataset.mathAlt&&!i.dataset.mathAlt&&(i.dataset.mathAlt=e.dataset.mathAlt),o?i.dataset.equationNumber=o:i.removeAttribute("data-equation-number"),i.dataset.equationLabel=n.label||"",l){i.id=l;let c=o||n.label||l;if((o||n.label)&&(this.setEquationReference(l,c),n.label&&n.label!==l&&this.setEquationReference(n.label,c,l),n.label&&n.label.startsWith("eq:"))){let h=n.label.replace(/^eq:/,"");this.setEquationReference(h,c,l)}}this.attachNumberBadge(i,o),this.attachToolbar(i)},extractEquationInfo(e){let t=(e||"").trim(),a=t.match(/\\tag\*?\{([^}]*)\}/),i=t.match(/\\label\{([^}]*)\}/),n=/\\notag|\\nonumber/.test(t);return{tag:a?a[1].trim():"",label:i?i[1].trim():"",skipNumber:n}},buildAnchorId(e,t){return e?e.startsWith("eq:")?e:`eq:${e}`:t||""},setEquationReference(e,t,a){if(!e)return;let i=a||e,n=t||e;this.equationMap.set(e,{anchor:i,label:e,number:n}),e.startsWith("eq:")||this.equationMap.set(`eq:${e}`,{anchor:i,label:e,number:n})},attachNumberBadge(e,t){let a=e.querySelector(".math-expression__number"),i=e.querySelector(".math-expression__sr");if(!t){a&&a.remove(),i&&i.remove();return}a||(a=document.createElement("span"),a.className="math-expression__number",a.setAttribute("aria-hidden","true"),e.appendChild(a)),a.textContent=t,i||(i=document.createElement("span"),i.className="visually-hidden math-expression__sr",e.appendChild(i)),i.textContent=`Equation ${t.replace(/[()]/g,"")}`},attachToolbar(e){let t=e.querySelector(".math-expression__toolbar");if(!t){t=document.createElement("div"),t.className="math-expression__toolbar";let a=document.createElement("button");a.type="button",a.className="math-expression__button",a.setAttribute("data-math-copy","true"),a.setAttribute("aria-label","Copy LaTeX code");let i=document.createElement("span");i.setAttribute("aria-hidden","true"),i.textContent="\u29C9";let n=document.createElement("span");n.className="visually-hidden",n.textContent="Copy equation",a.appendChild(i),a.appendChild(n);let r=document.createElement("button");r.type="button",r.className="math-expression__button",r.setAttribute("data-math-edit","true"),r.setAttribute("aria-label","Open equation editor");let s=document.createElement("span");s.setAttribute("aria-hidden","true"),s.textContent="\u270E";let o=document.createElement("span");o.className="visually-hidden",o.textContent="Edit equation",r.appendChild(s),r.appendChild(o);let l=document.createElement("span");l.className="math-expression__message",l.setAttribute("aria-live","polite"),l.hidden=!0,t.appendChild(a),t.appendChild(r),t.appendChild(l),e.appendChild(t)}},handleClick(e){let t=e.target.closest("[data-math-copy]");if(t){e.preventDefault();let s=t.closest(".math-expression"),o=s?s.dataset.mathLatexClean||s.dataset.mathLatex:null;this.copyLatex(o,s);return}let a=e.target.closest("[data-math-edit]");if(a){e.preventDefault();let s=a.closest(".math-expression"),o=s&&s.dataset.mathLatex||"";this.openEditor(o);return}if(e.target.closest("[data-math-editor-close]")){e.preventDefault(),this.closeEditor();return}if(e.target.closest("[data-math-editor-copy]")){e.preventDefault(),this.editor&&this.editor.textarea&&this.copyLatex(this.editor.textarea.value,null,this.editor.status);return}let r=e.target.closest("[data-symbol-insert]");if(r){e.preventDefault();let s=r.getAttribute("data-symbol-insert");this.insertSymbol(s||"")}},handleKeydown(e){let t=document.activeElement,a=t&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable);if((e.ctrlKey||e.metaKey)&&e.altKey&&(e.key==="e"||e.key==="E")){e.preventDefault();let i=a&&t&&t.value||"";this.openEditor(i);return}e.key==="Escape"&&this.editorOpen&&(e.preventDefault(),this.closeEditor())},copyLatex(e,t,a){if(!e)return;let i=r=>{if(a)a.hidden=!1,a.textContent=r,clearTimeout(this.messageTimeout),this.messageTimeout=window.setTimeout(()=>{a.hidden=!0,a.textContent=""},2e3);else if(t){let s=t.querySelector(".math-expression__message");s&&(s.hidden=!1,s.textContent=r,clearTimeout(this.messageTimeout),this.messageTimeout=window.setTimeout(()=>{s.hidden=!0,s.textContent=""},2e3))}},n=()=>{let r=document.createElement("textarea");r.value=e,r.setAttribute("aria-hidden","true"),r.style.position="fixed",r.style.opacity="0",document.body.appendChild(r),r.select();try{document.execCommand("copy"),i("Copied equation")}catch(s){i("Unable to copy")}document.body.removeChild(r)};navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(e).then(()=>i("Copied equation")).catch(()=>n()):n()},setupEditor(){if(this.editor)return;let e=document.createElement("div");e.id="math-tooling-panel",e.hidden=!0;let t=document.createElement("div");t.className="math-tooling",t.setAttribute("role","dialog"),t.setAttribute("aria-modal","true"),t.setAttribute("aria-labelledby","math-tooling-title");let a=document.createElement("h2");a.id="math-tooling-title",a.className="math-tooling__title",a.textContent="Equation editor";let i=document.createElement("p");i.className="math-tooling__description",i.innerHTML="Craft LaTeX expressions with live preview, quick statistical symbols, and chemistry support.";let n=document.createElement("textarea");n.className="math-tooling__input",n.setAttribute("data-math-editor-input","true"),n.setAttribute("spellcheck","false"),n.rows=10;let r=document.createElement("div");r.className="math-tooling__actions";let s=document.createElement("div");s.className="math-tooling__preview",s.setAttribute("data-math-editor-preview","true"),s.setAttribute("aria-live","polite");let o=document.createElement("span");o.className="math-tooling__status",o.hidden=!0;let l=document.createElement("div");l.className="math-tooling__library";let c=document.createElement("h3");c.className="math-tooling__library-title",c.textContent="Quick insert";let h=document.createElement("div");h.className="math-tooling__symbols",[{label:"Mean \u03BC",value:"\\mu"},{label:"Variance \u03C3\xB2",value:"\\sigma^2"},{label:"Std. dev \u03C3",value:"\\sigma"},{label:"Probability",value:"\\mathbb{P}(A)"},{label:"Expectation",value:"\\mathbb{E}[X]"},{label:"Covariance",value:"\\mathrm{Cov}(X, Y)"},{label:"Vector",value:"\\mathbf{x}"},{label:"Norm",value:"\\lVert x \\rVert_2"},{label:"Inner product",value:"\\langle x, y \\rangle"},{label:"Derivative",value:"\\frac{\\mathrm{d}}{\\mathrm{d}t}"},{label:"Integral",value:"\\int_0^1 f(x) \\, \\mathrm{d}x"},{label:"Bayes",value:"\\mathbb{P}(A \\mid B)"},{label:"Chemical H\u2082O",value:"\\ce{H2O}"},{label:"Chemical CO\u2082",value:"\\ce{CO2}"}].forEach(g=>{let p=document.createElement("button");p.type="button",p.className="math-tooling__symbol",p.setAttribute("data-symbol-insert",g.value),p.textContent=g.label,h.appendChild(p)});let d=document.createElement("button");d.type="button",d.className="math-tooling__close",d.setAttribute("data-math-editor-close","true");let b=document.createElement("span");b.setAttribute("aria-hidden","true"),b.textContent="\u2715";let f=document.createElement("span");f.className="visually-hidden",f.textContent="Close equation editor",d.appendChild(b),d.appendChild(f);let m=document.createElement("button");m.type="button",m.className="math-tooling__copy",m.setAttribute("data-math-editor-copy","true"),m.textContent="Copy LaTeX",r.appendChild(m),r.appendChild(d),r.appendChild(o),l.appendChild(c),l.appendChild(h),t.appendChild(a),t.appendChild(i),t.appendChild(n),t.appendChild(s),t.appendChild(r),t.appendChild(l),e.appendChild(t),document.body.appendChild(e),n.addEventListener("input",()=>this.updateEditorPreview()),this.editor={overlay:e,dialog:t,textarea:n,preview:s,status:o}},openEditor(e){if(!this.editor)return;let t=(e||"").trim();this.editor.overlay.hidden=!1,document.body.classList.add("math-tooling-open"),this.editor.textarea.value=t,this.editor.textarea.focus(),this.editor.textarea.setSelectionRange(t.length,t.length),this.editorOpen=!0,this.updateEditorPreview()},closeEditor(){this.editor&&(this.editor.overlay.hidden=!0,document.body.classList.remove("math-tooling-open"),this.editorOpen=!1)},updateEditorPreview(){if(!this.editor||!this.MathJax)return;let e=this.editor.textarea.value.trim();if(!e){this.editor.preview.replaceChildren();let t=document.createElement("p");t.className="math-tooling__placeholder",t.textContent="Preview will appear here.",this.editor.preview.appendChild(t);return}this.renderLatex(this.editor.preview,e,{display:!0,enhance:!1})},insertSymbol(e){if(!this.editor||!this.editor.textarea)return;let t=this.editor.textarea,a=t.selectionStart||0,i=t.selectionEnd||0,n=t.value,r=`${n.slice(0,a)}${e}${n.slice(i)}`;t.value=r;let s=a+e.length;t.focus(),t.setSelectionRange(s,s),this.updateEditorPreview()},updateEquationReferences(){if(!this.equationMap||this.equationMap.size===0)return;document.querySelectorAll("[data-equation-ref]").forEach(a=>{let i=a.getAttribute("data-equation-ref");if(!i)return;let n=this.lookupEquation(i.replace(/^#/,""));if(!n)return;a.setAttribute("href",`#${n.anchor}`);let r=a.textContent.trim();(!r||r===i||r===n.anchor||r===`(${i})`)&&(a.textContent=n.number||n.anchor),a.classList.add("math-reference"),a.setAttribute("aria-label",`Jump to equation ${n.number||n.anchor}`)}),document.querySelectorAll('a[href^="#eq:"]').forEach(a=>{let i=a.getAttribute("href");if(!i)return;let n=i.replace(/^#/,""),r=this.lookupEquation(n);if(!r)return;a.setAttribute("href",`#${r.anchor}`);let s=a.textContent.trim();(!s||s===i||s===n)&&(a.textContent=r.number||r.anchor),a.dataset.equationRef=r.anchor,a.classList.add("math-reference")})},lookupEquation(e){if(!e)return null;if(this.equationMap.has(e))return this.equationMap.get(e);let t=e.startsWith("eq:")?e:`eq:${e}`;return this.equationMap.get(t)||null},renderLatex(e,t,a={}){if(!e)return Promise.resolve();let i=a.display!==!1;if(!this.MathJax)return e.textContent=t,this.pendingTypeset||(this.pendingTypeset=[]),this.pendingTypeset.push({target:e,latex:t,options:a}),Promise.resolve();let n=i?`\\[${t}\\]`:`\\(${t}\\)`;return e.innerHTML=n,this.MathJax.typesetPromise([e]).catch(r=>{})},cleanLatex(e){return(e||"").replace(/%\s*alt:.*$/gm,"").replace(/\\label\{[^}]*\}/g,"").replace(/\\tag\*?\{[^}]*\}/g,"").trim()},resolveAltText(e,t){let a=e||null,i=this.findDatasetAlt(a);if(i)return i;let n=this.extractAltComment(t);if(n)return n;let s=(a&&a.getAttribute?a.getAttribute("data-math-source"):null)||t;return this.generateAltFromLatex(s)},findDatasetAlt(e){let t=e;for(;t;){if(t.dataset&&t.dataset.mathAlt){let a=t.dataset.mathAlt.trim();if(a)return a}t=t.parentElement}return""},extractAltComment(e){if(!e)return"";let t=String(e).split(/\r?\n/);for(let a=0;a<t.length;a+=1){let i=t[a];if(!i)continue;let n=i.match(/%\s*alt:\s*(.+)$/i);if(n)return n[1].trim()}return""},generateAltFromLatex(e){if(!e)return"";let t=String(e).replace(/%.*$/gm,"");return t=t.replace(/\\frac\s*\{([^{}]+)\}\s*\{([^{}]+)\}/g,(a,i,n)=>{let r=this.sanitizeSegment(i),s=this.sanitizeSegment(n);return`${r} over ${s}`.trim()}),t=t.replace(/\\int(?:_\{([^}]*)\}|_([^\s^{}]+))?(?:\^\{([^}]*)\}|\^([^\s_{}]+))?/g,(a,i,n,r,s)=>{let o=this.sanitizeSegment(i||n),l=this.sanitizeSegment(r||s),c="integral";return o&&(c+=` from ${o}`),l&&(c+=` to ${l}`),c}),t=t.replace(/\\sum(?:_\{([^}]*)\}|_([^\s^{}]+))?(?:\^\{([^}]*)\}|\^([^\s_{}]+))?/g,(a,i,n,r,s)=>{let o=this.sanitizeSegment(i||n),l=this.sanitizeSegment(r||s),c="summation";return o&&(c+=` from ${o}`),l&&(c+=` to ${l}`),c}),t=t.replace(/\\sqrt\s*\{([^{}]+)\}/g,(a,i)=>`square root of ${this.sanitizeSegment(i)}`),t=t.replace(/\\mathrm\s*\{([^{}]+)\}/g,(a,i)=>this.sanitizeSegment(i)),t=t.replace(/\\operatorname\*?\s*\{([^{}]+)\}/g,(a,i)=>this.sanitizeSegment(i)),t=t.replace(/\\[a-zA-Z]+/g," "),t=t.replace(/[{}]/g," "),t=t.replace(/\s+/g," ").trim(),t||"Mathematical expression"},sanitizeSegment(e){return e?String(e).replace(/\\[a-zA-Z]+/g," ").replace(/[{}]/g," ").replace(/\s+/g," ").trim():""},syncAltAttributes(e,t,a){a&&(e&&e.setAttribute&&(e.setAttribute("aria-label",a),e.dataset&&(e.dataset.mathAlt=a)),t&&t.setAttribute&&(t.setAttribute("aria-label",a),t.dataset&&(t.dataset.mathAlt=a)))}};typeof globalThis!="undefined"&&(globalThis.__DATALOG_MATH_INTERNALS__=u),window.DatalogMath={init(e){u.init(e)},onPageReady(){u.initialized&&u.onPageReady()},renderLatex(e,t,a){return u.renderLatex(e,t,a)}}})();
|