myst-demo 0.14.2 → 0.15.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/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -5
- package/package.json +2 -2
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAyN1D,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,2CAqQA;AAED,eAAO,MAAM,gBAAgB,EAAE,YAS9B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
22
22
|
import { VFile } from 'vfile';
|
|
23
23
|
import { remove } from 'unist-util-remove';
|
|
24
24
|
import { load as yamlLoad, dump as yamlDump } from 'js-yaml';
|
|
25
|
-
import { fileError, RuleId
|
|
25
|
+
import { fileError, RuleId } from 'myst-common';
|
|
26
26
|
import { SourceFileKind } from 'myst-spec-ext';
|
|
27
27
|
import { validatePageFrontmatter } from 'myst-frontmatter';
|
|
28
28
|
import { ArticleProvider, GridSystemProvider } from '@myst-theme/providers';
|
|
@@ -127,7 +127,6 @@ function parse(text, defaultFrontmatter, options) {
|
|
|
127
127
|
const htmlString = mystToHtml(JSON.parse(JSON.stringify(mdast)));
|
|
128
128
|
const references = {
|
|
129
129
|
cite: { order: [], data: {} },
|
|
130
|
-
footnotes: {},
|
|
131
130
|
};
|
|
132
131
|
const frontmatterRaw = getFrontmatter(vfile, mdast);
|
|
133
132
|
const frontmatter = validatePageFrontmatter(frontmatterRaw, {
|
|
@@ -208,7 +207,6 @@ function parse(text, defaultFrontmatter, options) {
|
|
|
208
207
|
});
|
|
209
208
|
}
|
|
210
209
|
export function MySTRenderer({ id, value, column, fullscreen, numbering, TitleBlock, captureTab, className, }) {
|
|
211
|
-
var _a;
|
|
212
210
|
const area = useRef(null);
|
|
213
211
|
const [text, setText] = useState(value.trim());
|
|
214
212
|
const [references, setReferences] = useState({});
|
|
@@ -302,13 +300,13 @@ export function MySTRenderer({ id, value, column, fullscreen, numbering, TitleBl
|
|
|
302
300
|
'grid grid-cols-2 gap-0 grid-rows-[3rem_1fr]': column,
|
|
303
301
|
'rounded shadow-lg': !fullscreen,
|
|
304
302
|
'm-0': fullscreen,
|
|
305
|
-
}, className), children: [column && (_jsxs("div", { className: "flex flex-row col-span-2
|
|
303
|
+
}, className), children: [column && (_jsxs("div", { className: "flex flex-row items-stretch h-full col-span-2 px-2 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', {
|
|
306
304
|
'overflow-auto': column,
|
|
307
305
|
}), children: [!column && _jsx("div", { className: "absolute top-0 left-0", children: demoMenu }), _jsxs("div", { className: classnames('px-6 pb-6', {
|
|
308
306
|
'pt-[40px]': !column && previewType !== 'AST',
|
|
309
307
|
'pt-[80px]': !column && previewType === 'AST',
|
|
310
308
|
'pt-4': column,
|
|
311
|
-
}), children: [previewType === 'DEMO' && (_jsx(_Fragment, { children: _jsx(ArticleProvider, { kind: SourceFileKind.Article, references: references, frontmatter: reducedFrontmatter, children: _jsxs(GridSystemProvider, { gridSystem: "demo-grid", children: [TitleBlock && _jsx(TitleBlock, { frontmatter: frontmatter }), _jsx(MyST, { ast:
|
|
309
|
+
}), children: [previewType === 'DEMO' && (_jsx(_Fragment, { children: _jsx(ArticleProvider, { kind: SourceFileKind.Article, references: references, frontmatter: reducedFrontmatter, children: _jsxs(GridSystemProvider, { gridSystem: "demo-grid", children: [TitleBlock && _jsx(TitleBlock, { frontmatter: frontmatter }), _jsx(MyST, { ast: references.article })] }) }) })), 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', {
|
|
312
310
|
'bg-red-500 dark:bg-red-800': m.fatal === true,
|
|
313
311
|
'bg-orange-500 dark:bg-orange-700': m.fatal === false,
|
|
314
312
|
'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.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"myst-to-docx": "^1.0.14",
|
|
39
39
|
"myst-to-html": "^1.5.11",
|
|
40
40
|
"myst-to-jats": "^1.0.32",
|
|
41
|
-
"myst-to-react": "^0.
|
|
41
|
+
"myst-to-react": "^0.15.0",
|
|
42
42
|
"myst-to-tex": "^1.0.41",
|
|
43
43
|
"myst-to-typst": "^0.0.30",
|
|
44
44
|
"myst-transforms": "^1.3.32",
|