@diplodoc/client 3.7.2 → 3.8.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/CHANGELOG.md +27 -0
- package/build/client/app.js +1 -1
- package/build/client/app.js.map +1 -1
- package/build/client/react.js +1 -1
- package/build/client/react.js.LICENSE.txt +0 -20
- package/build/client/react.js.map +1 -1
- package/build/client/search.js +1 -1
- package/build/client/search.js.map +1 -1
- package/build/client/vendor.css +1 -1
- package/build/client/vendor.css.map +1 -1
- package/build/client/vendor.js +1 -1
- package/build/client/vendor.js.map +1 -1
- package/build/client/vendor.rtl.css +1 -1
- package/build/components/App/index.d.ts +3 -2
- package/build/server/app.js +59 -5
- package/build/server/app.js.map +1 -1
- package/build/server/vendor.js +324 -924
- package/build/server/vendor.js.map +1 -1
- package/build/utils.d.ts +12 -1
- package/package.json +4 -4
package/build/server/vendor.js
CHANGED
|
@@ -1694,923 +1694,6 @@ __exportStar(__webpack_require__(78748), exports);
|
|
|
1694
1694
|
__exportStar(__webpack_require__(52270), exports);
|
|
1695
1695
|
|
|
1696
1696
|
|
|
1697
|
-
/***/ }),
|
|
1698
|
-
|
|
1699
|
-
/***/ 2097:
|
|
1700
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1701
|
-
|
|
1702
|
-
"use strict";
|
|
1703
|
-
|
|
1704
|
-
// EXPORTS
|
|
1705
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
1706
|
-
Xf: () => (/* reexport */ hooks_useMdxSsr)
|
|
1707
|
-
});
|
|
1708
|
-
|
|
1709
|
-
// UNUSED EXPORTS: MdxSetStateCtx, MdxStateCtx, getAsyncMdxCollectPlugin, getAsyncSsrRenderer, getMdxCollectPlugin, getRender, getSsrRenderer, isWithMdxArtifacts, mdxPlugin, useMdx, validateMdx, withInitialProps, withPortal
|
|
1710
|
-
|
|
1711
|
-
;// ./node_modules/@mdx-js/mdx/lib/run.js
|
|
1712
|
-
/**
|
|
1713
|
-
* @import {MDXModule} from 'mdx/types.js'
|
|
1714
|
-
* @import {RunOptions} from './util/resolve-evaluate-options.js'
|
|
1715
|
-
*/
|
|
1716
|
-
|
|
1717
|
-
/** @type {new (code: string, ...args: Array<unknown>) => Function} **/
|
|
1718
|
-
const AsyncFunction = Object.getPrototypeOf(run_run).constructor
|
|
1719
|
-
|
|
1720
|
-
/**
|
|
1721
|
-
* Run code compiled with `outputFormat: 'function-body'`.
|
|
1722
|
-
*
|
|
1723
|
-
* > ☢️ **Danger**: this `eval`s JavaScript.
|
|
1724
|
-
*
|
|
1725
|
-
* @param {{toString(): string}} code
|
|
1726
|
-
* JavaScript function body to run.
|
|
1727
|
-
* @param {RunOptions} options
|
|
1728
|
-
* Configuration (**required**).
|
|
1729
|
-
* @return {Promise<MDXModule>}
|
|
1730
|
-
* Promise to a module;
|
|
1731
|
-
* the result is an object with a `default` field set to the component;
|
|
1732
|
-
* anything else that was exported is available too.
|
|
1733
|
-
*/
|
|
1734
|
-
async function run_run(code, options) {
|
|
1735
|
-
return new AsyncFunction(String(code))(options)
|
|
1736
|
-
}
|
|
1737
|
-
|
|
1738
|
-
/**
|
|
1739
|
-
* Run code, synchronously.
|
|
1740
|
-
*
|
|
1741
|
-
* When possible please use the async `run`.
|
|
1742
|
-
*
|
|
1743
|
-
* > ☢️ **Danger**: this `eval`s JavaScript.
|
|
1744
|
-
*
|
|
1745
|
-
* @param {{toString(): string}} code
|
|
1746
|
-
* JavaScript function body to run.
|
|
1747
|
-
* @param {RunOptions} options
|
|
1748
|
-
* Configuration (**required**).
|
|
1749
|
-
* @return {MDXModule}
|
|
1750
|
-
* Module.
|
|
1751
|
-
*/
|
|
1752
|
-
function run_runSync(code, options) {
|
|
1753
|
-
// eslint-disable-next-line no-new-func
|
|
1754
|
-
return new Function(String(code))(options)
|
|
1755
|
-
}
|
|
1756
|
-
|
|
1757
|
-
// EXTERNAL MODULE: ./node_modules/react-dom/client.js
|
|
1758
|
-
var client = __webpack_require__(5338);
|
|
1759
|
-
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
|
|
1760
|
-
var jsx_runtime = __webpack_require__(74848);
|
|
1761
|
-
var jsx_runtime_namespaceObject = /*#__PURE__*/__webpack_require__.t(jsx_runtime, 2);
|
|
1762
|
-
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
1763
|
-
var react = __webpack_require__(96540);
|
|
1764
|
-
;// ./node_modules/@diplodoc/mdx-extension/build/esm/context/MdxStateCtx.js
|
|
1765
|
-
|
|
1766
|
-
const MdxStateCtx_MdxStateCtx = (0,react.createContext)(null);
|
|
1767
|
-
;// ./node_modules/@diplodoc/mdx-extension/build/esm/context/MdxSetStateCtx.js
|
|
1768
|
-
|
|
1769
|
-
const MdxSetStateCtx_MdxSetStateCtx = (0,react.createContext)(null);
|
|
1770
|
-
;// ./node_modules/@diplodoc/mdx-extension/build/esm/context/index.js
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
;// ./node_modules/@diplodoc/mdx-extension/build/esm/context/internal/MdxPortalSetterCtx.js
|
|
1774
|
-
|
|
1775
|
-
const MdxPortalSetterCtx_MdxPortalSetterCtx = (0,react.createContext)(null);
|
|
1776
|
-
;// ./node_modules/@diplodoc/mdx-extension/build/esm/utils/internal/maps.js
|
|
1777
|
-
|
|
1778
|
-
const maps_portalWrapperComponentMap = new WeakMap();
|
|
1779
|
-
const maps_componentGetInitProps = new WeakMap();
|
|
1780
|
-
;// ./node_modules/@diplodoc/mdx-extension/build/esm/utils/internal/common.js
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
const nodeRootMap = new WeakMap();
|
|
1789
|
-
const nodeWillUmount = new WeakMap();
|
|
1790
|
-
const nodePortalCleanup = new WeakMap();
|
|
1791
|
-
const common_renderMdxComponents = ({
|
|
1792
|
-
idMdxComponent,
|
|
1793
|
-
isSSR,
|
|
1794
|
-
ctr,
|
|
1795
|
-
components,
|
|
1796
|
-
setPortal,
|
|
1797
|
-
idTagName
|
|
1798
|
-
}) => {
|
|
1799
|
-
const unmountFns = Object.entries(idMdxComponent).map(([id, Content]) => {
|
|
1800
|
-
let node = ctr.querySelector(`.${id}`);
|
|
1801
|
-
if (!node) {
|
|
1802
|
-
throw new Error('node is null');
|
|
1803
|
-
}
|
|
1804
|
-
if (nodeWillUmount.get(node) && node.parentNode) {
|
|
1805
|
-
const newNode = node.cloneNode(true);
|
|
1806
|
-
node.parentNode.replaceChild(newNode, node);
|
|
1807
|
-
node = newNode;
|
|
1808
|
-
}
|
|
1809
|
-
const mdxState = node?.dataset?.mdxState ? JSON.parse(node.dataset.mdxState) : null;
|
|
1810
|
-
const contentNode = react.createElement(MdxStateCtx_MdxStateCtx.Provider, {
|
|
1811
|
-
value: mdxState,
|
|
1812
|
-
children: react.createElement(Content, {
|
|
1813
|
-
components
|
|
1814
|
-
})
|
|
1815
|
-
});
|
|
1816
|
-
const isTopLevelPortal = components && common_isPortal(components[idTagName[id]]);
|
|
1817
|
-
let root;
|
|
1818
|
-
if (isTopLevelPortal) {
|
|
1819
|
-
if (!nodePortalCleanup.has(node)) {
|
|
1820
|
-
nodePortalCleanup.set(node, true);
|
|
1821
|
-
while (node.firstChild) {
|
|
1822
|
-
node.removeChild(node.firstChild);
|
|
1823
|
-
}
|
|
1824
|
-
}
|
|
1825
|
-
setPortal({
|
|
1826
|
-
id,
|
|
1827
|
-
node,
|
|
1828
|
-
reactNode: contentNode
|
|
1829
|
-
});
|
|
1830
|
-
} else {
|
|
1831
|
-
const reactNode = react.createElement(MdxPortalSetterCtx_MdxPortalSetterCtx.Provider, {
|
|
1832
|
-
value: setPortal,
|
|
1833
|
-
children: contentNode
|
|
1834
|
-
});
|
|
1835
|
-
root = nodeRootMap.get(node);
|
|
1836
|
-
if (root) {
|
|
1837
|
-
root.render(reactNode);
|
|
1838
|
-
} else {
|
|
1839
|
-
const options = {
|
|
1840
|
-
identifierPrefix: id
|
|
1841
|
-
};
|
|
1842
|
-
if (isSSR) {
|
|
1843
|
-
root = (0,client/* hydrateRoot */.c)(node, reactNode, options);
|
|
1844
|
-
} else {
|
|
1845
|
-
root = (0,client/* createRoot */.H)(node, options);
|
|
1846
|
-
root.render(reactNode);
|
|
1847
|
-
}
|
|
1848
|
-
nodeRootMap.set(node, root);
|
|
1849
|
-
}
|
|
1850
|
-
}
|
|
1851
|
-
return () => {
|
|
1852
|
-
nodeWillUmount.set(node, true);
|
|
1853
|
-
if (isTopLevelPortal) {
|
|
1854
|
-
setPortal({
|
|
1855
|
-
id,
|
|
1856
|
-
node: null,
|
|
1857
|
-
reactNode: null
|
|
1858
|
-
});
|
|
1859
|
-
} else if (root) {
|
|
1860
|
-
setTimeout(() => root.unmount(), 0);
|
|
1861
|
-
}
|
|
1862
|
-
};
|
|
1863
|
-
});
|
|
1864
|
-
return () => unmountFns.forEach(cb => cb());
|
|
1865
|
-
};
|
|
1866
|
-
const common_idMdxToComponents = idMdx => {
|
|
1867
|
-
return Object.entries(idMdx ?? {}).reduce((acc, [id, fnStr]) => {
|
|
1868
|
-
// eslint-disable-next-line no-param-reassign
|
|
1869
|
-
acc[id] = run_runSync(fnStr, jsx_runtime_namespaceObject).default;
|
|
1870
|
-
return acc;
|
|
1871
|
-
}, {});
|
|
1872
|
-
};
|
|
1873
|
-
function common_generateUniqueId() {
|
|
1874
|
-
return Date.now().toString(36) + Math.random().toString(36).substring(2);
|
|
1875
|
-
}
|
|
1876
|
-
function common_isPortal(component) {
|
|
1877
|
-
return maps_portalWrapperComponentMap.has(component);
|
|
1878
|
-
}
|
|
1879
|
-
function common_getInitMdxArtifacts() {
|
|
1880
|
-
return {
|
|
1881
|
-
idMdx: {},
|
|
1882
|
-
idTagName: {}
|
|
1883
|
-
};
|
|
1884
|
-
}
|
|
1885
|
-
;// ./node_modules/@diplodoc/mdx-extension/build/esm/mdx-plugin.js
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
const mdxPlugin = options => {
|
|
1891
|
-
const {
|
|
1892
|
-
render = getRender(),
|
|
1893
|
-
isTestMode = false,
|
|
1894
|
-
tagNames
|
|
1895
|
-
} = options ?? {};
|
|
1896
|
-
const transform = md => {
|
|
1897
|
-
const idMdxBody = {};
|
|
1898
|
-
const iTagLen = InternalTagName.length + 2;
|
|
1899
|
-
const corePlugin = state => {
|
|
1900
|
-
let index = 0;
|
|
1901
|
-
// eslint-disable-next-line no-param-reassign
|
|
1902
|
-
state.src = replaceBlocks({
|
|
1903
|
-
content: state.src,
|
|
1904
|
-
tagNames,
|
|
1905
|
-
replacer: body => {
|
|
1906
|
-
const id = String(++index);
|
|
1907
|
-
idMdxBody[id] = body;
|
|
1908
|
-
return `<${InternalTagName}>${id}</${InternalTagName}>`;
|
|
1909
|
-
}
|
|
1910
|
-
});
|
|
1911
|
-
return true;
|
|
1912
|
-
};
|
|
1913
|
-
md.core.ruler.before('block', 'mdx-replacer-core', corePlugin);
|
|
1914
|
-
const mdxRe = new RegExp(`<${InternalTagName}>(\\d+)</${InternalTagName}>`, 'g');
|
|
1915
|
-
const tokenTypes = ['code_block', 'code_inline', 'fence'];
|
|
1916
|
-
const coreReplaceBack = state => {
|
|
1917
|
-
const next = tokens => {
|
|
1918
|
-
for (let i = 0, len = tokens.length; i < len; i++) {
|
|
1919
|
-
const token = tokens[i];
|
|
1920
|
-
if (tokenTypes.includes(token.type)) {
|
|
1921
|
-
token.content = token.content.replace(mdxRe, (_, id) => {
|
|
1922
|
-
return idMdxBody[id].fragment;
|
|
1923
|
-
});
|
|
1924
|
-
}
|
|
1925
|
-
if (token.children) {
|
|
1926
|
-
// eslint-disable-next-line callback-return
|
|
1927
|
-
next(token.children);
|
|
1928
|
-
}
|
|
1929
|
-
}
|
|
1930
|
-
};
|
|
1931
|
-
next(state.tokens);
|
|
1932
|
-
return true;
|
|
1933
|
-
};
|
|
1934
|
-
md.core.ruler.push('mdx-replace-back', coreReplaceBack);
|
|
1935
|
-
const blockPlugin = (state, startLine, endLine, silent) => {
|
|
1936
|
-
const {
|
|
1937
|
-
env
|
|
1938
|
-
} = state;
|
|
1939
|
-
const mdxArtifacts = env.mdxArtifacts = env.mdxArtifacts ?? getInitMdxArtifacts();
|
|
1940
|
-
const start = state.bMarks[startLine] + state.tShift[startLine];
|
|
1941
|
-
if (state.src.slice(start, start + iTagLen) !== `<${InternalTagName}>`) {
|
|
1942
|
-
return false;
|
|
1943
|
-
}
|
|
1944
|
-
let endPos = -1;
|
|
1945
|
-
let line = startLine;
|
|
1946
|
-
for (; line <= endLine; line++) {
|
|
1947
|
-
endPos = state.src.indexOf(`</${InternalTagName}>`, state.bMarks[line]);
|
|
1948
|
-
if (endPos !== -1 && endPos <= state.eMarks[line]) {
|
|
1949
|
-
break;
|
|
1950
|
-
}
|
|
1951
|
-
}
|
|
1952
|
-
if (endPos === -1) return false;
|
|
1953
|
-
if (!silent) {
|
|
1954
|
-
const htmlToken = state.push('html_block', '', 0);
|
|
1955
|
-
const id = state.src.slice(start + iTagLen, endPos);
|
|
1956
|
-
const {
|
|
1957
|
-
content,
|
|
1958
|
-
tagName
|
|
1959
|
-
} = idMdxBody[id];
|
|
1960
|
-
htmlToken.content = render({
|
|
1961
|
-
mdx: content,
|
|
1962
|
-
mdxArtifacts,
|
|
1963
|
-
tagName
|
|
1964
|
-
});
|
|
1965
|
-
htmlToken.map = [startLine, line];
|
|
1966
|
-
const afterText = state.src.slice(endPos + (iTagLen + 1), state.eMarks[line]);
|
|
1967
|
-
if (afterText) {
|
|
1968
|
-
const afterToken = state.push('inline', '', 0);
|
|
1969
|
-
afterToken.content = afterText;
|
|
1970
|
-
afterToken.children = [];
|
|
1971
|
-
afterToken.map = [line, line + 1];
|
|
1972
|
-
}
|
|
1973
|
-
}
|
|
1974
|
-
// eslint-disable-next-line no-param-reassign
|
|
1975
|
-
state.line = line + 1;
|
|
1976
|
-
return true;
|
|
1977
|
-
};
|
|
1978
|
-
md.block.ruler.before('table', 'mdx-replacer-block', blockPlugin);
|
|
1979
|
-
const inlinePlugin = (state, silent) => {
|
|
1980
|
-
const {
|
|
1981
|
-
env
|
|
1982
|
-
} = state;
|
|
1983
|
-
const mdxArtifacts = env.mdxArtifacts = env.mdxArtifacts ?? getInitMdxArtifacts();
|
|
1984
|
-
const start = state.pos;
|
|
1985
|
-
// Проверяем открывающий тег <MDX>
|
|
1986
|
-
if (state.src.slice(start, start + iTagLen) !== `<${InternalTagName}>`) {
|
|
1987
|
-
return false;
|
|
1988
|
-
}
|
|
1989
|
-
// Находим закрывающий тег
|
|
1990
|
-
const endPos = state.src.indexOf(`</${InternalTagName}>`, start + iTagLen);
|
|
1991
|
-
if (endPos === -1) return false;
|
|
1992
|
-
if (!silent) {
|
|
1993
|
-
const token = state.push('html_inline', '', 0);
|
|
1994
|
-
const id = state.src.slice(start + iTagLen, endPos);
|
|
1995
|
-
const {
|
|
1996
|
-
content,
|
|
1997
|
-
tagName
|
|
1998
|
-
} = idMdxBody[id];
|
|
1999
|
-
token.content = render({
|
|
2000
|
-
mdx: content,
|
|
2001
|
-
mdxArtifacts,
|
|
2002
|
-
tagName
|
|
2003
|
-
});
|
|
2004
|
-
}
|
|
2005
|
-
// eslint-disable-next-line no-param-reassign
|
|
2006
|
-
state.pos = endPos + (iTagLen + 1);
|
|
2007
|
-
return true;
|
|
2008
|
-
};
|
|
2009
|
-
md.inline.ruler.before('text', 'mdx-replacer-inline', inlinePlugin);
|
|
2010
|
-
if (isTestMode) {
|
|
2011
|
-
const testMd = md;
|
|
2012
|
-
testMd.env = testMd.env || {};
|
|
2013
|
-
testMd.env.idMdxBody = idMdxBody;
|
|
2014
|
-
testMd.env.corePlugin = corePlugin;
|
|
2015
|
-
testMd.env.coreReplaceBack = coreReplaceBack;
|
|
2016
|
-
testMd.env.blockPlugin = blockPlugin;
|
|
2017
|
-
testMd.env.inlinePlugin = inlinePlugin;
|
|
2018
|
-
}
|
|
2019
|
-
};
|
|
2020
|
-
return transform;
|
|
2021
|
-
};
|
|
2022
|
-
/* harmony default export */ const mdx_plugin = ((/* unused pure expression or super */ null && (mdxPlugin)));
|
|
2023
|
-
// EXTERNAL MODULE: ./node_modules/react-dom/server.node.js
|
|
2024
|
-
var server_node = __webpack_require__(94362);
|
|
2025
|
-
;// ./node_modules/@diplodoc/mdx-extension/build/esm/utils/getSsrRenderer.js
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
const getSsrRenderer_getSsrRenderer = ({
|
|
2036
|
-
components,
|
|
2037
|
-
pureComponents,
|
|
2038
|
-
compileOptions
|
|
2039
|
-
}) => {
|
|
2040
|
-
const componentsNames = Object.keys(components || {});
|
|
2041
|
-
const usedComponents = new Set();
|
|
2042
|
-
const combinedComponents = {
|
|
2043
|
-
...components,
|
|
2044
|
-
...pureComponents
|
|
2045
|
-
};
|
|
2046
|
-
const combinedComponentsWatch = wrapObject(combinedComponents, name => usedComponents.add(name));
|
|
2047
|
-
const render = (id, mdx, tagName) => {
|
|
2048
|
-
const vFile = compileSync(mdx, {
|
|
2049
|
-
...compileOptions,
|
|
2050
|
-
outputFormat: 'function-body'
|
|
2051
|
-
});
|
|
2052
|
-
const {
|
|
2053
|
-
default: Component
|
|
2054
|
-
} = runSync(vFile, runtime);
|
|
2055
|
-
const isTopLevelPortal = isPortal(combinedComponents[tagName]);
|
|
2056
|
-
let code = vFile.toString();
|
|
2057
|
-
const state = {};
|
|
2058
|
-
const setState = value => {
|
|
2059
|
-
Object.assign(state, value);
|
|
2060
|
-
};
|
|
2061
|
-
const options = {
|
|
2062
|
-
identifierPrefix: id
|
|
2063
|
-
};
|
|
2064
|
-
usedComponents.clear();
|
|
2065
|
-
let html = renderToString(React.createElement(TAG_NAME, {
|
|
2066
|
-
className: id,
|
|
2067
|
-
children: React.createElement(MdxPortalSetterCtx.Provider, {
|
|
2068
|
-
value: () => {},
|
|
2069
|
-
children: React.createElement(MdxSetStateCtx.Provider, {
|
|
2070
|
-
value: setState,
|
|
2071
|
-
children: React.createElement(MdxStateCtx.Provider, {
|
|
2072
|
-
value: state,
|
|
2073
|
-
children: React.createElement(Component, {
|
|
2074
|
-
components: combinedComponentsWatch
|
|
2075
|
-
})
|
|
2076
|
-
})
|
|
2077
|
-
})
|
|
2078
|
-
})
|
|
2079
|
-
}), options);
|
|
2080
|
-
if (!isEmptyObject(state)) {
|
|
2081
|
-
html = html.replace(`${TAG_NAME} `, `${TAG_NAME} data-mdx-state="${escapeAttribute(JSON.stringify(state))}" `);
|
|
2082
|
-
}
|
|
2083
|
-
const withComponents = componentsNames.some(name => usedComponents.has(name));
|
|
2084
|
-
if (!withComponents) {
|
|
2085
|
-
html = trimComponentWrapper(html);
|
|
2086
|
-
code = undefined;
|
|
2087
|
-
}
|
|
2088
|
-
if (isTopLevelPortal) {
|
|
2089
|
-
html = trimPortalTag(html);
|
|
2090
|
-
}
|
|
2091
|
-
return {
|
|
2092
|
-
html,
|
|
2093
|
-
code
|
|
2094
|
-
};
|
|
2095
|
-
};
|
|
2096
|
-
let idx = 0;
|
|
2097
|
-
const getHtml = ({
|
|
2098
|
-
mdx,
|
|
2099
|
-
mdxArtifacts,
|
|
2100
|
-
tagName
|
|
2101
|
-
}) => {
|
|
2102
|
-
const {
|
|
2103
|
-
idMdx,
|
|
2104
|
-
idTagName
|
|
2105
|
-
} = mdxArtifacts;
|
|
2106
|
-
const id = `${MDX_PREFIX}${++idx}`;
|
|
2107
|
-
const {
|
|
2108
|
-
html,
|
|
2109
|
-
code
|
|
2110
|
-
} = render(id, mdx, tagName);
|
|
2111
|
-
if (code) {
|
|
2112
|
-
idMdx[id] = code;
|
|
2113
|
-
idTagName[id] = tagName;
|
|
2114
|
-
}
|
|
2115
|
-
return html;
|
|
2116
|
-
};
|
|
2117
|
-
return getHtml;
|
|
2118
|
-
};
|
|
2119
|
-
/* harmony default export */ const utils_getSsrRenderer = ((/* unused pure expression or super */ null && (getSsrRenderer_getSsrRenderer)));
|
|
2120
|
-
;// ./node_modules/@diplodoc/mdx-extension/build/esm/utils/internal/asyncRenderTools.js
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
const getInitPropsFn = component => {
|
|
2125
|
-
const origComponent = portalWrapperComponentMap.get(component);
|
|
2126
|
-
const initFn = componentGetInitProps.get(component) ?? (origComponent && componentGetInitProps.get(origComponent));
|
|
2127
|
-
return initFn;
|
|
2128
|
-
};
|
|
2129
|
-
class AsyncComponentWrapper {
|
|
2130
|
-
args;
|
|
2131
|
-
jsxs;
|
|
2132
|
-
node;
|
|
2133
|
-
constructor(jsxs, args) {
|
|
2134
|
-
this.jsxs = jsxs;
|
|
2135
|
-
this.args = args;
|
|
2136
|
-
}
|
|
2137
|
-
build() {
|
|
2138
|
-
const jsxFn = this.jsxs ? runtime.jsxs : runtime.jsx;
|
|
2139
|
-
return jsxFn.apply(runtime, this.args);
|
|
2140
|
-
}
|
|
2141
|
-
}
|
|
2142
|
-
function asyncRenderTools_getMdxRuntimeWithHook() {
|
|
2143
|
-
const refs = [];
|
|
2144
|
-
const jsx = function (isJsxs, ...args) {
|
|
2145
|
-
const ref = new AsyncComponentWrapper(isJsxs, args);
|
|
2146
|
-
refs.push(ref);
|
|
2147
|
-
return ref;
|
|
2148
|
-
};
|
|
2149
|
-
const rt = {
|
|
2150
|
-
Fragment: runtime.Fragment,
|
|
2151
|
-
jsx: jsx.bind(null, false),
|
|
2152
|
-
jsxs: jsx.bind(null, true)
|
|
2153
|
-
};
|
|
2154
|
-
const init = async state => {
|
|
2155
|
-
for (let i = 0, len = refs.length; i < len; i++) {
|
|
2156
|
-
const ref = refs[i];
|
|
2157
|
-
const {
|
|
2158
|
-
args
|
|
2159
|
-
} = ref;
|
|
2160
|
-
replaceComponentRefs(args);
|
|
2161
|
-
const [component, props] = args;
|
|
2162
|
-
const initFn = getInitPropsFn(component);
|
|
2163
|
-
if (initFn) {
|
|
2164
|
-
const readyProps = await initFn(props, state);
|
|
2165
|
-
args[1] = {
|
|
2166
|
-
...props,
|
|
2167
|
-
...readyProps
|
|
2168
|
-
};
|
|
2169
|
-
}
|
|
2170
|
-
}
|
|
2171
|
-
};
|
|
2172
|
-
return {
|
|
2173
|
-
runtime: rt,
|
|
2174
|
-
init
|
|
2175
|
-
};
|
|
2176
|
-
}
|
|
2177
|
-
function replaceComponentRefs(thing) {
|
|
2178
|
-
if (thing instanceof AsyncComponentWrapper) {
|
|
2179
|
-
return thing.build();
|
|
2180
|
-
}
|
|
2181
|
-
if (Array.isArray(thing)) {
|
|
2182
|
-
const arr = thing;
|
|
2183
|
-
for (let i = 0, len = arr.length; i < len; i++) {
|
|
2184
|
-
// eslint-disable-next-line no-param-reassign
|
|
2185
|
-
arr[i] = replaceComponentRefs(arr[i]);
|
|
2186
|
-
}
|
|
2187
|
-
return arr;
|
|
2188
|
-
}
|
|
2189
|
-
if (typeof thing === 'object' && thing !== null) {
|
|
2190
|
-
const obj = thing;
|
|
2191
|
-
for (const key in obj) {
|
|
2192
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
2193
|
-
obj[key] = replaceComponentRefs(obj[key]);
|
|
2194
|
-
}
|
|
2195
|
-
}
|
|
2196
|
-
}
|
|
2197
|
-
return thing;
|
|
2198
|
-
}
|
|
2199
|
-
;// ./node_modules/@diplodoc/mdx-extension/build/esm/utils/getAsyncSsrRenderer.js
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
const getAsyncSsrRenderer_getAsyncSsrRenderer = ({
|
|
2210
|
-
components,
|
|
2211
|
-
pureComponents,
|
|
2212
|
-
compileOptions
|
|
2213
|
-
}) => {
|
|
2214
|
-
const componentsNames = Object.keys(components || {});
|
|
2215
|
-
const combinedComponents = {
|
|
2216
|
-
...components,
|
|
2217
|
-
...pureComponents
|
|
2218
|
-
};
|
|
2219
|
-
const render = async (id, mdx, tagName) => {
|
|
2220
|
-
const vFile = await compile(mdx, {
|
|
2221
|
-
...compileOptions,
|
|
2222
|
-
outputFormat: 'function-body'
|
|
2223
|
-
});
|
|
2224
|
-
const state = {};
|
|
2225
|
-
const setState = value => {
|
|
2226
|
-
Object.assign(state, value);
|
|
2227
|
-
};
|
|
2228
|
-
const {
|
|
2229
|
-
runtime,
|
|
2230
|
-
init
|
|
2231
|
-
} = getMdxRuntimeWithHook();
|
|
2232
|
-
const {
|
|
2233
|
-
default: componentFn
|
|
2234
|
-
} = await run(vFile, runtime);
|
|
2235
|
-
const isTopLevelPortal = isPortal(combinedComponents[tagName]);
|
|
2236
|
-
const usedComponents = new Set();
|
|
2237
|
-
const combinedComponentsWatch = wrapObject(combinedComponents, name => usedComponents.add(name));
|
|
2238
|
-
const asyncWrapper = componentFn({
|
|
2239
|
-
components: combinedComponentsWatch
|
|
2240
|
-
});
|
|
2241
|
-
await init(state);
|
|
2242
|
-
const Component = () => asyncWrapper.build();
|
|
2243
|
-
let code = vFile.toString();
|
|
2244
|
-
const options = {
|
|
2245
|
-
identifierPrefix: id
|
|
2246
|
-
};
|
|
2247
|
-
let html = renderToString(React.createElement(TAG_NAME, {
|
|
2248
|
-
className: id,
|
|
2249
|
-
children: React.createElement(MdxPortalSetterCtx.Provider, {
|
|
2250
|
-
value: () => {},
|
|
2251
|
-
children: React.createElement(MdxSetStateCtx.Provider, {
|
|
2252
|
-
value: setState,
|
|
2253
|
-
children: React.createElement(MdxStateCtx.Provider, {
|
|
2254
|
-
value: state,
|
|
2255
|
-
children: React.createElement(Component)
|
|
2256
|
-
})
|
|
2257
|
-
})
|
|
2258
|
-
})
|
|
2259
|
-
}), options);
|
|
2260
|
-
if (!isEmptyObject(state)) {
|
|
2261
|
-
html = html.replace(`${TAG_NAME} `, `${TAG_NAME} data-mdx-state="${escapeAttribute(JSON.stringify(state))}" `);
|
|
2262
|
-
}
|
|
2263
|
-
const withComponents = componentsNames.some(name => usedComponents.has(name));
|
|
2264
|
-
if (!withComponents) {
|
|
2265
|
-
html = trimComponentWrapper(html);
|
|
2266
|
-
code = undefined;
|
|
2267
|
-
}
|
|
2268
|
-
if (isTopLevelPortal) {
|
|
2269
|
-
html = trimPortalTag(html);
|
|
2270
|
-
}
|
|
2271
|
-
return {
|
|
2272
|
-
html,
|
|
2273
|
-
code
|
|
2274
|
-
};
|
|
2275
|
-
};
|
|
2276
|
-
const idFragment = new Map();
|
|
2277
|
-
const getHtmlAsync = async (inputOrig, mdxArtifacts) => {
|
|
2278
|
-
let input = inputOrig;
|
|
2279
|
-
const {
|
|
2280
|
-
idMdx,
|
|
2281
|
-
idTagName
|
|
2282
|
-
} = mdxArtifacts ?? getInitMdxArtifacts();
|
|
2283
|
-
const items = [];
|
|
2284
|
-
const promises = [];
|
|
2285
|
-
idFragment.forEach(({
|
|
2286
|
-
replacer,
|
|
2287
|
-
mdx,
|
|
2288
|
-
tagName
|
|
2289
|
-
}, id) => {
|
|
2290
|
-
promises.push(render(id, mdx, tagName));
|
|
2291
|
-
items.push({
|
|
2292
|
-
id,
|
|
2293
|
-
replacer,
|
|
2294
|
-
tagName
|
|
2295
|
-
});
|
|
2296
|
-
});
|
|
2297
|
-
const promiseResults = await Promise.all(promises);
|
|
2298
|
-
for (let item, i = 0; item = items[i]; i++) {
|
|
2299
|
-
const {
|
|
2300
|
-
id,
|
|
2301
|
-
replacer,
|
|
2302
|
-
tagName
|
|
2303
|
-
} = item;
|
|
2304
|
-
const {
|
|
2305
|
-
html,
|
|
2306
|
-
code
|
|
2307
|
-
} = promiseResults[i];
|
|
2308
|
-
input = input.replace(replacer, () => html);
|
|
2309
|
-
if (code) {
|
|
2310
|
-
idMdx[id] = code;
|
|
2311
|
-
idTagName[id] = tagName;
|
|
2312
|
-
}
|
|
2313
|
-
}
|
|
2314
|
-
return input;
|
|
2315
|
-
};
|
|
2316
|
-
let idx = 0;
|
|
2317
|
-
const getHtml = ({
|
|
2318
|
-
mdx,
|
|
2319
|
-
tagName
|
|
2320
|
-
}) => {
|
|
2321
|
-
const id = `${MDX_PREFIX}${++idx}`;
|
|
2322
|
-
const replacer = `<${TAG_NAME} class="${id}">${generateUniqueId()}</${TAG_NAME}>`;
|
|
2323
|
-
idFragment.set(id, {
|
|
2324
|
-
replacer,
|
|
2325
|
-
mdx,
|
|
2326
|
-
tagName
|
|
2327
|
-
});
|
|
2328
|
-
return replacer;
|
|
2329
|
-
};
|
|
2330
|
-
return {
|
|
2331
|
-
render: getHtml,
|
|
2332
|
-
renderAsync: getHtmlAsync
|
|
2333
|
-
};
|
|
2334
|
-
};
|
|
2335
|
-
/* harmony default export */ const utils_getAsyncSsrRenderer = ((/* unused pure expression or super */ null && (getAsyncSsrRenderer_getAsyncSsrRenderer)));
|
|
2336
|
-
;// ./node_modules/@diplodoc/mdx-extension/build/esm/utils/withInitialProps.js
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
const withInitialProps = (component, getInitProps) => {
|
|
2340
|
-
componentGetInitProps.set(component, getInitProps);
|
|
2341
|
-
return component;
|
|
2342
|
-
};
|
|
2343
|
-
/* harmony default export */ const utils_withInitialProps = ((/* unused pure expression or super */ null && (withInitialProps)));
|
|
2344
|
-
;// ./node_modules/@diplodoc/mdx-extension/build/esm/hooks/internal/useLocalLayoutEffect.js
|
|
2345
|
-
|
|
2346
|
-
/**
|
|
2347
|
-
* Just mute errors on server with useLayoutEffect
|
|
2348
|
-
*/
|
|
2349
|
-
const useLocalLayoutEffect_useLocalLayoutEffect = typeof window !== 'undefined' ? react.useLayoutEffect : react.useEffect;
|
|
2350
|
-
;// ./node_modules/@diplodoc/mdx-extension/build/esm/utils/withPortal.js
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
const withPortal = (component, fallback) => {
|
|
2358
|
-
const wrappedComponent = portalSwitch(component, fallback);
|
|
2359
|
-
portalWrapperComponentMap.set(wrappedComponent, component);
|
|
2360
|
-
return wrappedComponent;
|
|
2361
|
-
};
|
|
2362
|
-
/* harmony default export */ const utils_withPortal = ((/* unused pure expression or super */ null && (withPortal)));
|
|
2363
|
-
function portalSwitch(component, fallback) {
|
|
2364
|
-
return props => {
|
|
2365
|
-
const portalSetter = useContext(MdxPortalSetterCtx);
|
|
2366
|
-
if (!portalSetter) {
|
|
2367
|
-
// inside portal
|
|
2368
|
-
return React.createElement(component, props);
|
|
2369
|
-
}
|
|
2370
|
-
return React.createElement(portalWrapper(component, fallback), props);
|
|
2371
|
-
};
|
|
2372
|
-
}
|
|
2373
|
-
function portalWrapper(component, fallback) {
|
|
2374
|
-
return props => {
|
|
2375
|
-
const portalSetter = useContext(MdxPortalSetterCtx);
|
|
2376
|
-
const ref = useRef();
|
|
2377
|
-
const id = useMemo(() => generateUniqueId(), []);
|
|
2378
|
-
const [mounted, setMounted] = useState(false);
|
|
2379
|
-
useEffect(() => {
|
|
2380
|
-
return () => {
|
|
2381
|
-
if (!portalSetter) return;
|
|
2382
|
-
portalSetter({
|
|
2383
|
-
id,
|
|
2384
|
-
node: null,
|
|
2385
|
-
reactNode: null
|
|
2386
|
-
});
|
|
2387
|
-
};
|
|
2388
|
-
}, [id]);
|
|
2389
|
-
useLocalLayoutEffect(() => {
|
|
2390
|
-
const node = ref.current;
|
|
2391
|
-
if (!node || !portalSetter) return;
|
|
2392
|
-
setMounted(true);
|
|
2393
|
-
portalSetter({
|
|
2394
|
-
id,
|
|
2395
|
-
node,
|
|
2396
|
-
reactNode: React.createElement(component, props)
|
|
2397
|
-
});
|
|
2398
|
-
}, [id, component, props]);
|
|
2399
|
-
return React.createElement(TAG_NAME, {
|
|
2400
|
-
ref,
|
|
2401
|
-
children: mounted || !fallback ? null : React.createElement(fallback, props)
|
|
2402
|
-
});
|
|
2403
|
-
};
|
|
2404
|
-
}
|
|
2405
|
-
;// ./node_modules/@diplodoc/mdx-extension/build/esm/utils/index.js
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
;// ./node_modules/@diplodoc/mdx-extension/build/esm/mdx-collect-plugin.js
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
const getMdxCollectPlugin = options => {
|
|
2418
|
-
const {
|
|
2419
|
-
tagNames,
|
|
2420
|
-
...rendererOptions
|
|
2421
|
-
} = options;
|
|
2422
|
-
const render = getSsrRenderer(rendererOptions);
|
|
2423
|
-
const plugin = origContent => {
|
|
2424
|
-
const mdxArtifacts = getInitMdxArtifacts();
|
|
2425
|
-
const content = replaceBlocks({
|
|
2426
|
-
content: origContent,
|
|
2427
|
-
tagNames,
|
|
2428
|
-
replacer: ({
|
|
2429
|
-
content: contentLocal,
|
|
2430
|
-
tagName
|
|
2431
|
-
}) => render({
|
|
2432
|
-
mdx: contentLocal,
|
|
2433
|
-
mdxArtifacts,
|
|
2434
|
-
tagName
|
|
2435
|
-
})
|
|
2436
|
-
});
|
|
2437
|
-
return content;
|
|
2438
|
-
};
|
|
2439
|
-
return plugin;
|
|
2440
|
-
};
|
|
2441
|
-
const getAsyncMdxCollectPlugin = options => {
|
|
2442
|
-
const {
|
|
2443
|
-
tagNames,
|
|
2444
|
-
...rendererOptions
|
|
2445
|
-
} = options;
|
|
2446
|
-
const {
|
|
2447
|
-
render,
|
|
2448
|
-
renderAsync
|
|
2449
|
-
} = getAsyncSsrRenderer(rendererOptions);
|
|
2450
|
-
const plugin = async origContent => {
|
|
2451
|
-
const mdxArtifacts = getInitMdxArtifacts();
|
|
2452
|
-
let content = replaceBlocks({
|
|
2453
|
-
content: origContent,
|
|
2454
|
-
tagNames,
|
|
2455
|
-
replacer: ({
|
|
2456
|
-
content: contentLocal,
|
|
2457
|
-
tagName
|
|
2458
|
-
}) => render({
|
|
2459
|
-
mdx: contentLocal,
|
|
2460
|
-
mdxArtifacts,
|
|
2461
|
-
tagName
|
|
2462
|
-
})
|
|
2463
|
-
});
|
|
2464
|
-
content = await renderAsync(content, mdxArtifacts);
|
|
2465
|
-
return content;
|
|
2466
|
-
};
|
|
2467
|
-
return plugin;
|
|
2468
|
-
};
|
|
2469
|
-
// EXTERNAL MODULE: ./node_modules/react-dom/index.js
|
|
2470
|
-
var react_dom = __webpack_require__(40961);
|
|
2471
|
-
;// ./node_modules/@diplodoc/mdx-extension/build/esm/hooks/internal/usePortals.js
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
const usePortals_usePortals = () => {
|
|
2475
|
-
const refIdPortalMap = (0,react.useRef)(new Map());
|
|
2476
|
-
const [portalNodes, setPortalNodes] = (0,react.useState)([]);
|
|
2477
|
-
const setPortal = (0,react.useCallback)(({
|
|
2478
|
-
id,
|
|
2479
|
-
node,
|
|
2480
|
-
reactNode
|
|
2481
|
-
}) => {
|
|
2482
|
-
const idPortalMap = refIdPortalMap.current;
|
|
2483
|
-
if (node) {
|
|
2484
|
-
idPortalMap.set(id, (0,react_dom.createPortal)(reactNode, node, id));
|
|
2485
|
-
} else {
|
|
2486
|
-
idPortalMap.delete(id);
|
|
2487
|
-
}
|
|
2488
|
-
setPortalNodes(Array.from(idPortalMap.values()));
|
|
2489
|
-
}, []);
|
|
2490
|
-
const fragment = (0,react.useMemo)(() => react.createElement(react.Fragment, {
|
|
2491
|
-
children: portalNodes
|
|
2492
|
-
}), [portalNodes]);
|
|
2493
|
-
return {
|
|
2494
|
-
portalsNode: fragment,
|
|
2495
|
-
setPortal
|
|
2496
|
-
};
|
|
2497
|
-
};
|
|
2498
|
-
/* harmony default export */ const internal_usePortals = (usePortals_usePortals);
|
|
2499
|
-
;// ./node_modules/@diplodoc/mdx-extension/build/esm/hooks/useMdx.js
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
const useMdx = ({
|
|
2504
|
-
refCtr,
|
|
2505
|
-
html,
|
|
2506
|
-
components,
|
|
2507
|
-
pureComponents,
|
|
2508
|
-
mdxArtifacts
|
|
2509
|
-
}) => {
|
|
2510
|
-
const refUmount = useRef(() => {});
|
|
2511
|
-
const {
|
|
2512
|
-
portalsNode,
|
|
2513
|
-
setPortal
|
|
2514
|
-
} = usePortals();
|
|
2515
|
-
const combinedComponents = useMemo(() => ({
|
|
2516
|
-
...components,
|
|
2517
|
-
...pureComponents
|
|
2518
|
-
}), [components, pureComponents]);
|
|
2519
|
-
// building mdx scripts into components
|
|
2520
|
-
const idMdxComponent = useMemo(() => idMdxToComponents(mdxArtifacts?.idMdx), [mdxArtifacts?.idMdx]);
|
|
2521
|
-
const idTagName = useMemo(() => mdxArtifacts?.idTagName ?? {}, [mdxArtifacts]);
|
|
2522
|
-
// render new html
|
|
2523
|
-
useLayoutEffect(() => {
|
|
2524
|
-
const ctr = refCtr.current;
|
|
2525
|
-
if (!ctr) {
|
|
2526
|
-
throw new Error('ctr is null');
|
|
2527
|
-
}
|
|
2528
|
-
const dom = new DOMParser().parseFromString(`<html lang="en"><body>${html}</body></html>`, 'text/html');
|
|
2529
|
-
const bodyNode = dom.querySelector('body');
|
|
2530
|
-
if (!bodyNode) {
|
|
2531
|
-
throw new Error('bodyNode is null');
|
|
2532
|
-
}
|
|
2533
|
-
const fragment = document.createDocumentFragment();
|
|
2534
|
-
fragment.append(...Array.from(bodyNode.childNodes.values()));
|
|
2535
|
-
ctr.textContent = null;
|
|
2536
|
-
ctr.appendChild(fragment);
|
|
2537
|
-
// umount mdx components when html or refCtr changes
|
|
2538
|
-
return () => refUmount.current();
|
|
2539
|
-
}, [refCtr, html]);
|
|
2540
|
-
// render mdx
|
|
2541
|
-
useLayoutEffect(() => {
|
|
2542
|
-
const ctr = refCtr.current;
|
|
2543
|
-
if (!ctr) {
|
|
2544
|
-
throw new Error('ctr is null');
|
|
2545
|
-
}
|
|
2546
|
-
refUmount.current = renderMdxComponents({
|
|
2547
|
-
idMdxComponent,
|
|
2548
|
-
idTagName,
|
|
2549
|
-
ctr,
|
|
2550
|
-
components: combinedComponents,
|
|
2551
|
-
setPortal
|
|
2552
|
-
});
|
|
2553
|
-
}, [refCtr, html, combinedComponents, idMdxComponent, idTagName, setPortal]);
|
|
2554
|
-
return portalsNode;
|
|
2555
|
-
};
|
|
2556
|
-
/* harmony default export */ const hooks_useMdx = ((/* unused pure expression or super */ null && (useMdx)));
|
|
2557
|
-
;// ./node_modules/@diplodoc/mdx-extension/build/esm/hooks/useMdxSsr.js
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
const useMdxSsr = ({
|
|
2562
|
-
html,
|
|
2563
|
-
refCtr,
|
|
2564
|
-
mdxArtifacts,
|
|
2565
|
-
components,
|
|
2566
|
-
pureComponents
|
|
2567
|
-
}) => {
|
|
2568
|
-
const refUmount = (0,react.useRef)(() => {});
|
|
2569
|
-
const {
|
|
2570
|
-
portalsNode,
|
|
2571
|
-
setPortal
|
|
2572
|
-
} = internal_usePortals();
|
|
2573
|
-
const combinedComponents = (0,react.useMemo)(() => ({
|
|
2574
|
-
...components,
|
|
2575
|
-
...pureComponents
|
|
2576
|
-
}), [components, pureComponents]);
|
|
2577
|
-
// building mdx scripts into components
|
|
2578
|
-
const idMdxComponent = (0,react.useMemo)(() => common_idMdxToComponents(mdxArtifacts?.idMdx), [mdxArtifacts?.idMdx]);
|
|
2579
|
-
const idTagName = (0,react.useMemo)(() => mdxArtifacts?.idTagName ?? {}, [mdxArtifacts]);
|
|
2580
|
-
// umount mdx components when html or refCtr changes
|
|
2581
|
-
(0,react.useLayoutEffect)(() => {
|
|
2582
|
-
return () => refUmount.current();
|
|
2583
|
-
}, [html, refCtr]);
|
|
2584
|
-
// render mdx
|
|
2585
|
-
(0,react.useLayoutEffect)(() => {
|
|
2586
|
-
const ctr = refCtr.current;
|
|
2587
|
-
if (!ctr) {
|
|
2588
|
-
throw new Error('ctr is null');
|
|
2589
|
-
}
|
|
2590
|
-
refUmount.current = common_renderMdxComponents({
|
|
2591
|
-
idMdxComponent,
|
|
2592
|
-
idTagName,
|
|
2593
|
-
ctr,
|
|
2594
|
-
components: combinedComponents,
|
|
2595
|
-
isSSR: true,
|
|
2596
|
-
setPortal
|
|
2597
|
-
});
|
|
2598
|
-
}, [html, refCtr, combinedComponents, idMdxComponent, idTagName, setPortal]);
|
|
2599
|
-
return portalsNode;
|
|
2600
|
-
};
|
|
2601
|
-
/* harmony default export */ const hooks_useMdxSsr = (useMdxSsr);
|
|
2602
|
-
;// ./node_modules/@diplodoc/mdx-extension/build/esm/hooks/index.js
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
;// ./node_modules/@diplodoc/mdx-extension/build/esm/index.js
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
1697
|
/***/ }),
|
|
2615
1698
|
|
|
2616
1699
|
/***/ 2141:
|
|
@@ -139411,13 +138494,14 @@ var DocLayout = ({
|
|
|
139411
138494
|
router,
|
|
139412
138495
|
headerHeight,
|
|
139413
138496
|
tocTitleIcon,
|
|
139414
|
-
hideTocHeader,
|
|
139415
138497
|
hideToc,
|
|
139416
138498
|
singlePage,
|
|
139417
138499
|
onChangeSinglePage,
|
|
139418
|
-
pdfLink
|
|
138500
|
+
pdfLink,
|
|
138501
|
+
hideTocHeader
|
|
139419
138502
|
}) => {
|
|
139420
138503
|
const isTocHidden = (0,useInterface/* useInterface */.j)("toc");
|
|
138504
|
+
const isTocHeaderHidden = (0,useInterface/* useInterface */.j)("toc-header");
|
|
139421
138505
|
let left, center, right;
|
|
139422
138506
|
const modes = {
|
|
139423
138507
|
"regular-page-width": !wideFormat,
|
|
@@ -139449,7 +138533,7 @@ var DocLayout = ({
|
|
|
139449
138533
|
router,
|
|
139450
138534
|
headerHeight,
|
|
139451
138535
|
tocTitleIcon,
|
|
139452
|
-
hideTocHeader,
|
|
138536
|
+
hideTocHeader: hideTocHeader || isTocHeaderHidden,
|
|
139453
138537
|
singlePage,
|
|
139454
138538
|
onChangeSinglePage,
|
|
139455
138539
|
pdfLink
|
|
@@ -139477,14 +138561,14 @@ var DocContentPage = ({
|
|
|
139477
138561
|
router,
|
|
139478
138562
|
headerHeight,
|
|
139479
138563
|
wideFormat = defaultWideFormat,
|
|
139480
|
-
hideTocHeader,
|
|
139481
138564
|
hideToc,
|
|
139482
138565
|
tocTitleIcon,
|
|
139483
138566
|
footer,
|
|
139484
138567
|
children,
|
|
139485
138568
|
useMainTag,
|
|
139486
138569
|
legacyToc,
|
|
139487
|
-
fullScreen
|
|
138570
|
+
fullScreen,
|
|
138571
|
+
hideTocHeader
|
|
139488
138572
|
}) => {
|
|
139489
138573
|
const modes = {
|
|
139490
138574
|
"regular-page-width": !wideFormat
|
|
@@ -139496,14 +138580,14 @@ var DocContentPage = ({
|
|
|
139496
138580
|
router,
|
|
139497
138581
|
headerHeight,
|
|
139498
138582
|
className: DocContentPage_b(modes),
|
|
139499
|
-
hideTocHeader,
|
|
139500
138583
|
hideToc,
|
|
139501
138584
|
fullScreen: fullScreen || (data == null ? void 0 : data.fullScreen),
|
|
139502
138585
|
tocTitleIcon,
|
|
139503
138586
|
footer,
|
|
139504
138587
|
hideRight: true,
|
|
139505
138588
|
wideFormat,
|
|
139506
|
-
legacyToc
|
|
138589
|
+
legacyToc,
|
|
138590
|
+
hideTocHeader
|
|
139507
138591
|
},
|
|
139508
138592
|
/* @__PURE__ */ react.createElement(DocLayout.Center, null, /* @__PURE__ */ react.createElement("div", { className: DocContentPage_b("main") }, /* @__PURE__ */ react.createElement(ContentWrapper, { className: DocContentPage_b("content"), useMainTag }, children)))
|
|
139509
138593
|
);
|
|
@@ -177756,6 +176840,322 @@ MarkdownIt.prototype.renderInline = function (src, env) {
|
|
|
177756
176840
|
module.exports = MarkdownIt;
|
|
177757
176841
|
|
|
177758
176842
|
|
|
176843
|
+
/***/ }),
|
|
176844
|
+
|
|
176845
|
+
/***/ 91353:
|
|
176846
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
176847
|
+
|
|
176848
|
+
"use strict";
|
|
176849
|
+
|
|
176850
|
+
// EXPORTS
|
|
176851
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
176852
|
+
A: () => (/* binding */ hooks_useMdxSsr)
|
|
176853
|
+
});
|
|
176854
|
+
|
|
176855
|
+
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
176856
|
+
var react = __webpack_require__(96540);
|
|
176857
|
+
// EXTERNAL MODULE: ./node_modules/react-dom/client.js
|
|
176858
|
+
var client = __webpack_require__(5338);
|
|
176859
|
+
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
|
|
176860
|
+
var jsx_runtime = __webpack_require__(74848);
|
|
176861
|
+
var jsx_runtime_namespaceObject = /*#__PURE__*/__webpack_require__.t(jsx_runtime, 2);
|
|
176862
|
+
;// ./node_modules/@diplodoc/mdx-extension/build/esm/context/MdxStateCtx.js
|
|
176863
|
+
|
|
176864
|
+
const MdxStateCtx = (0,react.createContext)(null);
|
|
176865
|
+
|
|
176866
|
+
;// ./node_modules/@diplodoc/mdx-extension/build/esm/context/internal/MdxPortalSetterCtx.js
|
|
176867
|
+
|
|
176868
|
+
const MdxPortalSetterCtx = (0,react.createContext)(null);
|
|
176869
|
+
|
|
176870
|
+
;// ./node_modules/@diplodoc/mdx-extension/build/esm/utils/internal/maps.js
|
|
176871
|
+
|
|
176872
|
+
const portalWrapperComponentMap = new WeakMap();
|
|
176873
|
+
const componentGetInitProps = new WeakMap();
|
|
176874
|
+
|
|
176875
|
+
;// ./node_modules/@diplodoc/mdx-extension/build/esm/components/internal/CtxProxy.js
|
|
176876
|
+
|
|
176877
|
+
const CtxProxy = (0,react.forwardRef)(({ ctx, children, initValue }, ref) => {
|
|
176878
|
+
const [value, setValue] = react.useState(() => initValue);
|
|
176879
|
+
(0,react.useImperativeHandle)(ref, () => {
|
|
176880
|
+
return {
|
|
176881
|
+
setValue: (v) => setValue(() => v),
|
|
176882
|
+
};
|
|
176883
|
+
}, []);
|
|
176884
|
+
return react.createElement(ctx.Provider, {
|
|
176885
|
+
value,
|
|
176886
|
+
children,
|
|
176887
|
+
});
|
|
176888
|
+
});
|
|
176889
|
+
/* harmony default export */ const internal_CtxProxy = (CtxProxy);
|
|
176890
|
+
|
|
176891
|
+
;// ./node_modules/@diplodoc/mdx-extension/build/esm/utils/internal/common.js
|
|
176892
|
+
|
|
176893
|
+
|
|
176894
|
+
|
|
176895
|
+
|
|
176896
|
+
|
|
176897
|
+
|
|
176898
|
+
|
|
176899
|
+
const nodeRootMap = new WeakMap();
|
|
176900
|
+
const nodeWillUmount = new WeakMap();
|
|
176901
|
+
const nodePortalCleanup = new WeakMap();
|
|
176902
|
+
const renderMdxComponents = ({ idMdxComponent, isSSR, ctr, components, setPortal, idTagName, getCtxEmitterRef, contextList = [], }) => {
|
|
176903
|
+
const unmountFns = Object.entries(idMdxComponent).map(([id, Content]) => {
|
|
176904
|
+
let node = ctr.querySelector(`.${id}`);
|
|
176905
|
+
if (!node) {
|
|
176906
|
+
throw new Error('node is null');
|
|
176907
|
+
}
|
|
176908
|
+
if (nodeWillUmount.get(node) && node.parentNode) {
|
|
176909
|
+
const newNode = node.cloneNode(true);
|
|
176910
|
+
node.parentNode.replaceChild(newNode, node);
|
|
176911
|
+
node = newNode;
|
|
176912
|
+
}
|
|
176913
|
+
const mdxState = node?.dataset?.mdxState ? JSON.parse(node.dataset.mdxState) : null;
|
|
176914
|
+
const contentNode = react.createElement(MdxStateCtx.Provider, {
|
|
176915
|
+
value: mdxState,
|
|
176916
|
+
children: react.createElement(Content, {
|
|
176917
|
+
components,
|
|
176918
|
+
}),
|
|
176919
|
+
});
|
|
176920
|
+
const isTopLevelPortal = components && isPortal(components[idTagName[id]]);
|
|
176921
|
+
let root;
|
|
176922
|
+
if (isTopLevelPortal) {
|
|
176923
|
+
if (!nodePortalCleanup.has(node)) {
|
|
176924
|
+
nodePortalCleanup.set(node, true);
|
|
176925
|
+
node.textContent = null;
|
|
176926
|
+
}
|
|
176927
|
+
setPortal({
|
|
176928
|
+
id,
|
|
176929
|
+
node,
|
|
176930
|
+
reactNode: contentNode,
|
|
176931
|
+
});
|
|
176932
|
+
}
|
|
176933
|
+
else {
|
|
176934
|
+
const reactNode = react.createElement(MdxPortalSetterCtx.Provider, {
|
|
176935
|
+
value: setPortal,
|
|
176936
|
+
children: contextList.reduce((acc, ctxItem) => {
|
|
176937
|
+
const { ctx } = getCtxFromCtxItem(ctxItem);
|
|
176938
|
+
const { ref, value } = getCtxEmitterRef(Content, ctx);
|
|
176939
|
+
return react.createElement(internal_CtxProxy, {
|
|
176940
|
+
ref,
|
|
176941
|
+
ctx,
|
|
176942
|
+
children: acc,
|
|
176943
|
+
initValue: value,
|
|
176944
|
+
});
|
|
176945
|
+
}, contentNode),
|
|
176946
|
+
});
|
|
176947
|
+
root = nodeRootMap.get(node);
|
|
176948
|
+
if (root) {
|
|
176949
|
+
root.render(reactNode);
|
|
176950
|
+
}
|
|
176951
|
+
else {
|
|
176952
|
+
const options = {
|
|
176953
|
+
identifierPrefix: id,
|
|
176954
|
+
};
|
|
176955
|
+
if (isSSR) {
|
|
176956
|
+
root = (0,client/* hydrateRoot */.c)(node, reactNode, options);
|
|
176957
|
+
}
|
|
176958
|
+
else {
|
|
176959
|
+
root = (0,client/* createRoot */.H)(node, options);
|
|
176960
|
+
root.render(reactNode);
|
|
176961
|
+
}
|
|
176962
|
+
nodeRootMap.set(node, root);
|
|
176963
|
+
}
|
|
176964
|
+
}
|
|
176965
|
+
return () => {
|
|
176966
|
+
nodeWillUmount.set(node, true);
|
|
176967
|
+
getCtxEmitterRef(Content, null);
|
|
176968
|
+
if (isTopLevelPortal) {
|
|
176969
|
+
setPortal({
|
|
176970
|
+
id,
|
|
176971
|
+
node: null,
|
|
176972
|
+
reactNode: null,
|
|
176973
|
+
});
|
|
176974
|
+
}
|
|
176975
|
+
else if (root) {
|
|
176976
|
+
setTimeout(() => root.unmount(), 0);
|
|
176977
|
+
}
|
|
176978
|
+
};
|
|
176979
|
+
});
|
|
176980
|
+
return () => unmountFns.forEach((cb) => cb());
|
|
176981
|
+
};
|
|
176982
|
+
const idMdxToComponents = (idMdx) => {
|
|
176983
|
+
return Object.entries(idMdx ?? {}).reduce((acc, [id, fnStr]) => {
|
|
176984
|
+
// eslint-disable-next-line no-param-reassign
|
|
176985
|
+
acc[id] = runSync(fnStr, jsx_runtime_namespaceObject).default;
|
|
176986
|
+
return acc;
|
|
176987
|
+
}, {});
|
|
176988
|
+
};
|
|
176989
|
+
function generateUniqueId() {
|
|
176990
|
+
return Date.now().toString(36) + Math.random().toString(36).substring(2);
|
|
176991
|
+
}
|
|
176992
|
+
function isPortal(component) {
|
|
176993
|
+
if (!component || typeof component !== 'object')
|
|
176994
|
+
return false;
|
|
176995
|
+
return portalWrapperComponentMap.has(component);
|
|
176996
|
+
}
|
|
176997
|
+
function getInitMdxArtifacts() {
|
|
176998
|
+
return { idMdx: {}, idTagName: {} };
|
|
176999
|
+
}
|
|
177000
|
+
// runSync from @mdx-js/mdx
|
|
177001
|
+
function runSync(code, options) {
|
|
177002
|
+
// eslint-disable-next-line no-new-func
|
|
177003
|
+
return new Function(String(code))(options);
|
|
177004
|
+
}
|
|
177005
|
+
function getCtxFromCtxItem(ctxItem) {
|
|
177006
|
+
let ctx;
|
|
177007
|
+
let initValue;
|
|
177008
|
+
if ('ctx' in ctxItem) {
|
|
177009
|
+
ctx = ctxItem.ctx;
|
|
177010
|
+
initValue = ctxItem.initValue;
|
|
177011
|
+
}
|
|
177012
|
+
else {
|
|
177013
|
+
ctx = ctxItem;
|
|
177014
|
+
}
|
|
177015
|
+
return {
|
|
177016
|
+
ctx: ctx,
|
|
177017
|
+
initValue,
|
|
177018
|
+
};
|
|
177019
|
+
}
|
|
177020
|
+
|
|
177021
|
+
// EXTERNAL MODULE: ./node_modules/react-dom/index.js
|
|
177022
|
+
var react_dom = __webpack_require__(40961);
|
|
177023
|
+
;// ./node_modules/@diplodoc/mdx-extension/build/esm/hooks/internal/usePortals.js
|
|
177024
|
+
|
|
177025
|
+
|
|
177026
|
+
const usePortals = () => {
|
|
177027
|
+
const refIdPortalMap = (0,react.useRef)(new Map());
|
|
177028
|
+
const [portalNodes, setPortalNodes] = (0,react.useState)([]);
|
|
177029
|
+
const setPortal = (0,react.useCallback)(({ id, node, reactNode }) => {
|
|
177030
|
+
const idPortalMap = refIdPortalMap.current;
|
|
177031
|
+
if (node) {
|
|
177032
|
+
idPortalMap.set(id, (0,react_dom.createPortal)(reactNode, node, id));
|
|
177033
|
+
}
|
|
177034
|
+
else {
|
|
177035
|
+
idPortalMap.delete(id);
|
|
177036
|
+
}
|
|
177037
|
+
setPortalNodes(Array.from(idPortalMap.values()));
|
|
177038
|
+
}, []);
|
|
177039
|
+
const fragment = (0,react.useMemo)(() => react.createElement(react.Fragment, { children: portalNodes }), [portalNodes]);
|
|
177040
|
+
return {
|
|
177041
|
+
portalsNode: fragment,
|
|
177042
|
+
setPortal,
|
|
177043
|
+
};
|
|
177044
|
+
};
|
|
177045
|
+
/* harmony default export */ const internal_usePortals = (usePortals);
|
|
177046
|
+
|
|
177047
|
+
;// ./node_modules/@diplodoc/mdx-extension/build/esm/components/internal/CtxListener.js
|
|
177048
|
+
|
|
177049
|
+
const CtxListener = ({ ctx, setValue }) => {
|
|
177050
|
+
const value = (0,react.useContext)(ctx);
|
|
177051
|
+
(0,react.useMemo)(() => setValue(value), [value, setValue]);
|
|
177052
|
+
return null;
|
|
177053
|
+
};
|
|
177054
|
+
/* harmony default export */ const internal_CtxListener = (CtxListener);
|
|
177055
|
+
|
|
177056
|
+
;// ./node_modules/@diplodoc/mdx-extension/build/esm/hooks/internal/useContextProxy.js
|
|
177057
|
+
|
|
177058
|
+
|
|
177059
|
+
|
|
177060
|
+
const useContextProxy = (contextList) => {
|
|
177061
|
+
const refCtxValue = (0,react.useRef)(new Map());
|
|
177062
|
+
const refContentCtxListMap = (0,react.useRef)(new Map());
|
|
177063
|
+
const handleChangeValue = (0,react.useCallback)((ctx, value) => {
|
|
177064
|
+
const ctxValue = refCtxValue.current;
|
|
177065
|
+
const contentCtxListMap = refContentCtxListMap.current;
|
|
177066
|
+
ctxValue.set(ctx, value);
|
|
177067
|
+
contentCtxListMap.forEach((list) => {
|
|
177068
|
+
list.forEach(({ ctx: ctxLocal, ref }) => {
|
|
177069
|
+
if (ref.current && ctxLocal === ctx) {
|
|
177070
|
+
ref.current.setValue(value);
|
|
177071
|
+
}
|
|
177072
|
+
});
|
|
177073
|
+
});
|
|
177074
|
+
}, []);
|
|
177075
|
+
const listenerNodes = (0,react.useMemo)(() => {
|
|
177076
|
+
if (!contextList)
|
|
177077
|
+
return [];
|
|
177078
|
+
return contextList.map((ctxItem, idx) => {
|
|
177079
|
+
const { ctx } = getCtxFromCtxItem(ctxItem);
|
|
177080
|
+
return react.createElement(internal_CtxListener, {
|
|
177081
|
+
key: `ctx-${ctx.displayName ?? idx}`,
|
|
177082
|
+
ctx,
|
|
177083
|
+
setValue: (v) => handleChangeValue(ctx, v),
|
|
177084
|
+
});
|
|
177085
|
+
});
|
|
177086
|
+
}, [contextList, handleChangeValue]);
|
|
177087
|
+
const getCtxEmitterRef = (0,react.useCallback)((Content, ctx) => {
|
|
177088
|
+
const contentCtxListMap = refContentCtxListMap.current;
|
|
177089
|
+
if (!ctx) {
|
|
177090
|
+
contentCtxListMap.delete(Content);
|
|
177091
|
+
return { ref: null, value: null };
|
|
177092
|
+
}
|
|
177093
|
+
const ref = { current: null };
|
|
177094
|
+
const ctxValueMap = refCtxValue.current;
|
|
177095
|
+
let ctxListLocal = contentCtxListMap.get(Content);
|
|
177096
|
+
if (!ctxListLocal) {
|
|
177097
|
+
ctxListLocal = [];
|
|
177098
|
+
contentCtxListMap.set(Content, ctxListLocal);
|
|
177099
|
+
}
|
|
177100
|
+
ctxListLocal.push({ ctx, ref });
|
|
177101
|
+
const value = ctxValueMap.get(ctx);
|
|
177102
|
+
return { ref, value };
|
|
177103
|
+
}, []);
|
|
177104
|
+
return {
|
|
177105
|
+
getCtxEmitterRef,
|
|
177106
|
+
listenerNode: react.createElement(react.Fragment, { children: listenerNodes }),
|
|
177107
|
+
};
|
|
177108
|
+
};
|
|
177109
|
+
/* harmony default export */ const internal_useContextProxy = (useContextProxy);
|
|
177110
|
+
|
|
177111
|
+
;// ./node_modules/@diplodoc/mdx-extension/build/esm/hooks/useMdxSsr.js
|
|
177112
|
+
|
|
177113
|
+
|
|
177114
|
+
|
|
177115
|
+
|
|
177116
|
+
const useMdxSsr = ({ html, refCtr, mdxArtifacts, components, pureComponents, contextList, }) => {
|
|
177117
|
+
const refUmount = (0,react.useRef)(() => { });
|
|
177118
|
+
const { portalsNode, setPortal } = internal_usePortals();
|
|
177119
|
+
const combinedComponents = (0,react.useMemo)(() => ({ ...components, ...pureComponents }), [components, pureComponents]);
|
|
177120
|
+
// building mdx scripts into components
|
|
177121
|
+
const idMdxComponent = (0,react.useMemo)(() => idMdxToComponents(mdxArtifacts?.idMdx), [mdxArtifacts?.idMdx]);
|
|
177122
|
+
const idTagName = (0,react.useMemo)(() => mdxArtifacts?.idTagName ?? {}, [mdxArtifacts]);
|
|
177123
|
+
const { getCtxEmitterRef, listenerNode } = internal_useContextProxy(contextList);
|
|
177124
|
+
// umount mdx components when html or refCtr changes
|
|
177125
|
+
(0,react.useLayoutEffect)(() => {
|
|
177126
|
+
return () => refUmount.current();
|
|
177127
|
+
}, [html, refCtr]);
|
|
177128
|
+
// render mdx
|
|
177129
|
+
(0,react.useLayoutEffect)(() => {
|
|
177130
|
+
const ctr = refCtr.current;
|
|
177131
|
+
if (!ctr) {
|
|
177132
|
+
throw new Error('ctr is null');
|
|
177133
|
+
}
|
|
177134
|
+
refUmount.current = renderMdxComponents({
|
|
177135
|
+
idMdxComponent,
|
|
177136
|
+
idTagName,
|
|
177137
|
+
ctr,
|
|
177138
|
+
components: combinedComponents,
|
|
177139
|
+
setPortal,
|
|
177140
|
+
getCtxEmitterRef,
|
|
177141
|
+
contextList,
|
|
177142
|
+
isSSR: true,
|
|
177143
|
+
});
|
|
177144
|
+
}, [
|
|
177145
|
+
html,
|
|
177146
|
+
refCtr,
|
|
177147
|
+
combinedComponents,
|
|
177148
|
+
idMdxComponent,
|
|
177149
|
+
idTagName,
|
|
177150
|
+
setPortal,
|
|
177151
|
+
getCtxEmitterRef,
|
|
177152
|
+
contextList,
|
|
177153
|
+
]);
|
|
177154
|
+
return react.createElement(react.Fragment, null, portalsNode, listenerNode);
|
|
177155
|
+
};
|
|
177156
|
+
/* harmony default export */ const hooks_useMdxSsr = (useMdxSsr);
|
|
177157
|
+
|
|
177158
|
+
|
|
177759
177159
|
/***/ }),
|
|
177760
177160
|
|
|
177761
177161
|
/***/ 91541:
|