@dooc-dev/dooc 0.0.6 → 0.0.8
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/client.global.js +1 -0
- package/dist/code-worker.global.js +11 -11
- package/dist/code.global.js +75 -75
- package/dist/edit.global.js +234 -231
- package/dist/{compiler → engine/compiler}/bundle-urls.js +1 -4
- package/dist/{compiler → engine/compiler}/check-prose.d.ts +1 -1
- package/dist/{compiler → engine/compiler}/check-prose.js +1 -1
- package/dist/{compiler → engine/compiler}/check.js +15 -27
- package/dist/{compiler → engine/compiler}/code-blocks.js +3 -1
- package/dist/{compiler → engine/compiler}/code-languages.js +1 -2
- package/dist/{compiler → engine/compiler}/compile.d.ts +5 -4
- package/dist/{compiler → engine/compiler}/compile.js +91 -32
- package/dist/{compiler → engine/compiler}/config.js +1 -3
- package/dist/{compiler → engine/compiler}/dialect.d.ts +1 -3
- package/dist/{compiler → engine/compiler}/dialect.js +8 -52
- package/dist/{compiler → engine/compiler}/dxf.js +1 -1
- package/dist/{compiler → engine/compiler}/export.js +15 -8
- package/dist/{compiler → engine/compiler}/figures.js +26 -22
- package/dist/{compiler → engine/compiler}/file-cache.d.ts +1 -2
- package/dist/{compiler → engine/compiler}/file-cache.js +8 -15
- package/dist/{compiler → engine/compiler}/files.js +49 -38
- package/dist/{compiler → engine/compiler}/fonts.js +1 -3
- package/dist/{compiler → engine/compiler}/from-mdast.js +1 -1
- package/dist/engine/compiler/host.d.ts +10 -0
- package/dist/engine/compiler/host.js +16 -0
- package/dist/{compiler → engine/compiler}/icons.d.ts +3 -0
- package/dist/{compiler → engine/compiler}/icons.js +28 -10
- package/dist/{compiler → engine/compiler}/ignored-files.d.ts +2 -0
- package/dist/{compiler → engine/compiler}/ignored-files.js +12 -3
- package/dist/{compiler → engine/compiler}/locales.js +2 -8
- package/dist/{compiler → engine/compiler}/manifest.d.ts +3 -2
- package/dist/engine/compiler/manifest.js +46 -0
- package/dist/{compiler → engine/compiler}/ops.d.ts +4 -1
- package/dist/{compiler → engine/compiler}/ops.js +36 -21
- package/dist/engine/compiler/schema-file-references.d.ts +2 -0
- package/dist/engine/compiler/schema-file-references.js +82 -0
- package/dist/engine/compiler/serialize.d.ts +2 -0
- package/dist/engine/compiler/serialize.js +5 -0
- package/dist/{compiler → engine/compiler}/subformat-schema.js +1 -3
- package/dist/{compiler → engine/compiler}/subformats.d.ts +10 -0
- package/dist/{compiler → engine/compiler}/subformats.js +122 -18
- package/dist/{compiler → engine/compiler}/textfile-remote.js +1 -2
- package/dist/{compiler → engine/compiler}/textfile.js +4 -6
- package/dist/{compiler → engine/compiler}/theme-variants.js +1 -1
- package/dist/{compiler → engine/compiler}/zip.js +1 -1
- package/dist/{core → engine/core}/blocks.d.ts +6 -4
- package/dist/{core → engine/core}/content-metadata.d.ts +6 -1
- package/dist/{core → engine/core}/content-metadata.js +84 -18
- package/dist/{core → engine/core}/content-types.d.ts +4 -2
- package/dist/{core → engine/core}/html.d.ts +7 -0
- package/dist/{core → engine/core}/html.js +44 -3
- package/dist/{core → engine/core}/icons.d.ts +3 -0
- package/dist/engine/core/icons.js +20 -0
- package/dist/{core → engine/core}/routing.d.ts +2 -0
- package/dist/{core → engine/core}/routing.js +9 -0
- package/dist/{core → engine/core}/schema-refs.d.ts +1 -1
- package/dist/{core → engine/core}/schema-refs.js +3 -1
- package/dist/engine/core/subformat-references.d.ts +5 -0
- package/dist/engine/core/subformat-references.js +33 -0
- package/dist/{core → engine/core}/subformats.d.ts +7 -0
- package/dist/{core → engine/core}/subformats.js +5 -1
- package/dist/{core → engine/core}/taxonomy.d.ts +2 -3
- package/dist/{core → engine/core}/taxonomy.js +1 -5
- package/dist/flow.global.js +1031 -1057
- package/dist/frontend/application-request.d.ts +14 -0
- package/dist/frontend/application-request.js +36 -0
- package/dist/frontend/document-application.d.ts +200 -0
- package/dist/{viewer/serve.js → frontend/document-application.js} +1611 -1670
- package/dist/frontend/figure-preview.d.ts +4 -0
- package/dist/{viewer → frontend}/figure-preview.js +4 -4
- package/dist/{viewer → frontend}/file-references.d.ts +1 -1
- package/dist/{viewer → frontend}/file-references.js +3 -3
- package/dist/{viewer → frontend}/font-picker.d.ts +1 -1
- package/dist/{viewer → frontend}/font-settings.d.ts +1 -1
- package/dist/{viewer → frontend}/language-picker.js +112 -18
- package/dist/{viewer → frontend}/locales/eng.json +16 -2
- package/dist/{viewer → frontend}/locales/jpn.json +16 -2
- package/dist/{viewer → frontend}/locales/zho.json +16 -2
- package/dist/{viewer → frontend}/nav-focus.js +2 -0
- package/dist/{viewer → frontend}/plugin-blocks.js +2 -2
- package/dist/{viewer → frontend}/resize.js +14 -2
- package/dist/frontend/resource-download.d.ts +2 -0
- package/dist/frontend/resource-download.js +43 -0
- package/dist/{viewer → frontend}/resource-library.d.ts +9 -2
- package/dist/{viewer → frontend}/resource-library.js +133 -37
- package/dist/{core → frontend}/schema-graph-flow.d.ts +1 -1
- package/dist/{core → frontend}/schema-graph-flow.js +1 -1
- package/dist/{viewer → frontend}/search.d.ts +2 -2
- package/dist/{viewer → frontend}/search.js +26 -8
- package/dist/graph/{abnfDiagram-S7VZAUFO-ASBULSKE.js → abnfDiagram-S7VZAUFO-GAGCW2J5.js} +1 -1
- package/dist/graph/{architecture-WOLXFQ4H-V57EDXXY.js → architecture-WOLXFQ4H-AWAC3VBS.js} +1 -1
- package/dist/graph/{architectureDiagram-YGSQEFNW-GIMP347N.js → architectureDiagram-YGSQEFNW-WQ7QKSUJ.js} +1 -1
- package/dist/graph/{blockDiagram-APKKGZFW-RDL2T4JW.js → blockDiagram-APKKGZFW-H7ZNJMOM.js} +1 -1
- package/dist/graph/{bpmnIcons-APHXDYXF-TWOSQNUQ.js → bpmnIcons-APHXDYXF-EAVPNTFE.js} +1 -1
- package/dist/graph/{c4Diagram-KJ2TOQU5-75LIUC4F.js → c4Diagram-KJ2TOQU5-3IYS34YL.js} +1 -1
- package/dist/graph/{chunk-KU6GTEMS.js → chunk-3CJU2RDX.js} +1 -1
- package/dist/graph/{chunk-ISO77HML.js → chunk-5N2X2DXU.js} +1 -1
- package/dist/graph/{chunk-YCRLJT2S.js → chunk-67BPVAXC.js} +1 -1
- package/dist/graph/{chunk-26TUJSYJ.js → chunk-6CDZONCA.js} +1 -1
- package/dist/graph/{chunk-I3DMZIHV.js → chunk-7ASYMKN2.js} +1 -1
- package/dist/graph/{chunk-K2KLZU7M.js → chunk-7JQUFVT4.js} +2 -2
- package/dist/graph/{chunk-BBD5CEDC.js → chunk-7LSMJ4VU.js} +1 -1
- package/dist/graph/{chunk-EG5UVNOC.js → chunk-7UKJADAE.js} +1 -1
- package/dist/graph/{chunk-BZAMCJ6B.js → chunk-AARGNXTW.js} +1 -1
- package/dist/graph/{chunk-HOPPTA6H.js → chunk-BOXAA5AP.js} +2 -2
- package/dist/graph/{chunk-N3OHKGRZ.js → chunk-BTMPKSGF.js} +1 -1
- package/dist/graph/{chunk-QCJUF4YA.js → chunk-DIDARDST.js} +1 -1
- package/dist/graph/{chunk-R63JUMUK.js → chunk-EWYECPNJ.js} +1 -1
- package/dist/graph/{chunk-3YJHMOOA.js → chunk-FD7ZFC7R.js} +1 -1
- package/dist/graph/chunk-GWYODWCE.js +1 -0
- package/dist/graph/{chunk-IC23EEF6.js → chunk-HKRJKXEE.js} +1 -1
- package/dist/graph/{chunk-PW2RGZ3O.js → chunk-I5LEUF24.js} +1 -1
- package/dist/graph/{chunk-OFZLK5G4.js → chunk-ICJPOOXG.js} +1 -1
- package/dist/graph/{chunk-KT4VPQD5.js → chunk-IVZHB6RS.js} +2 -2
- package/dist/graph/{chunk-VM2H7G2R.js → chunk-JZGXHT3J.js} +1 -1
- package/dist/graph/{chunk-HJG2HUYJ.js → chunk-LSRL537V.js} +1 -1
- package/dist/graph/{chunk-C6J4A356.js → chunk-N44XPVUD.js} +1 -1
- package/dist/graph/{chunk-JD7ZBJD2.js → chunk-NDAMZVXQ.js} +1 -1
- package/dist/graph/{chunk-QEEA3KYY.js → chunk-QLS7NIYR.js} +1 -1
- package/dist/graph/{chunk-JRSH5GNS.js → chunk-QQIGL7OP.js} +1 -1
- package/dist/graph/chunk-SQE76S5B.js +1 -0
- package/dist/graph/{chunk-ZMCB7VP2.js → chunk-WQHTQAFY.js} +1 -1
- package/dist/graph/{classDiagram-v2-L25IHNXF-JL7LVDZH.js → classDiagram-v2-L25IHNXF-HNTCDTNK.js} +1 -1
- package/dist/graph/{cose-bilkent-JH36ORCC-PNM3EYPB.js → cose-bilkent-JH36ORCC-2GVA7XKO.js} +1 -1
- package/dist/graph/{cynefin-EF2NZ3EQ-PSXP3DXL.js → cynefin-EF2NZ3EQ-TCI65RAQ.js} +1 -1
- package/dist/graph/{cynefinDiagram-L36ESFBY-QVY54CXO.js → cynefinDiagram-L36ESFBY-OKQ5BLVF.js} +1 -1
- package/dist/graph/{dagre-SPEB5RXH-HPGQXBZJ.js → dagre-SPEB5RXH-KZEBD52K.js} +1 -1
- package/dist/graph/{diagram-3B7GL73J-DWH5WS2P.js → diagram-3B7GL73J-ESCBJM3O.js} +1 -1
- package/dist/graph/{diagram-DNEMPZML-TEGH2U5I.js → diagram-DNEMPZML-ZIBUSQZI.js} +1 -1
- package/dist/graph/{diagram-L3MUGCDN-X4MREUWR.js → diagram-L3MUGCDN-IGK62IPN.js} +1 -1
- package/dist/graph/{diagram-LA4NIPWU-NXT746HG.js → diagram-LA4NIPWU-2KZCOFJ5.js} +1 -1
- package/dist/graph/{diagram-MHCOC4E2-JGHXSAGS.js → diagram-MHCOC4E2-EYAAB236.js} +1 -1
- package/dist/graph/{diagram-XPFHEONP-ZHZPBLT4.js → diagram-XPFHEONP-OZ5ARGMG.js} +1 -1
- package/dist/graph/{ebnfDiagram-UZSYDL2S-SMF6KJ43.js → ebnfDiagram-UZSYDL2S-M3XJHARD.js} +1 -1
- package/dist/graph/{erDiagram-EYBAPDEH-B3JNJ357.js → erDiagram-EYBAPDEH-Y7KUBH7A.js} +1 -1
- package/dist/graph/{eventmodeling-K75KTNOO-WG6DDYMC.js → eventmodeling-K75KTNOO-ROLYRDEP.js} +1 -1
- package/dist/graph/flowDiagram-MALGAFMO-AAUEIPCR.js +1 -0
- package/dist/graph/{ganttDiagram-23REXITY-YXBYWFOJ.js → ganttDiagram-23REXITY-JSBTFSSJ.js} +1 -1
- package/dist/graph/{gitGraph-VSP46ZUC-VBFWJBBT.js → gitGraph-VSP46ZUC-ZCBCDVNF.js} +1 -1
- package/dist/graph/{gitGraphDiagram-STJD7YCW-4FZDCFGV.js → gitGraphDiagram-STJD7YCW-3ZA5FT3G.js} +1 -1
- package/dist/graph/{info-OHQRW6UA-ALVDUVYV.js → info-OHQRW6UA-JKJGOQNY.js} +1 -1
- package/dist/graph/infoDiagram-KBXO4MBG-6LFMPP2O.js +2 -0
- package/dist/graph/{ishikawaDiagram-M35NCXHK-FRZD2PWQ.js → ishikawaDiagram-M35NCXHK-YLEU44DY.js} +1 -1
- package/dist/graph/{journeyDiagram-OPLOXDXO-7Z66JCPR.js → journeyDiagram-OPLOXDXO-ZHJV66ZT.js} +1 -1
- package/dist/graph/{kanban-definition-BZKZHSQY-NN5AIKTE.js → kanban-definition-BZKZHSQY-SDU25WUM.js} +1 -1
- package/dist/graph/{katex-DXDNVO6V.js → katex-WSLZOTY7.js} +1 -1
- package/dist/graph/{mindmap-definition-I2QAS2VK-HDPCABN2.js → mindmap-definition-I2QAS2VK-XQNBCYHN.js} +1 -1
- package/dist/graph/{packet-JDAUHWVQ-5MQIBWAH.js → packet-JDAUHWVQ-Y3H77ERD.js} +1 -1
- package/dist/graph/{pegDiagram-FD4XPPHP-H2BFNCKT.js → pegDiagram-FD4XPPHP-YO4VWH6V.js} +1 -1
- package/dist/graph/{pie-XZMESJXO-T5VRKHVT.js → pie-XZMESJXO-PRER4XL5.js} +1 -1
- package/dist/graph/{pieDiagram-J4AKIIQI-O3NJSVD3.js → pieDiagram-J4AKIIQI-TJ5WOOSV.js} +1 -1
- package/dist/graph/{quadrantDiagram-XTYBLID2-TMTZJI3P.js → quadrantDiagram-XTYBLID2-G6MSSZLW.js} +1 -1
- package/dist/graph/{radar-ABXABTNO-C6FXIBYW.js → radar-ABXABTNO-M6MV34GM.js} +1 -1
- package/dist/graph/{railroad-I3PHUGI6-ZSO5JXB3.js → railroad-I3PHUGI6-YIWPGN6Q.js} +1 -1
- package/dist/graph/{railroad-abnf-LNEFI6M7-CI4GQRHB.js → railroad-abnf-LNEFI6M7-7JHLZ2R7.js} +1 -1
- package/dist/graph/{railroad-ebnf-DWYD2UWJ-MUENNCGK.js → railroad-ebnf-DWYD2UWJ-V55BXEWY.js} +1 -1
- package/dist/graph/{railroad-peg-JR7BVNR7-N3X5GGIX.js → railroad-peg-JR7BVNR7-XCGKDRMK.js} +1 -1
- package/dist/graph/{railroadDiagram-MRQ6NCDL-JHWS23UO.js → railroadDiagram-MRQ6NCDL-RACSFXC4.js} +1 -1
- package/dist/graph/{requirementDiagram-Y7LWUY3S-7DVLPO4B.js → requirementDiagram-Y7LWUY3S-4LQIQWHQ.js} +1 -1
- package/dist/graph/{sankeyDiagram-WGJFYUXA-Z5L4R5TR.js → sankeyDiagram-WGJFYUXA-K3RXG5FB.js} +1 -1
- package/dist/graph/schema-graph-global.js +17 -17
- package/dist/graph/{sequenceDiagram-5NDRBG5M-RCTU25NT.js → sequenceDiagram-5NDRBG5M-Y6RBHRS3.js} +1 -1
- package/dist/graph/{sizeCapture-INFHLROL-RROY32P5.js → sizeCapture-INFHLROL-TJW3VUGH.js} +1 -1
- package/dist/graph/{stateDiagram-v2-FJ4FJNEA-BXUSPWDK.js → stateDiagram-v2-FJ4FJNEA-4M5WZORG.js} +1 -1
- package/dist/graph/swimlanes-UMQ2AFYF-O4W6U4RO.js +1 -0
- package/dist/graph/swimlanesDiagram-OMPLPG4O-HZAKM45N.js +8 -0
- package/dist/graph/{timeline-definition-SEUHKTQE-ZQSMIVAS.js → timeline-definition-SEUHKTQE-IHISQ4Q7.js} +1 -1
- package/dist/graph/{treeView-D4JQ5SDB-42S7U73N.js → treeView-D4JQ5SDB-EVGY4VYS.js} +1 -1
- package/dist/graph/{treemap-SAJKECNS-RUBYQ7XF.js → treemap-SAJKECNS-LN3SMFRX.js} +1 -1
- package/dist/graph/{usecaseDiagram-AFA6YXN4-57RDRYXF.js → usecaseDiagram-AFA6YXN4-B645A3J6.js} +1 -1
- package/dist/graph/{vennDiagram-NNMJR3RB-5C3LVAV6.js → vennDiagram-NNMJR3RB-K3HWMON6.js} +1 -1
- package/dist/graph/{wardley-7MLQ67FV-NV5HXTTC.js → wardley-7MLQ67FV-RRWOELC6.js} +1 -1
- package/dist/graph/{wardleyDiagram-S7YFUSEH-6D5BKXHM.js → wardleyDiagram-S7YFUSEH-DMMWKJEK.js} +1 -1
- package/dist/graph/{xychartDiagram-GGNKY7IX-6ET3ZM67.js → xychartDiagram-GGNKY7IX-K6MUQVXR.js} +1 -1
- package/dist/install.sh +68 -0
- package/dist/plugins.global.js +62 -62
- package/dist/{viewer → server}/assets.d.ts +2 -0
- package/dist/server/assets.js +7 -0
- package/dist/{viewer → server}/build-plugins.js +4 -4
- package/dist/{viewer → server}/build.d.ts +2 -1
- package/dist/{viewer → server}/build.js +31 -15
- package/dist/{cli.js → server/cli.js} +223 -56
- package/dist/server/editor-tools.d.ts +1 -0
- package/dist/server/editor-tools.js +1 -0
- package/dist/{viewer → server}/extension-pack.js +2 -2
- package/dist/{viewer → server}/extensions.d.ts +1 -1
- package/dist/{viewer → server}/extensions.js +3 -3
- package/dist/server/git-diff.d.ts +10 -0
- package/dist/{viewer → server}/git-diff.js +45 -10
- package/dist/server/git-origin.d.ts +4 -0
- package/dist/server/git-origin.js +103 -0
- package/dist/server/git.d.ts +9 -0
- package/dist/{viewer → server}/git.js +50 -6
- package/dist/server/history.d.ts +14 -0
- package/dist/server/history.js +205 -0
- package/dist/{viewer → server}/hmr.d.ts +0 -22
- package/dist/server/hmr.js +168 -0
- package/dist/server/index.d.ts +17 -0
- package/dist/{index.js → server/index.js} +16 -16
- package/dist/{viewer → server}/ja-lint.d.ts +1 -1
- package/dist/{viewer → server}/languages.d.ts +1 -1
- package/dist/{viewer → server}/languages.js +3 -3
- package/dist/{mcp.d.ts → server/mcp.d.ts} +2 -2
- package/dist/{mcp.js → server/mcp.js} +60 -21
- package/dist/{viewer → server}/plugin-config.d.ts +2 -2
- package/dist/{viewer → server}/plugin-config.js +2 -2
- package/dist/{plugins → server/plugins}/local-storage.d.ts +1 -1
- package/dist/{plugins → server/plugins}/local-storage.js +1 -1
- package/dist/{plugins → server/plugins}/runtime.d.ts +4 -4
- package/dist/{plugins → server/plugins}/runtime.js +4 -4
- package/dist/{viewer → server}/plugins.d.ts +3 -3
- package/dist/{viewer → server}/plugins.js +14 -13
- package/dist/server/resource-library.d.ts +1 -0
- package/dist/server/resource-library.js +1 -0
- package/dist/server/self.d.ts +5 -0
- package/dist/server/self.js +98 -0
- package/dist/server/serve.d.ts +61 -0
- package/dist/server/serve.js +503 -0
- package/dist/server/static-client.d.ts +4 -0
- package/dist/server/static-client.js +117 -0
- package/dist/server/workspace-server.d.ts +16 -0
- package/dist/server/workspace-server.js +266 -0
- package/dist/{viewer → server}/workspace.d.ts +6 -1
- package/dist/{viewer → server}/workspace.js +46 -0
- package/dist/subformats.global.js +92 -6
- package/dist/ui.global.js +85 -72
- package/dist/workspace/client.d.ts +13 -0
- package/dist/workspace/client.js +114 -0
- package/dist/{viewer → workspace}/code-file.d.ts +1 -1
- package/dist/{viewer → workspace}/code-file.js +7 -7
- package/dist/workspace/connection.d.ts +27 -0
- package/dist/workspace/connection.js +38 -0
- package/dist/{viewer → workspace}/editor-tools.d.ts +7 -1
- package/dist/{viewer → workspace}/editor-tools.js +12 -9
- package/dist/{viewer → workspace}/git-types.d.ts +7 -0
- package/dist/workspace/github.d.ts +4 -0
- package/dist/workspace/github.js +99 -0
- package/dist/workspace/history.d.ts +46 -0
- package/dist/workspace/history.js +86 -0
- package/dist/workspace/protocol.d.ts +38 -0
- package/dist/workspace/protocol.js +20 -0
- package/dist/workspace/resource-download.d.ts +1 -0
- package/dist/workspace/resource-download.js +8 -0
- package/dist/workspace/server.d.ts +9 -0
- package/dist/workspace/server.js +48 -0
- package/dist/{viewer → workspace}/site-icon.js +9 -10
- package/dist/{viewer → workspace}/site-title.js +6 -7
- package/dist/{viewer → workspace}/textfile.d.ts +1 -1
- package/dist/{viewer → workspace}/textfile.js +5 -5
- package/dist/workspace-worker.global.js +2859 -0
- package/package.json +43 -21
- package/dist/compiler/manifest.js +0 -37
- package/dist/compiler/serialize.d.ts +0 -3
- package/dist/compiler/serialize.js +0 -16
- package/dist/core/icons.js +0 -5
- package/dist/graph/chunk-3RNHDNP5.js +0 -1
- package/dist/graph/chunk-5UUEAHTN.js +0 -1
- package/dist/graph/chunk-6T55RVVR.js +0 -1
- package/dist/graph/elk-XV6XMXQE-AZ4HLCWI.js +0 -27
- package/dist/graph/flowDiagram-MALGAFMO-2R7EYAQI.js +0 -1
- package/dist/graph/infoDiagram-KBXO4MBG-7EHX2GQG.js +0 -2
- package/dist/graph/swimlanes-UMQ2AFYF-LDD74Q2S.js +0 -1
- package/dist/graph/swimlanesDiagram-OMPLPG4O-ZYULLJSU.js +0 -8
- package/dist/index.d.ts +0 -17
- package/dist/viewer/assets.js +0 -3
- package/dist/viewer/figure-preview.d.ts +0 -4
- package/dist/viewer/git-diff.d.ts +0 -6
- package/dist/viewer/git.d.ts +0 -5
- package/dist/viewer/hmr.js +0 -341
- package/dist/viewer/serve.d.ts +0 -216
- /package/dist/{compiler → engine/compiler}/asset-references.d.ts +0 -0
- /package/dist/{compiler → engine/compiler}/asset-references.js +0 -0
- /package/dist/{compiler → engine/compiler}/bundle-urls.d.ts +0 -0
- /package/dist/{compiler → engine/compiler}/check-types.d.ts +0 -0
- /package/dist/{compiler → engine/compiler}/check-types.js +0 -0
- /package/dist/{compiler → engine/compiler}/check.d.ts +0 -0
- /package/dist/{compiler → engine/compiler}/code-blocks.d.ts +0 -0
- /package/dist/{compiler → engine/compiler}/code-languages.d.ts +0 -0
- /package/dist/{compiler → engine/compiler}/config.d.ts +0 -0
- /package/dist/{compiler → engine/compiler}/drawio.d.ts +0 -0
- /package/dist/{compiler → engine/compiler}/drawio.js +0 -0
- /package/dist/{compiler → engine/compiler}/dxf.d.ts +0 -0
- /package/dist/{compiler → engine/compiler}/export.d.ts +0 -0
- /package/dist/{compiler → engine/compiler}/figures.d.ts +0 -0
- /package/dist/{compiler → engine/compiler}/files.d.ts +0 -0
- /package/dist/{compiler → engine/compiler}/fonts.d.ts +0 -0
- /package/dist/{compiler → engine/compiler}/format.d.ts +0 -0
- /package/dist/{compiler → engine/compiler}/format.js +0 -0
- /package/dist/{compiler → engine/compiler}/from-mdast.d.ts +0 -0
- /package/dist/{compiler → engine/compiler}/language-codes.d.ts +0 -0
- /package/dist/{compiler → engine/compiler}/language-codes.js +0 -0
- /package/dist/{compiler → engine/compiler}/locales.d.ts +0 -0
- /package/dist/{compiler → engine/compiler}/public-file.d.ts +0 -0
- /package/dist/{compiler → engine/compiler}/public-file.js +0 -0
- /package/dist/{compiler → engine/compiler}/subformat-schema.d.ts +0 -0
- /package/dist/{compiler → engine/compiler}/terms.d.ts +0 -0
- /package/dist/{compiler → engine/compiler}/terms.js +0 -0
- /package/dist/{compiler → engine/compiler}/textfile-remote.d.ts +0 -0
- /package/dist/{compiler → engine/compiler}/textfile.d.ts +0 -0
- /package/dist/{compiler → engine/compiler}/theme-variants.d.ts +0 -0
- /package/dist/{compiler → engine/compiler}/zip.d.ts +0 -0
- /package/dist/{core → engine/core}/blocks.js +0 -0
- /package/dist/{core → engine/core}/code-file.d.ts +0 -0
- /package/dist/{core → engine/core}/code-file.js +0 -0
- /package/dist/{core → engine/core}/code-grammars.d.ts +0 -0
- /package/dist/{core → engine/core}/code-grammars.js +0 -0
- /package/dist/{core → engine/core}/content-types.js +0 -0
- /package/dist/{core → engine/core}/escape-html.d.ts +0 -0
- /package/dist/{core → engine/core}/escape-html.js +0 -0
- /package/dist/{core → engine/core}/extension-package.d.ts +0 -0
- /package/dist/{core → engine/core}/extension-package.js +0 -0
- /package/dist/{core → engine/core}/figure-frame.d.ts +0 -0
- /package/dist/{core → engine/core}/figure-frame.js +0 -0
- /package/dist/{core → engine/core}/file-embed.d.ts +0 -0
- /package/dist/{core → engine/core}/file-embed.js +0 -0
- /package/dist/{core → engine/core}/files.d.ts +0 -0
- /package/dist/{core → engine/core}/files.js +0 -0
- /package/dist/{core → engine/core}/graph-common.d.ts +0 -0
- /package/dist/{core → engine/core}/graph-common.js +0 -0
- /package/dist/{core → engine/core}/graph.d.ts +0 -0
- /package/dist/{core → engine/core}/graph.js +0 -0
- /package/dist/{core → engine/core}/inline.d.ts +0 -0
- /package/dist/{core → engine/core}/inline.js +0 -0
- /package/dist/{core → engine/core}/json-tools.d.ts +0 -0
- /package/dist/{core → engine/core}/json-tools.js +0 -0
- /package/dist/{core → engine/core}/language.d.ts +0 -0
- /package/dist/{core → engine/core}/language.js +0 -0
- /package/dist/{core → engine/core}/languages/ja.d.ts +0 -0
- /package/dist/{core → engine/core}/languages/ja.js +0 -0
- /package/dist/{core → engine/core}/markdown.d.ts +0 -0
- /package/dist/{core → engine/core}/markdown.js +0 -0
- /package/dist/{core → engine/core}/previewers.d.ts +0 -0
- /package/dist/{core → engine/core}/previewers.js +0 -0
- /package/dist/{core → engine/core}/schema-comments.d.ts +0 -0
- /package/dist/{core → engine/core}/schema-comments.js +0 -0
- /package/dist/{core → engine/core}/schema-fields.d.ts +0 -0
- /package/dist/{core → engine/core}/schema-fields.js +0 -0
- /package/dist/{core → engine/core}/schema-graph.d.ts +0 -0
- /package/dist/{core → engine/core}/schema-graph.js +0 -0
- /package/dist/{core → engine/core}/subformat-record.d.ts +0 -0
- /package/dist/{core → engine/core}/subformat-record.js +0 -0
- /package/dist/{core → engine/core}/term-reference.d.ts +0 -0
- /package/dist/{core → engine/core}/term-reference.js +0 -0
- /package/dist/{core → engine/core}/textfile.d.ts +0 -0
- /package/dist/{core → engine/core}/textfile.js +0 -0
- /package/dist/{core → engine/core}/theme-variants.d.ts +0 -0
- /package/dist/{core → engine/core}/theme-variants.js +0 -0
- /package/dist/{core → engine/core}/workspace.d.ts +0 -0
- /package/dist/{core → engine/core}/workspace.js +0 -0
- /package/dist/{viewer → frontend}/bundle-network.d.ts +0 -0
- /package/dist/{viewer → frontend}/bundle-network.js +0 -0
- /package/dist/{core → frontend}/flow-base-css.generated.d.ts +0 -0
- /package/dist/{core → frontend}/flow-base-css.generated.js +0 -0
- /package/dist/{core → frontend}/flow-css.d.ts +0 -0
- /package/dist/{core → frontend}/flow-css.js +0 -0
- /package/dist/{viewer → frontend}/font-picker.js +0 -0
- /package/dist/{viewer → frontend}/font-settings.js +0 -0
- /package/dist/{viewer → frontend}/i18n.d.ts +0 -0
- /package/dist/{viewer → frontend}/i18n.js +0 -0
- /package/dist/{viewer → frontend}/language-picker.d.ts +0 -0
- /package/dist/{viewer → frontend}/lazy-preview.d.ts +0 -0
- /package/dist/{viewer → frontend}/lazy-preview.js +0 -0
- /package/dist/{viewer → frontend}/nav-focus.d.ts +0 -0
- /package/dist/{viewer → frontend}/nav-update.d.ts +0 -0
- /package/dist/{viewer → frontend}/nav-update.js +0 -0
- /package/dist/{viewer → frontend}/plugin-blocks.d.ts +0 -0
- /package/dist/{viewer → frontend}/plugin-style.d.ts +0 -0
- /package/dist/{viewer → frontend}/plugin-style.js +0 -0
- /package/dist/{viewer → frontend}/plugin-view.d.ts +0 -0
- /package/dist/{viewer → frontend}/plugin-view.js +0 -0
- /package/dist/{viewer → frontend}/resize.d.ts +0 -0
- /package/dist/{core → frontend}/schema-graph-mount.d.ts +0 -0
- /package/dist/{core → frontend}/schema-graph-mount.js +0 -0
- /package/dist/{core → frontend}/table-ui.d.ts +0 -0
- /package/dist/{core → frontend}/table-ui.js +0 -0
- /package/dist/{core → frontend}/terms-ui.d.ts +0 -0
- /package/dist/{core → frontend}/terms-ui.js +0 -0
- /package/dist/{viewer → frontend}/theme-picker.d.ts +0 -0
- /package/dist/{viewer → frontend}/theme-picker.js +0 -0
- /package/dist/{core → frontend}/toc-ui.d.ts +0 -0
- /package/dist/{core → frontend}/toc-ui.js +0 -0
- /package/dist/{core → frontend}/video-ui.d.ts +0 -0
- /package/dist/{core → frontend}/video-ui.js +0 -0
- /package/dist/graph/{chunk-GYT4IYBZ.js → chunk-RJFVWYCA.js} +0 -0
- /package/dist/{viewer → server}/build-plugins.d.ts +0 -0
- /package/dist/{cli.d.ts → server/cli.d.ts} +0 -0
- /package/dist/{viewer → server}/extension-pack.d.ts +0 -0
- /package/dist/{viewer → server}/fonts/LICENSE.txt +0 -0
- /package/dist/{viewer → server}/fonts/udev-gothic-regular.woff2 +0 -0
- /package/dist/{viewer → server}/fonts.d.ts +0 -0
- /package/dist/{viewer → server}/fonts.js +0 -0
- /package/dist/{viewer → server}/ja-lint.js +0 -0
- /package/dist/{viewer → workspace}/git-types.js +0 -0
- /package/dist/{viewer → workspace}/site-icon.d.ts +0 -0
- /package/dist/{viewer → workspace}/site-title.d.ts +0 -0
package/dist/viewer/hmr.js
DELETED
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
// HMR for the dev server (shared by preview / edit). Funnels changes into a single SSE stream
|
|
2
|
-
// (`/api/hmr`), by source:
|
|
3
|
-
// data side (content/*.md, dooc.yaml, figures/*) = picked up by this module's watcher;
|
|
4
|
-
// preview swaps only the main body + nav (keeping scroll). edit likewise does a partial
|
|
5
|
-
// update of just the body + nav (no reload; keeps CodeMirror cursor/scroll/undo and
|
|
6
|
-
// unsaved content) — only on pages where edit-client.ts registered `onContent`
|
|
7
|
-
// (unregistered, e.g. the new page, reloads).
|
|
8
|
-
// client bundle side (src/viewer/edit-client.ts, src/core/*.tsx = bundle sources of the schema
|
|
9
|
-
// graph interaction layer `/assets/graph.js`) = not imported by the server (esbuild
|
|
10
|
-
// bundles them on demand), so tsx watch doesn't react → the data-side watcher picks
|
|
11
|
-
// them up as "client" and triggers a reload.
|
|
12
|
-
// server side (all other src/*.ts) = tsx watch restarts the whole process, so not watched.
|
|
13
|
-
// The client notices the swap from the bootId difference in `hello` on reconnect and
|
|
14
|
-
// reloads.
|
|
15
|
-
// All content events reach the editor, which compares disk contents with its saved base.
|
|
16
|
-
import { existsSync, readFileSync, realpathSync, unwatchFile, watch, watchFile } from "node:fs";
|
|
17
|
-
import { dirname, join, resolve } from "node:path";
|
|
18
|
-
import { managedFile } from "../compiler/files.js";
|
|
19
|
-
import { textfilePath } from "../compiler/textfile.js";
|
|
20
|
-
import { MANIFEST_FILE } from "../core/content-metadata.js";
|
|
21
|
-
import { isRemoteTextfile } from "../core/textfile.js";
|
|
22
|
-
import { prebuilt } from "./assets.js";
|
|
23
|
-
import { updateNav } from "./nav-update.js";
|
|
24
|
-
import { gitHeadFile } from "./workspace.js";
|
|
25
|
-
/** SSE endpoint. SoT for the server route and the client script's connection target. */
|
|
26
|
-
export const HMR_PATH = "/api/hmr";
|
|
27
|
-
/**
|
|
28
|
-
* Changed path (repo-root relative) → HMR kind. undefined for out-of-scope files
|
|
29
|
-
* (dist output, temp files etc.).
|
|
30
|
-
*/
|
|
31
|
-
export const classifyChange = (rel) => {
|
|
32
|
-
const p = rel.replace(/\\/g, "/");
|
|
33
|
-
// edit's client bundle itself (src/viewer/edit-client.ts) and src/core/*.tsx
|
|
34
|
-
// (schema-graph-*.tsx = bundle sources of `/assets/graph.js`) aren't imported by the server
|
|
35
|
-
// (esbuild bundles them per request), so tsx watch can't pick them up → explicitly classify
|
|
36
|
-
// them as "client" here to trigger a reload. Other src/*.ts (the server itself) stay out of
|
|
37
|
-
// scope (= tsx watch restart → the client picks it up from the bootId difference in hello).
|
|
38
|
-
if (p === "src/viewer/edit-client.ts" ||
|
|
39
|
-
p === "src/viewer/files-ui.ts" ||
|
|
40
|
-
p === "src/viewer/resource-library-ui.ts" ||
|
|
41
|
-
p === "src/viewer/subformats-ui.ts" ||
|
|
42
|
-
p === "src/viewer/edit-code-file.ts" ||
|
|
43
|
-
p === "src/core/code-file.ts" ||
|
|
44
|
-
p === "src/core/files.ts" ||
|
|
45
|
-
p === "src/viewer/edit-schema-completion.ts" ||
|
|
46
|
-
p === "src/viewer/edit-textfile.ts" ||
|
|
47
|
-
p === "src/viewer/file-references.ts" ||
|
|
48
|
-
p === "src/core/markdown.ts" ||
|
|
49
|
-
p === "src/core/mermaid-mount.ts" ||
|
|
50
|
-
p === "src/core/textfile.ts" ||
|
|
51
|
-
p === "src/core/file-embed.ts" ||
|
|
52
|
-
p === "src/core/term-reference.ts" ||
|
|
53
|
-
p === "src/core/taxonomy.ts" ||
|
|
54
|
-
p === "src/core/previewers.ts" ||
|
|
55
|
-
p === "src/viewer/edit-file-preview.ts" ||
|
|
56
|
-
p === "src/viewer/edit-conflict.ts" ||
|
|
57
|
-
p === "src/viewer/edit-code-highlight.ts" ||
|
|
58
|
-
p === "src/viewer/edit-git-diff.ts" ||
|
|
59
|
-
p === "src/viewer/code-tokens.ts" ||
|
|
60
|
-
p === "src/viewer/code-worker.ts" ||
|
|
61
|
-
p === "src/viewer/i18n.ts" ||
|
|
62
|
-
p === "src/viewer/language-picker.ts" ||
|
|
63
|
-
p === "src/viewer/theme-picker.ts" ||
|
|
64
|
-
p === "src/viewer/ui-client.ts" ||
|
|
65
|
-
p === "src/viewer/extensions-ui.ts" ||
|
|
66
|
-
p === "src/viewer/extensions-store.ts" ||
|
|
67
|
-
p === "src/viewer/plugins-ui.ts" ||
|
|
68
|
-
p === "src/viewer/plugin-view.ts" ||
|
|
69
|
-
p === "src/viewer/plugin-resize.ts" ||
|
|
70
|
-
p === "src/viewer/preview-update.ts" ||
|
|
71
|
-
p === "src/plugins/view.ts" ||
|
|
72
|
-
p === "src/viewer/nav-focus.ts" ||
|
|
73
|
-
p === "src/viewer/nav-update.ts" ||
|
|
74
|
-
p === "src/viewer/code-highlight.ts" ||
|
|
75
|
-
(p.startsWith("src/viewer/locales/") && p.endsWith(".json")) ||
|
|
76
|
-
(p.startsWith("src/core/") && p.endsWith(".tsx"))) {
|
|
77
|
-
return "client";
|
|
78
|
-
}
|
|
79
|
-
// content = body text (.md) and dooc.yaml (= SoT for hierarchy and ordering).
|
|
80
|
-
if (p === MANIFEST_FILE || (p.startsWith("content/") && p.endsWith(".md"))) {
|
|
81
|
-
return "content";
|
|
82
|
-
}
|
|
83
|
-
if (p.startsWith("locales/") && p.endsWith(".md"))
|
|
84
|
-
return "content";
|
|
85
|
-
if (p.startsWith("figures/") && /\.(svg|html|png|webp|jpe?g)$/.test(p)) {
|
|
86
|
-
return "content";
|
|
87
|
-
}
|
|
88
|
-
// icons/<id>.svg (doc icons) is data side too = partial update.
|
|
89
|
-
if (p.startsWith("icons/") && p.endsWith(".svg")) {
|
|
90
|
-
return "content";
|
|
91
|
-
}
|
|
92
|
-
return undefined;
|
|
93
|
-
};
|
|
94
|
-
/** One SSE frame (in the format the client's EventSource reads). */
|
|
95
|
-
export const sseFrame = (event, data) => `event: ${event}\ndata: ${JSON.stringify(data)}\n\n`;
|
|
96
|
-
export const createHmrHub = (bootId) => {
|
|
97
|
-
const clients = new Set();
|
|
98
|
-
// Ping periodically to clean up dead sockets, even on localhost without a proxy.
|
|
99
|
-
const ping = setInterval(() => {
|
|
100
|
-
for (const res of clients) {
|
|
101
|
-
res.write(": ping\n\n");
|
|
102
|
-
}
|
|
103
|
-
}, 20_000);
|
|
104
|
-
ping.unref();
|
|
105
|
-
return {
|
|
106
|
-
handle: (res) => {
|
|
107
|
-
res.writeHead(200, {
|
|
108
|
-
"content-type": "text/event-stream; charset=utf-8",
|
|
109
|
-
"cache-control": "no-cache, no-transform",
|
|
110
|
-
connection: "keep-alive",
|
|
111
|
-
});
|
|
112
|
-
// Make clients reconnect quickly right after a restart (tsx watch); the default
|
|
113
|
-
// reconnect interval is browser-dependent.
|
|
114
|
-
res.write("retry: 300\n\n");
|
|
115
|
-
res.write(sseFrame("hello", { bootId }));
|
|
116
|
-
clients.add(res);
|
|
117
|
-
res.on("close", () => clients.delete(res));
|
|
118
|
-
},
|
|
119
|
-
broadcast: (kind, files) => {
|
|
120
|
-
const frame = sseFrame("change", { kind, files });
|
|
121
|
-
for (const res of clients) {
|
|
122
|
-
res.write(frame);
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
};
|
|
126
|
-
};
|
|
127
|
-
/**
|
|
128
|
-
* Folders to watch. The docs-side ones are relative to docsRoot, src to pkgRoot (only files that
|
|
129
|
-
* classifyChange marks "client" count).
|
|
130
|
-
*/
|
|
131
|
-
/**
|
|
132
|
-
* Notifies data-side changes batched by kind. An editor save fires multiple events
|
|
133
|
-
* (rename + change), so debounce collapses them into one. Referenced text files can be added
|
|
134
|
-
* as drafts are compiled; close() releases all watchers.
|
|
135
|
-
*/
|
|
136
|
-
export const watchProject = (docsRoot, pkgRoot, onChange, debounceMs = 60) => {
|
|
137
|
-
const pending = new Map();
|
|
138
|
-
let timer;
|
|
139
|
-
const flush = () => {
|
|
140
|
-
timer = undefined;
|
|
141
|
-
const byKind = new Map();
|
|
142
|
-
for (const [file, kind] of pending) {
|
|
143
|
-
byKind.set(kind, [...(byKind.get(kind) ?? []), file]);
|
|
144
|
-
}
|
|
145
|
-
pending.clear();
|
|
146
|
-
for (const [kind, files] of byKind) {
|
|
147
|
-
onChange(kind, files);
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
const note = (rel, kind = classifyChange(rel)) => {
|
|
151
|
-
if (!kind) {
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
pending.set(rel, kind);
|
|
155
|
-
if (!timer) {
|
|
156
|
-
timer = setTimeout(flush, debounceMs);
|
|
157
|
-
timer.unref();
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
// Skip missing folders (checkouts / test fixtures without optional asset folders) to avoid ENOENT.
|
|
161
|
-
const dirs = [["src", join(pkgRoot, "src")]];
|
|
162
|
-
const watchers = dirs
|
|
163
|
-
.filter(([, abs]) => !prebuilt && existsSync(abs))
|
|
164
|
-
.map(([dir, abs]) => watch(abs, { recursive: true }, (_event, name) => {
|
|
165
|
-
if (name) {
|
|
166
|
-
note(`${dir}/${String(name)}`);
|
|
167
|
-
}
|
|
168
|
-
}));
|
|
169
|
-
// Watch the directory so atomic replacements of the manifest are detected too.
|
|
170
|
-
watchers.push(watch(docsRoot, { recursive: true }, (_event, name) => {
|
|
171
|
-
if (!name)
|
|
172
|
-
return;
|
|
173
|
-
const path = String(name).replaceAll("\\", "/");
|
|
174
|
-
if (path === MANIFEST_FILE ||
|
|
175
|
-
path.startsWith("locales/") ||
|
|
176
|
-
/(^|\/)\.gitignore$/.test(path))
|
|
177
|
-
note(path, "content");
|
|
178
|
-
else if (managedFile(path) && !path.startsWith("src/") && !/\.(tmp|swp)$/.test(path))
|
|
179
|
-
note(path, "content");
|
|
180
|
-
}));
|
|
181
|
-
const textfiles = new Map();
|
|
182
|
-
const headFile = gitHeadFile(docsRoot);
|
|
183
|
-
if (headFile) {
|
|
184
|
-
for (let parent = realpathSync(docsRoot); !existsSync(join(parent, ".git"));) {
|
|
185
|
-
const next = dirname(parent);
|
|
186
|
-
if (next === parent)
|
|
187
|
-
break;
|
|
188
|
-
parent = next;
|
|
189
|
-
watchers.push(watch(parent, (_event, name) => {
|
|
190
|
-
if (String(name) === ".gitignore")
|
|
191
|
-
note(".gitignore", "content");
|
|
192
|
-
}));
|
|
193
|
-
}
|
|
194
|
-
const directory = dirname(headFile);
|
|
195
|
-
const common = join(directory, "commondir");
|
|
196
|
-
const directories = new Set([
|
|
197
|
-
directory,
|
|
198
|
-
existsSync(common)
|
|
199
|
-
? resolve(directory, readFileSync(common, "utf8").trim())
|
|
200
|
-
: directory,
|
|
201
|
-
]);
|
|
202
|
-
for (const path of directories)
|
|
203
|
-
watchers.push(watch(path, { recursive: true }, (_event, name) => {
|
|
204
|
-
const file = String(name).replaceAll("\\", "/");
|
|
205
|
-
if (file === "HEAD" || file === "packed-refs" || file.startsWith("refs/"))
|
|
206
|
-
note(".git/HEAD", "content");
|
|
207
|
-
else if (file === "index" || file === "info/exclude" || file === "config")
|
|
208
|
-
note(`.git/${file}`, "content");
|
|
209
|
-
}));
|
|
210
|
-
}
|
|
211
|
-
// shortcut: keep encountered file watches until shutdown; prune if sessions collect many removed references.
|
|
212
|
-
const watchTextfiles = (files) => {
|
|
213
|
-
for (const file of files) {
|
|
214
|
-
if (isRemoteTextfile(file))
|
|
215
|
-
continue;
|
|
216
|
-
try {
|
|
217
|
-
textfilePath(docsRoot, file);
|
|
218
|
-
}
|
|
219
|
-
catch {
|
|
220
|
-
continue;
|
|
221
|
-
}
|
|
222
|
-
const path = resolve(docsRoot, file);
|
|
223
|
-
if (textfiles.has(path))
|
|
224
|
-
continue;
|
|
225
|
-
const changed = () => note(file.replace(/^(\.\/)+/, ""), "content");
|
|
226
|
-
// Poll referenced paths so atomic saves, deletion and creation are all detected.
|
|
227
|
-
watchFile(path, { persistent: false, interval: 200 }, changed);
|
|
228
|
-
textfiles.set(path, changed);
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
const close = () => {
|
|
232
|
-
if (timer) {
|
|
233
|
-
clearTimeout(timer);
|
|
234
|
-
timer = undefined;
|
|
235
|
-
}
|
|
236
|
-
for (const w of watchers) {
|
|
237
|
-
w.close();
|
|
238
|
-
}
|
|
239
|
-
for (const [path, listener] of textfiles)
|
|
240
|
-
unwatchFile(path, listener);
|
|
241
|
-
};
|
|
242
|
-
return { close, watchTextfiles };
|
|
243
|
-
};
|
|
244
|
-
/**
|
|
245
|
-
* Client script injected into page(). How changes are applied depends on mode:
|
|
246
|
-
* preview = swap the main <main> + nav (keeping scroll / sidebar state).
|
|
247
|
-
* edit = delegate content changes to `window.__docsHmr.onContent` (registered by
|
|
248
|
-
* edit-client.ts) without reloading (pages without it, e.g. the new page, reload).
|
|
249
|
-
* Changes to the client bundle (`src/viewer/edit-client.ts` / `src/core/*.tsx`) and
|
|
250
|
-
* a bootId difference in `hello` (= the server itself restarted) reload. While there
|
|
251
|
-
* are unsaved (dirty) changes, the reload is downgraded to a badge and waits.
|
|
252
|
-
*/
|
|
253
|
-
export const hmrClientScript = (mode) => `
|
|
254
|
-
(() => {
|
|
255
|
-
const MODE = ${JSON.stringify(mode)};
|
|
256
|
-
let bootId = null;
|
|
257
|
-
let isDirty = false;
|
|
258
|
-
let pendingReload = false;
|
|
259
|
-
|
|
260
|
-
let badge = null;
|
|
261
|
-
const showBadge = () => {
|
|
262
|
-
pendingReload = true;
|
|
263
|
-
if (badge) return;
|
|
264
|
-
badge = document.createElement("button");
|
|
265
|
-
badge.type = "button";
|
|
266
|
-
badge.textContent = "Updated externally — click to reload";
|
|
267
|
-
badge.style.cssText = "position:fixed;right:14px;bottom:14px;z-index:9999;font:inherit;font-size:12px;padding:6px 10px;border-radius:6px;cursor:pointer;border:1px solid var(--doc-border-2,#c4ccd8);background:var(--doc-panel,#fff);color:var(--doc-fg-2,#2a3140);box-shadow:0 2px 8px rgba(0,0,0,.18)";
|
|
268
|
-
badge.addEventListener("click", () => location.reload());
|
|
269
|
-
document.body.appendChild(badge);
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
// Never silently discard unsaved changes (downgrade to a badge and wait).
|
|
273
|
-
const reload = () => { if (isDirty) { showBadge(); return; } location.reload(); };
|
|
274
|
-
|
|
275
|
-
// preview partial swap — refetch the same URL and replace only the contents of <main> and nav.
|
|
276
|
-
const swap = async () => {
|
|
277
|
-
let next;
|
|
278
|
-
try {
|
|
279
|
-
const res = await fetch(location.href, { headers: { "cache-control": "no-cache" } });
|
|
280
|
-
if (!res.ok) { reload(); return; }
|
|
281
|
-
next = new DOMParser().parseFromString(await res.text(), "text/html");
|
|
282
|
-
} catch { return; } // e.g. server restarting — picked up by the next hello
|
|
283
|
-
const main = document.querySelector("main");
|
|
284
|
-
const nextMain = next.querySelector("main");
|
|
285
|
-
if (!main || !nextMain) { reload(); return; }
|
|
286
|
-
const y = main.scrollTop;
|
|
287
|
-
document.title = next.title;
|
|
288
|
-
const title = document.getElementById("site-title");
|
|
289
|
-
const nextTitle = next.getElementById("site-title");
|
|
290
|
-
if (title && nextTitle) {
|
|
291
|
-
title.textContent = nextTitle.textContent;
|
|
292
|
-
title.title = nextTitle.title;
|
|
293
|
-
}
|
|
294
|
-
const logo = document.getElementById("site-icon");
|
|
295
|
-
const nextLogo = next.getElementById("site-icon");
|
|
296
|
-
if (logo && nextLogo) logo.replaceWith(nextLogo);
|
|
297
|
-
const updatePreview = window.__docsHmr && window.__docsHmr.updatePreview;
|
|
298
|
-
if (updatePreview) updatePreview(main, nextMain);
|
|
299
|
-
else main.innerHTML = nextMain.innerHTML;
|
|
300
|
-
const nav = document.getElementById("nav-groups");
|
|
301
|
-
const nextNav = next.getElementById("nav-groups");
|
|
302
|
-
if (nav && nextNav) {
|
|
303
|
-
(${updateNav.toString()})(nav, nextNav.innerHTML);
|
|
304
|
-
if (window.__docsNavRestore) window.__docsNavRestore();
|
|
305
|
-
}
|
|
306
|
-
main.scrollTo(0, y);
|
|
307
|
-
};
|
|
308
|
-
|
|
309
|
-
// Notification hooks for the edit client (src/viewer/edit-client.ts). edit-client.ts may run
|
|
310
|
-
// first (bootScripts sit near the top of body, this script at the end of body), so merge
|
|
311
|
-
// instead of clobbering what's already there (an earlier onContent registration).
|
|
312
|
-
window.__docsHmr = Object.assign(window.__docsHmr || {}, {
|
|
313
|
-
setDirty: (v) => {
|
|
314
|
-
isDirty = Boolean(v);
|
|
315
|
-
if (!isDirty && pendingReload) location.reload();
|
|
316
|
-
},
|
|
317
|
-
});
|
|
318
|
-
|
|
319
|
-
const es = new EventSource(${JSON.stringify(HMR_PATH)});
|
|
320
|
-
es.addEventListener("hello", (ev) => {
|
|
321
|
-
const id = JSON.parse(ev.data).bootId;
|
|
322
|
-
if (bootId === null) { bootId = id; return; }
|
|
323
|
-
// bootId changed = the server itself (src/*.ts) was replaced and restarted.
|
|
324
|
-
if (id !== bootId) reload();
|
|
325
|
-
});
|
|
326
|
-
es.addEventListener("change", (ev) => {
|
|
327
|
-
const { kind, files } = JSON.parse(ev.data);
|
|
328
|
-
if (MODE === "preview" && kind === "content") { void swap(); return; }
|
|
329
|
-
if (kind === "content") {
|
|
330
|
-
const onContent = window.__docsHmr && window.__docsHmr.onContent;
|
|
331
|
-
// If registered, leave it to the in-place update and don't reload (the editor swaps
|
|
332
|
-
// body/nav itself). Unregistered (pages without an editor, e.g. the empty 0-doc page)
|
|
333
|
-
// → reload.
|
|
334
|
-
if (onContent) { onContent(files); return; }
|
|
335
|
-
reload();
|
|
336
|
-
return;
|
|
337
|
-
}
|
|
338
|
-
// Client bundle (src/viewer/edit-client.ts / src/core/*.tsx) changed — reload to refetch it.
|
|
339
|
-
reload();
|
|
340
|
-
});
|
|
341
|
-
})();`;
|
package/dist/viewer/serve.d.ts
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import { type ProjectFont } from "../compiler/fonts.js";
|
|
2
|
-
import type { LanguageRegistration } from "shiki/core";
|
|
3
|
-
import { type Compiled } from "../compiler/compile.js";
|
|
4
|
-
import { assembleDoc } from "../compiler/ops.js";
|
|
5
|
-
import { type Block, type TocEntry } from "../core/blocks.js";
|
|
6
|
-
import type { CompiledDoc, TermEntry } from "../core/content-types.js";
|
|
7
|
-
import { type RenderCtx } from "../core/html.js";
|
|
8
|
-
import { type LanguageAdapter } from "../core/language.js";
|
|
9
|
-
import { type PreviewSettings } from "../core/previewers.js";
|
|
10
|
-
import { type Frontmatter } from "../core/taxonomy.js";
|
|
11
|
-
import { type WorkspaceSource } from "../core/workspace.js";
|
|
12
|
-
import { type FilePreviewResults } from "./file-references.js";
|
|
13
|
-
import { type SiteLanguages } from "./languages.js";
|
|
14
|
-
import { type ViewerRuntime } from "./plugin-config.js";
|
|
15
|
-
export type ServeMode = "preview" | "edit";
|
|
16
|
-
/**
|
|
17
|
-
* One doc in the viewer = a view model combining the compiler's CompiledDoc (rendering) and
|
|
18
|
-
* DocSource (extra info for editing).
|
|
19
|
-
* file is `<id>.md` (= same shape as the save API's file parameter; CompiledDoc.file minus the
|
|
20
|
-
* content/ prefix).
|
|
21
|
-
*/
|
|
22
|
-
export interface Entry {
|
|
23
|
-
id: string;
|
|
24
|
-
subformat?: CompiledDoc["subformat"];
|
|
25
|
-
translatedLanguages?: string[];
|
|
26
|
-
/** Parent doc id (omitted = top level). */
|
|
27
|
-
parent?: string;
|
|
28
|
-
file: string;
|
|
29
|
-
sourceFile?: string;
|
|
30
|
-
iconFile?: string;
|
|
31
|
-
frontmatter: Frontmatter | undefined;
|
|
32
|
-
/** Resolved language (front-matter `lang`, else the site default). */
|
|
33
|
-
lang: string;
|
|
34
|
-
/** Source md without the front-matter (the editor's initial value). */
|
|
35
|
-
body: string;
|
|
36
|
-
blocks: Block[];
|
|
37
|
-
toc: TocEntry[];
|
|
38
|
-
/**
|
|
39
|
-
* For the editor's correspondence display: body-relative start line of each block (same
|
|
40
|
-
* index as blocks).
|
|
41
|
-
*/
|
|
42
|
-
blockLines: number[];
|
|
43
|
-
/**
|
|
44
|
-
* Full source on disk (including front-matter). Used as the base for the editor's
|
|
45
|
-
* external-change detection.
|
|
46
|
-
*/
|
|
47
|
-
raw: string;
|
|
48
|
-
/** Validation errors for this doc (the compiler's DocSource.errors). */
|
|
49
|
-
errors: string[];
|
|
50
|
-
/** Icon for the sidebar (full svg, 1:1). */
|
|
51
|
-
icon?: string;
|
|
52
|
-
/** Names of the figures the body references (Resources' "used in"). */
|
|
53
|
-
figureRefs?: string[];
|
|
54
|
-
termRefs?: string[];
|
|
55
|
-
terms?: TermEntry[];
|
|
56
|
-
referencedFiles?: string[];
|
|
57
|
-
}
|
|
58
|
-
export interface Site {
|
|
59
|
-
sourceBase?: string;
|
|
60
|
-
subformats?: Compiled["subformats"];
|
|
61
|
-
fonts?: readonly ProjectFont[];
|
|
62
|
-
workspace?: WorkspaceSource;
|
|
63
|
-
filePaths?: readonly string[];
|
|
64
|
-
previews?: PreviewSettings;
|
|
65
|
-
title?: string;
|
|
66
|
-
icon?: string;
|
|
67
|
-
iconVariants?: Record<string, string>;
|
|
68
|
-
codeLanguages?: string[];
|
|
69
|
-
codeGrammars?: LanguageRegistration[];
|
|
70
|
-
contentLanguage?: string;
|
|
71
|
-
/** Display order (pre-order traversal of the manifest). */
|
|
72
|
-
entries: Entry[];
|
|
73
|
-
ctx: RenderCtx;
|
|
74
|
-
/** Errors not tied to a doc (the compiler's siteErrors). Shown on every page. */
|
|
75
|
-
errors: string[];
|
|
76
|
-
/** Language adapters (docs.config.mjs + built-ins); each doc renders with its own. */
|
|
77
|
-
languages: readonly LanguageAdapter[];
|
|
78
|
-
/** Site default language. */
|
|
79
|
-
defaultLang: string;
|
|
80
|
-
/** Declared site languages, when the manifest restricts the language picker. */
|
|
81
|
-
contentLanguages?: readonly string[];
|
|
82
|
-
themes?: readonly ("light" | "dark")[];
|
|
83
|
-
}
|
|
84
|
-
/** Compile result → viewer Site (shared by the server's per-request path and one-off publish). */
|
|
85
|
-
export declare const siteFrom: ({ title, icon, iconVariants, docs, terms, figures, sources, siteErrors, defaultLang, previews, contentLanguages, themes, subformats, }: Compiled, languages?: readonly LanguageAdapter[], code?: Pick<SiteLanguages, "codeLanguages" | "codeGrammars">) => Site;
|
|
86
|
-
export declare const filePreviewResults: (entry: Entry, site: Site) => FilePreviewResults;
|
|
87
|
-
/** Renders only the requested doc, not every doc in site.entries. */
|
|
88
|
-
export declare const renderEntryHtml: (site: Site, entry: Entry) => {
|
|
89
|
-
html: string;
|
|
90
|
-
errors: string[];
|
|
91
|
-
};
|
|
92
|
-
/** Compiles + renders one source (its current content on disk) (implements `/api/doc`). */
|
|
93
|
-
export declare const renderDocFile: (site: Site, file: string, raw: string) => {
|
|
94
|
-
gitBase: string | null;
|
|
95
|
-
raw: string;
|
|
96
|
-
frontmatter: Frontmatter | undefined;
|
|
97
|
-
body: string;
|
|
98
|
-
html: string;
|
|
99
|
-
errors: string[];
|
|
100
|
-
toc: TocEntry[];
|
|
101
|
-
blockLines: number[];
|
|
102
|
-
filePreviews: FilePreviewResults;
|
|
103
|
-
previews?: PreviewSettings;
|
|
104
|
-
sourceFile?: string;
|
|
105
|
-
};
|
|
106
|
-
/** Response for `GET /api/doc?file=<id>.md` (status + body). mode === "edit" only. */
|
|
107
|
-
export declare const docQueryResponse: (site: Site, file: unknown) => {
|
|
108
|
-
status: number;
|
|
109
|
-
body: unknown;
|
|
110
|
-
};
|
|
111
|
-
export { assembleDoc };
|
|
112
|
-
/** Client JSON → Frontmatter (keeps supported fields and drops empty optional values). */
|
|
113
|
-
export declare const sanitizeFrontmatter: (v: unknown) => Frontmatter;
|
|
114
|
-
/**
|
|
115
|
-
* Compares the base the editor started from (the disk source the client last read) with the
|
|
116
|
-
* current disk source to tell whether it was rewritten externally (direct edit / git etc.)
|
|
117
|
-
* without the editor knowing.
|
|
118
|
-
* A client that sends no base (no baseRaw) can't be judged, so false (= overwrite).
|
|
119
|
-
*/
|
|
120
|
-
export declare const isExternallyModified: (baseRaw: unknown, currentRaw: string) => boolean;
|
|
121
|
-
/**
|
|
122
|
-
* Validates the write target path — rejects anything other than `<id>.md` (directly under
|
|
123
|
-
* content/), including traversal.
|
|
124
|
-
*/
|
|
125
|
-
export declare const resolveContentFile: (rel: unknown) => {
|
|
126
|
-
id: string;
|
|
127
|
-
name: string;
|
|
128
|
-
abs: string;
|
|
129
|
-
} | undefined;
|
|
130
|
-
export declare const navGroupsHtml: (mode: ServeMode, site: Site, currentId?: string, currentRes?: string) => string;
|
|
131
|
-
export declare const textfilePreviewHtml: (site: Site, file: string, source: string) => string;
|
|
132
|
-
export declare const textfilePreviewErrors: (site: Site, file: string, source: string) => string[];
|
|
133
|
-
export declare const resourcesMain: (site: Site, rest: string) => {
|
|
134
|
-
title: string;
|
|
135
|
-
main: string;
|
|
136
|
-
sourceFile?: string;
|
|
137
|
-
} | undefined;
|
|
138
|
-
/**
|
|
139
|
-
* Turns the whole Site into a single HTML file readable without a server (everything embedded,
|
|
140
|
-
* down to figures / terms / schema graph JS). Each doc is held in a
|
|
141
|
-
* <template> and switched via hash routes.
|
|
142
|
-
*/
|
|
143
|
-
export declare const publishHtml: (site: Site, graphJs: string, title?: string, codeJs?: string, mode?: "static" | "network" | "live", pluginJs?: string, subformatJs?: string) => string;
|
|
144
|
-
/**
|
|
145
|
-
* Boot data for the client (edit-client.ts) — the same shape is passed for the initial render and
|
|
146
|
-
* on doc switch. Insertion happens via the client's in-editor autocomplete (`/` palette), so the
|
|
147
|
-
* candidate data (figures / docs / terms) is passed here, plus blockLines for the correspondence
|
|
148
|
-
* display.
|
|
149
|
-
*/
|
|
150
|
-
export interface EditorBoot {
|
|
151
|
-
gitBase: string | null;
|
|
152
|
-
filePreviews: FilePreviewResults;
|
|
153
|
-
previews?: PreviewSettings;
|
|
154
|
-
siteTitle?: string;
|
|
155
|
-
siteIcon?: string;
|
|
156
|
-
contentLanguage?: string;
|
|
157
|
-
sourceLanguage?: string;
|
|
158
|
-
docLanguage?: string;
|
|
159
|
-
translatedLanguages?: string[];
|
|
160
|
-
/** `<id>.md` (the save API's key). */
|
|
161
|
-
file: string;
|
|
162
|
-
sourceFile?: string;
|
|
163
|
-
/** Resolution key for published URLs. */
|
|
164
|
-
docId: string;
|
|
165
|
-
title: string;
|
|
166
|
-
path: string;
|
|
167
|
-
body: string;
|
|
168
|
-
figures: string[];
|
|
169
|
-
codeLanguages: readonly string[];
|
|
170
|
-
docs: {
|
|
171
|
-
ref: string;
|
|
172
|
-
title: string;
|
|
173
|
-
}[];
|
|
174
|
-
terms: TermEntry[];
|
|
175
|
-
blockLines: number[];
|
|
176
|
-
/** Full source on disk (the base for external-change detection). */
|
|
177
|
-
baseRaw: string;
|
|
178
|
-
/** Data URI of the sidebar icon (null if none). */
|
|
179
|
-
icon: string | null;
|
|
180
|
-
/** Site default language (used for lint when the `lang` field is left empty). */
|
|
181
|
-
defaultLang: string;
|
|
182
|
-
/** Language of the CodeMirror content's browser spellcheck (the doc language's adapter). */
|
|
183
|
-
spellcheckLang: string;
|
|
184
|
-
}
|
|
185
|
-
export declare const languageFieldHtml: (defaultLang: string, language?: string, translatedLanguages?: readonly string[], declaredLanguages?: readonly string[]) => string;
|
|
186
|
-
export declare const editorBoot: (entry: Entry, site: Site) => EditorBoot;
|
|
187
|
-
/**
|
|
188
|
-
* Response for `GET /api/page?route=/<ancestor/.../docId>` (status + body). mode === "edit" only.
|
|
189
|
-
* The diff for doing edit's doc switch via client-side navigation (= keep scroll position /
|
|
190
|
-
* search term / open state without rebuilding the sidebar DOM); it returns only what the client
|
|
191
|
-
* replaces: main html + the panel's variable parts (file name / front-matter fields) + the new
|
|
192
|
-
* doc's boot.
|
|
193
|
-
* File views replace the central workspace while retaining the current editor.
|
|
194
|
-
*/
|
|
195
|
-
export declare const pageDataResponse: (site: Site, path: unknown) => {
|
|
196
|
-
status: number;
|
|
197
|
-
body: unknown;
|
|
198
|
-
};
|
|
199
|
-
/** Cache of entry name → { js, etag }. clear() is called on HMR "client" notifications
|
|
200
|
-
* (changes to edit-client.ts / the schema graph interaction layer) (= invalidation is
|
|
201
|
-
* startServer's job; this is just the container). */
|
|
202
|
-
export interface BundleCache {
|
|
203
|
-
get: (entry: string, build: () => Promise<string>) => Promise<{
|
|
204
|
-
js: string;
|
|
205
|
-
etag: string;
|
|
206
|
-
}>;
|
|
207
|
-
clear: () => void;
|
|
208
|
-
}
|
|
209
|
-
export declare const createBundleCache: () => BundleCache;
|
|
210
|
-
/** Minified client bundle shared by local viewing and published HTML. */
|
|
211
|
-
export declare const bundleClient: (entry: string) => Promise<string>;
|
|
212
|
-
export declare const startServer: (mode: ServeMode, port?: number, pluginModule?: string, startup?: {
|
|
213
|
-
file?: string;
|
|
214
|
-
data?: string;
|
|
215
|
-
login?: string;
|
|
216
|
-
}) => Promise<ViewerRuntime>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|