@myst-theme/site 0.9.0 → 0.9.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myst-theme/site",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -17,19 +17,19 @@
17
17
  "dependencies": {
18
18
  "@headlessui/react": "^1.7.15",
19
19
  "@heroicons/react": "^2.0.18",
20
- "@myst-theme/common": "^0.9.0",
21
- "@myst-theme/diagrams": "^0.9.0",
22
- "@myst-theme/frontmatter": "^0.9.0",
23
- "@myst-theme/jupyter": "^0.9.0",
24
- "@myst-theme/providers": "^0.9.0",
20
+ "@myst-theme/common": "^0.9.1",
21
+ "@myst-theme/diagrams": "^0.9.1",
22
+ "@myst-theme/frontmatter": "^0.9.1",
23
+ "@myst-theme/jupyter": "^0.9.1",
24
+ "@myst-theme/providers": "^0.9.1",
25
25
  "@radix-ui/react-collapsible": "^1.0.3",
26
26
  "classnames": "^2.3.2",
27
27
  "lodash.throttle": "^4.1.1",
28
- "myst-common": "^1.3.0",
29
- "myst-config": "^1.3.0",
30
- "myst-demo": "^0.9.0",
31
- "myst-spec-ext": "^1.3.0",
32
- "myst-to-react": "^0.9.0",
28
+ "myst-common": "^1.4.0",
29
+ "myst-config": "^1.4.0",
30
+ "myst-demo": "^0.9.1",
31
+ "myst-spec-ext": "^1.4.0",
32
+ "myst-to-react": "^0.9.1",
33
33
  "nbtx": "^0.2.3",
34
34
  "node-cache": "^5.1.2",
35
35
  "node-fetch": "^2.6.11",
package/src/index.ts CHANGED
@@ -3,3 +3,4 @@ export * from './loaders/index.js';
3
3
  export * from './components/index.js';
4
4
  export * from './pages/index.js';
5
5
  export * from './seo/index.js';
6
+ export * from './themeCSS.js';
@@ -0,0 +1,33 @@
1
+ export type ThemeCssOptions = {
2
+ numbered_references?: boolean;
3
+ };
4
+
5
+ type MystThemeVariables = {
6
+ 'cite-group-open'?: '(' | '[' | string;
7
+ 'cite-group-close'?: ')' | ']' | string;
8
+ };
9
+
10
+ function variables(vars: MystThemeVariables) {
11
+ const css = Object.entries(vars)
12
+ .map(([name, value]) => `--${name}: '${value}';`)
13
+ .join('\n ');
14
+ if (!css) return '';
15
+ return `:root {\n ${css}}`;
16
+ }
17
+
18
+ export function themeCSS(options?: ThemeCssOptions) {
19
+ const numbered_references = !!options?.numbered_references;
20
+ const citationCss = numbered_references
21
+ ? { 'cite-group-open': '[', 'cite-group-close': ']' }
22
+ : {};
23
+ return variables({ ...citationCss });
24
+ }
25
+
26
+ export function cssResponse(css: string): Response {
27
+ return new Response(css, {
28
+ headers: {
29
+ 'Content-Type': 'text/css',
30
+ 'Cache-Control': 'no-cache',
31
+ },
32
+ });
33
+ }