myst-demo 0.13.5 → 0.13.7
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 +8 -7
- package/package.json +18 -17
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;
|
|
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;AA0N1D,wBAAgB,YAAY,CAAC,EAC3B,EAAE,EACF,KAAK,EACL,MAAM,EACN,UAAU,EACV,SAAS,EACT,UAAU,EACV,UAAU,EACV,SAAS,GACV,EAAE;IACD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,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,2CA+PA;AAED,eAAO,MAAM,gBAAgB,EAAE,YAS9B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -93,6 +93,7 @@ function parse(text, defaultFrontmatter, options) {
|
|
|
93
93
|
const { default: mystToTypst } = yield import('myst-to-typst');
|
|
94
94
|
const { default: mystToJats } = yield import('myst-to-jats').catch(() => ({ default: null }));
|
|
95
95
|
const { mystToHtml } = yield import('myst-to-html');
|
|
96
|
+
const { buttonRole } = yield import('myst-ext-button');
|
|
96
97
|
const { cardDirective } = yield import('myst-ext-card');
|
|
97
98
|
const { gridDirective } = yield import('myst-ext-grid');
|
|
98
99
|
const { tabDirectives } = yield import('myst-ext-tabs');
|
|
@@ -108,7 +109,7 @@ function parse(text, defaultFrontmatter, options) {
|
|
|
108
109
|
proofDirective,
|
|
109
110
|
...exerciseDirectives,
|
|
110
111
|
],
|
|
111
|
-
|
|
112
|
+
roles: [buttonRole],
|
|
112
113
|
vfile,
|
|
113
114
|
});
|
|
114
115
|
const mdast = parseMyst(text);
|
|
@@ -134,7 +135,7 @@ function parse(text, defaultFrontmatter, options) {
|
|
|
134
135
|
messages: {},
|
|
135
136
|
});
|
|
136
137
|
const state = new ReferenceState('', {
|
|
137
|
-
numbering: (_a = frontmatter.numbering) !== null && _a !== void 0 ? _a : defaultFrontmatter === null || defaultFrontmatter === void 0 ? void 0 : defaultFrontmatter.numbering,
|
|
138
|
+
frontmatter: Object.assign(Object.assign({}, frontmatter), { numbering: (_a = frontmatter.numbering) !== null && _a !== void 0 ? _a : defaultFrontmatter === null || defaultFrontmatter === void 0 ? void 0 : defaultFrontmatter.numbering }),
|
|
138
139
|
vfile,
|
|
139
140
|
});
|
|
140
141
|
visit(mdast, (n) => {
|
|
@@ -299,20 +300,20 @@ export function MySTRenderer({ id, value, column, fullscreen, numbering, TitleBl
|
|
|
299
300
|
const { downloads, exports, parts } = frontmatter, reducedFrontmatter = __rest(frontmatter, ["downloads", "exports", "parts"]);
|
|
300
301
|
return (_jsxs("figure", { id: id, className: classnames('relative', {
|
|
301
302
|
'grid grid-cols-2 gap-0 grid-rows-[3rem_1fr]': column,
|
|
302
|
-
'shadow-lg
|
|
303
|
+
'rounded shadow-lg': !fullscreen,
|
|
303
304
|
'm-0': fullscreen,
|
|
304
|
-
}, className), children: [column && (_jsxs("div", { className: "flex flex-row
|
|
305
|
+
}, className), children: [column && (_jsxs("div", { className: "flex flex-row col-span-2 items-stretch px-2 h-full border dark:border-slate-600", children: [_jsx("div", { className: "flex-grow" }), demoMenu] })), _jsxs("div", { className: classnames('relative myst', { 'overflow-auto': column }), children: [_jsx(CopyIcon, { text: text, className: "absolute right-0 p-1" }), _jsxs("label", { children: [_jsx("span", { className: "sr-only", children: "Edit the MyST Markdown text" }), _jsx("textarea", { ref: area, value: text, className: classnames('block p-6 w-full font-mono shadow-inner outline-none resize-none bg-slate-50/50 dark:bg-slate-800/50', { 'text-sm': !column }, { 'h-full': column }), onChange: (e) => setText(e.target.value) })] })] }), _jsxs("div", { className: classnames('relative exclude-from-outline min-h-1 dark:bg-slate-900', {
|
|
305
306
|
'overflow-auto': column,
|
|
306
307
|
}), children: [!column && _jsx("div", { className: "absolute top-0 left-0", children: demoMenu }), _jsxs("div", { className: classnames('px-6 pb-6', {
|
|
307
308
|
'pt-[40px]': !column && previewType !== 'AST',
|
|
308
309
|
'pt-[80px]': !column && previewType === 'AST',
|
|
309
310
|
'pt-4': column,
|
|
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
|
|
311
|
+
}), 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 rounded border", 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', {
|
|
311
312
|
'bg-red-500 dark:bg-red-800': m.fatal === true,
|
|
312
313
|
'bg-orange-500 dark:bg-orange-700': m.fatal === false,
|
|
313
314
|
'bg-slate-500 dark:bg-slate-800': m.fatal === null,
|
|
314
315
|
}), children: [m.fatal === true && (_jsx(ExclamationCircleIcon, { width: "1.3rem", height: "1.3rem", className: "inline mr-1" })), m.fatal === false && (_jsx(ExclamationTriangleIcon, { width: "1.3rem", height: "1.3rem", className: "inline mr-1" })), m.fatal === null && (_jsx(InformationCircleIcon, { width: "1.3rem", height: "1.3rem", className: "inline mr-1" })), _jsx("code", { children: m.ruleId || m.source }), ": ", m.message] }, i))) }))] })] }));
|
|
315
316
|
}
|
|
316
|
-
export const MystDemoRenderer = ({ node }) => {
|
|
317
|
-
return (_jsx(MySTRenderer, { id: node.html_id || node.identifier, value: node.value, numbering: node.numbering, className: node.class }));
|
|
317
|
+
export const MystDemoRenderer = ({ node, className }) => {
|
|
318
|
+
return (_jsx(MySTRenderer, { id: node.html_id || node.identifier, value: node.value, numbering: node.numbering, className: classnames(node.class, className) }));
|
|
318
319
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "myst-demo",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -23,24 +23,25 @@
|
|
|
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.7.
|
|
28
|
-
"myst-directives": "^1.5.
|
|
26
|
+
"myst-common": "^1.7.8",
|
|
27
|
+
"myst-config": "^1.7.8",
|
|
28
|
+
"myst-directives": "^1.5.11",
|
|
29
|
+
"myst-ext-button": "^0.0.1",
|
|
29
30
|
"myst-ext-card": "^1.0.9",
|
|
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.
|
|
31
|
+
"myst-ext-exercise": "^1.0.9",
|
|
32
|
+
"myst-ext-grid": "^1.0.9",
|
|
33
|
+
"myst-ext-proof": "^1.0.12",
|
|
34
|
+
"myst-ext-tabs": "^1.0.9",
|
|
35
|
+
"myst-frontmatter": "^1.7.8",
|
|
36
|
+
"myst-parser": "^1.5.11",
|
|
36
37
|
"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.
|
|
38
|
+
"myst-to-docx": "^1.0.13",
|
|
39
|
+
"myst-to-html": "^1.5.11",
|
|
40
|
+
"myst-to-jats": "^1.0.32",
|
|
41
|
+
"myst-to-react": "^0.13.7",
|
|
42
|
+
"myst-to-tex": "^1.0.41",
|
|
43
|
+
"myst-to-typst": "^0.0.30",
|
|
44
|
+
"myst-transforms": "^1.3.31",
|
|
44
45
|
"unified": "^10.1.2",
|
|
45
46
|
"unist-util-remove": "^4.0.0",
|
|
46
47
|
"unist-util-visit": "^4.1.2",
|