react-cheminfo 0.64.1 → 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/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/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
|
@@ -59,11 +59,55 @@ export interface WorkerChannelOptions<TRequest, TResponse, TProgress = never> {
|
|
|
59
59
|
cooperativeCancel?: boolean;
|
|
60
60
|
/**
|
|
61
61
|
* The same job run on this thread, used instead of the worker where the page
|
|
62
|
-
* has no `Worker` at all — Node.js, a unit test
|
|
63
|
-
*
|
|
62
|
+
* has no `Worker` at all — Node.js, a unit test — or where creating one
|
|
63
|
+
* throws, as a browser refuses a page framed under an opaque origin a worker
|
|
64
|
+
* from its own server; every later job then runs here too. Only a channel
|
|
65
|
+
* built from a function that creates the worker falls back to it.
|
|
64
66
|
* @default undefined — every job goes to the worker
|
|
65
67
|
*/
|
|
66
68
|
runInProcess?: (request: TRequest, context: WorkerJobContext<TProgress>) => Promise<TResponse>;
|
|
69
|
+
/**
|
|
70
|
+
* Turn what went wrong into the error the requests reject with, so a page
|
|
71
|
+
* can say it in its own words — a translated message, an error class of its
|
|
72
|
+
* own. Answering `undefined` keeps the default error. Cancellations and
|
|
73
|
+
* timeouts are not failures: they keep their own error classes.
|
|
74
|
+
* @default undefined — the job's message, or `<name> failed: …`
|
|
75
|
+
*/
|
|
76
|
+
failure?: (failure: WorkerFailure) => Error | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Post a job again, once, on a fresh worker when its worker failed before
|
|
79
|
+
* answering, rather than reporting the failure: a worker whose module graph
|
|
80
|
+
* was still loading when the channel replaced it dies without having run
|
|
81
|
+
* anything. A job posted with buffers to transfer is not posted twice. Only
|
|
82
|
+
* a channel built from a function that creates the worker can do it.
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
85
|
+
retryAfterWorkerFailure?: boolean;
|
|
86
|
+
}
|
|
87
|
+
/** What went wrong, before it becomes the error a request rejects with. */
|
|
88
|
+
export interface WorkerFailure {
|
|
89
|
+
/**
|
|
90
|
+
* `job`: the job failed — its worker answered with a failure, or its
|
|
91
|
+
* in-process run threw. `worker`: the worker itself failed outright; an
|
|
92
|
+
* empty `message` means it never ran at all, its module graph not loading.
|
|
93
|
+
* `start`: creating the worker threw, and no in-process run stood in.
|
|
94
|
+
*/
|
|
95
|
+
kind: 'job' | 'worker' | 'start';
|
|
96
|
+
/** The channel's name, e.g. `conformers`. */
|
|
97
|
+
name: string;
|
|
98
|
+
/** What was said: the job's message, the error event's, or the thrown error's. */
|
|
99
|
+
message: string;
|
|
100
|
+
/**
|
|
101
|
+
* The `detail` a failed answer carried, as `serveWorkerRequests` was told to
|
|
102
|
+
* write it — the key of a translatable message, say.
|
|
103
|
+
* @default undefined
|
|
104
|
+
*/
|
|
105
|
+
detail?: unknown;
|
|
106
|
+
/**
|
|
107
|
+
* What the failure came with: the failed answer the worker posted, the error
|
|
108
|
+
* the in-process run threw, the error event, or what the factory threw.
|
|
109
|
+
*/
|
|
110
|
+
cause: unknown;
|
|
67
111
|
}
|
|
68
112
|
/** What one call may ask of the channel. */
|
|
69
113
|
export interface WorkerRequestOptions<TProgress = never> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workerChannelTypes.d.ts","sourceRoot":"","sources":["../../../src/worker/core/workerChannelTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE/D,+EAA+E;AAC/E,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,CAAC,MAAM,UAAU,CAAC,CAAC;AAE3D,2EAA2E;AAC3E,MAAM,WAAW,gBAAgB,CAAC,SAAS,GAAG,KAAK;IACjD;;;OAGG;IACH,MAAM,EAAE,WAAW,CAAC;IACpB;;;OAGG;IACH,cAAc,EAAE,CAAC,QAAQ,EAAE,SAAS,KAAK,IAAI,CAAC;CAC/C;AAED,uDAAuD;AACvD,MAAM,WAAW,oBAAoB,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,GAAG,KAAK;IAC1E;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B;;;;;;;OAOG;IACH,iBAAiB,CA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AAE,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;IACjC,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,kFAAkF;IAClF,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,4CAA4C;AAC5C,MAAM,WAAW,oBAAoB,CAAC,SAAS,GAAG,KAAK;IACrD;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,KAAK,IAAI,CAAC;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;CAC3B;AAED,0EAA0E;AAC1E,MAAM,WAAW,aAAa,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,GAAG,KAAK;IACnE;;;;;OAKG;IACH,OAAO,EAAE,CACP,OAAO,EAAE,QAAQ,EACjB,OAAO,CAAC,EAAE,oBAAoB,CAAC,SAAS,CAAC,KACtC,OAAO,CAAC,SAAS,CAAC,CAAC;IACxB,yDAAyD;IACzD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB;;;;OAIG;IACH,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { WorkerLike } from './messages.ts';
|
|
2
|
+
import type { Outcome } from './workerChannelParts.ts';
|
|
3
|
+
import type { WorkerFailure, WorkerJobContext, WorkerSource } from './workerChannelTypes.ts';
|
|
4
|
+
/**
|
|
5
|
+
* The one worker a channel posts to, kept, replaced and listened to.
|
|
6
|
+
*
|
|
7
|
+
* Handed a worker, the slot holds it until it is terminated. Handed a function,
|
|
8
|
+
* it creates the worker on first use and again after one failed or was let go,
|
|
9
|
+
* and runs the jobs on this thread instead — where there is no `Worker`, or
|
|
10
|
+
* where creating one throws — when the channel was given an in-process run.
|
|
11
|
+
* What a worker posts is heard only while it is the slot's current one, so a
|
|
12
|
+
* worker already let go cannot settle a job it no longer runs.
|
|
13
|
+
* @param source - The worker, or the function that creates it.
|
|
14
|
+
* @param options - What the slot reports to, and how failures are worded.
|
|
15
|
+
* @returns The slot.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createWorkerSlot<TRequest, TResponse, TProgress>(source: WorkerSource, options: WorkerSlotOptions<TRequest, TResponse, TProgress>): WorkerSlot<TRequest, TResponse, TProgress>;
|
|
18
|
+
/** What a slot is told about its channel. */
|
|
19
|
+
export interface WorkerSlotOptions<TRequest, TResponse, TProgress> {
|
|
20
|
+
/** The channel's name, for its errors. */
|
|
21
|
+
name: string;
|
|
22
|
+
/**
|
|
23
|
+
* The job run on this thread instead of a worker.
|
|
24
|
+
* @default undefined — every job goes to the worker
|
|
25
|
+
*/
|
|
26
|
+
runInProcess?: (request: TRequest, context: WorkerJobContext<TProgress>) => Promise<TResponse>;
|
|
27
|
+
/**
|
|
28
|
+
* The channel's own wording of a failure.
|
|
29
|
+
* @default undefined — the default errors
|
|
30
|
+
*/
|
|
31
|
+
failure?: (failure: WorkerFailure) => Error | undefined;
|
|
32
|
+
/** Whether somebody still waits for a request. */
|
|
33
|
+
isWaited: (id: number) => boolean;
|
|
34
|
+
/** Where what the current worker posts goes. */
|
|
35
|
+
report: {
|
|
36
|
+
/** News about a running job. */
|
|
37
|
+
progress: (id: number, progress: unknown) => void;
|
|
38
|
+
/** The end of a job. */
|
|
39
|
+
answer: (id: number, outcome: Outcome<TResponse>) => void;
|
|
40
|
+
/** The worker failed outright, and a factory's was let go. */
|
|
41
|
+
failure: (error: Error) => void;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/** The worker of a channel; see {@link createWorkerSlot}. */
|
|
45
|
+
export interface WorkerSlot<TRequest, TResponse, TProgress> {
|
|
46
|
+
/** Whether the slot creates its workers, and can therefore replace one. */
|
|
47
|
+
readonly hasFactory: boolean;
|
|
48
|
+
/** The worker posted to now, if there is one. */
|
|
49
|
+
readonly current: WorkerLike | null;
|
|
50
|
+
/**
|
|
51
|
+
* The worker a job goes to, created if need be.
|
|
52
|
+
* @returns It, or `null` when the job runs on this thread instead.
|
|
53
|
+
* @throws {CancelledRequestError} When a worker handed over was terminated.
|
|
54
|
+
* @throws {Error} What creating the worker threw, worded by the channel.
|
|
55
|
+
*/
|
|
56
|
+
acquire: () => WorkerLike | null;
|
|
57
|
+
/** Run a job on this thread, as the channel's in-process run. */
|
|
58
|
+
runLocally: (payload: TRequest, context: WorkerJobContext<TProgress>) => Promise<TResponse>;
|
|
59
|
+
/** The error an in-process run that failed rejects with. */
|
|
60
|
+
jobFailed: (error: Error) => Error;
|
|
61
|
+
/** End a factory's worker, so the next job starts on a fresh one. */
|
|
62
|
+
abandon: () => void;
|
|
63
|
+
/** End the worker, whatever made it. */
|
|
64
|
+
terminate: () => void;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=workerSlot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workerSlot.d.ts","sourceRoot":"","sources":["../../../src/worker/core/workerSlot.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAyB,MAAM,eAAe,CAAC;AACvE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAKvD,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,YAAY,EACb,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAC7D,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,iBAAiB,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,GACzD,UAAU,CAAC,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B,4DAA4D;IAC5D,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,KAAK,CAAC;IACnC,qEAAqE;IACrE,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,wCAAwC;IACxC,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { errorMessage } from "../../error/core/toError.js";
|
|
2
|
+
import { CancelledRequestError } from "./errors.js";
|
|
3
|
+
import { defaultFailureError, subscribeToWorker, } from "./workerChannelParts.js";
|
|
4
|
+
/**
|
|
5
|
+
* The one worker a channel posts to, kept, replaced and listened to.
|
|
6
|
+
*
|
|
7
|
+
* Handed a worker, the slot holds it until it is terminated. Handed a function,
|
|
8
|
+
* it creates the worker on first use and again after one failed or was let go,
|
|
9
|
+
* and runs the jobs on this thread instead — where there is no `Worker`, or
|
|
10
|
+
* where creating one throws — when the channel was given an in-process run.
|
|
11
|
+
* What a worker posts is heard only while it is the slot's current one, so a
|
|
12
|
+
* worker already let go cannot settle a job it no longer runs.
|
|
13
|
+
* @param source - The worker, or the function that creates it.
|
|
14
|
+
* @param options - What the slot reports to, and how failures are worded.
|
|
15
|
+
* @returns The slot.
|
|
16
|
+
*/
|
|
17
|
+
export function createWorkerSlot(source, options) {
|
|
18
|
+
const { name, runInProcess, failure, isWaited, report } = options;
|
|
19
|
+
const factory = typeof source === 'function' ? source : undefined;
|
|
20
|
+
let worker = null;
|
|
21
|
+
let local = factory !== undefined && !('Worker' in globalThis)
|
|
22
|
+
? runInProcess
|
|
23
|
+
: undefined;
|
|
24
|
+
if (typeof source !== 'function') {
|
|
25
|
+
worker = source;
|
|
26
|
+
listen(source);
|
|
27
|
+
}
|
|
28
|
+
function fail(described) {
|
|
29
|
+
return failure?.(described) ?? defaultFailureError(described);
|
|
30
|
+
}
|
|
31
|
+
function acquire() {
|
|
32
|
+
if (local !== undefined)
|
|
33
|
+
return null;
|
|
34
|
+
if (worker !== null)
|
|
35
|
+
return worker;
|
|
36
|
+
if (factory === undefined) {
|
|
37
|
+
throw new CancelledRequestError(`${name} was terminated`);
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
worker = factory();
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
if (runInProcess === undefined) {
|
|
44
|
+
const message = errorMessage(error);
|
|
45
|
+
throw fail({ kind: 'start', name, message, cause: error });
|
|
46
|
+
}
|
|
47
|
+
local = runInProcess;
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
listen(worker);
|
|
51
|
+
return worker;
|
|
52
|
+
}
|
|
53
|
+
function outcomeOf(id, message) {
|
|
54
|
+
if (message.ok) {
|
|
55
|
+
return { ok: true, response: message.response };
|
|
56
|
+
}
|
|
57
|
+
if (!isWaited(id))
|
|
58
|
+
return { ok: false, error: new Error(message.message) };
|
|
59
|
+
const { detail } = message;
|
|
60
|
+
const described = { kind: 'job', name, message: message.message };
|
|
61
|
+
return { ok: false, error: fail({ ...described, detail, cause: message }) };
|
|
62
|
+
}
|
|
63
|
+
function listen(target) {
|
|
64
|
+
subscribeToWorker(target, {
|
|
65
|
+
progress: (id, progress) => {
|
|
66
|
+
if (target === worker)
|
|
67
|
+
report.progress(id, progress);
|
|
68
|
+
},
|
|
69
|
+
answer: (id, message) => {
|
|
70
|
+
if (target === worker)
|
|
71
|
+
report.answer(id, outcomeOf(id, message));
|
|
72
|
+
},
|
|
73
|
+
failure: (detail, event) => {
|
|
74
|
+
if (target !== worker)
|
|
75
|
+
return;
|
|
76
|
+
if (factory !== undefined) {
|
|
77
|
+
target.terminate();
|
|
78
|
+
worker = null;
|
|
79
|
+
}
|
|
80
|
+
report.failure(fail({ kind: 'worker', name, message: detail, cause: event }));
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
hasFactory: factory !== undefined,
|
|
86
|
+
get current() {
|
|
87
|
+
return worker;
|
|
88
|
+
},
|
|
89
|
+
acquire,
|
|
90
|
+
runLocally: (payload, context) => local === undefined
|
|
91
|
+
? Promise.reject(new Error(`${name} has no in-process run`))
|
|
92
|
+
: local(payload, context),
|
|
93
|
+
jobFailed: (error) => fail({ kind: 'job', name, message: error.message, cause: error }),
|
|
94
|
+
abandon: () => {
|
|
95
|
+
if (factory === undefined || worker === null)
|
|
96
|
+
return;
|
|
97
|
+
worker.terminate();
|
|
98
|
+
worker = null;
|
|
99
|
+
},
|
|
100
|
+
terminate: () => {
|
|
101
|
+
worker?.terminate();
|
|
102
|
+
if (factory !== undefined)
|
|
103
|
+
worker = null;
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=workerSlot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workerSlot.js","sourceRoot":"","sources":["../../../src/worker/core/workerSlot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAGpD,OAAO,EACL,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,yBAAyB,CAAC;AAOjC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAAoB,EACpB,OAA0D;IAE1D,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAClE,MAAM,OAAO,GAAG,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAClE,IAAI,MAAM,GAAsB,IAAI,CAAC;IACrC,IAAI,KAAK,GACP,OAAO,KAAK,SAAS,IAAI,CAAC,CAAC,QAAQ,IAAI,UAAU,CAAC;QAChD,CAAC,CAAC,YAAY;QACd,CAAC,CAAC,SAAS,CAAC;IAChB,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;QACjC,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AChB,CAAC;QACD,OAAO;QACP,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAC/B,KAAK,KAAK,SAAS;YACjB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,GAAG,IAAI,wBAAwB,CAAC,CAAC;YAC5D,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC;QAC7B,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CACnB,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;QACnE,OAAO,EAAE,GAAG,EAAE;YACZ,IAAI,OAAO,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI;gBAAE,OAAO;YACrD,MAAM,CAAC,SAAS,EAAE,CAAC;YACnB,MAAM,GAAG,IAAI,CAAC;QAChB,CAAC;QACD,SAAS,EAAE,GAAG,EAAE;YACd,MAAM,EAAE,SAAS,EAAE,CAAC;YACpB,IAAI,OAAO,KAAK,SAAS;gBAAE,MAAM,GAAG,IAAI,CAAC;QAC3C,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-cheminfo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.65.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React components, hooks and framework-free helpers shared by the cheminfo sites: site chrome, citations, sharing, routing, pedagogy, charts, and the structure, orbital and 3D molecule viewers",
|
|
6
6
|
"author": "Luc Patiny",
|
|
@@ -16,8 +16,10 @@
|
|
|
16
16
|
],
|
|
17
17
|
"exports": {
|
|
18
18
|
"./build-info": "./lib/build-info.js",
|
|
19
|
+
"./card": "./lib/card.js",
|
|
19
20
|
"./conformers": "./lib/conformers.js",
|
|
20
21
|
"./core": "./lib/core.js",
|
|
22
|
+
"./formula": "./lib/formula.js",
|
|
21
23
|
"./host": "./lib/host.js",
|
|
22
24
|
"./host-testing": "./lib/host-testing.js",
|
|
23
25
|
"./ir": "./lib/ir.js",
|
|
@@ -76,9 +78,12 @@
|
|
|
76
78
|
"intl-messageformat": "^11.2.15",
|
|
77
79
|
"ir-spectrum": "^4.2.0",
|
|
78
80
|
"leven": "^4.1.0",
|
|
81
|
+
"mf-parser": "^3.9.3",
|
|
79
82
|
"ml-spectra-processing": "^14.35.1",
|
|
83
|
+
"ml-xsadd": "^3.0.1",
|
|
80
84
|
"openchemlib": "^9.25.0",
|
|
81
85
|
"react-markdown": "^10.1.0",
|
|
86
|
+
"react-mf": "^3.1.1",
|
|
82
87
|
"rehype-raw": "^7.0.0",
|
|
83
88
|
"rehype-sanitize": "^6.0.0",
|
|
84
89
|
"semver": "^7.8.5",
|
|
@@ -87,6 +92,7 @@
|
|
|
87
92
|
"devDependencies": {
|
|
88
93
|
"@blueprintjs/core": "^6.18.0",
|
|
89
94
|
"@fastify/static": "^10.1.6",
|
|
95
|
+
"@fastify/type-provider-typebox": "^6.3.0",
|
|
90
96
|
"@playwright/test": "^1.62.1",
|
|
91
97
|
"@storybook/addon-docs": "^10.5.8",
|
|
92
98
|
"@storybook/react-vite": "^10.5.8",
|
|
@@ -98,6 +104,7 @@
|
|
|
98
104
|
"@zakodium/tsconfig": "^1.0.5",
|
|
99
105
|
"benchmark": "^2.1.4",
|
|
100
106
|
"chemical-elements": "^2.3.2",
|
|
107
|
+
"cheminfo-mcp-server": "^0.6.2",
|
|
101
108
|
"eslint": "^9.39.5",
|
|
102
109
|
"eslint-config-cheminfo-react": "^20.1.0",
|
|
103
110
|
"eslint-config-cheminfo-typescript": "^22.1.0",
|
|
@@ -123,6 +130,8 @@
|
|
|
123
130
|
"peerDependencies": {
|
|
124
131
|
"@blueprintjs/core": "^6.18.0",
|
|
125
132
|
"@fastify/static": "^10.0.0",
|
|
133
|
+
"@fastify/type-provider-typebox": "^6.0.0",
|
|
134
|
+
"cheminfo-mcp-server": "^0.6.2",
|
|
126
135
|
"fastify": "^5.0.0",
|
|
127
136
|
"ml-pca": "^4.1.1",
|
|
128
137
|
"ml-signal-processing": "^2.2.2",
|
|
@@ -147,6 +156,12 @@
|
|
|
147
156
|
"@fastify/static": {
|
|
148
157
|
"optional": true
|
|
149
158
|
},
|
|
159
|
+
"@fastify/type-provider-typebox": {
|
|
160
|
+
"optional": true
|
|
161
|
+
},
|
|
162
|
+
"cheminfo-mcp-server": {
|
|
163
|
+
"optional": true
|
|
164
|
+
},
|
|
150
165
|
"fastify": {
|
|
151
166
|
"optional": true
|
|
152
167
|
},
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The card of an answer, as its address says it.
|
|
3
|
+
*
|
|
4
|
+
* A chat shows a tool's answer twice: inline, as a card drawing only what the
|
|
5
|
+
* question asked, and over the full screen, as the site's page. The card is
|
|
6
|
+
* that page with `card` in its query, always with `embed`, so the card and
|
|
7
|
+
* the page behind it read the same parameters and can never disagree about
|
|
8
|
+
* what was asked. `card` is read by its presence: `?card` and `?card=1` both
|
|
9
|
+
* ask for it.
|
|
10
|
+
*
|
|
11
|
+
* Pure string work: the page reads these addresses, and the tool server
|
|
12
|
+
* writes them, in Node.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { parseQueryEntries } from '../../router/core/query.ts';
|
|
16
|
+
import { EMBED_PARAM, HIDE_PARAM } from '../../share/core/config.ts';
|
|
17
|
+
|
|
18
|
+
/** The parameter asking for the answer's card instead of the page. */
|
|
19
|
+
export const CARD_PARAM = 'card';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Whether an address asks for a card.
|
|
23
|
+
* @param search - The query string, with or without its leading `?`.
|
|
24
|
+
* @returns True when it names `card`, with a value or bare.
|
|
25
|
+
*/
|
|
26
|
+
export function isCardAddress(search: string): boolean {
|
|
27
|
+
for (const [key] of parseQueryEntries(search)) {
|
|
28
|
+
if (key === CARD_PARAM) return true;
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The address a card is at: `globalThis.location`, a `URL`, or any record of
|
|
35
|
+
* the three parts.
|
|
36
|
+
*/
|
|
37
|
+
export interface CardLocation {
|
|
38
|
+
/** Its origin, e.g. `https://equilibrium.cheminfo.org`. */
|
|
39
|
+
readonly origin: string;
|
|
40
|
+
/** Its path, the mount and a language prefix included. */
|
|
41
|
+
readonly pathname: string;
|
|
42
|
+
/** Its query string, with or without its `?`. */
|
|
43
|
+
readonly search: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** How {@link sitePageUrl} tells the card's parameters from the page's. */
|
|
47
|
+
export interface SitePageOptions {
|
|
48
|
+
/**
|
|
49
|
+
* The parameters only the site's card reads, beside `card` itself: what a
|
|
50
|
+
* card draws beyond the page, e.g. `['rows']`, `['scale', 'ph']`.
|
|
51
|
+
* @default []
|
|
52
|
+
*/
|
|
53
|
+
cardParams?: readonly string[];
|
|
54
|
+
/**
|
|
55
|
+
* Read a `+` in a key as a plus rather than as a space, as
|
|
56
|
+
* `parseQueryEntries` does. A key carries no `+` on any site of the family,
|
|
57
|
+
* so this only matters to a site that writes its own addresses with
|
|
58
|
+
* `URLSearchParams`.
|
|
59
|
+
* @default true
|
|
60
|
+
*/
|
|
61
|
+
literalPlus?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* A parameter the page at a given path does not read, though another page
|
|
64
|
+
* of the site does: a tutorial step reads no InChI, the converter does.
|
|
65
|
+
* @default undefined - nothing beyond `card`, `embed`, `hide` and
|
|
66
|
+
* `cardParams` is left out
|
|
67
|
+
*/
|
|
68
|
+
isCardOnly?: (key: string, pathname: string) => boolean;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The site's own page a card stands for, with its chrome: the card's address
|
|
73
|
+
* without `card`, `embed`, `hide` and what only the card reads. Every other
|
|
74
|
+
* parameter is kept exactly as it was written, so the `+` of a charged atom
|
|
75
|
+
* stays a plus and the commas of a list stay commas. This is the address an
|
|
76
|
+
* answer's `link` names, and the one the card's Details button opens.
|
|
77
|
+
* @param location - The card's address: `globalThis.location`, or
|
|
78
|
+
* `new URL(href)` for an address held as text.
|
|
79
|
+
* @param options - What only the site's card reads.
|
|
80
|
+
* @returns The page's absolute address, without a fragment.
|
|
81
|
+
*/
|
|
82
|
+
export function sitePageUrl(
|
|
83
|
+
location: CardLocation,
|
|
84
|
+
options: SitePageOptions = {},
|
|
85
|
+
): string {
|
|
86
|
+
const { cardParams = [], literalPlus = true, isCardOnly } = options;
|
|
87
|
+
const dropped = new Set([CARD_PARAM, EMBED_PARAM, HIDE_PARAM, ...cardParams]);
|
|
88
|
+
const kept: string[] = [];
|
|
89
|
+
const search = location.search.startsWith('?')
|
|
90
|
+
? location.search.slice(1)
|
|
91
|
+
: location.search;
|
|
92
|
+
for (const part of search.split('&')) {
|
|
93
|
+
const [entry] = parseQueryEntries(part, { literalPlus });
|
|
94
|
+
if (entry === undefined || dropped.has(entry[0])) continue;
|
|
95
|
+
if (isCardOnly?.(entry[0], location.pathname)) continue;
|
|
96
|
+
kept.push(part);
|
|
97
|
+
}
|
|
98
|
+
const query = kept.join('&');
|
|
99
|
+
return `${location.origin}${location.pathname}${query === '' ? '' : `?${query}`}`;
|
|
100
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two addresses a chat frames for one answer: the card, inline, and the
|
|
3
|
+
* page itself, over the full screen. Both are the site's page under `embed`,
|
|
4
|
+
* so neither carries the site's chrome; the card adds `card` and what only it
|
|
5
|
+
* reads.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { QueryEntry } from '../../router/core/query.ts';
|
|
9
|
+
import { formatQueryEntries } from '../../router/core/query.ts';
|
|
10
|
+
import { EMBED_PARAM, HIDE_PARAM } from '../../share/core/config.ts';
|
|
11
|
+
|
|
12
|
+
import { CARD_PARAM } from './cardAddress.ts';
|
|
13
|
+
|
|
14
|
+
/** How {@link framedPageUrl} frames a page. */
|
|
15
|
+
export interface FramedPageOptions {
|
|
16
|
+
/**
|
|
17
|
+
* The parts of the page left out, on the card and on the full page alike:
|
|
18
|
+
* keys of the site's `hide` vocabulary, written `hide=a,b`.
|
|
19
|
+
* @default []
|
|
20
|
+
*/
|
|
21
|
+
hide?: readonly string[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** What {@link cardPageUrl} adds to the framed page. */
|
|
25
|
+
export interface CardPageOptions extends FramedPageOptions {
|
|
26
|
+
/**
|
|
27
|
+
* What `card` carries, for a site whose page draws more than one card:
|
|
28
|
+
* wikidata's `card=infobox`.
|
|
29
|
+
* @default '1'
|
|
30
|
+
*/
|
|
31
|
+
card?: string;
|
|
32
|
+
/**
|
|
33
|
+
* What only the card reads, written after `card` in the order given, e.g.
|
|
34
|
+
* `{ rows: '10' }`. A value left `undefined` or empty is not written.
|
|
35
|
+
* @default {}
|
|
36
|
+
*/
|
|
37
|
+
extra?: Readonly<Record<string, string | undefined>>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The page under `embed=1`, and `hide` when parts are left out: what a chat
|
|
42
|
+
* shows over the full screen when the reader asks for more than the card.
|
|
43
|
+
* @param page - The site's page as people open it, with its own query and
|
|
44
|
+
* without `embed`, `hide` or `card`; absolute, or a path.
|
|
45
|
+
* @param options - The parts left out.
|
|
46
|
+
* @returns The framed page's address.
|
|
47
|
+
*/
|
|
48
|
+
export function framedPageUrl(
|
|
49
|
+
page: string,
|
|
50
|
+
options: FramedPageOptions = {},
|
|
51
|
+
): string {
|
|
52
|
+
const { hide = [] } = options;
|
|
53
|
+
const entries: QueryEntry[] = [[EMBED_PARAM, '1']];
|
|
54
|
+
if (hide.length > 0) entries.push([HIDE_PARAM, hide.join(',')]);
|
|
55
|
+
return withQueryEntries(page, entries);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The card of an answer: the framed page with `card`, and what only the card
|
|
60
|
+
* reads after it.
|
|
61
|
+
* @param page - The site's page as people open it, with its own query and
|
|
62
|
+
* without `embed`, `hide` or `card`; absolute, or a path.
|
|
63
|
+
* @param options - The parts left out, and what the card draws.
|
|
64
|
+
* @returns The card's address.
|
|
65
|
+
*/
|
|
66
|
+
export function cardPageUrl(
|
|
67
|
+
page: string,
|
|
68
|
+
options: CardPageOptions = {},
|
|
69
|
+
): string {
|
|
70
|
+
const { card = '1', extra = {} } = options;
|
|
71
|
+
const entries: QueryEntry[] = [[CARD_PARAM, card]];
|
|
72
|
+
for (const [key, value] of Object.entries(extra)) {
|
|
73
|
+
if (value !== undefined && value !== '') entries.push([key, value]);
|
|
74
|
+
}
|
|
75
|
+
return withQueryEntries(framedPageUrl(page, options), entries);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Append parameters to an address, before its fragment.
|
|
80
|
+
* @param address - The address, with or without a query.
|
|
81
|
+
* @param entries - The parameters, in the order they are written.
|
|
82
|
+
* @returns The address carrying them.
|
|
83
|
+
*/
|
|
84
|
+
function withQueryEntries(
|
|
85
|
+
address: string,
|
|
86
|
+
entries: readonly QueryEntry[],
|
|
87
|
+
): string {
|
|
88
|
+
const hashIndex = address.indexOf('#');
|
|
89
|
+
const head = hashIndex === -1 ? address : address.slice(0, hashIndex);
|
|
90
|
+
const fragment = hashIndex === -1 ? '' : address.slice(hashIndex);
|
|
91
|
+
const separator = head.includes('?')
|
|
92
|
+
? head.endsWith('?') || head.endsWith('&')
|
|
93
|
+
? ''
|
|
94
|
+
: '&'
|
|
95
|
+
: '?';
|
|
96
|
+
return `${head}${separator}${formatQueryEntries(entries)}${fragment}`;
|
|
97
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { CardLocation, SitePageOptions } from './cardAddress.ts';
|
|
2
|
+
export { CARD_PARAM, isCardAddress, sitePageUrl } from './cardAddress.ts';
|
|
3
|
+
export type { CardPageOptions, FramedPageOptions } from './cardPageUrl.ts';
|
|
4
|
+
export { cardPageUrl, framedPageUrl } from './cardPageUrl.ts';
|
|
5
|
+
export type { OpenPanel } from './panelRoom.ts';
|
|
6
|
+
export { roomForPanels } from './panelRoom.ts';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Room in the frame for a panel a card opens over itself.
|
|
3
|
+
*
|
|
4
|
+
* A chat sizes the frame of a card from the card's own height, and a popover
|
|
5
|
+
* or a dialog opened from the card — the panel that copies or saves a figure,
|
|
6
|
+
* the notations of a structure — is drawn over the card inside that frame.
|
|
7
|
+
* Taller than the card, it would be cut off at the frame's edge, its Copy
|
|
8
|
+
* button with it. So while one is open the card is made as tall as the panel
|
|
9
|
+
* needs, which grows the frame with it.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** What one open panel needs of the frame. */
|
|
13
|
+
export interface OpenPanel {
|
|
14
|
+
/**
|
|
15
|
+
* `dialog`: centred in the frame; `popover`: hung beside or under the
|
|
16
|
+
* control that opened it.
|
|
17
|
+
*/
|
|
18
|
+
kind: 'dialog' | 'popover';
|
|
19
|
+
/**
|
|
20
|
+
* Its height with nothing scrolled away, in pixels: a dialog's body scrolls
|
|
21
|
+
* past 70 % of the frame, which is no height at all in a frame of 260. A
|
|
22
|
+
* dialog's margins are counted in.
|
|
23
|
+
*/
|
|
24
|
+
height: number;
|
|
25
|
+
/**
|
|
26
|
+
* Where a popover ends as it is placed, in pixels from the top of the card:
|
|
27
|
+
* one opened at the pointer, or from a control outside the card, hangs lower
|
|
28
|
+
* than the control it is reckoned from.
|
|
29
|
+
* @default undefined - reckoned from the control alone
|
|
30
|
+
*/
|
|
31
|
+
bottom?: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Between a popover and its control, arrow included, and under the popover:
|
|
36
|
+
* enough for one hung under its control, and a margin for one beside it.
|
|
37
|
+
*/
|
|
38
|
+
const POPOVER_SPACE = 24;
|
|
39
|
+
|
|
40
|
+
/** Under a popover placed where it is, so that its shadow is not cut. */
|
|
41
|
+
const POPOVER_GAP = 8;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* How tall the card must be for every open panel to fit in its frame.
|
|
45
|
+
* @param panels - The panels on screen.
|
|
46
|
+
* @param anchor - Where the lowest control whose popover is open ends, in
|
|
47
|
+
* pixels from the top of the card; a popover hangs from it.
|
|
48
|
+
* @returns The least height of the card, or 0 when no panel is open.
|
|
49
|
+
*/
|
|
50
|
+
export function roomForPanels(
|
|
51
|
+
panels: readonly OpenPanel[],
|
|
52
|
+
anchor: number,
|
|
53
|
+
): number {
|
|
54
|
+
let room = 0;
|
|
55
|
+
for (const panel of panels) {
|
|
56
|
+
let needed = panel.height;
|
|
57
|
+
if (panel.kind === 'popover') {
|
|
58
|
+
needed = anchor + panel.height + POPOVER_SPACE;
|
|
59
|
+
if (panel.bottom !== undefined && panel.bottom + POPOVER_GAP > needed) {
|
|
60
|
+
needed = panel.bottom + POPOVER_GAP;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (needed > room) room = needed;
|
|
64
|
+
}
|
|
65
|
+
return Math.ceil(room);
|
|
66
|
+
}
|