explico 0.7.0 → 0.11.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 +1409 -1
- package/README.md +60 -15
- package/dist/compiler/astro.d.ts +6 -1
- package/dist/compiler/cli.d.ts +54 -3
- package/dist/compiler/cli.js +80 -6
- package/dist/compiler/collections.d.ts +35 -2
- package/dist/compiler/collections.js +84 -8
- package/dist/compiler/course-config.d.ts +3 -194
- package/dist/compiler/course-config.js +78 -5
- package/dist/compiler/exports/standalone-html.d.ts +6 -1
- package/dist/compiler/knowledge-version.js +1 -1
- package/dist/compiler/lesson-derivation.d.ts +27 -10
- package/dist/compiler/lesson-derivation.js +23 -8
- package/dist/compiler/logging.d.ts +14 -1
- package/dist/compiler/logging.js +6 -2
- package/dist/compiler/manifest.d.ts +204 -31
- package/dist/compiler/manifest.js +270 -55
- package/dist/compiler/resolution-report.d.ts +6 -1
- package/dist/course-config-Dsnri9Tk.d.ts +464 -0
- package/dist/reference/base-accents.d.mts +26 -0
- package/dist/reference/base-accents.mjs +31 -0
- package/dist/reference/base-roman-labels.d.mts +2 -2
- package/dist/reference/base-roman-labels.mjs +2 -2
- package/dist/reference/consistency.d.ts +14 -2
- package/dist/reference/consistency.js +108 -4
- package/dist/reference/delimiter-size.d.ts +21 -11
- package/dist/reference/delimiter-size.js +15 -39
- package/dist/reference/diagrams-validate.d.ts +7 -2
- package/dist/reference/diagrams-validate.js +9 -1
- package/dist/reference/equations-validate.d.ts +8 -5
- package/dist/reference/equations-validate.js +1 -0
- package/dist/reference/equations.d.mts +69 -34
- package/dist/reference/equations.mjs +90 -44
- package/dist/reference/examples-validate.d.ts +31 -0
- package/dist/reference/examples-validate.js +48 -0
- package/dist/reference/figures-validate.d.ts +1 -1
- package/dist/reference/figures-validate.js +4 -1
- package/dist/reference/folds-validate.d.ts +33 -0
- package/dist/reference/folds-validate.js +32 -0
- package/dist/reference/gate-abbreviations.d.ts +3 -1
- package/dist/reference/gate-abbreviations.js +3 -2
- package/dist/reference/gate-course-rules.d.ts +32 -0
- package/dist/reference/gate-course-rules.js +85 -0
- package/dist/reference/gate-heading-length.d.ts +5 -2
- package/dist/reference/gate-heading-length.js +47 -23
- package/dist/reference/gate-heading-structure.d.ts +41 -0
- package/dist/reference/gate-heading-structure.js +113 -0
- package/dist/reference/gate-math-punctuation.d.ts +71 -0
- package/dist/reference/gate-math-punctuation.js +251 -0
- package/dist/reference/gate-math.d.ts +44 -6
- package/dist/reference/gate-math.js +63 -10
- package/dist/reference/gate-part-pages.d.ts +50 -0
- package/dist/reference/gate-part-pages.js +118 -0
- package/dist/reference/gate-prose-notation.d.ts +32 -11
- package/dist/reference/gate-prose-notation.js +30 -8
- package/dist/reference/katex-delimiters.d.mts +15 -0
- package/dist/reference/katex-delimiters.mjs +138 -0
- package/dist/reference/katex-options.mjs +4 -0
- package/dist/reference/keyed-float-validate.d.ts +27 -10
- package/dist/reference/keyed-float-validate.js +15 -1
- package/dist/reference/keyed-jsx-floats.d.mts +11 -5
- package/dist/reference/keyed-jsx-floats.mjs +73 -20
- package/dist/reference/knowledge-checks-validate.d.ts +1 -1
- package/dist/reference/knowledge-checks.d.mts +3 -1
- package/dist/reference/knowledge-checks.mjs +9 -4
- package/dist/reference/lab-math-scope.d.ts +1 -0
- package/dist/reference/lab-math-slot.d.ts +34 -0
- package/dist/reference/lab-math-slot.js +6 -0
- package/dist/reference/math-glyphs.d.mts +80 -4
- package/dist/reference/math-glyphs.mjs +588 -39
- package/dist/reference/page-notation.d.ts +6 -1
- package/dist/reference/raw-floats-validate.js +1 -1
- package/dist/reference/raw-floats.mjs +1 -1
- package/dist/reference/rehype-heading-anchors.d.mts +14 -0
- package/dist/reference/rehype-heading-anchors.mjs +116 -17
- package/dist/reference/rehype-table-header-labels.d.mts +6 -1
- package/dist/reference/rehype-table-header-labels.mjs +21 -3
- package/dist/reference/remark-asides.d.mts +3 -0
- package/dist/reference/remark-asides.mjs +180 -0
- package/dist/reference/remark-memo.d.mts +3 -1
- package/dist/reference/remark-memo.mjs +42 -11
- package/dist/reference/remark-notation.d.mts +60 -10
- package/dist/reference/remark-notation.mjs +387 -36
- package/dist/reference/render-lab-math.d.ts +4 -26
- package/dist/reference/render-lab-math.js +5 -5
- package/dist/reference/sections-validate.d.ts +27 -0
- package/dist/reference/sections-validate.js +41 -0
- package/dist/reference/sections.d.mts +97 -0
- package/dist/reference/sections.mjs +306 -0
- package/dist/reference/tables-validate.d.ts +1 -1
- package/dist/reference/types.d.ts +24 -1
- package/dist/reference/unit-words.d.ts +37 -0
- package/dist/reference/unit-words.js +170 -0
- package/dist/rules/catalog.d.ts +176 -0
- package/dist/rules/catalog.js +983 -0
- package/dist/rules/course-rules.d.ts +115 -0
- package/dist/rules/course-rules.js +292 -0
- package/dist/rules/course-rules.schema.json +138 -0
- package/dist/rules/in-effect.d.ts +53 -0
- package/dist/rules/in-effect.js +142 -0
- package/dist/rules/rules.schema.json +1072 -0
- package/dist/rules/settings.d.ts +3 -0
- package/dist/rules/settings.js +290 -0
- package/dist/rules/waivers.d.ts +53 -0
- package/dist/rules/waivers.js +132 -0
- package/dist/session/PreferenceStore.d.ts +5 -0
- package/dist/session/PreferenceStore.js +9 -0
- package/docs/VERSIONING.md +2 -2
- package/docs/authoring/README.md +232 -40
- package/docs/authoring/agents.md +55 -9
- package/docs/authoring/components.md +178 -22
- package/docs/authoring/migrating.md +1324 -2
- package/docs/authoring/notation.md +616 -344
- package/docs/authoring/prose.md +551 -0
- package/docs/authoring/retired.md +35 -0
- package/docs/authoring/structure-rules.md +422 -40
- package/docs/authoring/structure.md +445 -62
- package/docs/authoring/versioning.md +20 -28
- package/docs/authoring/visualizations.md +142 -20
- package/docs/katex-bracket-scaling.md +191 -0
- package/package.json +3 -2
- package/src/compiler/cli.ts +139 -6
- package/src/compiler/collections.ts +144 -10
- package/src/compiler/course-config.ts +273 -34
- package/src/compiler/knowledge-version.ts +1 -1
- package/src/compiler/lesson-derivation.ts +54 -15
- package/src/compiler/logging.ts +21 -4
- package/src/compiler/manifest.ts +573 -104
- package/src/components/BlockHeading.astro +113 -0
- package/src/components/CourseContents.astro +221 -0
- package/src/components/CurriculumMap.astro +5 -6
- package/src/components/FloatIndex.astro +200 -0
- package/src/components/HoverPanel.astro +431 -79
- package/src/components/PartBridge.astro +27 -0
- package/src/components/PartOverview.astro +401 -0
- package/src/components/PartScope.astro +27 -0
- package/src/components/abbreviation/AbbreviationLayer.astro +49 -51
- package/src/components/assessments/AssessmentRunner.tsx +8 -5
- package/src/components/assessments/AssessmentSet.astro +23 -26
- package/src/components/block-heading.ts +146 -0
- package/src/components/card-arrow.ts +243 -0
- package/src/components/card-drag.ts +631 -0
- package/src/components/card-jump.ts +45 -0
- package/src/components/card-manager.ts +1589 -0
- package/src/components/card-memory.ts +177 -0
- package/src/components/card-placement.ts +504 -0
- package/src/components/card-side.ts +336 -0
- package/src/components/card-travel.ts +197 -0
- package/src/components/citation/CitationLayer.astro +77 -76
- package/src/components/diagram/Diagram.astro +161 -316
- package/src/components/disclosure/course-disclosure.ts +24 -0
- package/src/components/disclosure/hover-preview.ts +122 -42
- package/src/components/disclosure/persisted-disclosure.ts +3 -3
- package/src/components/disclosure/print-as-shown.ts +252 -0
- package/src/components/examples/CompactExample.astro +3 -1
- package/src/components/examples/CompactExamples.astro +101 -94
- package/src/components/figure/Figure.astro +174 -274
- package/src/components/figure/FloatCaption.astro +87 -0
- package/src/components/figure/figure-state.ts +58 -0
- package/src/components/figure/figure-tools.ts +87 -0
- package/src/components/float-name.ts +101 -0
- package/src/components/fold/Fold.astro +125 -0
- package/src/components/fold/fold-id.ts +40 -0
- package/src/components/memo/Memo.astro +162 -231
- package/src/components/memo/ShortNote.astro +6 -6
- package/src/components/notation/NotationFormula.astro +5 -1
- package/src/components/notation/NotationGlossary.astro +24 -14
- package/src/components/notation/NotationLayer.astro +169 -162
- package/src/components/notation/NotationMath.astro +10 -1
- package/src/components/notation/render-notation-math.ts +111 -10
- package/src/components/reference/FloatRefLayer.astro +485 -423
- package/src/components/starlight/AboutPanel.astro +22 -6
- package/src/components/starlight/CollapsibleSections.astro +207 -93
- package/src/components/starlight/DiagramEnhancer.astro +15 -138
- package/src/components/starlight/HeadingAnchorEnhancer.astro +193 -1
- package/src/components/starlight/KeyedFloatEnhancer.astro +100 -9
- package/src/components/starlight/LayoutHeader.astro +298 -19
- package/src/components/starlight/LayoutPageSidebar.astro +99 -12
- package/src/components/starlight/LayoutPageTitle.astro +120 -0
- package/src/components/starlight/LayoutSidebar.astro +229 -11
- package/src/components/starlight/LessonExportActions.astro +53 -72
- package/src/components/starlight/LessonFooter.astro +26 -4
- package/src/components/starlight/section-parts.ts +15 -2
- package/src/components/starlight/section-summary.ts +181 -0
- package/src/components/table/Table.astro +95 -76
- package/src/components/table/TableOverflowExpander.astro +65 -28
- package/src/content-config.ts +40 -4
- package/src/reference/base-accents.mjs +31 -0
- package/src/reference/base-roman-labels.mjs +2 -2
- package/src/reference/consistency.ts +176 -5
- package/src/reference/delimiter-size.ts +40 -61
- package/src/reference/diagrams-validate.ts +17 -1
- package/src/reference/equations-validate.ts +10 -5
- package/src/reference/equations.mjs +90 -44
- package/src/reference/examples-validate.ts +97 -0
- package/src/reference/figures-validate.ts +6 -1
- package/src/reference/folds-validate.ts +65 -0
- package/src/reference/gate-abbreviations.ts +3 -2
- package/src/reference/gate-course-rules.ts +134 -0
- package/src/reference/gate-heading-length.ts +68 -37
- package/src/reference/gate-heading-structure.ts +193 -0
- package/src/reference/gate-math-punctuation.ts +381 -0
- package/src/reference/gate-math.ts +119 -12
- package/src/reference/gate-part-pages.ts +217 -0
- package/src/reference/gate-prose-notation.ts +74 -13
- package/src/reference/katex-delimiters.mjs +138 -0
- package/src/reference/katex-options.mjs +4 -0
- package/src/reference/keyed-float-validate.ts +45 -11
- package/src/reference/keyed-jsx-floats.mjs +73 -20
- package/src/reference/knowledge-checks-validate.ts +1 -1
- package/src/reference/knowledge-checks.mjs +9 -4
- package/src/reference/lab-math-slot.ts +36 -0
- package/src/reference/math-glyphs.mjs +588 -39
- package/src/reference/raw-floats-validate.ts +1 -1
- package/src/reference/raw-floats.mjs +1 -1
- package/src/reference/rehype-heading-anchors.mjs +116 -17
- package/src/reference/rehype-table-header-labels.mjs +21 -3
- package/src/reference/remark-asides.mjs +180 -0
- package/src/reference/remark-memo.mjs +42 -11
- package/src/reference/remark-notation.mjs +387 -36
- package/src/reference/render-lab-math.ts +17 -32
- package/src/reference/sections-validate.ts +81 -0
- package/src/reference/sections.mjs +306 -0
- package/src/reference/tables-validate.ts +2 -1
- package/src/reference/types.ts +24 -0
- package/src/reference/unit-words.ts +233 -0
- package/src/rules/catalog.ts +1298 -0
- package/src/rules/course-rules.ts +456 -0
- package/src/rules/in-effect.ts +235 -0
- package/src/rules/settings.ts +448 -0
- package/src/rules/waivers.ts +249 -0
- package/src/session/PreferenceStore.ts +15 -0
- package/src/styles/global.css +1471 -163
- package/src/styles/surfaces.css +182 -0
- package/src/components/hover-panel.ts +0 -339
- package/src/components/popup-stack.ts +0 -345
|
@@ -1,82 +1,121 @@
|
|
|
1
1
|
---
|
|
2
|
+
/**
|
|
3
|
+
* A set of worked examples, one tab each (`CompactExample.astro`) — a
|
|
4
|
+
* numbered kind of its own, like a knowledge check
|
|
5
|
+
* (docs/plans/titles-and-containers.md Part 6, Q11): `Example 1.1.1`,
|
|
6
|
+
* anchored `#ex-‹id›`, cited with `[[ex-‹id›]]`. The author names only the
|
|
7
|
+
* topic, in `short` (rule S1 measures it); the engine's heading
|
|
8
|
+
* (`BlockHeading.astro`) puts the "Example" badge and the number before it.
|
|
9
|
+
* `remark-notation.mjs` numbers the set and hands this component its
|
|
10
|
+
* `number` and `anchorId`; an unplaced set renders without a number.
|
|
11
|
+
*
|
|
12
|
+
* **The set is a section of its own**, the way a `<Memo>` is (Part 4): its
|
|
13
|
+
* heading sits in a collapsible `.sl-heading-wrapper` marked
|
|
14
|
+
* `data-section-to-end`, so `CollapsibleSections.astro` folds the whole set —
|
|
15
|
+
* the gutter chevron, the hover peek, "Hidden here: 2 worked examples",
|
|
16
|
+
* persistence (`section:ex-‹id›`) and print-as-shown — and the chain icon
|
|
17
|
+
* copies its link. Its first-visit state is the course's
|
|
18
|
+
* `disclosure.workedExamples`; `defaultOpen` overrides it at one set. The
|
|
19
|
+
* frame is an accent card (`ex-tier-accent`, `surfaces.css`). Unlike a memo's
|
|
20
|
+
* `######`, the heading is an `<h2>` of the outline, as a knowledge check's
|
|
21
|
+
* is: it ends the section before it, "On this page" lists it, and rules S6
|
|
22
|
+
* and S7 read it as a `##` (`gate-heading-structure.ts`).
|
|
23
|
+
*/
|
|
24
|
+
import BlockHeading from '../BlockHeading.astro';
|
|
25
|
+
import { courseDisclosure } from '../disclosure/course-disclosure';
|
|
26
|
+
|
|
2
27
|
interface Props {
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
/**
|
|
28
|
+
/** Stable lowercase/hyphenated key: the set's anchor `#ex-‹id›` and `[[ex-‹id›]]`. */
|
|
29
|
+
id: string;
|
|
30
|
+
/** The set's topical title, after the engine's "Example" badge and number. */
|
|
31
|
+
short: string;
|
|
32
|
+
/** Optional one-line cue above the tabs. */
|
|
6
33
|
hint?: string;
|
|
7
|
-
/** Accessible name for the tab list created by progressive enhancement. */
|
|
34
|
+
/** Accessible name for the tab list created by progressive enhancement. Default: `short`. */
|
|
8
35
|
tabsLabel?: string;
|
|
36
|
+
/** State for a reader with nothing saved yet. Default: the course's `disclosure.workedExamples`. */
|
|
37
|
+
defaultOpen?: boolean;
|
|
38
|
+
/** Persist the reader's open/closed choice across visits, per page. Default: `true`. */
|
|
39
|
+
rememberState?: boolean;
|
|
40
|
+
/** Computed by `remark-notation.mjs` — never author this directly. */
|
|
41
|
+
number?: string;
|
|
42
|
+
/** Computed by `remark-notation.mjs` — never author this directly. */
|
|
43
|
+
anchorId?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if ('summary' in Astro.props) {
|
|
47
|
+
throw new Error(
|
|
48
|
+
'<CompactExamples> has no `summary` prop: the set is named by its `short` title.',
|
|
49
|
+
);
|
|
9
50
|
}
|
|
10
51
|
|
|
11
52
|
const {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
53
|
+
id,
|
|
54
|
+
short,
|
|
55
|
+
hint,
|
|
56
|
+
tabsLabel,
|
|
57
|
+
defaultOpen,
|
|
58
|
+
rememberState = true,
|
|
59
|
+
number,
|
|
60
|
+
anchorId,
|
|
15
61
|
} = Astro.props;
|
|
62
|
+
|
|
63
|
+
if (typeof id !== 'string' || !id.trim()) {
|
|
64
|
+
throw new Error(
|
|
65
|
+
'<CompactExamples> requires an `id`: the set is anchored `#ex-‹id›` and cited with `[[ex-‹id›]]`.',
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
if (typeof short !== 'string' || !short.trim()) {
|
|
69
|
+
throw new Error(
|
|
70
|
+
`<CompactExamples id="${id}"> requires a \`short\` title naming its topic; the engine draws "Example" and the number before it.`,
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const open = defaultOpen ?? (await courseDisclosure()).workedExamples.defaultOpen;
|
|
16
75
|
---
|
|
17
76
|
|
|
18
|
-
<compact-examples
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
77
|
+
<compact-examples
|
|
78
|
+
class="compact-examples ex-section-card ex-tier-accent"
|
|
79
|
+
data-tabs-label={tabsLabel ?? short}
|
|
80
|
+
>
|
|
81
|
+
<BlockHeading
|
|
82
|
+
kind="example"
|
|
83
|
+
anchorId={anchorId ?? `ex-${id}`}
|
|
84
|
+
title={short}
|
|
85
|
+
number={number}
|
|
86
|
+
collapsible={true}
|
|
87
|
+
defaultOpen={open}
|
|
88
|
+
rememberState={rememberState}
|
|
89
|
+
sectionToEnd
|
|
90
|
+
class="compact-examples__titlebar"
|
|
91
|
+
/>
|
|
92
|
+
{hint && <div class="compact-examples__hint">{hint}</div>}
|
|
93
|
+
<div class="compact-examples__body">
|
|
94
|
+
<slot />
|
|
95
|
+
</div>
|
|
28
96
|
</compact-examples>
|
|
29
97
|
|
|
30
98
|
<style>
|
|
99
|
+
/* The accent card (`ex-tier-accent`) draws the surface, border, radius and
|
|
100
|
+
shadow; `ex-section-card` (`surfaces.css`) its padding, which is also the
|
|
101
|
+
gutter the section chevron centres in. */
|
|
31
102
|
compact-examples {
|
|
32
103
|
display: block;
|
|
33
|
-
margin-block: 1.5rem;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.compact-examples {
|
|
37
|
-
overflow: clip;
|
|
38
|
-
border: 1px solid var(--sl-color-gray-5);
|
|
39
|
-
border-radius: 0.75rem;
|
|
40
|
-
background: var(--sl-color-gray-7);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.compact-examples__summary {
|
|
44
|
-
padding: 0.8rem 1rem;
|
|
45
|
-
cursor: pointer;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.compact-examples__summary::marker {
|
|
49
|
-
color: var(--sl-color-text-accent);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.compact-examples__summary:focus-visible {
|
|
53
|
-
outline: 3px solid var(--sl-color-accent);
|
|
54
|
-
outline-offset: -3px;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.compact-examples__title {
|
|
58
|
-
font-weight: 700;
|
|
59
104
|
}
|
|
60
105
|
|
|
61
106
|
.compact-examples__hint {
|
|
62
|
-
display: block;
|
|
63
|
-
margin-block-start: 0.15rem;
|
|
64
107
|
color: var(--sl-color-gray-3);
|
|
65
108
|
font-size: var(--sl-text-sm);
|
|
66
109
|
}
|
|
67
110
|
|
|
68
|
-
.
|
|
69
|
-
padding: 0.25rem 1rem 1rem;
|
|
70
|
-
border-block-start: 1px solid var(--sl-color-gray-5);
|
|
71
|
-
}
|
|
72
|
-
|
|
111
|
+
/* The tab row spans the card, edge to edge, under the title. */
|
|
73
112
|
:global(.compact-examples__tabs) {
|
|
74
113
|
display: flex;
|
|
75
114
|
gap: 0.25rem;
|
|
76
115
|
overflow-x: auto;
|
|
77
|
-
margin: 0 -
|
|
78
|
-
padding: 0
|
|
79
|
-
border-block-end:
|
|
116
|
+
margin: 0.25rem calc(-1 * var(--ex-pad-box)) 1rem;
|
|
117
|
+
padding: 0 var(--ex-pad-box);
|
|
118
|
+
border-block-end: var(--ex-edge-border);
|
|
80
119
|
}
|
|
81
120
|
|
|
82
121
|
:global(.compact-examples__tab) {
|
|
@@ -108,23 +147,15 @@ const {
|
|
|
108
147
|
}
|
|
109
148
|
|
|
110
149
|
@media print {
|
|
111
|
-
.
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
.compact-examples__summary,
|
|
150
|
+
/* Print follows the screen (`../disclosure/print-as-shown.ts`): an open
|
|
151
|
+
set prints every example in turn under its own title, no tabs; a
|
|
152
|
+
folded one prints its heading and a "(content collapsed …)" note, like
|
|
153
|
+
any section. */
|
|
154
|
+
.compact-examples__hint,
|
|
118
155
|
:global(.compact-examples__tabs) {
|
|
119
156
|
display: none;
|
|
120
157
|
}
|
|
121
158
|
|
|
122
|
-
.compact-examples__body {
|
|
123
|
-
display: block !important;
|
|
124
|
-
padding: 0;
|
|
125
|
-
border: 0;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
159
|
:global(.compact-example[hidden]) {
|
|
129
160
|
display: block !important;
|
|
130
161
|
}
|
|
@@ -146,12 +177,10 @@ const {
|
|
|
146
177
|
connectedCallback() {
|
|
147
178
|
if (this.dataset.enhanced === 'true') return;
|
|
148
179
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
const body =
|
|
152
|
-
|
|
153
|
-
);
|
|
154
|
-
if (!details || !body) return;
|
|
180
|
+
// Not `:scope >`: `CollapsibleSections` may already have moved the
|
|
181
|
+
// body into the set's `<details>` — the two scripts run in either order.
|
|
182
|
+
const body = this.querySelector<HTMLElement>('.compact-examples__body');
|
|
183
|
+
if (!body) return;
|
|
155
184
|
|
|
156
185
|
const panels = Array.from(
|
|
157
186
|
body.querySelectorAll<HTMLElement>(':scope > [data-compact-example]'),
|
|
@@ -224,28 +253,6 @@ const {
|
|
|
224
253
|
|
|
225
254
|
body.prepend(tablist);
|
|
226
255
|
activate(0);
|
|
227
|
-
|
|
228
|
-
let openBeforePrint: boolean | undefined;
|
|
229
|
-
const enterPrintMode = () => {
|
|
230
|
-
if (document.querySelector('[data-explico-print-controller]')) return;
|
|
231
|
-
if (openBeforePrint !== undefined) return;
|
|
232
|
-
openBeforePrint = details.open;
|
|
233
|
-
details.open = true;
|
|
234
|
-
};
|
|
235
|
-
const leavePrintMode = () => {
|
|
236
|
-
if (document.querySelector('[data-explico-print-controller]')) return;
|
|
237
|
-
if (openBeforePrint === undefined) return;
|
|
238
|
-
details.open = openBeforePrint;
|
|
239
|
-
openBeforePrint = undefined;
|
|
240
|
-
};
|
|
241
|
-
const printMedia = window.matchMedia('print');
|
|
242
|
-
printMedia.addEventListener('change', (event) => {
|
|
243
|
-
if (event.matches) enterPrintMode();
|
|
244
|
-
else leavePrintMode();
|
|
245
|
-
});
|
|
246
|
-
window.addEventListener('beforeprint', enterPrintMode);
|
|
247
|
-
window.addEventListener('afterprint', leavePrintMode);
|
|
248
|
-
if (printMedia.matches) enterPrintMode();
|
|
249
256
|
}
|
|
250
257
|
}
|
|
251
258
|
|