explico 0.2.0 → 0.4.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.
- package/CHANGELOG.md +173 -0
- package/README.md +67 -7
- package/dist/compiler/astro.d.ts +30 -0
- package/dist/compiler/astro.js +79 -0
- package/dist/compiler/cli.d.ts +16 -0
- package/dist/compiler/cli.js +43 -9
- package/dist/compiler/collections.js +4 -1
- package/dist/compiler/course-config.d.ts +80 -4
- package/dist/compiler/course-config.js +12 -0
- package/dist/compiler/knowledge-version.d.ts +58 -0
- package/dist/compiler/knowledge-version.js +80 -0
- package/dist/compiler/lesson-derivation.d.ts +1 -1
- package/dist/compiler/lesson-derivation.js +2 -2
- package/dist/compiler/manifest.d.ts +98 -2
- package/dist/compiler/manifest.js +153 -24
- package/dist/compiler/resolution-report.d.ts +4 -0
- package/dist/reference/base-operators.d.mts +38 -0
- package/dist/reference/base-operators.mjs +103 -0
- package/dist/reference/consistency.d.ts +7 -2
- package/dist/reference/consistency.js +51 -2
- package/dist/reference/diagram-layout.d.ts +63 -0
- package/dist/reference/diagram-layout.js +122 -0
- package/dist/reference/equations-validate.d.ts +10 -0
- package/dist/reference/equations-validate.js +1 -1
- package/dist/reference/equations.d.mts +80 -13
- package/dist/reference/equations.mjs +109 -19
- package/dist/reference/figures-validate.d.ts +21 -0
- package/dist/reference/figures-validate.js +13 -0
- package/dist/reference/keyed-float-validate.d.ts +73 -0
- package/dist/reference/keyed-float-validate.js +110 -0
- package/dist/reference/keyed-jsx-floats.d.mts +64 -0
- package/dist/reference/keyed-jsx-floats.mjs +191 -0
- package/dist/reference/math-glyphs.d.mts +18 -0
- package/dist/reference/math-glyphs.mjs +92 -0
- package/dist/reference/remark-notation.d.mts +61 -0
- package/dist/reference/remark-notation.mjs +344 -10
- package/dist/reference/tables-validate.d.ts +21 -0
- package/dist/reference/tables-validate.js +13 -0
- package/dist/reference/units-vocab.js +19 -1
- package/docs/VERSIONING.md +66 -0
- package/docs/authoring/README.md +100 -0
- package/docs/authoring/agents.md +63 -0
- package/docs/authoring/migrating.md +169 -0
- package/docs/authoring/notation.md +297 -0
- package/docs/authoring/structure.md +139 -0
- package/docs/authoring/versioning.md +116 -0
- package/docs/authoring/visualizations.md +195 -0
- package/package.json +20 -5
- package/src/compiler/astro.ts +127 -0
- package/src/compiler/cli.ts +52 -7
- package/src/compiler/collections.ts +12 -3
- package/src/compiler/course-config.ts +93 -3
- package/src/compiler/knowledge-version.ts +157 -0
- package/src/compiler/lesson-derivation.ts +2 -2
- package/src/compiler/manifest.ts +320 -26
- package/src/components/CurriculumMap.astro +27 -0
- package/src/components/diagram/Diagram.astro +317 -0
- package/src/components/examples/CompactExamples.astro +1 -1
- package/src/components/figure/Figure.astro +104 -0
- package/src/components/notation/NotationLayer.astro +11 -0
- package/src/components/notation/render-notation-math.ts +13 -2
- package/src/components/reference/FloatRefLayer.astro +671 -0
- package/src/components/starlight/AboutPanel.astro +255 -0
- package/src/components/starlight/HeadingAnchorEnhancer.astro +3 -3
- package/src/components/starlight/KeyedFloatEnhancer.astro +137 -0
- package/src/components/starlight/LayoutSidebar.astro +62 -1
- package/src/components/starlight/LayoutSocialIcons.astro +12 -0
- package/src/components/starlight/LessonFooter.astro +15 -2
- package/src/components/table/Table.astro +105 -0
- package/src/reference/base-operators.mjs +103 -0
- package/src/reference/consistency.ts +83 -2
- package/src/reference/diagram-layout.ts +246 -0
- package/src/reference/equations-validate.ts +8 -1
- package/src/reference/equations.mjs +109 -19
- package/src/reference/figures-validate.ts +40 -0
- package/src/reference/keyed-float-validate.ts +210 -0
- package/src/reference/keyed-jsx-floats.mjs +191 -0
- package/src/reference/math-glyphs.mjs +92 -0
- package/src/reference/remark-notation.mjs +344 -10
- package/src/reference/tables-validate.ts +40 -0
- package/src/reference/units-vocab.ts +18 -0
- package/src/styles/global.css +244 -7
- package/src/components/starlight/EquationEnhancer.astro +0 -87
package/src/styles/global.css
CHANGED
|
@@ -448,6 +448,135 @@
|
|
|
448
448
|
min-height: 100%;
|
|
449
449
|
}
|
|
450
450
|
|
|
451
|
+
/* A compact chapter remains useful as a row of lesson icons. The
|
|
452
|
+
link text doubles as a pointer/keyboard tooltip; opening the chapter via
|
|
453
|
+
its summary restores Starlight's normal, fully labelled list. */
|
|
454
|
+
.layout-compact-sidebar
|
|
455
|
+
details[data-compact]
|
|
456
|
+
> ul:not(.top-level) {
|
|
457
|
+
display: flex;
|
|
458
|
+
flex-wrap: wrap;
|
|
459
|
+
gap: 0.35rem;
|
|
460
|
+
margin: 0.2rem 0 0.35rem;
|
|
461
|
+
padding-inline-start: 0.5rem;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.layout-compact-sidebar
|
|
465
|
+
details[data-compact]
|
|
466
|
+
> ul:not(.top-level)
|
|
467
|
+
> li {
|
|
468
|
+
position: relative;
|
|
469
|
+
margin-inline-start: 0;
|
|
470
|
+
border-inline-start: 0;
|
|
471
|
+
padding-inline-start: 0;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
.layout-compact-sidebar
|
|
475
|
+
details[data-compact]
|
|
476
|
+
> ul:not(.top-level)
|
|
477
|
+
> li
|
|
478
|
+
> a {
|
|
479
|
+
display: grid;
|
|
480
|
+
position: relative;
|
|
481
|
+
place-items: center;
|
|
482
|
+
width: 1.75rem;
|
|
483
|
+
height: 1.75rem;
|
|
484
|
+
border: 1px solid var(--sl-color-gray-5);
|
|
485
|
+
border-radius: 0.4rem;
|
|
486
|
+
padding: 0;
|
|
487
|
+
color: var(--sl-color-gray-3);
|
|
488
|
+
background: var(--sl-color-bg-sidebar);
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
.layout-compact-sidebar
|
|
492
|
+
details[data-compact]
|
|
493
|
+
> ul:not(.top-level)
|
|
494
|
+
> li
|
|
495
|
+
> a::before {
|
|
496
|
+
content: '';
|
|
497
|
+
width: 0.65rem;
|
|
498
|
+
height: 0.78rem;
|
|
499
|
+
border: 1.5px solid currentColor;
|
|
500
|
+
border-radius: 0.13rem;
|
|
501
|
+
box-shadow: 0.18rem 0.18rem 0 -0.1rem var(--sl-color-bg-sidebar),
|
|
502
|
+
0.18rem 0.18rem 0 0 currentColor;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
.layout-compact-sidebar
|
|
506
|
+
details[data-compact]
|
|
507
|
+
> ul:not(.top-level)
|
|
508
|
+
> li
|
|
509
|
+
> a:hover,
|
|
510
|
+
.layout-compact-sidebar
|
|
511
|
+
details[data-compact]
|
|
512
|
+
> ul:not(.top-level)
|
|
513
|
+
> li
|
|
514
|
+
> a:focus-visible {
|
|
515
|
+
border-color: var(--sl-color-accent);
|
|
516
|
+
color: var(--sl-color-text-accent);
|
|
517
|
+
background: var(--sl-color-accent-low);
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
.layout-compact-sidebar
|
|
521
|
+
details[data-compact]
|
|
522
|
+
> ul:not(.top-level)
|
|
523
|
+
> li
|
|
524
|
+
> a[aria-current='page'] {
|
|
525
|
+
color: var(--sl-color-text-invert);
|
|
526
|
+
background: var(--sl-color-text-accent);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
.layout-compact-sidebar
|
|
530
|
+
details[data-compact]
|
|
531
|
+
> ul:not(.top-level)
|
|
532
|
+
> li
|
|
533
|
+
> a
|
|
534
|
+
> span {
|
|
535
|
+
position: absolute;
|
|
536
|
+
z-index: 2;
|
|
537
|
+
inset-block-start: 50%;
|
|
538
|
+
inset-inline-start: calc(100% + 0.45rem);
|
|
539
|
+
width: max-content;
|
|
540
|
+
max-width: 12rem;
|
|
541
|
+
border: 1px solid var(--sl-color-gray-5);
|
|
542
|
+
border-radius: 0.35rem;
|
|
543
|
+
padding: 0.3rem 0.5rem;
|
|
544
|
+
color: var(--sl-color-white);
|
|
545
|
+
background: var(--sl-color-bg-nav);
|
|
546
|
+
box-shadow: var(--sl-shadow-md);
|
|
547
|
+
font-size: var(--sl-text-xs);
|
|
548
|
+
font-weight: 500;
|
|
549
|
+
line-height: 1.3;
|
|
550
|
+
opacity: 0;
|
|
551
|
+
pointer-events: none;
|
|
552
|
+
transform: translateY(-50%) translateX(-0.2rem);
|
|
553
|
+
transition:
|
|
554
|
+
opacity 100ms ease,
|
|
555
|
+
transform 100ms ease;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
.layout-compact-sidebar
|
|
559
|
+
details[data-compact]
|
|
560
|
+
> ul:not(.top-level)
|
|
561
|
+
> li
|
|
562
|
+
> a:is(:hover, :focus-visible)
|
|
563
|
+
> span {
|
|
564
|
+
opacity: 1;
|
|
565
|
+
transform: translateY(-50%) translateX(0);
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
.layout-compact-sidebar details[data-compact] > summary .caret {
|
|
569
|
+
transform: rotateZ(0);
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
[dir='rtl']
|
|
573
|
+
.layout-compact-sidebar
|
|
574
|
+
details[data-compact]
|
|
575
|
+
> summary
|
|
576
|
+
.caret {
|
|
577
|
+
transform: rotateZ(180deg);
|
|
578
|
+
}
|
|
579
|
+
|
|
451
580
|
.layout-navigation-toggle {
|
|
452
581
|
position: fixed;
|
|
453
582
|
z-index: calc(var(--sl-z-index-menu) + 1);
|
|
@@ -668,7 +797,7 @@
|
|
|
668
797
|
`.keyed-equation` with an `id="eq-<key>"`, a `data-eq-number`, and a
|
|
669
798
|
focusable number link. Prose refers to it with `[[eq:key]]` →
|
|
670
799
|
`a.equation-ref`. The deep-link highlight is a pure-CSS `:target` animation
|
|
671
|
-
with a reduced-motion fallback; `
|
|
800
|
+
with a reduced-motion fallback; `KeyedFloatEnhancer.astro` only re-triggers it
|
|
672
801
|
on a repeated activation and moves focus. */
|
|
673
802
|
.sl-markdown-content .keyed-equation {
|
|
674
803
|
position: relative;
|
|
@@ -690,12 +819,11 @@
|
|
|
690
819
|
font-size: var(--sl-text-sm);
|
|
691
820
|
color: var(--sl-color-text-accent);
|
|
692
821
|
text-decoration: none;
|
|
693
|
-
/*
|
|
694
|
-
|
|
695
|
-
still
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
opacity: 0;
|
|
822
|
+
/* Present but quiet by default (F4): partially visible so a reader
|
|
823
|
+
scanning the page can always find the number without hunting, but it
|
|
824
|
+
still doesn't compete with the equation itself. Hover, focus, and a
|
|
825
|
+
deep-link (`:target`) push it to full opacity, same as before. */
|
|
826
|
+
opacity: 0.45;
|
|
699
827
|
transition: opacity 120ms ease-out;
|
|
700
828
|
}
|
|
701
829
|
|
|
@@ -726,6 +854,41 @@
|
|
|
726
854
|
}
|
|
727
855
|
}
|
|
728
856
|
|
|
857
|
+
/* Once a reader has actually arrived at (or clicked through to) an equation —
|
|
858
|
+
a deep-link on load, an in-page `[[eq:key]]` navigation, or pinning its
|
|
859
|
+
preview card (`FloatRefLayer.astro`) — its number stays fully visible
|
|
860
|
+
for the rest of the page's life, not just while `:target` or `:hover`
|
|
861
|
+
holds. `KeyedFloatEnhancer.astro` and `FloatRefLayer.astro` add this class
|
|
862
|
+
in JS; it is never present in the static markup. One extra class over the
|
|
863
|
+
base selector's specificity, so this always wins regardless of rule order. */
|
|
864
|
+
.sl-markdown-content a.keyed-equation__number.eq-number-revealed {
|
|
865
|
+
opacity: 1;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
/* A referencing `[[eq:key]]` link elsewhere in the prose was hovered/focused
|
|
869
|
+
and the equation it points to is already fully on screen: highlight it in
|
|
870
|
+
place instead of opening a preview card (`FloatRefLayer.astro` decides
|
|
871
|
+
which). Mirrors the reduced-motion `:target` treatment below — steady, no
|
|
872
|
+
keyframe — since this fires on every hover, not just a rare deep-link. */
|
|
873
|
+
.sl-markdown-content .keyed-equation.eq-ref-highlight {
|
|
874
|
+
background: var(--sl-color-accent-low);
|
|
875
|
+
outline: 2px solid var(--sl-color-accent);
|
|
876
|
+
outline-offset: 0.2rem;
|
|
877
|
+
transition:
|
|
878
|
+
background 120ms ease-out,
|
|
879
|
+
outline-color 120ms ease-out;
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
.sl-markdown-content .keyed-equation.eq-ref-highlight a.keyed-equation__number {
|
|
883
|
+
opacity: 1;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
@media (forced-colors: active) {
|
|
887
|
+
.sl-markdown-content .keyed-equation.eq-ref-highlight {
|
|
888
|
+
outline-color: Highlight;
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
|
|
729
892
|
.sl-markdown-content a.equation-ref {
|
|
730
893
|
font-variant-numeric: tabular-nums;
|
|
731
894
|
font-weight: 600;
|
|
@@ -785,12 +948,86 @@
|
|
|
785
948
|
transform: none;
|
|
786
949
|
text-align: end;
|
|
787
950
|
color: inherit;
|
|
951
|
+
opacity: 1;
|
|
788
952
|
}
|
|
789
953
|
.sl-markdown-content .keyed-equation {
|
|
790
954
|
padding-inline-end: 0;
|
|
791
955
|
}
|
|
792
956
|
}
|
|
793
957
|
|
|
958
|
+
/* `<Table>`/`<Figure>` keyed floats (F-tables-figures) — the same deep-link
|
|
959
|
+
and hover-highlight treatment as equations above, via `KeyedFloatEnhancer`
|
|
960
|
+
and `FloatRefLayer.astro`. Unlike an equation's number (quiet until
|
|
961
|
+
hovered, F4), a table/figure number lives in its always-visible caption,
|
|
962
|
+
so there is no opacity dance to mirror here — only the `:target` flash
|
|
963
|
+
(reusing the `eq-flash` keyframe above) and the ref-highlight. */
|
|
964
|
+
.sl-markdown-content a.table-ref,
|
|
965
|
+
.sl-markdown-content a.figure-ref {
|
|
966
|
+
font-variant-numeric: tabular-nums;
|
|
967
|
+
font-weight: 600;
|
|
968
|
+
text-decoration: underline;
|
|
969
|
+
text-underline-offset: 0.15em;
|
|
970
|
+
padding-inline: 0.1em;
|
|
971
|
+
border-radius: 0.2em;
|
|
972
|
+
color: var(--sl-color-text-accent);
|
|
973
|
+
white-space: nowrap;
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
.sl-markdown-content a.table-ref:hover,
|
|
977
|
+
.sl-markdown-content a.table-ref:focus-visible,
|
|
978
|
+
.sl-markdown-content a.figure-ref:hover,
|
|
979
|
+
.sl-markdown-content a.figure-ref:focus-visible {
|
|
980
|
+
background: var(--sl-color-accent-low);
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
.sl-markdown-content .keyed-table:target,
|
|
984
|
+
.sl-markdown-content .keyed-figure:target {
|
|
985
|
+
animation: eq-flash 5s ease-out both;
|
|
986
|
+
border-radius: 0.3rem;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
@media (prefers-reduced-motion: reduce) {
|
|
990
|
+
.sl-markdown-content .keyed-table:target,
|
|
991
|
+
.sl-markdown-content .keyed-figure:target {
|
|
992
|
+
animation: none;
|
|
993
|
+
background: var(--sl-color-accent-low);
|
|
994
|
+
outline: 2px solid var(--sl-color-accent);
|
|
995
|
+
outline-offset: 0.2rem;
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
/* A referencing `[[tab-key]]`/`[[fig-key]]` link elsewhere in the prose was
|
|
1000
|
+
hovered/focused and the float it points to is already fully on screen:
|
|
1001
|
+
highlight it in place instead of opening a preview card
|
|
1002
|
+
(`FloatRefLayer.astro` decides which) — mirrors `.eq-ref-highlight`. */
|
|
1003
|
+
.sl-markdown-content .keyed-table.tab-ref-highlight,
|
|
1004
|
+
.sl-markdown-content .keyed-figure.fig-ref-highlight {
|
|
1005
|
+
background: var(--sl-color-accent-low);
|
|
1006
|
+
outline: 2px solid var(--sl-color-accent);
|
|
1007
|
+
outline-offset: 0.2rem;
|
|
1008
|
+
border-radius: 0.3rem;
|
|
1009
|
+
transition:
|
|
1010
|
+
background 120ms ease-out,
|
|
1011
|
+
outline-color 120ms ease-out;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
@media (forced-colors: active) {
|
|
1015
|
+
.sl-markdown-content .keyed-table:target,
|
|
1016
|
+
.sl-markdown-content .keyed-figure:target,
|
|
1017
|
+
.sl-markdown-content .keyed-table.tab-ref-highlight,
|
|
1018
|
+
.sl-markdown-content .keyed-figure.fig-ref-highlight {
|
|
1019
|
+
animation: none;
|
|
1020
|
+
outline: 2px solid Highlight;
|
|
1021
|
+
outline-offset: 0.2rem;
|
|
1022
|
+
}
|
|
1023
|
+
.sl-markdown-content a.table-ref:hover,
|
|
1024
|
+
.sl-markdown-content a.table-ref:focus-visible,
|
|
1025
|
+
.sl-markdown-content a.figure-ref:hover,
|
|
1026
|
+
.sl-markdown-content a.figure-ref:focus-visible {
|
|
1027
|
+
outline: 2px solid Highlight;
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
|
|
794
1031
|
/* Deep-linkable content headings (F3). The wrapper + anchor-link markup and its
|
|
795
1032
|
hover/focus reveal come from Starlight's bundled `anchor-links.css`; these
|
|
796
1033
|
rules add the sticky-header scroll offset and the `:target` flash, mirroring
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
/**
|
|
3
|
-
* Progressive enhancement for keyed equations (Step D7).
|
|
4
|
-
*
|
|
5
|
-
* The no-JS baseline is complete: `remark-notation` emits a real `id="eq-<key>"`
|
|
6
|
-
* container, a focusable number `<a>`, and `[[eq:key]]` renders a plain anchor;
|
|
7
|
-
* `global.css` does the `:target` deep-link highlight (with a
|
|
8
|
-
* `prefers-reduced-motion` fallback) and the sticky-header scroll offset via
|
|
9
|
-
* `scroll-margin`.
|
|
10
|
-
*
|
|
11
|
-
* This script only adds what CSS and anchors cannot:
|
|
12
|
-
* - a smooth, header-aware scroll on an in-page jump;
|
|
13
|
-
* - re-triggering the highlight when the same `#eq-…` is activated again —
|
|
14
|
-
* the one case a plain anchor click does nothing for, since the browser
|
|
15
|
-
* won't navigate to a fragment that's already current;
|
|
16
|
-
* - moving keyboard focus onto the equation so screen-reader users land on it.
|
|
17
|
-
*
|
|
18
|
-
* It deliberately does *not* intercept an ordinary click that changes the
|
|
19
|
-
* hash. `:target` is set only by a genuine same-document fragment
|
|
20
|
-
* navigation — never by `history.pushState` (a common trap: pushState
|
|
21
|
-
* updates the URL but leaves `:target`, and thus `eq-flash`, dark). Letting
|
|
22
|
-
* the click through and reacting to the `hashchange` it produces is what
|
|
23
|
-
* actually plays the highlight.
|
|
24
|
-
*
|
|
25
|
-
* Everything here is gated on `prefers-reduced-motion` and degrades to the
|
|
26
|
-
* native anchor behaviour if it throws.
|
|
27
|
-
*/
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
<script>
|
|
31
|
-
(() => {
|
|
32
|
-
const root = document.querySelector('.sl-markdown-content');
|
|
33
|
-
if (!root) return;
|
|
34
|
-
|
|
35
|
-
const reduce = window.matchMedia('(prefers-reduced-motion: reduce)');
|
|
36
|
-
|
|
37
|
-
const activate = (target: HTMLElement | null, doScroll: boolean) => {
|
|
38
|
-
if (!target) return;
|
|
39
|
-
if (!reduce.matches) {
|
|
40
|
-
// Restart the CSS `:target` animation even when the hash is unchanged.
|
|
41
|
-
target.style.animation = 'none';
|
|
42
|
-
void target.offsetWidth;
|
|
43
|
-
target.style.removeProperty('animation');
|
|
44
|
-
}
|
|
45
|
-
if (doScroll) {
|
|
46
|
-
target.scrollIntoView({
|
|
47
|
-
behavior: reduce.matches ? 'auto' : 'smooth',
|
|
48
|
-
block: 'start',
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
target.setAttribute('tabindex', '-1');
|
|
52
|
-
try {
|
|
53
|
-
target.focus({ preventScroll: true });
|
|
54
|
-
} catch {
|
|
55
|
-
target.focus();
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
root.addEventListener('click', (event) => {
|
|
60
|
-
const origin = event.target instanceof Element ? event.target : null;
|
|
61
|
-
const link = origin?.closest('a.equation-ref, a.keyed-equation__number');
|
|
62
|
-
if (!link) return;
|
|
63
|
-
const href = link.getAttribute('href') || '';
|
|
64
|
-
if (!href.startsWith('#eq-')) return; // cross-page: let the browser navigate
|
|
65
|
-
const target = document.getElementById(href.slice(1));
|
|
66
|
-
if (!target) return;
|
|
67
|
-
// Only the already-on-this-anchor click needs handling here — the
|
|
68
|
-
// browser has nothing new to navigate to, so it won't fire `hashchange`
|
|
69
|
-
// and nothing else will re-trigger the flash. Every other click is left
|
|
70
|
-
// alone: its native navigation sets `:target` and fires `hashchange`,
|
|
71
|
-
// which the listener below turns into the same `activate()`.
|
|
72
|
-
if (location.hash === href) {
|
|
73
|
-
event.preventDefault();
|
|
74
|
-
activate(target, true);
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
window.addEventListener('hashchange', () => {
|
|
79
|
-
if (!location.hash.startsWith('#eq-')) return;
|
|
80
|
-
activate(document.getElementById(location.hash.slice(1)), true);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
if (location.hash.startsWith('#eq-')) {
|
|
84
|
-
activate(document.getElementById(location.hash.slice(1)), true);
|
|
85
|
-
}
|
|
86
|
-
})();
|
|
87
|
-
</script>
|