@neuromatch/course-kit 0.0.0-stage → 0.1.1
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/dist/assets/cells/cells.css +121 -0
- package/dist/assets/cells/page.css +71 -0
- package/dist/assets/cells/panel.mjs +27 -0
- package/dist/assets/cells/runtime-widget.mjs +4 -0
- package/dist/assets/feedback/widget.mjs +146 -0
- package/dist/assets/scrolly/engine.mjs +140 -0
- package/dist/assets/scrolly/runnable.css +67 -0
- package/dist/assets/scrolly/runnable.mjs +353 -0
- package/dist/assets/scrolly/scrolly.css +173 -0
- package/dist/build-info.json +4 -0
- package/dist/nma.mjs +8285 -0
- package/dist/nma.yml +9 -0
- package/package.json +38 -4
- package/README.md +0 -3
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/* Editable cell panel (in each panel's shadow root).
|
|
2
|
+
Layout: header, editor, action bar, output. Colours follow the site theme.
|
|
3
|
+
Public tokens, set on :root / html.dark in _static/custom.css:
|
|
4
|
+
--nma-cell-{bg,fg}-{light,dark}, --nma-cell-head-{bg,fg}-{light,dark},
|
|
5
|
+
--nma-cell-bar-bg-{light,dark}, --nma-cell-out-bg-{light,dark},
|
|
6
|
+
--nma-cell-gutter-{bg,fg}-{light,dark}, --nma-cell-active-line-{light,dark},
|
|
7
|
+
--nma-cell-border-{light,dark}, --nma-cell-radius,
|
|
8
|
+
--nma-cell-accent-{light,dark}, --nma-cell-exercise-accent-{light,dark},
|
|
9
|
+
--nma-cell-font-family, --nma-cell-font-size-value,
|
|
10
|
+
--nma-tok-{keyword,string,number,comment,function,definition}-{light,dark}. */
|
|
11
|
+
:host {
|
|
12
|
+
display: block;
|
|
13
|
+
margin: 1.25rem 0;
|
|
14
|
+
--_bg: var(--nma-cell-bg-light, #fafafd);
|
|
15
|
+
--_fg: var(--nma-cell-fg-light, #1f1d3a);
|
|
16
|
+
--_head-bg: var(--nma-cell-head-bg-light, #f0f0f7);
|
|
17
|
+
--_head-fg: var(--nma-cell-head-fg-light, #55537e);
|
|
18
|
+
--_bar-bg: var(--nma-cell-bar-bg-light, #f5f5fa);
|
|
19
|
+
--_out-bg: var(--nma-cell-out-bg-light, #ffffff);
|
|
20
|
+
--_border: var(--nma-cell-border-light, #d9d9e8);
|
|
21
|
+
--_gutter-bg: var(--nma-cell-gutter-bg-light, #f5f5fa);
|
|
22
|
+
--_gutter-fg: var(--nma-cell-gutter-fg-light, #9a98b8);
|
|
23
|
+
--_active: var(--nma-cell-active-line-light, rgba(79, 70, 229, 0.06));
|
|
24
|
+
--_accent: var(--nma-cell-accent-light, #4f46e5);
|
|
25
|
+
--_accent-fg: #ffffff;
|
|
26
|
+
--_exercise: var(--nma-cell-exercise-accent-light, #c77d0a);
|
|
27
|
+
--_keyword: var(--nma-tok-keyword-light, #7c3aed);
|
|
28
|
+
--_string: var(--nma-tok-string-light, #0b7a5a);
|
|
29
|
+
--_number: var(--nma-tok-number-light, #b4540b);
|
|
30
|
+
--_comment: var(--nma-tok-comment-light, #7a7897);
|
|
31
|
+
--_function: var(--nma-tok-function-light, #1c5fb8);
|
|
32
|
+
--_definition: var(--nma-tok-definition-light, #1c5fb8);
|
|
33
|
+
}
|
|
34
|
+
:host([data-theme='dark']) {
|
|
35
|
+
--_bg: var(--nma-cell-bg-dark, #1b1a2e);
|
|
36
|
+
--_fg: var(--nma-cell-fg-dark, #e8e7ff);
|
|
37
|
+
--_head-bg: var(--nma-cell-head-bg-dark, #232240);
|
|
38
|
+
--_head-fg: var(--nma-cell-head-fg-dark, #b4b3dc);
|
|
39
|
+
--_bar-bg: var(--nma-cell-bar-bg-dark, #201f38);
|
|
40
|
+
--_out-bg: var(--nma-cell-out-bg-dark, #151424);
|
|
41
|
+
--_border: var(--nma-cell-border-dark, #36345c);
|
|
42
|
+
--_gutter-bg: var(--nma-cell-gutter-bg-dark, #201f38);
|
|
43
|
+
--_gutter-fg: var(--nma-cell-gutter-fg-dark, #7f7da8);
|
|
44
|
+
--_active: var(--nma-cell-active-line-dark, rgba(185, 184, 255, 0.07));
|
|
45
|
+
--_accent: var(--nma-cell-accent-dark, #7c7bff);
|
|
46
|
+
--_exercise: var(--nma-cell-exercise-accent-dark, #f0b35a);
|
|
47
|
+
--_keyword: var(--nma-tok-keyword-dark, #c3a6ff);
|
|
48
|
+
--_string: var(--nma-tok-string-dark, #5efbd7);
|
|
49
|
+
--_number: var(--nma-tok-number-dark, #ffb86b);
|
|
50
|
+
--_comment: var(--nma-tok-comment-dark, #8b89b3);
|
|
51
|
+
--_function: var(--nma-tok-function-dark, #8ab8ff);
|
|
52
|
+
--_definition: var(--nma-tok-definition-dark, #8ab8ff);
|
|
53
|
+
}
|
|
54
|
+
* { box-sizing: border-box; }
|
|
55
|
+
[hidden] { display: none !important; }
|
|
56
|
+
|
|
57
|
+
.cell {
|
|
58
|
+
--nma-cell-bg: var(--_bg);
|
|
59
|
+
--nma-cell-fg: var(--_fg);
|
|
60
|
+
--nma-cell-gutter-bg: var(--_gutter-bg);
|
|
61
|
+
--nma-cell-gutter-fg: var(--_gutter-fg);
|
|
62
|
+
--nma-cell-active-line: var(--_active);
|
|
63
|
+
--nma-tok-keyword: var(--_keyword);
|
|
64
|
+
--nma-tok-string: var(--_string);
|
|
65
|
+
--nma-tok-number: var(--_number);
|
|
66
|
+
--nma-tok-comment: var(--_comment);
|
|
67
|
+
--nma-tok-function: var(--_function);
|
|
68
|
+
--nma-tok-definition: var(--_definition);
|
|
69
|
+
--nma-cell-font: var(--nma-cell-font-family, ui-monospace, 'Cascadia Code', SFMono-Regular, Menlo, Consolas, monospace);
|
|
70
|
+
--nma-cell-font-size: var(--nma-cell-font-size-value, 0.85rem);
|
|
71
|
+
--nma-cell-accent: var(--_accent);
|
|
72
|
+
--_mark: var(--_accent);
|
|
73
|
+
border: 1px solid var(--_border);
|
|
74
|
+
border-radius: var(--nma-cell-radius, 10px);
|
|
75
|
+
overflow: hidden;
|
|
76
|
+
background: var(--_bg);
|
|
77
|
+
color: var(--_fg);
|
|
78
|
+
text-align: left;
|
|
79
|
+
font-family: system-ui, sans-serif;
|
|
80
|
+
}
|
|
81
|
+
.cell.is-exercise { --_mark: var(--_exercise); --nma-cell-accent: var(--_exercise); }
|
|
82
|
+
.cell.is-exercise { border-left: 4px solid var(--_exercise); }
|
|
83
|
+
|
|
84
|
+
.head {
|
|
85
|
+
display: flex; align-items: center;
|
|
86
|
+
padding: 0.4rem 1rem; background: var(--_head-bg); color: var(--_head-fg);
|
|
87
|
+
border-bottom: 1px solid var(--_border);
|
|
88
|
+
font: 600 0.78rem system-ui, sans-serif; letter-spacing: 0.02em;
|
|
89
|
+
}
|
|
90
|
+
.cell.is-exercise .head { color: var(--_exercise); }
|
|
91
|
+
|
|
92
|
+
.editor .cm-editor { max-height: 60vh; }
|
|
93
|
+
.editor .cm-scroller { overflow: auto; line-height: 1.6; }
|
|
94
|
+
.editor .cm-content { padding: 0.6rem 0; }
|
|
95
|
+
.editor .cm-line { padding: 0 1.1rem 0 0.5rem; }
|
|
96
|
+
.editor .cm-gutters { padding-left: 0.4rem; }
|
|
97
|
+
.editor .cm-editor.cm-focused { outline: none; box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--_mark) 55%, transparent); }
|
|
98
|
+
|
|
99
|
+
.actions {
|
|
100
|
+
display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
|
|
101
|
+
padding: 0.45rem 1rem; background: var(--_bar-bg);
|
|
102
|
+
border-top: 1px solid var(--_border);
|
|
103
|
+
}
|
|
104
|
+
.actions button {
|
|
105
|
+
box-sizing: border-box; height: 1.9rem; min-width: 5rem; padding: 0 0.95rem;
|
|
106
|
+
display: inline-flex; align-items: center; justify-content: center;
|
|
107
|
+
font: 600 0.78rem system-ui, sans-serif; line-height: 1; white-space: nowrap;
|
|
108
|
+
border-radius: 6px; cursor: pointer;
|
|
109
|
+
background: transparent; color: var(--_fg); border: 1px solid var(--_border);
|
|
110
|
+
transition: background 0.12s, border-color 0.12s;
|
|
111
|
+
}
|
|
112
|
+
.actions button:hover { background: color-mix(in srgb, var(--_fg) 8%, transparent); border-color: color-mix(in srgb, var(--_fg) 35%, var(--_border)); }
|
|
113
|
+
.actions button:focus-visible { outline: 2px solid var(--_mark); outline-offset: 2px; }
|
|
114
|
+
.actions button.run { background: var(--_accent); border-color: var(--_accent); color: var(--_accent-fg); }
|
|
115
|
+
.cell.is-exercise .actions button.run { background: var(--_exercise); border-color: var(--_exercise); }
|
|
116
|
+
.actions button.run:hover { filter: brightness(1.1); }
|
|
117
|
+
.status { font: 500 0.78rem ui-monospace, Consolas, monospace; color: var(--_head-fg); margin-left: auto; }
|
|
118
|
+
|
|
119
|
+
.output { background: var(--_out-bg); border-top: 1px solid var(--_border); }
|
|
120
|
+
.output:has(slot[name='out']) { min-height: 0; }
|
|
121
|
+
slot[name='out'] { display: block; }
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/* Page-level rules for editable cells. runtime-widget.mjs copies this file into <head>. */
|
|
2
|
+
.nma-cells-runtime { display: none; }
|
|
3
|
+
|
|
4
|
+
/* Floating "Run all" control (runtime-widget.mjs). Brand-coloured via the theme
|
|
5
|
+
variables set in _static/custom.css, with safe fallbacks. */
|
|
6
|
+
.nma-run-all-bar {
|
|
7
|
+
position: fixed;
|
|
8
|
+
right: 1rem;
|
|
9
|
+
bottom: 1rem;
|
|
10
|
+
z-index: 50;
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
gap: 0.6rem;
|
|
14
|
+
padding: 0.35rem 0.5rem 0.35rem 0.35rem;
|
|
15
|
+
border-radius: 999px;
|
|
16
|
+
background: var(--myst-color-surface, #f3f4f6);
|
|
17
|
+
border: 1px solid var(--myst-color-border-strong, #d1d5db);
|
|
18
|
+
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
|
|
19
|
+
font: 600 0.85rem/1 var(--nma-font-sans, ui-sans-serif, system-ui, sans-serif);
|
|
20
|
+
}
|
|
21
|
+
.nma-run-all-bar .nma-run-all {
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
border: 0;
|
|
24
|
+
border-radius: 999px;
|
|
25
|
+
padding: 0.45rem 1rem;
|
|
26
|
+
font: inherit;
|
|
27
|
+
color: #fff;
|
|
28
|
+
background: var(--myst-color-primary, #008cbf);
|
|
29
|
+
}
|
|
30
|
+
.nma-run-all-bar .nma-run-all:hover:not(:disabled) { background: var(--myst-color-primary-hover, #006b8f); }
|
|
31
|
+
.nma-run-all-bar .nma-run-all:disabled { opacity: 0.6; cursor: default; }
|
|
32
|
+
.nma-run-all-bar .nma-run-all-status {
|
|
33
|
+
color: var(--myst-color-text-secondary, #4b5563);
|
|
34
|
+
white-space: nowrap;
|
|
35
|
+
font-weight: 400;
|
|
36
|
+
}
|
|
37
|
+
/* The output area is slotted into the panel, so it needs a little air only when it has content. */
|
|
38
|
+
.nma-cell-out { margin: 0; padding: 0; }
|
|
39
|
+
.nma-cell-out:not(:empty) { padding: 0.65rem 1.1rem 0.8rem; }
|
|
40
|
+
.nma-cell-out .nma-hint { margin: 0; opacity: 0.7; font-size: 0.85rem; font-style: italic; }
|
|
41
|
+
.nma-cell-out.is-stale { opacity: 0.55; }
|
|
42
|
+
.nma-cell-out.is-stale::before { content: 'Edited · run to update'; display: block; font-size: 0.75rem; margin-bottom: 0.3rem; }
|
|
43
|
+
|
|
44
|
+
/* Output text: follow the page theme, not MyST's dark <pre> blocks or thebe's pink stderr. */
|
|
45
|
+
.nma-cell-out .jp-OutputPrompt { display: none; }
|
|
46
|
+
.nma-cell-out .jp-RenderedText { background: transparent !important; }
|
|
47
|
+
.nma-cell-out .jp-RenderedText[data-mime-type='application/vnd.jupyter.stderr'] {
|
|
48
|
+
background: rgba(220, 53, 69, 0.07) !important;
|
|
49
|
+
border-left: 3px solid rgba(220, 53, 69, 0.55);
|
|
50
|
+
padding-left: 0.6rem;
|
|
51
|
+
}
|
|
52
|
+
.nma-cell-out pre {
|
|
53
|
+
margin: 0;
|
|
54
|
+
padding: 0;
|
|
55
|
+
background: transparent !important;
|
|
56
|
+
color: inherit !important;
|
|
57
|
+
border: 0;
|
|
58
|
+
font: 0.82rem/1.55 ui-monospace, 'Cascadia Code', SFMono-Regular, Menlo, Consolas, monospace;
|
|
59
|
+
white-space: pre-wrap;
|
|
60
|
+
overflow: auto;
|
|
61
|
+
max-height: 50vh;
|
|
62
|
+
}
|
|
63
|
+
.nma-cell-out .jp-RenderedImage img, .nma-cell-out img { max-width: 100%; height: auto; border-radius: 6px; background: #fff; }
|
|
64
|
+
/* ANSI colours (tracebacks) are tuned for light pages; lift them on dark ones. */
|
|
65
|
+
html.dark .nma-cell-out .ansi-red-fg { color: #ff8a8a; }
|
|
66
|
+
html.dark .nma-cell-out .ansi-green-fg { color: #5edba0; }
|
|
67
|
+
html.dark .nma-cell-out .ansi-blue-fg { color: #8ab8ff; }
|
|
68
|
+
html.dark .nma-cell-out .ansi-yellow-fg { color: #f0c36a; }
|
|
69
|
+
html.dark .nma-cell-out .ansi-magenta-fg { color: #d9a6ff; }
|
|
70
|
+
html.dark .nma-cell-out .ansi-cyan-fg { color: #6fe0e8; }
|
|
71
|
+
html.dark .nma-cell-out .ansi-black-fg, html.dark .nma-cell-out .ansi-white-fg { color: inherit; }
|