react-cheminfo 0.64.0 → 0.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +282 -0
- package/lib/card/core/cardAddress.d.ts +70 -0
- package/lib/card/core/cardAddress.d.ts.map +1 -0
- package/lib/card/core/cardAddress.js +59 -0
- package/lib/card/core/cardAddress.js.map +1 -0
- package/lib/card/core/cardPageUrl.d.ts +49 -0
- package/lib/card/core/cardPageUrl.d.ts.map +1 -0
- package/lib/card/core/cardPageUrl.js +59 -0
- package/lib/card/core/cardPageUrl.js.map +1 -0
- package/lib/card/core/index.d.ts +7 -0
- package/lib/card/core/index.d.ts.map +1 -0
- package/lib/card/core/index.js +4 -0
- package/lib/card/core/index.js.map +1 -0
- package/lib/card/core/panelRoom.d.ts +40 -0
- package/lib/card/core/panelRoom.d.ts.map +1 -0
- package/lib/card/core/panelRoom.js +40 -0
- package/lib/card/core/panelRoom.js.map +1 -0
- package/lib/card/ui/CardDetailsButton.d.ts +38 -0
- package/lib/card/ui/CardDetailsButton.d.ts.map +1 -0
- package/lib/card/ui/CardDetailsButton.js +50 -0
- package/lib/card/ui/CardDetailsButton.js.map +1 -0
- package/lib/card/ui/CardFigure.d.ts +51 -0
- package/lib/card/ui/CardFigure.d.ts.map +1 -0
- package/lib/card/ui/CardFigure.js +27 -0
- package/lib/card/ui/CardFigure.js.map +1 -0
- package/lib/card/ui/CardFrame.d.ts +30 -0
- package/lib/card/ui/CardFrame.d.ts.map +1 -0
- package/lib/card/ui/CardFrame.js +20 -0
- package/lib/card/ui/CardFrame.js.map +1 -0
- package/lib/card/ui/CopyTableButton.d.ts +37 -0
- package/lib/card/ui/CopyTableButton.d.ts.map +1 -0
- package/lib/card/ui/CopyTableButton.js +19 -0
- package/lib/card/ui/CopyTableButton.js.map +1 -0
- package/lib/card/ui/cardTooltip.d.ts +14 -0
- package/lib/card/ui/cardTooltip.d.ts.map +1 -0
- package/lib/card/ui/cardTooltip.js +15 -0
- package/lib/card/ui/cardTooltip.js.map +1 -0
- package/lib/card/ui/embed.d.ts +15 -0
- package/lib/card/ui/embed.d.ts.map +1 -0
- package/lib/card/ui/embed.js +24 -0
- package/lib/card/ui/embed.js.map +1 -0
- package/lib/card/ui/fitCardToFrame.d.ts +31 -0
- package/lib/card/ui/fitCardToFrame.d.ts.map +1 -0
- package/lib/card/ui/fitCardToFrame.js +66 -0
- package/lib/card/ui/fitCardToFrame.js.map +1 -0
- package/lib/card/ui/holdRoomForPanels.d.ts +16 -0
- package/lib/card/ui/holdRoomForPanels.d.ts.map +1 -0
- package/lib/card/ui/holdRoomForPanels.js +76 -0
- package/lib/card/ui/holdRoomForPanels.js.map +1 -0
- package/lib/card/ui/index.d.ts +11 -0
- package/lib/card/ui/index.d.ts.map +1 -0
- package/lib/card/ui/index.js +7 -0
- package/lib/card/ui/index.js.map +1 -0
- package/lib/card/ui/openPanels.d.ts +25 -0
- package/lib/card/ui/openPanels.d.ts.map +1 -0
- package/lib/card/ui/openPanels.js +85 -0
- package/lib/card/ui/openPanels.js.map +1 -0
- package/lib/card.d.ts +13 -0
- package/lib/card.d.ts.map +1 -0
- package/lib/card.js +13 -0
- package/lib/card.js.map +1 -0
- package/lib/conformers.d.ts +1 -0
- package/lib/conformers.d.ts.map +1 -1
- package/lib/conformers.js +1 -0
- package/lib/conformers.js.map +1 -1
- package/lib/core.d.ts +4 -0
- package/lib/core.d.ts.map +1 -1
- package/lib/core.js +5 -0
- package/lib/core.js.map +1 -1
- package/lib/fetch/core/apiError.d.ts +56 -0
- package/lib/fetch/core/apiError.d.ts.map +1 -0
- package/lib/fetch/core/apiError.js +43 -0
- package/lib/fetch/core/apiError.js.map +1 -0
- package/lib/fetch/core/fetchJson.d.ts +47 -0
- package/lib/fetch/core/fetchJson.d.ts.map +1 -0
- package/lib/fetch/core/fetchJson.js +109 -0
- package/lib/fetch/core/fetchJson.js.map +1 -0
- package/lib/fetch/core/index.d.ts +5 -0
- package/lib/fetch/core/index.d.ts.map +1 -0
- package/lib/fetch/core/index.js +3 -0
- package/lib/fetch/core/index.js.map +1 -0
- package/lib/formula/core/formulaText.d.ts +46 -0
- package/lib/formula/core/formulaText.d.ts.map +1 -0
- package/lib/formula/core/formulaText.js +74 -0
- package/lib/formula/core/formulaText.js.map +1 -0
- package/lib/formula/core/index.d.ts +6 -0
- package/lib/formula/core/index.d.ts.map +1 -0
- package/lib/formula/core/index.js +4 -0
- package/lib/formula/core/index.js.map +1 -0
- package/lib/formula/core/normalizeFormula.d.ts +22 -0
- package/lib/formula/core/normalizeFormula.d.ts.map +1 -0
- package/lib/formula/core/normalizeFormula.js +46 -0
- package/lib/formula/core/normalizeFormula.js.map +1 -0
- package/lib/formula/core/readFormula.d.ts +73 -0
- package/lib/formula/core/readFormula.d.ts.map +1 -0
- package/lib/formula/core/readFormula.js +132 -0
- package/lib/formula/core/readFormula.js.map +1 -0
- package/lib/formula/ui/CopyableFormula.d.ts +31 -0
- package/lib/formula/ui/CopyableFormula.d.ts.map +1 -0
- package/lib/formula/ui/CopyableFormula.js +19 -0
- package/lib/formula/ui/CopyableFormula.js.map +1 -0
- package/lib/formula/ui/FormulaInput.d.ts +29 -0
- package/lib/formula/ui/FormulaInput.d.ts.map +1 -0
- package/lib/formula/ui/FormulaInput.js +16 -0
- package/lib/formula/ui/FormulaInput.js.map +1 -0
- package/lib/formula/ui/QuestionFormula.d.ts +14 -0
- package/lib/formula/ui/QuestionFormula.d.ts.map +1 -0
- package/lib/formula/ui/QuestionFormula.js +13 -0
- package/lib/formula/ui/QuestionFormula.js.map +1 -0
- package/lib/formula/ui/index.d.ts +7 -0
- package/lib/formula/ui/index.d.ts.map +1 -0
- package/lib/formula/ui/index.js +4 -0
- package/lib/formula/ui/index.js.map +1 -0
- package/lib/formula.d.ts +11 -0
- package/lib/formula.d.ts.map +1 -0
- package/lib/formula.js +11 -0
- package/lib/formula.js.map +1 -0
- package/lib/hooks/ui/index.d.ts +1 -0
- package/lib/hooks/ui/index.d.ts.map +1 -1
- package/lib/hooks/ui/index.js.map +1 -1
- package/lib/hooks/ui/keyTargets.d.ts +4 -2
- package/lib/hooks/ui/keyTargets.d.ts.map +1 -1
- package/lib/hooks/ui/keyTargets.js +5 -3
- package/lib/hooks/ui/keyTargets.js.map +1 -1
- package/lib/hooks/ui/useAsync.d.ts +20 -5
- package/lib/hooks/ui/useAsync.d.ts.map +1 -1
- package/lib/hooks/ui/useAsync.js +29 -14
- package/lib/hooks/ui/useAsync.js.map +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
- package/lib/locales/de.json +37 -0
- package/lib/locales/en.json +37 -0
- package/lib/locales/es.json +37 -0
- package/lib/locales/fr.json +37 -0
- package/lib/locales/it.json +37 -0
- package/lib/molecule3d/core/highlight.d.ts.map +1 -1
- package/lib/molecule3d/core/highlight.js +2 -8
- package/lib/molecule3d/core/highlight.js.map +1 -1
- package/lib/molecule3d/core/index.d.ts +1 -1
- package/lib/molecule3d/core/index.d.ts.map +1 -1
- package/lib/molecule3d/core/index.js +1 -1
- package/lib/molecule3d/core/index.js.map +1 -1
- package/lib/molecule3d/core/measurement.d.ts +17 -0
- package/lib/molecule3d/core/measurement.d.ts.map +1 -1
- package/lib/molecule3d/core/measurement.js +43 -0
- package/lib/molecule3d/core/measurement.js.map +1 -1
- package/lib/molecule3d/ui/drawScene.d.ts +4 -2
- package/lib/molecule3d/ui/drawScene.d.ts.map +1 -1
- package/lib/molecule3d/ui/drawScene.js +1 -1
- package/lib/molecule3d/ui/drawScene.js.map +1 -1
- package/lib/molecule3d/ui/moleculeViewer3DProps.d.ts +3 -1
- package/lib/molecule3d/ui/moleculeViewer3DProps.d.ts.map +1 -1
- package/lib/molecule3d/ui/sceneDrawer.d.ts +47 -0
- package/lib/molecule3d/ui/sceneDrawer.d.ts.map +1 -0
- package/lib/molecule3d/ui/sceneDrawer.js +103 -0
- package/lib/molecule3d/ui/sceneDrawer.js.map +1 -0
- package/lib/molecule3d/ui/useMoleculeScene.d.ts +2 -1
- package/lib/molecule3d/ui/useMoleculeScene.d.ts.map +1 -1
- package/lib/molecule3d/ui/useMoleculeScene.js +13 -22
- package/lib/molecule3d/ui/useMoleculeScene.js.map +1 -1
- package/lib/molecule3d/ui/useSharedCamera.d.ts +1 -3
- package/lib/molecule3d/ui/useSharedCamera.d.ts.map +1 -1
- package/lib/molecule3d/ui/useSharedCamera.js.map +1 -1
- package/lib/moleculesClient/core/index.d.ts +5 -0
- package/lib/moleculesClient/core/index.d.ts.map +1 -0
- package/lib/moleculesClient/core/index.js +3 -0
- package/lib/moleculesClient/core/index.js.map +1 -0
- package/lib/moleculesClient/core/moleculesClient.d.ts +12 -0
- package/lib/moleculesClient/core/moleculesClient.d.ts.map +1 -0
- package/lib/moleculesClient/core/moleculesClient.js +105 -0
- package/lib/moleculesClient/core/moleculesClient.js.map +1 -0
- package/lib/moleculesClient/core/moleculesClientApi.d.ts +100 -0
- package/lib/moleculesClient/core/moleculesClientApi.d.ts.map +1 -0
- package/lib/moleculesClient/core/moleculesClientApi.js +20 -0
- package/lib/moleculesClient/core/moleculesClientApi.js.map +1 -0
- package/lib/moleculesClient/core/moleculesTypes.d.ts +154 -0
- package/lib/moleculesClient/core/moleculesTypes.d.ts.map +1 -0
- package/lib/moleculesClient/core/moleculesTypes.js +2 -0
- package/lib/moleculesClient/core/moleculesTypes.js.map +1 -0
- package/lib/moleculesClient/core/requestRetry.d.ts +50 -0
- package/lib/moleculesClient/core/requestRetry.d.ts.map +1 -0
- package/lib/moleculesClient/core/requestRetry.js +108 -0
- package/lib/moleculesClient/core/requestRetry.js.map +1 -0
- package/lib/molstar/core/camera.d.ts +2 -1
- package/lib/molstar/core/camera.d.ts.map +1 -1
- package/lib/molstar/core/camera.js +3 -2
- package/lib/molstar/core/camera.js.map +1 -1
- package/lib/molstar/core/framing.d.ts +102 -0
- package/lib/molstar/core/framing.d.ts.map +1 -0
- package/lib/molstar/core/framing.js +120 -0
- package/lib/molstar/core/framing.js.map +1 -0
- package/lib/molstar/core/hover.d.ts +16 -0
- package/lib/molstar/core/hover.d.ts.map +1 -1
- package/lib/molstar/core/hover.js +14 -0
- package/lib/molstar/core/hover.js.map +1 -1
- package/lib/molstar/core/index.d.ts +4 -1
- package/lib/molstar/core/index.d.ts.map +1 -1
- package/lib/molstar/core/index.js +2 -1
- package/lib/molstar/core/index.js.map +1 -1
- package/lib/pedagogy/core/answers.d.ts +46 -0
- package/lib/pedagogy/core/answers.d.ts.map +1 -0
- package/lib/pedagogy/core/answers.js +77 -0
- package/lib/pedagogy/core/answers.js.map +1 -0
- package/lib/pedagogy/core/attempts.d.ts +86 -0
- package/lib/pedagogy/core/attempts.d.ts.map +1 -0
- package/lib/pedagogy/core/attempts.js +117 -0
- package/lib/pedagogy/core/attempts.js.map +1 -0
- package/lib/pedagogy/core/index.d.ts +8 -0
- package/lib/pedagogy/core/index.d.ts.map +1 -1
- package/lib/pedagogy/core/index.js +4 -0
- package/lib/pedagogy/core/index.js.map +1 -1
- package/lib/pedagogy/core/progressController.d.ts +64 -0
- package/lib/pedagogy/core/progressController.d.ts.map +1 -0
- package/lib/pedagogy/core/progressController.js +56 -0
- package/lib/pedagogy/core/progressController.js.map +1 -0
- package/lib/pedagogy/core/seed.d.ts +96 -0
- package/lib/pedagogy/core/seed.d.ts.map +1 -0
- package/lib/pedagogy/core/seed.js +128 -0
- package/lib/pedagogy/core/seed.js.map +1 -0
- package/lib/pedagogy/core/series.d.ts +77 -0
- package/lib/pedagogy/core/series.d.ts.map +1 -0
- package/lib/pedagogy/core/series.js +10 -0
- package/lib/pedagogy/core/series.js.map +1 -0
- package/lib/pedagogy/ui/AnswerFields.d.ts +21 -0
- package/lib/pedagogy/ui/AnswerFields.d.ts.map +1 -0
- package/lib/pedagogy/ui/AnswerFields.js +24 -0
- package/lib/pedagogy/ui/AnswerFields.js.map +1 -0
- package/lib/pedagogy/ui/ExerciseList.d.ts +82 -0
- package/lib/pedagogy/ui/ExerciseList.d.ts.map +1 -0
- package/lib/pedagogy/ui/ExerciseList.js +53 -0
- package/lib/pedagogy/ui/ExerciseList.js.map +1 -0
- package/lib/pedagogy/ui/ExerciseSeries.d.ts +95 -0
- package/lib/pedagogy/ui/ExerciseSeries.d.ts.map +1 -0
- package/lib/pedagogy/ui/ExerciseSeries.js +74 -0
- package/lib/pedagogy/ui/ExerciseSeries.js.map +1 -0
- package/lib/pedagogy/ui/QuestionCard.d.ts +64 -0
- package/lib/pedagogy/ui/QuestionCard.d.ts.map +1 -0
- package/lib/pedagogy/ui/QuestionCard.js +73 -0
- package/lib/pedagogy/ui/QuestionCard.js.map +1 -0
- package/lib/pedagogy/ui/index.d.ts +10 -0
- package/lib/pedagogy/ui/index.d.ts.map +1 -1
- package/lib/pedagogy/ui/index.js +6 -0
- package/lib/pedagogy/ui/index.js.map +1 -1
- package/lib/pedagogy/ui/seriesCounts.d.ts +17 -0
- package/lib/pedagogy/ui/seriesCounts.d.ts.map +1 -0
- package/lib/pedagogy/ui/seriesCounts.js +27 -0
- package/lib/pedagogy/ui/seriesCounts.js.map +1 -0
- package/lib/pedagogy/ui/seriesParts.d.ts +55 -0
- package/lib/pedagogy/ui/seriesParts.d.ts.map +1 -0
- package/lib/pedagogy/ui/seriesParts.js +38 -0
- package/lib/pedagogy/ui/seriesParts.js.map +1 -0
- package/lib/pedagogy/ui/useAttemptRecords.d.ts +10 -0
- package/lib/pedagogy/ui/useAttemptRecords.d.ts.map +1 -0
- package/lib/pedagogy/ui/useAttemptRecords.js +11 -0
- package/lib/pedagogy/ui/useAttemptRecords.js.map +1 -0
- package/lib/periodic/ui/PeriodicTable.d.ts.map +1 -1
- package/lib/periodic/ui/PeriodicTable.js +6 -3
- package/lib/periodic/ui/PeriodicTable.js.map +1 -1
- package/lib/property/core/copyableText.d.ts +14 -0
- package/lib/property/core/copyableText.d.ts.map +1 -0
- package/lib/property/core/copyableText.js +21 -0
- package/lib/property/core/copyableText.js.map +1 -0
- package/lib/property/core/index.d.ts +2 -0
- package/lib/property/core/index.d.ts.map +1 -0
- package/lib/property/core/index.js +2 -0
- package/lib/property/core/index.js.map +1 -0
- package/lib/property/ui/PropertyTable.d.ts +43 -0
- package/lib/property/ui/PropertyTable.d.ts.map +1 -0
- package/lib/property/ui/PropertyTable.js +19 -0
- package/lib/property/ui/PropertyTable.js.map +1 -0
- package/lib/property/ui/index.d.ts +3 -0
- package/lib/property/ui/index.d.ts.map +1 -0
- package/lib/property/ui/index.js +2 -0
- package/lib/property/ui/index.js.map +1 -0
- package/lib/router/core/history.d.ts +24 -3
- package/lib/router/core/history.d.ts.map +1 -1
- package/lib/router/core/history.js +55 -7
- package/lib/router/core/history.js.map +1 -1
- package/lib/router/core/index.d.ts +3 -3
- package/lib/router/core/index.d.ts.map +1 -1
- package/lib/router/core/index.js +2 -2
- package/lib/router/core/index.js.map +1 -1
- package/lib/router/core/languageRoute.d.ts +61 -0
- package/lib/router/core/languageRoute.d.ts.map +1 -0
- package/lib/router/core/languageRoute.js +96 -0
- package/lib/router/core/languageRoute.js.map +1 -0
- package/lib/router/core/siteAddresses.d.ts +23 -0
- package/lib/router/core/siteAddresses.d.ts.map +1 -1
- package/lib/router/core/siteAddresses.js +26 -0
- package/lib/router/core/siteAddresses.js.map +1 -1
- package/lib/router/core/tabRouter.d.ts +2 -108
- package/lib/router/core/tabRouter.d.ts.map +1 -1
- package/lib/router/core/tabRouter.js +38 -5
- package/lib/router/core/tabRouter.js.map +1 -1
- package/lib/router/core/tabRouterTypes.d.ts +154 -0
- package/lib/router/core/tabRouterTypes.d.ts.map +1 -0
- package/lib/router/core/tabRouterTypes.js +2 -0
- package/lib/router/core/tabRouterTypes.js.map +1 -0
- package/lib/seo/core/fitDescription.d.ts +40 -0
- package/lib/seo/core/fitDescription.d.ts.map +1 -0
- package/lib/seo/core/fitDescription.js +45 -0
- package/lib/seo/core/fitDescription.js.map +1 -0
- package/lib/seo/core/index.d.ts +7 -0
- package/lib/seo/core/index.d.ts.map +1 -1
- package/lib/seo/core/index.js +4 -0
- package/lib/seo/core/index.js.map +1 -1
- package/lib/seo/core/limits.d.ts +24 -0
- package/lib/seo/core/limits.d.ts.map +1 -0
- package/lib/seo/core/limits.js +24 -0
- package/lib/seo/core/limits.js.map +1 -0
- package/lib/seo/core/pageContent.d.ts +25 -0
- package/lib/seo/core/pageContent.d.ts.map +1 -0
- package/lib/seo/core/pageContent.js +25 -0
- package/lib/seo/core/pageContent.js.map +1 -0
- package/lib/seo/core/plainDescription.d.ts.map +1 -1
- package/lib/seo/core/plainDescription.js +3 -2
- package/lib/seo/core/plainDescription.js.map +1 -1
- package/lib/seo/core/routeProblems.d.ts.map +1 -1
- package/lib/seo/core/routeProblems.js +1 -6
- package/lib/seo/core/routeProblems.js.map +1 -1
- package/lib/seo/core/routeTable.d.ts +31 -0
- package/lib/seo/core/routeTable.d.ts.map +1 -0
- package/lib/seo/core/routeTable.js +96 -0
- package/lib/seo/core/routeTable.js.map +1 -0
- package/lib/seo/vite/index.d.ts +2 -0
- package/lib/seo/vite/index.d.ts.map +1 -1
- package/lib/seo/vite/index.js +1 -0
- package/lib/seo/vite/index.js.map +1 -1
- package/lib/seo/vite/prerender.d.ts +10 -0
- package/lib/seo/vite/prerender.d.ts.map +1 -1
- package/lib/seo/vite/prerender.js +12 -1
- package/lib/seo/vite/prerender.js.map +1 -1
- package/lib/seo/vite/routeTable.d.ts +40 -0
- package/lib/seo/vite/routeTable.d.ts.map +1 -0
- package/lib/seo/vite/routeTable.js +44 -0
- package/lib/seo/vite/routeTable.js.map +1 -0
- package/lib/server/answerAddresses.d.ts +51 -0
- package/lib/server/answerAddresses.d.ts.map +1 -0
- package/lib/server/answerAddresses.js +72 -0
- package/lib/server/answerAddresses.js.map +1 -0
- package/lib/server/cardMeta.d.ts +57 -0
- package/lib/server/cardMeta.d.ts.map +1 -0
- package/lib/server/cardMeta.js +52 -0
- package/lib/server/cardMeta.js.map +1 -0
- package/lib/server/config.d.ts +72 -0
- package/lib/server/config.d.ts.map +1 -0
- package/lib/server/config.js +67 -0
- package/lib/server/config.js.map +1 -0
- package/lib/server/envNumber.d.ts +35 -0
- package/lib/server/envNumber.d.ts.map +1 -0
- package/lib/server/envNumber.js +42 -0
- package/lib/server/envNumber.js.map +1 -0
- package/lib/server/healthRoute.d.ts +26 -0
- package/lib/server/healthRoute.d.ts.map +1 -0
- package/lib/server/healthRoute.js +22 -0
- package/lib/server/healthRoute.js.map +1 -0
- package/lib/server/listenSite.d.ts +38 -0
- package/lib/server/listenSite.d.ts.map +1 -0
- package/lib/server/listenSite.js +60 -0
- package/lib/server/listenSite.js.map +1 -0
- package/lib/server/mcpServer.d.ts +8 -0
- package/lib/server/mcpServer.d.ts.map +1 -0
- package/lib/server/mcpServer.js +11 -0
- package/lib/server/mcpServer.js.map +1 -0
- package/lib/server/repositoryVersion.d.ts +16 -0
- package/lib/server/repositoryVersion.d.ts.map +1 -0
- package/lib/server/repositoryVersion.js +33 -0
- package/lib/server/repositoryVersion.js.map +1 -0
- package/lib/server/routeOptions.d.ts +23 -0
- package/lib/server/routeOptions.d.ts.map +1 -0
- package/lib/server/routeOptions.js +20 -0
- package/lib/server/routeOptions.js.map +1 -0
- package/lib/server/routeTable.d.ts +14 -0
- package/lib/server/routeTable.d.ts.map +1 -0
- package/lib/server/routeTable.js +32 -0
- package/lib/server/routeTable.js.map +1 -0
- package/lib/server/siteView.d.ts +29 -0
- package/lib/server/siteView.d.ts.map +1 -0
- package/lib/server/siteView.js +21 -0
- package/lib/server/siteView.js.map +1 -0
- package/lib/server/spaPages.d.ts +32 -0
- package/lib/server/spaPages.d.ts.map +1 -0
- package/lib/server/spaPages.js +126 -0
- package/lib/server/spaPages.js.map +1 -0
- package/lib/server/spaSite.d.ts +30 -0
- package/lib/server/spaSite.d.ts.map +1 -0
- package/lib/server/spaSite.js +170 -0
- package/lib/server/spaSite.js.map +1 -0
- package/lib/server/spaSiteOptions.d.ts +126 -0
- package/lib/server/spaSiteOptions.d.ts.map +1 -0
- package/lib/server/spaSiteOptions.js +2 -0
- package/lib/server/spaSiteOptions.js.map +1 -0
- package/lib/server/staticSite.d.ts +9 -0
- package/lib/server/staticSite.d.ts.map +1 -1
- package/lib/server/staticSite.js +41 -19
- package/lib/server/staticSite.js.map +1 -1
- package/lib/server/toolSiteServer.d.ts +77 -0
- package/lib/server/toolSiteServer.d.ts.map +1 -0
- package/lib/server/toolSiteServer.js +58 -0
- package/lib/server/toolSiteServer.js.map +1 -0
- package/lib/server/trustProxy.d.ts +20 -0
- package/lib/server/trustProxy.d.ts.map +1 -0
- package/lib/server/trustProxy.js +32 -0
- package/lib/server/trustProxy.js.map +1 -0
- package/lib/server/types.d.ts +13 -0
- package/lib/server/types.d.ts.map +1 -0
- package/lib/server/types.js +2 -0
- package/lib/server/types.js.map +1 -0
- package/lib/server.d.ts +22 -0
- package/lib/server.d.ts.map +1 -1
- package/lib/server.js +12 -0
- package/lib/server.js.map +1 -1
- package/lib/share/core/config.d.ts +18 -0
- package/lib/share/core/config.d.ts.map +1 -1
- package/lib/share/core/config.js +33 -2
- package/lib/share/core/config.js.map +1 -1
- package/lib/share/core/index.d.ts +3 -1
- package/lib/share/core/index.d.ts.map +1 -1
- package/lib/share/core/index.js +2 -1
- package/lib/share/core/index.js.map +1 -1
- package/lib/share/core/keySetParam.d.ts +40 -0
- package/lib/share/core/keySetParam.d.ts.map +1 -0
- package/lib/share/core/keySetParam.js +60 -0
- package/lib/share/core/keySetParam.js.map +1 -0
- package/lib/share/core/vocabulary.d.ts +8 -0
- package/lib/share/core/vocabulary.d.ts.map +1 -1
- package/lib/shell/ui/ShareControl.d.ts +75 -0
- package/lib/shell/ui/ShareControl.d.ts.map +1 -0
- package/lib/shell/ui/ShareControl.js +40 -0
- package/lib/shell/ui/ShareControl.js.map +1 -0
- package/lib/shell/ui/ShellFrame.d.ts +14 -0
- package/lib/shell/ui/ShellFrame.d.ts.map +1 -0
- package/lib/shell/ui/ShellFrame.js +45 -0
- package/lib/shell/ui/ShellFrame.js.map +1 -0
- package/lib/shell/ui/SiteShell.d.ts +251 -0
- package/lib/shell/ui/SiteShell.d.ts.map +1 -0
- package/lib/shell/ui/SiteShell.js +39 -0
- package/lib/shell/ui/SiteShell.js.map +1 -0
- package/lib/shell/ui/index.d.ts +5 -0
- package/lib/shell/ui/index.d.ts.map +1 -0
- package/lib/shell/ui/index.js +3 -0
- package/lib/shell/ui/index.js.map +1 -0
- package/lib/state/core/index.d.ts +1 -0
- package/lib/state/core/index.d.ts.map +1 -1
- package/lib/state/core/index.js.map +1 -1
- package/lib/state/core/legacyEntries.d.ts +30 -0
- package/lib/state/core/legacyEntries.d.ts.map +1 -0
- package/lib/state/core/legacyEntries.js +51 -0
- package/lib/state/core/legacyEntries.js.map +1 -0
- package/lib/state/core/persistBucket.d.ts +26 -2
- package/lib/state/core/persistBucket.d.ts.map +1 -1
- package/lib/state/core/persistBucket.js +26 -9
- package/lib/state/core/persistBucket.js.map +1 -1
- package/lib/state/core/persistSignalBucket.d.ts +26 -0
- package/lib/state/core/persistSignalBucket.d.ts.map +1 -1
- package/lib/state/core/persistSignalBucket.js +31 -0
- package/lib/state/core/persistSignalBucket.js.map +1 -1
- package/lib/state/core/storageEntry.d.ts +15 -0
- package/lib/state/core/storageEntry.d.ts.map +1 -1
- package/lib/state/core/storageEntry.js +33 -0
- package/lib/state/core/storageEntry.js.map +1 -1
- package/lib/structure/ui/StructureExportButton.d.ts +27 -0
- package/lib/structure/ui/StructureExportButton.d.ts.map +1 -0
- package/lib/structure/ui/StructureExportButton.js +21 -0
- package/lib/structure/ui/StructureExportButton.js.map +1 -0
- package/lib/structure/ui/index.d.ts +4 -0
- package/lib/structure/ui/index.d.ts.map +1 -1
- package/lib/structure/ui/index.js +2 -0
- package/lib/structure/ui/index.js.map +1 -1
- package/lib/structure/ui/useStructureDraft.d.ts +32 -0
- package/lib/structure/ui/useStructureDraft.d.ts.map +1 -0
- package/lib/structure/ui/useStructureDraft.js +20 -0
- package/lib/structure/ui/useStructureDraft.js.map +1 -0
- package/lib/ui.d.ts +2 -0
- package/lib/ui.d.ts.map +1 -1
- package/lib/ui.js +2 -0
- package/lib/ui.js.map +1 -1
- package/lib/worker/core/index.d.ts +1 -1
- package/lib/worker/core/index.d.ts.map +1 -1
- package/lib/worker/core/messages.d.ts +4 -2
- package/lib/worker/core/messages.d.ts.map +1 -1
- package/lib/worker/core/messages.js.map +1 -1
- package/lib/worker/core/oclResourcesUrl.d.ts +16 -0
- package/lib/worker/core/oclResourcesUrl.d.ts.map +1 -0
- package/lib/worker/core/oclResourcesUrl.js +19 -0
- package/lib/worker/core/oclResourcesUrl.js.map +1 -0
- package/lib/worker/core/serveWorkerRequests.d.ts +8 -0
- package/lib/worker/core/serveWorkerRequests.d.ts.map +1 -1
- package/lib/worker/core/serveWorkerRequests.js +15 -2
- package/lib/worker/core/serveWorkerRequests.js.map +1 -1
- package/lib/worker/core/workerChannel.d.ts +3 -4
- package/lib/worker/core/workerChannel.d.ts.map +1 -1
- package/lib/worker/core/workerChannel.js +72 -67
- package/lib/worker/core/workerChannel.js.map +1 -1
- package/lib/worker/core/workerChannelParts.d.ts +17 -6
- package/lib/worker/core/workerChannelParts.d.ts.map +1 -1
- package/lib/worker/core/workerChannelParts.js +20 -4
- package/lib/worker/core/workerChannelParts.js.map +1 -1
- package/lib/worker/core/workerChannelTypes.d.ts +46 -2
- package/lib/worker/core/workerChannelTypes.d.ts.map +1 -1
- package/lib/worker/core/workerSlot.d.ts +66 -0
- package/lib/worker/core/workerSlot.d.ts.map +1 -0
- package/lib/worker/core/workerSlot.js +107 -0
- package/lib/worker/core/workerSlot.js.map +1 -0
- package/package.json +16 -1
- package/src/card/core/cardAddress.ts +100 -0
- package/src/card/core/cardPageUrl.ts +97 -0
- package/src/card/core/index.ts +6 -0
- package/src/card/core/panelRoom.ts +66 -0
- package/src/card/ui/CardDetailsButton.tsx +104 -0
- package/src/card/ui/CardFigure.tsx +86 -0
- package/src/card/ui/CardFrame.tsx +46 -0
- package/src/card/ui/CopyTableButton.tsx +81 -0
- package/src/card/ui/cardTooltip.ts +18 -0
- package/src/card/ui/embed.ts +27 -0
- package/src/card/ui/fitCardToFrame.ts +76 -0
- package/src/card/ui/holdRoomForPanels.ts +83 -0
- package/src/card/ui/index.ts +14 -0
- package/src/card/ui/openPanels.ts +106 -0
- package/src/card.ts +13 -0
- package/src/conformers.ts +4 -0
- package/src/core.ts +5 -0
- package/src/fetch/core/apiError.ts +65 -0
- package/src/fetch/core/fetchJson.ts +129 -0
- package/src/fetch/core/index.ts +4 -0
- package/src/formula/core/formulaText.ts +96 -0
- package/src/formula/core/index.ts +20 -0
- package/src/formula/core/normalizeFormula.ts +50 -0
- package/src/formula/core/readFormula.ts +211 -0
- package/src/formula/ui/CopyableFormula.tsx +51 -0
- package/src/formula/ui/FormulaInput.tsx +50 -0
- package/src/formula/ui/QuestionFormula.tsx +20 -0
- package/src/formula/ui/index.ts +6 -0
- package/src/formula.ts +11 -0
- package/src/hooks/ui/index.ts +1 -0
- package/src/hooks/ui/keyTargets.ts +5 -3
- package/src/hooks/ui/useAsync.ts +50 -14
- package/src/locales/de.json +37 -0
- package/src/locales/en.json +37 -0
- package/src/locales/es.json +37 -0
- package/src/locales/fr.json +37 -0
- package/src/locales/it.json +37 -0
- package/src/molecule3d/core/highlight.ts +2 -8
- package/src/molecule3d/core/index.ts +1 -0
- package/src/molecule3d/core/measurement.ts +47 -0
- package/src/molecule3d/ui/drawScene.ts +13 -2
- package/src/molecule3d/ui/moleculeViewer3DProps.ts +3 -1
- package/src/molecule3d/ui/sceneDrawer.ts +132 -0
- package/src/molecule3d/ui/useMoleculeScene.ts +16 -26
- package/src/molecule3d/ui/useSharedCamera.ts +1 -3
- package/src/moleculesClient/core/index.ts +19 -0
- package/src/moleculesClient/core/moleculesClient.ts +175 -0
- package/src/moleculesClient/core/moleculesClientApi.ts +120 -0
- package/src/moleculesClient/core/moleculesTypes.ts +163 -0
- package/src/moleculesClient/core/requestRetry.ts +118 -0
- package/src/molstar/core/camera.ts +3 -2
- package/src/molstar/core/framing.ts +200 -0
- package/src/molstar/core/hover.ts +26 -0
- package/src/molstar/core/index.ts +21 -1
- package/src/pedagogy/core/answers.ts +94 -0
- package/src/pedagogy/core/attempts.ts +205 -0
- package/src/pedagogy/core/index.ts +36 -0
- package/src/pedagogy/core/progressController.ts +116 -0
- package/src/pedagogy/core/seed.ts +177 -0
- package/src/pedagogy/core/series.ts +82 -0
- package/src/pedagogy/ui/AnswerFields.tsx +63 -0
- package/src/pedagogy/ui/ExerciseList.tsx +202 -0
- package/src/pedagogy/ui/ExerciseSeries.tsx +250 -0
- package/src/pedagogy/ui/QuestionCard.tsx +231 -0
- package/src/pedagogy/ui/index.ts +18 -0
- package/src/pedagogy/ui/seriesCounts.ts +34 -0
- package/src/pedagogy/ui/seriesParts.tsx +127 -0
- package/src/pedagogy/ui/useAttemptRecords.ts +16 -0
- package/src/periodic/ui/PeriodicTable.tsx +6 -3
- package/src/property/core/copyableText.ts +20 -0
- package/src/property/core/index.ts +1 -0
- package/src/property/ui/PropertyTable.tsx +83 -0
- package/src/property/ui/index.ts +2 -0
- package/src/router/core/history.ts +61 -7
- package/src/router/core/index.ts +3 -2
- package/src/router/core/languageRoute.ts +136 -0
- package/src/router/core/siteAddresses.ts +38 -0
- package/src/router/core/tabRouter.ts +59 -117
- package/src/router/core/tabRouterTypes.ts +158 -0
- package/src/seo/core/fitDescription.ts +74 -0
- package/src/seo/core/index.ts +17 -0
- package/src/seo/core/limits.ts +27 -0
- package/src/seo/core/pageContent.ts +42 -0
- package/src/seo/core/plainDescription.ts +4 -2
- package/src/seo/core/routeProblems.ts +1 -7
- package/src/seo/core/routeTable.ts +103 -0
- package/src/seo/vite/index.ts +2 -0
- package/src/seo/vite/prerender.ts +26 -1
- package/src/seo/vite/routeTable.ts +79 -0
- package/src/server/answerAddresses.ts +92 -0
- package/src/server/cardMeta.ts +88 -0
- package/src/server/config.ts +125 -0
- package/src/server/envNumber.ts +65 -0
- package/src/server/healthRoute.ts +42 -0
- package/src/server/listenSite.ts +90 -0
- package/src/server/mcpServer.ts +14 -0
- package/src/server/repositoryVersion.ts +33 -0
- package/src/server/routeOptions.ts +26 -0
- package/src/server/routeTable.ts +35 -0
- package/src/server/siteView.ts +42 -0
- package/src/server/spaPages.ts +179 -0
- package/src/server/spaSite.ts +216 -0
- package/src/server/spaSiteOptions.ts +133 -0
- package/src/server/staticSite.ts +65 -35
- package/src/server/toolSiteServer.ts +127 -0
- package/src/server/trustProxy.ts +32 -0
- package/src/server/types.ts +25 -0
- package/src/server.ts +40 -0
- package/src/share/core/config.ts +45 -2
- package/src/share/core/index.ts +4 -0
- package/src/share/core/keySetParam.ts +92 -0
- package/src/share/core/vocabulary.ts +8 -0
- package/src/shell/ui/ShareControl.tsx +150 -0
- package/src/shell/ui/ShellFrame.tsx +180 -0
- package/src/shell/ui/SiteShell.tsx +297 -0
- package/src/shell/ui/index.ts +9 -0
- package/src/state/core/index.ts +1 -0
- package/src/state/core/legacyEntries.ts +76 -0
- package/src/state/core/persistBucket.ts +50 -10
- package/src/state/core/persistSignalBucket.ts +52 -0
- package/src/state/core/storageEntry.ts +32 -0
- package/src/structure/ui/StructureExportButton.tsx +57 -0
- package/src/structure/ui/index.ts +4 -0
- package/src/structure/ui/useStructureDraft.ts +47 -0
- package/src/ui.ts +2 -0
- package/src/worker/core/index.ts +1 -0
- package/src/worker/core/messages.ts +4 -3
- package/src/worker/core/oclResourcesUrl.ts +21 -0
- package/src/worker/core/serveWorkerRequests.ts +30 -2
- package/src/worker/core/workerChannel.ts +74 -74
- package/src/worker/core/workerChannelParts.ts +33 -13
- package/src/worker/core/workerChannelTypes.ts +47 -2
- package/src/worker/core/workerSlot.ts +181 -0
- package/styles/card.css +145 -0
- package/styles/chrome.css +248 -0
package/lib/server/staticSite.js
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
2
|
import { join, relative, resolve, sep } from 'node:path';
|
|
3
|
+
import { joinBasePath, normalizeBasePath } from "../router/core/basePath.js";
|
|
3
4
|
import { injectTrackingScript } from "../seo/core/trackingScript.js";
|
|
5
|
+
import { escapeAttribute } from "../share/core/escape.js";
|
|
6
|
+
import { healthRoute } from "./healthRoute.js";
|
|
7
|
+
import { ALLOW_ORIGIN, BUNDLE_CACHE, HIDDEN, PAGE_CACHE, } from "./routeOptions.js";
|
|
4
8
|
import { isHashedBundle, listSiteFiles, resolveAddress } from "./siteFiles.js";
|
|
5
|
-
/**
|
|
6
|
-
const
|
|
7
|
-
/** A bundle is named by its content, so it never changes under its name. */
|
|
8
|
-
const BUNDLE_CACHE = 'public, max-age=31536000, immutable';
|
|
9
|
-
/**
|
|
10
|
-
* Every file of a build is public, and a page framed by a sandboxed view runs
|
|
11
|
-
* under an opaque origin, where everything it fetches from its own site is
|
|
12
|
-
* cross-origin: the static hosts open every response, and so does this server.
|
|
13
|
-
*/
|
|
14
|
-
const ALLOW_ORIGIN = 'access-control-allow-origin';
|
|
15
|
-
/** Kept out of the API's documentation (`@fastify/swagger` reads `hide`). */
|
|
16
|
-
const HIDDEN = { hide: true };
|
|
9
|
+
/** The `<base>` a build carries, which a mounted deployment rewrites. */
|
|
10
|
+
const ROOT_BASE = /<base\s+href=(?<quote>["'])\/\k<quote>\s*\/?>/i;
|
|
17
11
|
/**
|
|
18
12
|
* Serve a site's build from Node, with the rules every static host of the
|
|
19
13
|
* family follows (static-web-server's `sws.toml`, Cloudflare Pages): a real
|
|
@@ -33,13 +27,14 @@ const HIDDEN = { hide: true };
|
|
|
33
27
|
export async function staticSite(fastify, options) {
|
|
34
28
|
const { trackingScript, redirects = {}, reserved = ['/v1/'] } = options;
|
|
35
29
|
const root = resolve(options.root);
|
|
36
|
-
|
|
30
|
+
const basePath = normalizeBasePath(options.basePath ?? '');
|
|
31
|
+
await healthRoute(fastify);
|
|
37
32
|
const files = await listSiteFiles(root);
|
|
38
33
|
if (files === undefined) {
|
|
39
34
|
fastify.log.warn({ root }, 'no built site: serving the API alone');
|
|
40
35
|
return;
|
|
41
36
|
}
|
|
42
|
-
const pages = await readPages(root, files, trackingScript);
|
|
37
|
+
const pages = await readPages(root, files, { trackingScript, basePath });
|
|
43
38
|
// An optional peer, installed only by a site that has a server: importing
|
|
44
39
|
// react-cheminfo/server must not need it.
|
|
45
40
|
const { default: fastifyStatic } = await import('@fastify/static');
|
|
@@ -61,7 +56,7 @@ export async function staticSite(fastify, options) {
|
|
|
61
56
|
reply.header(ALLOW_ORIGIN, '*');
|
|
62
57
|
const destination = redirects[pathname] ?? redirects[pathname.replace(/\/$/, '')];
|
|
63
58
|
if (destination !== undefined) {
|
|
64
|
-
return reply.redirect(`${destination}${search}`, 301);
|
|
59
|
+
return reply.redirect(`${mountedAddress(basePath, destination)}${search}`, 301);
|
|
65
60
|
}
|
|
66
61
|
const file = resolveAddress(files, pathname);
|
|
67
62
|
if (file === undefined) {
|
|
@@ -76,20 +71,47 @@ export async function staticSite(fastify, options) {
|
|
|
76
71
|
fastify.get('/*', { schema: HIDDEN }, answer);
|
|
77
72
|
}
|
|
78
73
|
/**
|
|
79
|
-
* Read every page of the build once, with the snippet in its head
|
|
74
|
+
* Read every page of the build once, with the snippet in its head and the
|
|
75
|
+
* mount in its `<base>`.
|
|
80
76
|
* @param root - The build.
|
|
81
77
|
* @param files - Its files.
|
|
82
|
-
* @param
|
|
78
|
+
* @param stamp - What is written into every page.
|
|
79
|
+
* @param stamp.trackingScript - The snippet, if any.
|
|
80
|
+
* @param stamp.basePath - The mount, `''` for none.
|
|
83
81
|
* @returns The pages, by file.
|
|
84
82
|
*/
|
|
85
|
-
async function readPages(root, files,
|
|
83
|
+
async function readPages(root, files, stamp) {
|
|
86
84
|
const htmlFiles = [...files].filter((file) => file.endsWith('.html'));
|
|
87
85
|
const pages = await Promise.all(htmlFiles.map(async (file) => {
|
|
88
|
-
const html = injectTrackingScript(await readFile(join(root, file), 'utf8'), trackingScript);
|
|
86
|
+
const html = stampBase(injectTrackingScript(await readFile(join(root, file), 'utf8'), stamp.trackingScript), stamp.basePath);
|
|
89
87
|
return [file, { html, etag: await etagOf(html) }];
|
|
90
88
|
}));
|
|
91
89
|
return new Map(pages);
|
|
92
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Write the mount into the first `<base href="/">` a page carries, as the
|
|
93
|
+
* container entrypoints of a mounted image do.
|
|
94
|
+
* @param html - The page.
|
|
95
|
+
* @param basePath - The mount, `''` for none.
|
|
96
|
+
* @returns The page, its relative addresses resolving under the mount.
|
|
97
|
+
*/
|
|
98
|
+
function stampBase(html, basePath) {
|
|
99
|
+
if (basePath === '')
|
|
100
|
+
return html;
|
|
101
|
+
const tag = `<base href="${escapeAttribute(`${basePath}/`)}" />`;
|
|
102
|
+
return html.replace(ROOT_BASE, () => tag);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Where a redirect sends the browser: under the mount the proxy took off.
|
|
106
|
+
* @param basePath - The mount, `''` for none.
|
|
107
|
+
* @param destination - The address, from the site's own root or absolute.
|
|
108
|
+
* @returns The address the browser is sent to.
|
|
109
|
+
*/
|
|
110
|
+
function mountedAddress(basePath, destination) {
|
|
111
|
+
if (basePath === '' || !destination.startsWith('/'))
|
|
112
|
+
return destination;
|
|
113
|
+
return joinBasePath(basePath, destination);
|
|
114
|
+
}
|
|
93
115
|
function sendPage(request, reply, page, status) {
|
|
94
116
|
if (page === undefined) {
|
|
95
117
|
return reply
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staticSite.js","sourceRoot":"","sources":["../../src/server/staticSite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"staticSite.js","sourceRoot":"","sources":["../../src/server/staticSite.ts"],"names":[],"mappings":"AAAA,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,OAAO,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QACrE,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAChC,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7E,CAAC;AAED,KAAK,UAAU,MAAM,CAAC,IAAY;IAChC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CACvC,SAAS,EACT,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAC/B,CAAC;IACF,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACrD,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,MAAM,IAAI,IAAI,KAAK;QAAE,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACpE,OAAO,IAAI,GAAG,GAAG,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { FastifyInstance, FastifyServerOptions } from 'fastify';
|
|
2
|
+
import type { SiteId } from '../ecosystem/core/sites.ts';
|
|
3
|
+
import type { ServerConfig } from './config.ts';
|
|
4
|
+
import type { ListenSiteOptions } from './listenSite.ts';
|
|
5
|
+
/** What a site's API is registered with. */
|
|
6
|
+
export interface ToolSiteContext {
|
|
7
|
+
/** The site, as `ECOSYSTEM_SITES` names it. */
|
|
8
|
+
siteId: SiteId;
|
|
9
|
+
/** Its host, `osiris.cheminfo.org`: what the tool server and its documentation are called. */
|
|
10
|
+
name: string;
|
|
11
|
+
/** The release the repository is at. */
|
|
12
|
+
version: string;
|
|
13
|
+
/** The configuration the server was built with. */
|
|
14
|
+
config: ServerConfig;
|
|
15
|
+
}
|
|
16
|
+
/** Options of {@link toolSiteServer}. */
|
|
17
|
+
export interface ToolSiteServerOptions {
|
|
18
|
+
/** The site, as `ECOSYSTEM_SITES` names it. */
|
|
19
|
+
siteId: SiteId;
|
|
20
|
+
/** The configuration, from `readServerConfig`. */
|
|
21
|
+
config: ServerConfig;
|
|
22
|
+
/**
|
|
23
|
+
* Register the API beside the pages: the tool routes of
|
|
24
|
+
* `cheminfo-mcp-server` under `/v1`, their documentation at `/docs`.
|
|
25
|
+
*/
|
|
26
|
+
registerApi: (app: FastifyInstance, context: ToolSiteContext) => void | Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Addresses the site does not have any more, and the one that does their
|
|
29
|
+
* work; the query is carried over.
|
|
30
|
+
* @default {}
|
|
31
|
+
*/
|
|
32
|
+
redirects?: Readonly<Record<string, string>>;
|
|
33
|
+
/**
|
|
34
|
+
* Whether, and how, Fastify logs.
|
|
35
|
+
* @default true
|
|
36
|
+
*/
|
|
37
|
+
logger?: FastifyServerOptions['logger'];
|
|
38
|
+
/**
|
|
39
|
+
* Address prefixes the API answers, which never answer a page.
|
|
40
|
+
* @default ['/v1/', '/docs']
|
|
41
|
+
*/
|
|
42
|
+
reserved?: readonly string[];
|
|
43
|
+
/**
|
|
44
|
+
* The release the API reports.
|
|
45
|
+
* @default the root `package.json` of the repository the process runs in
|
|
46
|
+
*/
|
|
47
|
+
version?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Build a tool site's server without listening: the API the site registers,
|
|
51
|
+
* then the same build the static host serves, by the static hosts' rules.
|
|
52
|
+
*
|
|
53
|
+
* The page never calls the API — it computes in the browser — so the server only
|
|
54
|
+
* adds: the tools under `/v1` for chats and MCP clients, documented at `/docs`.
|
|
55
|
+
*
|
|
56
|
+
* const app = await toolSiteServer({
|
|
57
|
+
* siteId: 'osiris',
|
|
58
|
+
* config,
|
|
59
|
+
* registerApi: (app, { name, version }) => registerTools(app, name, version),
|
|
60
|
+
* });
|
|
61
|
+
* @param options - The site, its configuration and its API.
|
|
62
|
+
* @returns The server, ready to listen or to be injected in tests.
|
|
63
|
+
*/
|
|
64
|
+
export declare function toolSiteServer(options: ToolSiteServerOptions): Promise<FastifyInstance>;
|
|
65
|
+
/**
|
|
66
|
+
* Build a site's server from its configuration, listen where it says, and close
|
|
67
|
+
* cleanly when the container is stopped — the whole of a `main.ts`:
|
|
68
|
+
*
|
|
69
|
+
* await startToolServer(buildServer, readServerConfig(process.env, SITE));
|
|
70
|
+
* @param build - Builds the server, e.g. with {@link toolSiteServer}.
|
|
71
|
+
* @param config - The configuration, from `readServerConfig`.
|
|
72
|
+
* @param options - What else to stop, and on which signals.
|
|
73
|
+
* @returns The server, listening.
|
|
74
|
+
* @throws {Error} When the server cannot listen, after it has been closed.
|
|
75
|
+
*/
|
|
76
|
+
export declare function startToolServer(build: (config: ServerConfig) => FastifyInstance | Promise<FastifyInstance>, config: ServerConfig, options?: Pick<ListenSiteOptions, 'onClose' | 'signals'>): Promise<FastifyInstance>;
|
|
77
|
+
//# sourceMappingURL=toolSiteServer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolSiteServer.d.ts","sourceRoot":"","sources":["../../src/server/toolSiteServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAGrE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAMzD,4CAA4C;AAC5C,MAAM,WAAW,eAAe;IAC9B,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,8FAA8F;IAC9F,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,MAAM,EAAE,YAAY,CAAC;CACtB;AAED,yCAAyC;AACzC,MAAM,WAAW,qBAAqB;IACpC,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,MAAM,EAAE,YAAY,CAAC;IACrB;;;OAGG;IACH,WAAW,EAAE,CACX,GAAG,EAAE,eAAe,EACpB,OAAO,EAAE,eAAe,KACrB,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7C;;;OAGG;IACH,MAAM,CAAC,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,eAAe,CAAC,CA2B1B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,EAC3E,MAAM,EAAE,YAAY,EACpB,OAAO,GAAE,IAAI,CAAC,iBAAiB,EAAE,SAAS,GAAG,SAAS,CAAM,GAC3D,OAAO,CAAC,eAAe,CAAC,CAI1B"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { siteById } from "../ecosystem/core/lookup.js";
|
|
2
|
+
import { listenSite } from "./listenSite.js";
|
|
3
|
+
import { readRepositoryVersion } from "./repositoryVersion.js";
|
|
4
|
+
import { DEFAULT_RESERVED } from "./routeOptions.js";
|
|
5
|
+
import { staticSite } from "./staticSite.js";
|
|
6
|
+
/**
|
|
7
|
+
* Build a tool site's server without listening: the API the site registers,
|
|
8
|
+
* then the same build the static host serves, by the static hosts' rules.
|
|
9
|
+
*
|
|
10
|
+
* The page never calls the API — it computes in the browser — so the server only
|
|
11
|
+
* adds: the tools under `/v1` for chats and MCP clients, documented at `/docs`.
|
|
12
|
+
*
|
|
13
|
+
* const app = await toolSiteServer({
|
|
14
|
+
* siteId: 'osiris',
|
|
15
|
+
* config,
|
|
16
|
+
* registerApi: (app, { name, version }) => registerTools(app, name, version),
|
|
17
|
+
* });
|
|
18
|
+
* @param options - The site, its configuration and its API.
|
|
19
|
+
* @returns The server, ready to listen or to be injected in tests.
|
|
20
|
+
*/
|
|
21
|
+
export async function toolSiteServer(options) {
|
|
22
|
+
const { siteId, config, registerApi, redirects = {}, logger = true, reserved = DEFAULT_RESERVED, } = options;
|
|
23
|
+
// An optional peer, installed only by a site that has a server.
|
|
24
|
+
const { fastify } = await import('fastify');
|
|
25
|
+
const app = fastify({ logger, trustProxy: config.trustProxy });
|
|
26
|
+
const version = options.version ?? readRepositoryVersion(process.cwd());
|
|
27
|
+
await registerApi(app, {
|
|
28
|
+
siteId,
|
|
29
|
+
name: siteById(siteId).host,
|
|
30
|
+
version,
|
|
31
|
+
config,
|
|
32
|
+
});
|
|
33
|
+
await app.register(staticSite, {
|
|
34
|
+
root: config.root,
|
|
35
|
+
trackingScript: config.trackingScript,
|
|
36
|
+
redirects,
|
|
37
|
+
reserved,
|
|
38
|
+
basePath: config.basePath,
|
|
39
|
+
});
|
|
40
|
+
return app;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Build a site's server from its configuration, listen where it says, and close
|
|
44
|
+
* cleanly when the container is stopped — the whole of a `main.ts`:
|
|
45
|
+
*
|
|
46
|
+
* await startToolServer(buildServer, readServerConfig(process.env, SITE));
|
|
47
|
+
* @param build - Builds the server, e.g. with {@link toolSiteServer}.
|
|
48
|
+
* @param config - The configuration, from `readServerConfig`.
|
|
49
|
+
* @param options - What else to stop, and on which signals.
|
|
50
|
+
* @returns The server, listening.
|
|
51
|
+
* @throws {Error} When the server cannot listen, after it has been closed.
|
|
52
|
+
*/
|
|
53
|
+
export async function startToolServer(build, config, options = {}) {
|
|
54
|
+
const app = await build(config);
|
|
55
|
+
await listenSite(app, { ...options, port: config.port, host: config.host });
|
|
56
|
+
return app;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=toolSiteServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolSiteServer.js","sourceRoot":"","sources":["../../src/server/toolSiteServer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAKvD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAmD7C;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,OAA8B;IAE9B,MAAM,EACJ,MAAM,EACN,MAAM,EACN,WAAW,EACX,SAAS,GAAG,EAAE,EACd,MAAM,GAAG,IAAI,EACb,QAAQ,GAAG,gBAAgB,GAC5B,GAAG,OAAO,CAAC;IACZ,gEAAgE;IAChE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,OAAO,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,qBAAqB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACxE,MAAM,WAAW,CAAC,GAAG,EAAE;QACrB,MAAM;QACN,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI;QAC3B,OAAO;QACP,MAAM;KACP,CAAC,CAAC;IACH,MAAM,GAAG,CAAC,QAAQ,CAAC,UAAU,EAAE;QAC7B,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,SAAS;QACT,QAAQ;QACR,QAAQ,EAAE,MAAM,CAAC,QAAQ;KAC1B,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,KAA2E,EAC3E,MAAoB,EACpB,UAA0D,EAAE;IAE5D,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,CAAC;IAChC,MAAM,UAAU,CAAC,GAAG,EAAE,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IAC5E,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read which reverse proxies a deployment names, for Fastify's `trustProxy`.
|
|
3
|
+
*
|
|
4
|
+
* Behind a proxy, `request.ip` is the proxy's address on every request and
|
|
5
|
+
* `request.protocol` reads `http` for an HTTPS client, so the variable names the
|
|
6
|
+
* proxy whose `X-Forwarded-For` is believed: an address, a CIDR range, or a
|
|
7
|
+
* comma-separated list of either. `true` believes any peer, which is only safe
|
|
8
|
+
* when the port is unreachable except through the proxy.
|
|
9
|
+
*
|
|
10
|
+
* A hop count is refused. Fastify 5.12.7 and later trust nothing for a number,
|
|
11
|
+
* since a hop count cannot tell the proxy from a client, so the service would
|
|
12
|
+
* silently log the proxy's address again — and a function over the hop, the
|
|
13
|
+
* usual way around it, believes any peer that sends enough addresses.
|
|
14
|
+
* @param value - `TRUST_PROXY`, as written.
|
|
15
|
+
* @returns The proxies as written, `true` to believe any peer, or `false` when
|
|
16
|
+
* the variable is unset, blank or `false`.
|
|
17
|
+
* @throws {Error} When the value is a hop count.
|
|
18
|
+
*/
|
|
19
|
+
export declare function parseTrustProxy(value: string | undefined): boolean | string;
|
|
20
|
+
//# sourceMappingURL=trustProxy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trustProxy.d.ts","sourceRoot":"","sources":["../../src/server/trustProxy.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAU3E"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** A value that is only digits: a hop count. */
|
|
2
|
+
const HOP_COUNT = /^\d+$/;
|
|
3
|
+
/**
|
|
4
|
+
* Read which reverse proxies a deployment names, for Fastify's `trustProxy`.
|
|
5
|
+
*
|
|
6
|
+
* Behind a proxy, `request.ip` is the proxy's address on every request and
|
|
7
|
+
* `request.protocol` reads `http` for an HTTPS client, so the variable names the
|
|
8
|
+
* proxy whose `X-Forwarded-For` is believed: an address, a CIDR range, or a
|
|
9
|
+
* comma-separated list of either. `true` believes any peer, which is only safe
|
|
10
|
+
* when the port is unreachable except through the proxy.
|
|
11
|
+
*
|
|
12
|
+
* A hop count is refused. Fastify 5.12.7 and later trust nothing for a number,
|
|
13
|
+
* since a hop count cannot tell the proxy from a client, so the service would
|
|
14
|
+
* silently log the proxy's address again — and a function over the hop, the
|
|
15
|
+
* usual way around it, believes any peer that sends enough addresses.
|
|
16
|
+
* @param value - `TRUST_PROXY`, as written.
|
|
17
|
+
* @returns The proxies as written, `true` to believe any peer, or `false` when
|
|
18
|
+
* the variable is unset, blank or `false`.
|
|
19
|
+
* @throws {Error} When the value is a hop count.
|
|
20
|
+
*/
|
|
21
|
+
export function parseTrustProxy(value) {
|
|
22
|
+
const text = value?.trim();
|
|
23
|
+
if (!text || text.toLowerCase() === 'false')
|
|
24
|
+
return false;
|
|
25
|
+
if (text.toLowerCase() === 'true')
|
|
26
|
+
return true;
|
|
27
|
+
if (HOP_COUNT.test(text)) {
|
|
28
|
+
throw new Error(`TRUST_PROXY=${text} is a hop count, which trusts nothing. Name the proxy's address or CIDR instead.`);
|
|
29
|
+
}
|
|
30
|
+
return text;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=trustProxy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trustProxy.js","sourceRoot":"","sources":["../../src/server/trustProxy.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,MAAM,SAAS,GAAG,OAAO,CAAC;AAE1B;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,eAAe,CAAC,KAAyB;IACvD,MAAM,IAAI,GAAG,KAAK,EAAE,IAAI,EAAE,CAAC;IAC3B,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,WAAW,EAAE,KAAK,OAAO;QAAE,OAAO,KAAK,CAAC;IAC1D,IAAI,IAAI,CAAC,WAAW,EAAE,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC;IAC/C,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,eAAe,IAAI,kFAAkF,CACtG,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TypeBoxTypeProvider } from '@fastify/type-provider-typebox';
|
|
2
|
+
import type { FastifyBaseLogger, FastifyInstance, RawReplyDefaultExpression, RawRequestDefaultExpression, RawServerDefault } from 'fastify';
|
|
3
|
+
/**
|
|
4
|
+
* A Fastify instance whose routes are typed from their TypeBox schemas: the
|
|
5
|
+
* `body`, `params`, `querystring` and response of a route registered on it are
|
|
6
|
+
* inferred. A route module takes it as its parameter, and the server is built
|
|
7
|
+
* with `fastify(options).withTypeProvider<TypeBoxTypeProvider>()`.
|
|
8
|
+
*
|
|
9
|
+
* Types only: `@fastify/type-provider-typebox` is an optional peer, installed by
|
|
10
|
+
* the backends that type their routes this way.
|
|
11
|
+
*/
|
|
12
|
+
export type FastifyTyped = FastifyInstance<RawServerDefault, RawRequestDefaultExpression, RawReplyDefaultExpression, FastifyBaseLogger, TypeBoxTypeProvider>;
|
|
13
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/server/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,yBAAyB,EACzB,2BAA2B,EAC3B,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAEjB;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GAAG,eAAe,CACxC,gBAAgB,EAChB,2BAA2B,EAC3B,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,CACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/server/types.ts"],"names":[],"mappings":""}
|
package/lib/server.d.ts
CHANGED
|
@@ -1,4 +1,26 @@
|
|
|
1
1
|
export type { StaticSiteOptions } from './server/staticSite.ts';
|
|
2
2
|
export { staticSite } from './server/staticSite.ts';
|
|
3
3
|
export { isHashedBundle, listSiteFiles, resolveAddress, } from './server/siteFiles.ts';
|
|
4
|
+
export type { ServerConfig, ServerConfigOptions, ServerEnvironment, } from './server/config.ts';
|
|
5
|
+
export { readHttpAddress, readServerConfig } from './server/config.ts';
|
|
6
|
+
export type { ReadEnvNumberOptions } from './server/envNumber.ts';
|
|
7
|
+
export { readEnvNumber } from './server/envNumber.ts';
|
|
8
|
+
export type { HealthRouteOptions } from './server/healthRoute.ts';
|
|
9
|
+
export { healthRoute } from './server/healthRoute.ts';
|
|
10
|
+
export type { ListenSiteOptions } from './server/listenSite.ts';
|
|
11
|
+
export { listenSite } from './server/listenSite.ts';
|
|
12
|
+
export { readRepositoryVersion } from './server/repositoryVersion.ts';
|
|
13
|
+
export { readRouteTable } from './server/routeTable.ts';
|
|
14
|
+
export { spaSite } from './server/spaSite.ts';
|
|
15
|
+
export type { SpaPage, SpaSiteOptions, SpaStructuredData, } from './server/spaSiteOptions.ts';
|
|
16
|
+
export type { ToolSiteContext, ToolSiteServerOptions, } from './server/toolSiteServer.ts';
|
|
17
|
+
export { startToolServer, toolSiteServer } from './server/toolSiteServer.ts';
|
|
18
|
+
export { parseTrustProxy } from './server/trustProxy.ts';
|
|
19
|
+
export type { FastifyTyped } from './server/types.ts';
|
|
20
|
+
export type { AnswerAddresses, AnswerAddressesInput, } from './server/answerAddresses.ts';
|
|
21
|
+
export { answerAddresses, joinAddress, viewOrigins, } from './server/answerAddresses.ts';
|
|
22
|
+
export type { CardMetaOptions, PageAnswer } from './server/cardMeta.ts';
|
|
23
|
+
export { cardMeta, pageAnswer } from './server/cardMeta.ts';
|
|
24
|
+
export type { SiteViewOptions } from './server/siteView.ts';
|
|
25
|
+
export { siteView } from './server/siteView.ts';
|
|
4
26
|
//# sourceMappingURL=server.d.ts.map
|
package/lib/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EACL,cAAc,EACd,aAAa,EACb,cAAc,GACf,MAAM,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,M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U,EAAE,MAAM,sBAAsB,CAAC;AAC5D,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC"}
|
package/lib/server.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
1
|
export { staticSite } from "./server/staticSite.js";
|
|
2
2
|
export { isHashedBundle, listSiteFiles, resolveAddress, } from "./server/siteFiles.js";
|
|
3
|
+
export { readHttpAddress, readServerConfig } from "./server/config.js";
|
|
4
|
+
export { readEnvNumber } from "./server/envNumber.js";
|
|
5
|
+
export { healthRoute } from "./server/healthRoute.js";
|
|
6
|
+
export { listenSite } from "./server/listenSite.js";
|
|
7
|
+
export { readRepositoryVersion } from "./server/repositoryVersion.js";
|
|
8
|
+
export { readRouteTable } from "./server/routeTable.js";
|
|
9
|
+
export { spaSite } from "./server/spaSite.js";
|
|
10
|
+
export { startToolServer, toolSiteServer } from "./server/toolSiteServer.js";
|
|
11
|
+
export { parseTrustProxy } from "./server/trustProxy.js";
|
|
12
|
+
export { answerAddresses, joinAddress, viewOrigins, } from "./server/answerAddresses.js";
|
|
13
|
+
export { cardMeta, pageAnswer } from "./server/cardMeta.js";
|
|
14
|
+
export { siteView } from "./server/siteView.js";
|
|
3
15
|
//# sourceMappingURL=server.js.map
|
package/lib/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EACL,cAAc,EACd,aAAa,EACb,cAAc,GACf,MAAM,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EACL,cAAc,EACd,aAAa,EACb,cAAc,GACf,MAAM,uBAAuB,CAAC;AAM/B,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEvE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAU9C,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAMzD,OAAO,EACL,eAAe,EACf,WAAW,EACX,WAAW,GACZ,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -69,4 +69,22 @@ export declare function isShareConfigured<Codecs extends ShareParamCodecs = Reco
|
|
|
69
69
|
* @returns The configuration to start from.
|
|
70
70
|
*/
|
|
71
71
|
export declare function suggestedShareConfig<Codecs extends ShareParamCodecs = Record<string, never>>(vocabulary: ShareVocabulary<Codecs>): ShareConfig<Codecs>;
|
|
72
|
+
/**
|
|
73
|
+
* Read the parts a `?hide=` value switches off, for a page that holds its
|
|
74
|
+
* query decoded rather than as a string.
|
|
75
|
+
* @param raw - The raw value, comma separated; `undefined` when absent.
|
|
76
|
+
* @param parts - The hideable parts, in the vocabulary order.
|
|
77
|
+
* @returns The keys of the parts named, in that order; a key the vocabulary
|
|
78
|
+
* does not list is dropped, so a hand-written link cannot hide what it cannot
|
|
79
|
+
* name.
|
|
80
|
+
*/
|
|
81
|
+
export declare function readHiddenParts(raw: string | undefined, parts: readonly HideablePart[]): readonly string[];
|
|
82
|
+
/**
|
|
83
|
+
* Write a `?hide=` value in the vocabulary order, so one selection always
|
|
84
|
+
* produces one link.
|
|
85
|
+
* @param hidden - The keys switched off, in any order and any collection.
|
|
86
|
+
* @param parts - The hideable parts, in the vocabulary order.
|
|
87
|
+
* @returns The value, empty when nothing the vocabulary lists is switched off.
|
|
88
|
+
*/
|
|
89
|
+
export declare function formatHiddenParts(hidden: Iterable<string>, parts: readonly HideablePart[]): string;
|
|
72
90
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/share/core/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAEzB,gDAAgD;AAChD,eAAO,MAAM,WAAW,UAAU,CAAC;AAEnC,2DAA2D;AAC3D,eAAO,MAAM,UAAU,SAAS,CAAC;AAEjC,gFAAgF;AAChF,MAAM,WAAW,WAAW,CAC1B,MAAM,SAAS,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;IAEvD,8EAA8E;IAC9E,KAAK,EAAE,OAAO,CAAC;IACf,sEAAsE;IACtE,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,oFAAoF;IACpF,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;CAClC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,SAAS,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EACvD,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/share/core/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,E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,MAAM,SAAS,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EACvD,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,eAAe,CAAC,MAAM,CAAC,GAAG,OAAO,CAE3E;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,SAAS,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EACvD,UAAU,EAAE,eAAe,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,CAM1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,KAAK,EAAE,SAAS,YAAY,EAAE,GAC7B,SAAS,MAAM,EAAE,CAEnB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,EACxB,KAAK,EAAE,SAAS,YAAY,EAAE,GAC7B,MAAM,CAER"}
|
package/lib/share/core/config.js
CHANGED
|
@@ -17,9 +17,11 @@ export const HIDE_PARAM = 'hide';
|
|
|
17
17
|
export function parseShareConfig(search, vocabulary) {
|
|
18
18
|
const values = firstValues(parseQuery(search));
|
|
19
19
|
const embed = values.get(EMBED_PARAM);
|
|
20
|
+
const asked = splitHidden(values.get(HIDE_PARAM));
|
|
20
21
|
return {
|
|
21
|
-
embed: embed !== undefined && embed !== '0'
|
|
22
|
-
|
|
22
|
+
embed: (embed !== undefined && embed !== '0') ||
|
|
23
|
+
namesAny(asked, vocabulary.legacyEmbedParts ?? []),
|
|
24
|
+
hidden: orderHidden(asked, vocabulary.parts),
|
|
23
25
|
params: readParams(values, vocabulary.params),
|
|
24
26
|
};
|
|
25
27
|
}
|
|
@@ -112,6 +114,35 @@ export function suggestedShareConfig(vocabulary) {
|
|
|
112
114
|
}
|
|
113
115
|
return { ...parseShareConfig('', vocabulary), embed: true, hidden };
|
|
114
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* Read the parts a `?hide=` value switches off, for a page that holds its
|
|
119
|
+
* query decoded rather than as a string.
|
|
120
|
+
* @param raw - The raw value, comma separated; `undefined` when absent.
|
|
121
|
+
* @param parts - The hideable parts, in the vocabulary order.
|
|
122
|
+
* @returns The keys of the parts named, in that order; a key the vocabulary
|
|
123
|
+
* does not list is dropped, so a hand-written link cannot hide what it cannot
|
|
124
|
+
* name.
|
|
125
|
+
*/
|
|
126
|
+
export function readHiddenParts(raw, parts) {
|
|
127
|
+
return orderHidden(splitHidden(raw), parts);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Write a `?hide=` value in the vocabulary order, so one selection always
|
|
131
|
+
* produces one link.
|
|
132
|
+
* @param hidden - The keys switched off, in any order and any collection.
|
|
133
|
+
* @param parts - The hideable parts, in the vocabulary order.
|
|
134
|
+
* @returns The value, empty when nothing the vocabulary lists is switched off.
|
|
135
|
+
*/
|
|
136
|
+
export function formatHiddenParts(hidden, parts) {
|
|
137
|
+
return orderHidden(new Set(hidden), parts).join(',');
|
|
138
|
+
}
|
|
139
|
+
function namesAny(asked, keys) {
|
|
140
|
+
for (const key of keys) {
|
|
141
|
+
if (asked.has(key))
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
115
146
|
function splitHidden(raw) {
|
|
116
147
|
const asked = new Set();
|
|
117
148
|
if (raw === undefined)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/share/core/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAQrE,gDAAgD;AAChD,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC;AAEnC,2DAA2D;AAC3D,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC;AAcjC;;;;;;;;;;GAUG;AACH,MAAM,UAAU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E,CAAC;QAClD,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export type { ShareConfig } from './config.ts';
|
|
2
|
-
export { EMBED_PARAM, HIDE_PARAM, applyShareConfig, isHidden, isShareConfigured, parseShareConfig, suggestedShareConfig, visibleShareParts, } from './config.ts';
|
|
2
|
+
export { EMBED_PARAM, HIDE_PARAM, applyShareConfig, formatHiddenParts, isHidden, isShareConfigured, parseShareConfig, readHiddenParts, suggestedShareConfig, visibleShareParts, } from './config.ts';
|
|
3
3
|
export type { SharePreviewDeviceKey, SharePreviewSize } from './devices.ts';
|
|
4
4
|
export { SHARE_PREVIEW_DEVICES, sharePreviewAddress, sharePreviewScale, sharePreviewSize, } from './devices.ts';
|
|
5
5
|
export { escapeAttribute, escapeText } from './escape.ts';
|
|
6
|
+
export type { KeySetParamOptions } from './keySetParam.ts';
|
|
7
|
+
export { keySetParam } from './keySetParam.ts';
|
|
6
8
|
export type { ShareRegion } from './regions.ts';
|
|
7
9
|
export { SHARE_REGIONS_MESSAGE, SHARE_REGIONS_REQUEST, isShareRegionsRequest, readShareRegions, } from './regions.ts';
|
|
8
10
|
export type { BooleanParamOptions, IntegerParamOptions, NumberParamOptions, ShareParamCodec, StringParamOptions, } from './params.ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/share/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EACL,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,YAA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,CAAC;AACzD,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,GAChB,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/share/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EACL,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,QAAQ,EACR,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC5E,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC1D,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,WAAW,EACX,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,aAAa,EACb,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACjE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EACL,UAAU,EACV,SAAS,EACT,YAAY,EACZ,WAAW,EACX,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC/E,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzD,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,GAChB,MAAM,iBAAiB,CAAC"}
|
package/lib/share/core/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export { EMBED_PARAM, HIDE_PARAM, applyShareConfig, isHidden, isShareConfigured, parseShareConfig, suggestedShareConfig, visibleShareParts, } from "./config.js";
|
|
1
|
+
export { EMBED_PARAM, HIDE_PARAM, applyShareConfig, formatHiddenParts, isHidden, isShareConfigured, parseShareConfig, readHiddenParts, suggestedShareConfig, visibleShareParts, } from "./config.js";
|
|
2
2
|
export { SHARE_PREVIEW_DEVICES, sharePreviewAddress, sharePreviewScale, sharePreviewSize, } from "./devices.js";
|
|
3
3
|
export { escapeAttribute, escapeText } from "./escape.js";
|
|
4
|
+
export { keySetParam } from "./keySetParam.js";
|
|
4
5
|
export { SHARE_REGIONS_MESSAGE, SHARE_REGIONS_REQUEST, isShareRegionsRequest, readShareRegions, } from "./regions.js";
|
|
5
6
|
export { booleanParam, enumParam, integerParam, numberParam, stringParam, } from "./params.js";
|
|
6
7
|
export { applyPreferencesFromSearch, syncPreferencesWithUrl, writePreferencesToSearch, } from "./preferences.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/share/core/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE1D,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAQtB,OAAO,EACL,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,WAAW,EACX,WAAW,GACZ,MAAM,aAAa,CAAC;AAQrB,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEjE,OAAO,EACL,UAAU,EACV,SAAS,EACT,YAAY,EACZ,WAAW,EACX,WAAW,GACZ,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE/E,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/share/core/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,QAAQ,EACR,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAQtB,OAAO,EACL,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,WAAW,EACX,WAAW,GACZ,MAAM,aAAa,CAAC;AAQrB,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEjE,OAAO,EACL,UAAU,EACV,SAAS,EACT,YAAY,EACZ,WAAW,EACX,WAAW,GACZ,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE/E,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ShareParamCodec } from './params.ts';
|
|
2
|
+
/** What {@link keySetParam} is configured with. */
|
|
3
|
+
export interface KeySetParamOptions<Key extends string> {
|
|
4
|
+
/**
|
|
5
|
+
* The word an empty set is written as. An empty value is dropped from the
|
|
6
|
+
* address, so a link switching every key off has to say so in a word.
|
|
7
|
+
* @default 'none'
|
|
8
|
+
*/
|
|
9
|
+
none?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The set a link carrying nothing stands for, and the one deleted rather
|
|
12
|
+
* than written. `null` means the link then says nothing about the keys, so
|
|
13
|
+
* whatever the visitor stored is left alone.
|
|
14
|
+
* @default null
|
|
15
|
+
*/
|
|
16
|
+
default?: readonly Key[] | null;
|
|
17
|
+
/**
|
|
18
|
+
* The set deleted from a link rather than written, when it is not the
|
|
19
|
+
* default — a site whose absent parameter leaves the visitor's stored keys
|
|
20
|
+
* alone, and whose own initial keys must not grow a plain visit a query
|
|
21
|
+
* string.
|
|
22
|
+
* @default the default set
|
|
23
|
+
*/
|
|
24
|
+
omitted?: readonly Key[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A set of keys a link switches on — the layers a figure draws,
|
|
28
|
+
* `?flags=breakdown,working` — written comma separated, in the order the keys
|
|
29
|
+
* are listed, so one selection always produces one link.
|
|
30
|
+
*
|
|
31
|
+
* A key the tool does not list is dropped rather than refused, so a link
|
|
32
|
+
* written before a key was renamed still opens; the word for nothing, `none`
|
|
33
|
+
* by default, reads as the empty set, and an absent or empty parameter as the
|
|
34
|
+
* default.
|
|
35
|
+
* @param keys - Every key the tool understands, in the order links write them.
|
|
36
|
+
* @param options - The word for nothing, and the default set.
|
|
37
|
+
* @returns The codec.
|
|
38
|
+
*/
|
|
39
|
+
export declare function keySetParam<Key extends string>(keys: readonly Key[], options?: KeySetParamOptions<Key>): ShareParamCodec<ReadonlySet<Key> | null>;
|
|
40
|
+
//# sourceMappingURL=keySetParam.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keySetParam.d.ts","sourceRoot":"","sources":["../../../src/share/core/keySetParam.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,mDAAmD;AACnD,MAAM,WAAW,kBAAkB,CAAC,GAAG,SAAS,MAAM;IACpD;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,EAAE,GAAG,IAAI,CAAC;IAChC;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,EAAE,CAAC;CAC1B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,GAAG,SAAS,MAAM,EAC5C,IAAI,EAAE,SAAS,GAAG,EAAE,EACpB,OAAO,GAAE,kBAAkB,CAAC,GAAG,CAAM,GACpC,eAAe,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CA0B1C"}
|