mirror of
https://gitee.com/antv/g6.git
synced 2024-11-29 18:28:19 +08:00
1 line
2.9 KiB
Plaintext
1 line
2.9 KiB
Plaintext
|
{"version":3,"sources":["../../node_modules/.pnpm/dumi@2.4.14_@babel+core@7.26.0_@swc+helpers@0.5.1_@types+node@20.17.9_@types+react@18.3.12_es_54awilfh3ualxwsi36hmrn5nxe/node_modules/dumi/dist/client/pages/Demo/index.js"],"sourcesContent":["import { useDemo, useLiveDemo, useParams } from 'dumi';\nimport { createElement, useEffect } from 'react';\nimport { useRenderer } from \"../../theme-api/useRenderer\";\nimport \"./index.less\";\nvar DemoRenderPage = function DemoRenderPage() {\n var params = useParams();\n var id = params.id;\n var demo = useDemo(id);\n var _useRenderer = useRenderer({\n id: id,\n component: demo.component,\n renderOpts: demo.renderOpts\n }),\n canvasRef = _useRenderer.canvasRef;\n var _ref = demo || {},\n component = _ref.component,\n renderOpts = _ref.renderOpts;\n var _useLiveDemo = useLiveDemo(id),\n liveDemoNode = _useLiveDemo.node,\n setSource = _useLiveDemo.setSource,\n liveDemoError = _useLiveDemo.error,\n loading = _useLiveDemo.loading;\n var finalNode = liveDemoNode || (renderOpts !== null && renderOpts !== void 0 && renderOpts.renderer ? /*#__PURE__*/createElement('div', {\n ref: canvasRef\n }) : component && /*#__PURE__*/createElement(component));\n\n // listen message event for setSource\n useEffect(function () {\n var handler = function handler(ev) {\n if (ev.data.type === 'dumi.liveDemo.setSource') {\n setSource(ev.data.value);\n }\n };\n window.addEventListener('message', handler);\n return function () {\n return window.removeEventListener('message', handler);\n };\n }, [setSource]);\n\n // notify parent window that compile done\n useEffect(function () {\n if (!loading && (liveDemoError || liveDemoNode)) {\n window.postMessage({\n type: 'dumi.liveDemo.compileDone',\n value: {\n err: liveDemoError\n }\n });\n }\n }, [liveDemoError, liveDemoNode, loading]);\n return finalNode;\n};\nexport default DemoRenderPage;"],"names":[],"mappings":"6PAoDA,+CAAA,cApDgD,gBACP,gBACb,YAkD5B,EAhDqB,WAEnB,IAAI,EAAK,AADI,GAAA,WAAS,IACN,EAAE,CACd,EAAO,GAAA,SAAO,EAAC,GAMjB,EAAY,AALK,GAAA,aAAW,EAAC,CAC3B,GAAI,EACJ,UAAW,EAAK,SAAS,CACzB,WAAY,EAAK,UAAU,AAC7B,GACyB,SAAS,CAChC,EAAO,GAAQ,CAAC,EAClB,EAAY,EAAK,SAAS,CAC1B,EAAa,EAAK,UAAU,CAC1B,EAAe,GAAA,aAAW,EAAC,GAC7B,EAAe,EAAa,IAAI,CAChC,EAAY,EAAa,SAAS,CAClC,EAAgB,EAAa,KAAK,CAClC,EAAU,EAAa,OAAO,CAC5B,EAAY,GAAiB,CAAA,MAAA,GAAgD,EAAW,QAAQ,CAAgB,GAAA,eAAa,EAAC,MAAO,CACvI,IAAK,CACP,GAAK,GAA0B,GAAA,eAAa,EAAC,EAAS,EA0BtD,MAvBA,GAAA,WAAS,EAAC,WACR,IAAI,EAAU,SAAiB,CAAE,EACV,4BAAjB,EAAG,IAAI,CAAC,IAAI,EACd,EAAU,EAAG,IAAI,CAAC,KAAK,EAE3B,EAEA,OADA,OAAO,gBAAgB,CAAC,UAAW,GAC5B,WACL,OAAO,OAAO,mBAAmB,CAAC,UAAW,GAC/C,EACF,EAAG,CAAC,EAAU,EAGd,GAAA,WAAS,EAAC,WACJ,CAAC,GAAY,CAAA,GAAiB,CAAW,GAC3C,OAAO,WAAW,CAAC,CACjB,KAAM,4BACN,MAAO,CACL,IAAK,CACP,CACF,GAEJ,EAAG,CAAC,EAAe,EAAc,EAAQ,EAClC,EACT"}
|