myst-demo 0.13.0 → 0.13.2
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/index.d.ts.map +1 -1
- package/dist/index.js +15 -3
- package/package.json +18 -18
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAsN1D,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,MAAM,EACN,UAAU,EACV,SAAS,EACT,UAAU,EACV,UAAU,EACV,SAAS,GACV,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE,eAAe,CAAA;KAAE,KAAK,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;IAC7E,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAsN1D,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,MAAM,EACN,UAAU,EACV,SAAS,EACT,UAAU,EACV,UAAU,EACV,SAAS,GACV,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE,eAAe,CAAA;KAAE,KAAK,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;IAC7E,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,2CA8PA;AAED,eAAO,MAAM,gBAAgB,EAAE,YAE9B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -7,10 +7,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
+
var t = {};
|
|
12
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
+
t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
+
t[p[i]] = s[p[i]];
|
|
18
|
+
}
|
|
19
|
+
return t;
|
|
20
|
+
};
|
|
10
21
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
22
|
import { VFile } from 'vfile';
|
|
12
23
|
import { remove } from 'unist-util-remove';
|
|
13
|
-
import
|
|
24
|
+
import { load as yamlLoad, dump as yamlDump } from 'js-yaml';
|
|
14
25
|
import { fileError, RuleId, } from 'myst-common';
|
|
15
26
|
import { SourceFileKind } from 'myst-spec-ext';
|
|
16
27
|
import { validatePageFrontmatter } from 'myst-frontmatter';
|
|
@@ -52,7 +63,7 @@ function getFrontmatter(vfile, tree) {
|
|
|
52
63
|
const firstIsYaml = (firstNode === null || firstNode === void 0 ? void 0 : firstNode.type) === 'code' && (firstNode === null || firstNode === void 0 ? void 0 : firstNode.lang) === 'yaml';
|
|
53
64
|
if (firstIsYaml) {
|
|
54
65
|
try {
|
|
55
|
-
frontmatter =
|
|
66
|
+
frontmatter = yamlLoad(firstNode.value) || {};
|
|
56
67
|
firstNode.type = '__delete__';
|
|
57
68
|
}
|
|
58
69
|
catch (err) {
|
|
@@ -285,6 +296,7 @@ export function MySTRenderer({ value, column, fullscreen, numbering, TitleBlock,
|
|
|
285
296
|
'bg-blue-800 text-white': astStage === show,
|
|
286
297
|
}), title: `Show the AST Stage ${show.toUpperCase()}`, "aria-pressed": astStage === show ? 'true' : 'false', onClick: () => setAstStage(show), children: show.toUpperCase() }, show)))] }))] }));
|
|
287
298
|
const mdastStage = astStage === 'pre' ? mdastPre : mdastPost;
|
|
299
|
+
const { downloads, exports, parts } = frontmatter, reducedFrontmatter = __rest(frontmatter, ["downloads", "exports", "parts"]);
|
|
288
300
|
return (_jsxs("figure", { className: classnames('relative', {
|
|
289
301
|
'grid grid-cols-2 gap-0 grid-rows-[3rem_1fr]': column,
|
|
290
302
|
'shadow-lg rounded': !fullscreen,
|
|
@@ -295,7 +307,7 @@ export function MySTRenderer({ value, column, fullscreen, numbering, TitleBlock,
|
|
|
295
307
|
'pt-[40px]': !column && previewType !== 'AST',
|
|
296
308
|
'pt-[80px]': !column && previewType === 'AST',
|
|
297
309
|
'pt-4': column,
|
|
298
|
-
}), children: [previewType === 'DEMO' && (_jsx(_Fragment, { children: _jsxs(ReferencesProvider, { references: references, frontmatter:
|
|
310
|
+
}), children: [previewType === 'DEMO' && (_jsx(_Fragment, { children: _jsxs(ReferencesProvider, { references: references, frontmatter: reducedFrontmatter, children: [TitleBlock && _jsx(TitleBlock, { frontmatter: frontmatter }), _jsx(MyST, { ast: (_a = references.article) === null || _a === void 0 ? void 0 : _a.children })] }) })), previewType === 'AST' && (_jsx(_Fragment, { children: _jsx(CodeBlock, { lang: astLang, value: astLang === 'yaml' ? yamlDump(mdastStage) : JSON.stringify(mdastStage, null, 2) }) })), previewType === 'HTML' && _jsx(CodeBlock, { lang: "xml", value: html, showCopy: false }), previewType === 'LaTeX' && _jsx(CodeBlock, { lang: "latex", value: tex, showCopy: false }), previewType === 'Typst' && _jsx(CodeBlock, { lang: "typst", value: typst, showCopy: false }), previewType === 'JATS' && _jsx(CodeBlock, { lang: "xml", value: jats, showCopy: false }), previewType === 'DOCX' && (_jsx("div", { children: _jsxs("button", { className: "p-3 border rounded", onClick: () => saveDocxFile('demo.docx', references.article), title: `Download Micorsoft Word`, "aria-label": `Download Micorsoft Word`, children: [_jsx(ArrowDownTrayIcon, { width: "1.3rem", height: "1.3rem", className: "inline mr-1" }), ' ', "Download as Microsoft Word"] }) }))] }), currentWarnings.length > 0 && (_jsx("div", { className: classnames('w-full', { 'absolute bottom-0': column }), children: currentWarnings.map((m, i) => (_jsxs("div", { className: classnames('p-1 shadow-inner text-white not-prose', {
|
|
299
311
|
'bg-red-500 dark:bg-red-800': m.fatal === true,
|
|
300
312
|
'bg-orange-500 dark:bg-orange-700': m.fatal === false,
|
|
301
313
|
'bg-slate-500 dark:bg-slate-800': m.fatal === null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "myst-demo",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -23,24 +23,24 @@
|
|
|
23
23
|
"@heroicons/react": "^2.0.18",
|
|
24
24
|
"classnames": "^2.3.2",
|
|
25
25
|
"js-yaml": "^4.1.0",
|
|
26
|
-
"myst-common": "^1.7.
|
|
27
|
-
"myst-config": "^1.
|
|
28
|
-
"myst-directives": "^1.5.
|
|
29
|
-
"myst-ext-card": "^1.0.
|
|
30
|
-
"myst-ext-exercise": "^1.0.
|
|
31
|
-
"myst-ext-grid": "^1.0.
|
|
32
|
-
"myst-ext-proof": "^1.0.
|
|
33
|
-
"myst-ext-tabs": "^1.0.
|
|
34
|
-
"myst-frontmatter": "^1.7.
|
|
35
|
-
"myst-parser": "^1.5.
|
|
26
|
+
"myst-common": "^1.7.2",
|
|
27
|
+
"myst-config": "^1.7.2",
|
|
28
|
+
"myst-directives": "^1.5.7",
|
|
29
|
+
"myst-ext-card": "^1.0.9",
|
|
30
|
+
"myst-ext-exercise": "^1.0.8",
|
|
31
|
+
"myst-ext-grid": "^1.0.8",
|
|
32
|
+
"myst-ext-proof": "^1.0.11",
|
|
33
|
+
"myst-ext-tabs": "^1.0.8",
|
|
34
|
+
"myst-frontmatter": "^1.7.2",
|
|
35
|
+
"myst-parser": "^1.5.7",
|
|
36
36
|
"myst-spec": "^0.0.5",
|
|
37
|
-
"myst-to-docx": "^1.0.
|
|
38
|
-
"myst-to-html": "^1.5.
|
|
39
|
-
"myst-to-jats": "^1.0.
|
|
40
|
-
"myst-to-react": "^0.13.
|
|
41
|
-
"myst-to-tex": "^1.0.
|
|
42
|
-
"myst-to-typst": "^0.0.
|
|
43
|
-
"myst-transforms": "^1.3.
|
|
37
|
+
"myst-to-docx": "^1.0.12",
|
|
38
|
+
"myst-to-html": "^1.5.7",
|
|
39
|
+
"myst-to-jats": "^1.0.30",
|
|
40
|
+
"myst-to-react": "^0.13.2",
|
|
41
|
+
"myst-to-tex": "^1.0.38",
|
|
42
|
+
"myst-to-typst": "^0.0.24",
|
|
43
|
+
"myst-transforms": "^1.3.26",
|
|
44
44
|
"unified": "^10.1.2",
|
|
45
45
|
"unist-util-remove": "^4.0.0",
|
|
46
46
|
"unist-util-visit": "^4.1.2",
|