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
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import type { Language } from '../../i18n/core/languages.ts';
|
|
2
|
+
|
|
3
|
+
/** A tab whose address carries more than the tab's own name. */
|
|
4
|
+
export interface TabDefinition<Tab extends string = string> {
|
|
5
|
+
/** Identifier of the tab, as the state and the components name it. */
|
|
6
|
+
id: Tab;
|
|
7
|
+
/**
|
|
8
|
+
* The address of the tab, from the site's own root. The home tab is always
|
|
9
|
+
* written as `/`, whatever it declares here, so the site has one address for
|
|
10
|
+
* it instead of two holding the same thing.
|
|
11
|
+
* @default `/${id}`
|
|
12
|
+
*/
|
|
13
|
+
path?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Whether the tab addresses one of its items in a second path segment — a
|
|
16
|
+
* tutorial step, an exercise, an element — so a lecturer can hand out a deep
|
|
17
|
+
* link and a crawler indexes each item as a page of its own.
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
takesId?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** How the addresses of a site's tabs are read and written. */
|
|
24
|
+
export interface TabRouterOptions<Tab extends string> {
|
|
25
|
+
/** Every tab of the site, named on its own or described in full. */
|
|
26
|
+
tabs: ReadonlyArray<Tab | TabDefinition<Tab>>;
|
|
27
|
+
/**
|
|
28
|
+
* The tab living at the root, and the one an address the site does not know
|
|
29
|
+
* opens — a link written before a rename still lands somewhere.
|
|
30
|
+
*/
|
|
31
|
+
home: Tab;
|
|
32
|
+
/**
|
|
33
|
+
* Whether the address is the path or the fragment. A public tool must use
|
|
34
|
+
* `'path'`: a `#` is dropped by half the tools that pass links around, the
|
|
35
|
+
* server never sees it, and a crawler indexes the whole site as one page.
|
|
36
|
+
* `'hash'` exists only so a site already routing that way can adopt this
|
|
37
|
+
* router before it moves.
|
|
38
|
+
* @default 'path'
|
|
39
|
+
*/
|
|
40
|
+
mode?: 'path' | 'hash';
|
|
41
|
+
/**
|
|
42
|
+
* The path the site is served under: nothing on a host of its own, `/surge`
|
|
43
|
+
* as one tool among several on a shared one.
|
|
44
|
+
* @default ''
|
|
45
|
+
*/
|
|
46
|
+
basePath?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Read a `+` in a value as the character it is rather than as a space.
|
|
49
|
+
* Without it a shared SMILES breaks.
|
|
50
|
+
* @default true
|
|
51
|
+
*/
|
|
52
|
+
literalPlus?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Write a parameter carrying nothing back as the bare key, so a hand-typed
|
|
55
|
+
* `?embed` survives the round trip.
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
keepEmptyValues?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Also read an address whose page is named by an old `#/tab/item` fragment,
|
|
61
|
+
* so links handed out before the site routed by path keep working.
|
|
62
|
+
* @default false
|
|
63
|
+
*/
|
|
64
|
+
adoptLegacyHash?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* The languages the site is written in, the default one included. Given,
|
|
67
|
+
* every route carries its `language`: a prefix between the mount and the
|
|
68
|
+
* tab — `/fr/tutorial` — with English written bare, so every link handed out
|
|
69
|
+
* before the site was translated still opens the page it names. A `?lang=` a
|
|
70
|
+
* sibling site handed the language over in is read when the prefix names
|
|
71
|
+
* none, and dropped from the parameters whenever it names a language of the
|
|
72
|
+
* site, since the route then says it once.
|
|
73
|
+
* @default undefined — the site speaks one language and its routes carry none
|
|
74
|
+
*/
|
|
75
|
+
languages?: readonly Language[];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** Where the app is: which tab, what it has open, and how it is set up. */
|
|
79
|
+
export interface TabRoute<Tab extends string = string> {
|
|
80
|
+
/** The tab the address opens. */
|
|
81
|
+
tab: Tab;
|
|
82
|
+
/** The item its second segment names, `null` on a tab that takes none. */
|
|
83
|
+
id: string | null;
|
|
84
|
+
/** Decoded query parameters, the tool's own and the share configuration's. */
|
|
85
|
+
params: Record<string, string>;
|
|
86
|
+
/**
|
|
87
|
+
* The language the page is read in, present only on a router given
|
|
88
|
+
* `languages`: the prefix of the address, else the `?lang=` it carries, else
|
|
89
|
+
* the default language.
|
|
90
|
+
* @default undefined
|
|
91
|
+
*/
|
|
92
|
+
language?: Language;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** A route as a caller writes it, the parts it does not carry left out. */
|
|
96
|
+
export interface TabRouteInput<Tab extends string = string> {
|
|
97
|
+
/** The tab to open; one the router does not know falls back to the home tab. */
|
|
98
|
+
tab: Tab;
|
|
99
|
+
/**
|
|
100
|
+
* The item the tab has open, ignored by a tab that addresses none.
|
|
101
|
+
* @default null
|
|
102
|
+
*/
|
|
103
|
+
id?: string | null;
|
|
104
|
+
/**
|
|
105
|
+
* Query parameters to carry; an empty, `undefined` or `null` value is left out.
|
|
106
|
+
* @default {}
|
|
107
|
+
*/
|
|
108
|
+
params?: Record<string, string | undefined | null>;
|
|
109
|
+
/**
|
|
110
|
+
* The language to write the address in, ignored by a router given no
|
|
111
|
+
* `languages`; one the site does not speak is written as the default.
|
|
112
|
+
* `writeRoute` keeps the language on screen when the route names none.
|
|
113
|
+
* @default the default language, written with no prefix
|
|
114
|
+
*/
|
|
115
|
+
language?: Language;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** The string ↔ route mapping of a site. */
|
|
119
|
+
export interface TabRouter<Tab extends string = string> {
|
|
120
|
+
/** Whether the route lives in the path or in the fragment. */
|
|
121
|
+
mode: 'path' | 'hash';
|
|
122
|
+
/**
|
|
123
|
+
* The route an address denotes. An unknown tab, a trailing slash, an empty
|
|
124
|
+
* address and an escape that does not decode all resolve to something
|
|
125
|
+
* sensible rather than throwing.
|
|
126
|
+
*/
|
|
127
|
+
parse: (address: string) => TabRoute<Tab>;
|
|
128
|
+
/** The address a route is reachable at, mount path and query included. */
|
|
129
|
+
format: (route: TabRouteInput<Tab>) => string;
|
|
130
|
+
/** Whether a string read out of an address names one of the site's tabs. */
|
|
131
|
+
isTab: (value: string) => value is Tab;
|
|
132
|
+
/**
|
|
133
|
+
* The address to put in the bar in place of a link written before the site
|
|
134
|
+
* routed by path: the page it names as this router writes it, with the query
|
|
135
|
+
* string kept as it was. `null` when the address is no such link, or when the
|
|
136
|
+
* router does not adopt them.
|
|
137
|
+
*/
|
|
138
|
+
legacyAddress: (address: string) => string | null;
|
|
139
|
+
/**
|
|
140
|
+
* The address to put in the bar in place of one carrying a `?lang=` the site
|
|
141
|
+
* speaks: the language moved into the path — unless the path already names
|
|
142
|
+
* one, which wins — and every other part of the address kept. `null` when
|
|
143
|
+
* there is nothing to adopt, on a hash router, or on a router given no
|
|
144
|
+
* `languages`.
|
|
145
|
+
* @default undefined — a router built by hand adopts nothing
|
|
146
|
+
*/
|
|
147
|
+
languageAddress?: (address: string) => string | null;
|
|
148
|
+
/**
|
|
149
|
+
* The path the site is served under, as the router normalised it.
|
|
150
|
+
* @default ''
|
|
151
|
+
*/
|
|
152
|
+
basePath?: string;
|
|
153
|
+
/**
|
|
154
|
+
* The languages the router writes, as it was given them.
|
|
155
|
+
* @default undefined — the router writes no language
|
|
156
|
+
*/
|
|
157
|
+
languages?: readonly Language[];
|
|
158
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DESCRIPTION_MAX,
|
|
3
|
+
DESCRIPTION_MIN,
|
|
4
|
+
DESCRIPTION_TARGET,
|
|
5
|
+
} from './limits.ts';
|
|
6
|
+
import { plainDescription, plainProse } from './plainDescription.ts';
|
|
7
|
+
|
|
8
|
+
/** The window {@link fitDescription} grows a description into. */
|
|
9
|
+
export interface FitDescriptionOptions {
|
|
10
|
+
/**
|
|
11
|
+
* The length growing stops at: a description past it keeps what it has.
|
|
12
|
+
* @default 132
|
|
13
|
+
*/
|
|
14
|
+
target?: number;
|
|
15
|
+
/**
|
|
16
|
+
* The shortest description whole sentences of the base may stop at.
|
|
17
|
+
* @default 110
|
|
18
|
+
*/
|
|
19
|
+
minLength?: number;
|
|
20
|
+
/**
|
|
21
|
+
* The longest description, a clause included: one that would run past it is
|
|
22
|
+
* not added.
|
|
23
|
+
* @default 160
|
|
24
|
+
*/
|
|
25
|
+
maxLength?: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The sentence a page is indexed under, cut from its own prose and grown, when
|
|
30
|
+
* that prose is short, with what kind of page it is.
|
|
31
|
+
*
|
|
32
|
+
* The base is fitted first, as `plainDescription` fits it — markup resolved,
|
|
33
|
+
* whole sentences kept, a dot inside `C(=O)O` ending none. Each entry of
|
|
34
|
+
* `extras` is then one choice, written longest first: at most one of its
|
|
35
|
+
* clauses is added, the first that still fits, and growing stops once the text
|
|
36
|
+
* reaches `target`. So a page whose own prose fills a result keeps it, and only
|
|
37
|
+
* a short one is told it is "exercise 3 of 12".
|
|
38
|
+
*
|
|
39
|
+
* Nothing is refused here: a description still outside the window is what
|
|
40
|
+
* `routeProblems` reports, in the test every site asserts empty.
|
|
41
|
+
* @param base - The page's own prose, markup and all.
|
|
42
|
+
* @param extras - Clauses to grow it with, most worth reading first, each
|
|
43
|
+
* entry its alternatives from longest to shortest.
|
|
44
|
+
* @param options - The window the description is grown into.
|
|
45
|
+
* @returns The description.
|
|
46
|
+
*/
|
|
47
|
+
export function fitDescription(
|
|
48
|
+
base: string,
|
|
49
|
+
extras: ReadonlyArray<readonly string[]> = [],
|
|
50
|
+
options: FitDescriptionOptions = {},
|
|
51
|
+
): string {
|
|
52
|
+
const {
|
|
53
|
+
target = DESCRIPTION_TARGET,
|
|
54
|
+
minLength = DESCRIPTION_MIN,
|
|
55
|
+
maxLength = DESCRIPTION_MAX,
|
|
56
|
+
} = options;
|
|
57
|
+
let text = plainDescription(base, { minLength, maxLength });
|
|
58
|
+
// Prose already cut mid-sentence is not grown: a clause after an ellipsis
|
|
59
|
+
// reads as two snippets.
|
|
60
|
+
if (text.endsWith('…')) return text;
|
|
61
|
+
for (const choice of extras) {
|
|
62
|
+
if (text.length >= target) break;
|
|
63
|
+
for (const clause of choice) {
|
|
64
|
+
const words = plainProse(clause);
|
|
65
|
+
if (words === '') continue;
|
|
66
|
+
const grown = text === '' ? words : `${text} ${words}`;
|
|
67
|
+
if (grown.length <= maxLength) {
|
|
68
|
+
text = grown;
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return text;
|
|
74
|
+
}
|
package/src/seo/core/index.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
export type { AlternateOptions } from './alternates.ts';
|
|
2
2
|
export { alternateLinkTags } from './alternates.ts';
|
|
3
3
|
export type { DocumentMeta } from './documentMeta.ts';
|
|
4
|
+
export type { FitDescriptionOptions } from './fitDescription.ts';
|
|
5
|
+
export { fitDescription } from './fitDescription.ts';
|
|
6
|
+
export {
|
|
7
|
+
DESCRIPTION_MAX,
|
|
8
|
+
DESCRIPTION_MIN,
|
|
9
|
+
DESCRIPTION_TARGET,
|
|
10
|
+
TITLE_LIMIT,
|
|
11
|
+
} from './limits.ts';
|
|
4
12
|
export { writeDocumentMeta } from './documentMeta.ts';
|
|
5
13
|
export type {
|
|
6
14
|
NoscriptEcosystem,
|
|
@@ -24,6 +32,13 @@ export { plainDescription, plainProse } from './plainDescription.ts';
|
|
|
24
32
|
export type { RobotsDisallow } from './robots.ts';
|
|
25
33
|
export { robotsTxt } from './robots.ts';
|
|
26
34
|
export { routeProblems, withheldPhrase } from './routeProblems.ts';
|
|
35
|
+
export type { RouteField } from './routeTable.ts';
|
|
36
|
+
export {
|
|
37
|
+
ROUTE_FIELDS,
|
|
38
|
+
ROUTE_TABLE_FILE,
|
|
39
|
+
parseRouteTable,
|
|
40
|
+
serializeRouteTable,
|
|
41
|
+
} from './routeTable.ts';
|
|
27
42
|
export type { RouteMeta } from './routes.ts';
|
|
28
43
|
export { assertRoutes, homeRoute, pageMetaFor, routeFor } from './routes.ts';
|
|
29
44
|
export type { SiteFilesOptions } from './siteFiles.ts';
|
|
@@ -34,3 +49,5 @@ export type { StructuredDataOptions } from './structuredData.ts';
|
|
|
34
49
|
export { structuredDataScript } from './structuredData.ts';
|
|
35
50
|
export { PAGE_BODY_MARKER, PAGE_HEAD_MARKER, fill } from './template.ts';
|
|
36
51
|
export { injectTrackingScript } from './trackingScript.ts';
|
|
52
|
+
export type { PageContentRecord } from './pageContent.ts';
|
|
53
|
+
export { pageContentOf } from './pageContent.ts';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The room a search result gives the words a page is indexed under. They are
|
|
3
|
+
* checked by `routeProblems` and fitted by `plainDescription` and
|
|
4
|
+
* `fitDescription`, so a site that composes its own prose reads them here
|
|
5
|
+
* rather than re-typing them.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The longest title that survives a search result whole, before the site name
|
|
10
|
+
* is appended to it.
|
|
11
|
+
*/
|
|
12
|
+
export const TITLE_LIMIT = 60;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The shortest description that says anything: under it a result pads the
|
|
16
|
+
* snippet with whatever text the crawler found on the page.
|
|
17
|
+
*/
|
|
18
|
+
export const DESCRIPTION_MIN = 110;
|
|
19
|
+
|
|
20
|
+
/** The longest description a result shows without clipping it. */
|
|
21
|
+
export const DESCRIPTION_MAX = 160;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* What a grown description aims for. It sits above {@link DESCRIPTION_MIN}
|
|
25
|
+
* because the floor is not the goal: a clause that fits is one the reader gets.
|
|
26
|
+
*/
|
|
27
|
+
export const DESCRIPTION_TARGET = 132;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The text each address says for itself, read from one record of the pages a
|
|
3
|
+
* site has written for.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { Language } from '../../i18n/core/languages.ts';
|
|
7
|
+
|
|
8
|
+
import type { PageContent } from './pageProse.ts';
|
|
9
|
+
import type { RouteMeta } from './routes.ts';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The pages a site has written for, by path, or a function giving them in
|
|
13
|
+
* each language.
|
|
14
|
+
*/
|
|
15
|
+
export type PageContentRecord =
|
|
16
|
+
| Readonly<Record<string, PageContent>>
|
|
17
|
+
| ((language: Language) => Readonly<Record<string, PageContent>>);
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* What each address says for itself: the page written for its path when there
|
|
21
|
+
* is one, and otherwise the name and the sentence the route is already indexed
|
|
22
|
+
* under.
|
|
23
|
+
*
|
|
24
|
+
* The fallback repeats the snippet rather than adding to it, which is thin —
|
|
25
|
+
* but the route table writes those distinctly per page, so a thin page is never
|
|
26
|
+
* a duplicate of its neighbour, and no address ships the bare menu.
|
|
27
|
+
* @param pages - The pages written for, by path.
|
|
28
|
+
* @returns The function `cheminfoPrerender` calls once per route and language.
|
|
29
|
+
*/
|
|
30
|
+
export function pageContentOf(
|
|
31
|
+
pages: PageContentRecord,
|
|
32
|
+
): (route: RouteMeta, language: Language) => PageContent {
|
|
33
|
+
return (route, language) => {
|
|
34
|
+
const written = typeof pages === 'function' ? pages(language) : pages;
|
|
35
|
+
return (
|
|
36
|
+
written[route.path] ?? {
|
|
37
|
+
heading: route.title,
|
|
38
|
+
paragraphs: [route.description],
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { InlineSegment } from '../../pedagogy/core/inlineMarks.ts';
|
|
2
2
|
import { parseInlineMarks } from '../../pedagogy/core/inlineMarks.ts';
|
|
3
3
|
|
|
4
|
+
import { DESCRIPTION_MAX, DESCRIPTION_MIN } from './limits.ts';
|
|
5
|
+
|
|
4
6
|
/** The room a search result gives a description. */
|
|
5
7
|
export interface PlainDescriptionOptions {
|
|
6
8
|
/**
|
|
@@ -34,8 +36,8 @@ export function plainDescription(
|
|
|
34
36
|
prose: string,
|
|
35
37
|
options: PlainDescriptionOptions = {},
|
|
36
38
|
): string {
|
|
37
|
-
const maxLength = options.maxLength ??
|
|
38
|
-
const minLength = options.minLength ??
|
|
39
|
+
const maxLength = options.maxLength ?? DESCRIPTION_MAX;
|
|
40
|
+
const minLength = options.minLength ?? DESCRIPTION_MIN;
|
|
39
41
|
const text = plainProse(prose);
|
|
40
42
|
if (text.length <= maxLength) return text;
|
|
41
43
|
const whole = wholeSentences(text, maxLength);
|
|
@@ -11,15 +11,9 @@
|
|
|
11
11
|
* The paths are `assertRoutes`' business; this is about the words.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
+
import { DESCRIPTION_MAX, DESCRIPTION_MIN, TITLE_LIMIT } from './limits.ts';
|
|
14
15
|
import type { RouteMeta } from './routes.ts';
|
|
15
16
|
|
|
16
|
-
/** The longest title that survives a search result whole. */
|
|
17
|
-
const TITLE_LIMIT = 60;
|
|
18
|
-
/** The shortest description that says anything. */
|
|
19
|
-
const DESCRIPTION_MIN = 110;
|
|
20
|
-
/** The longest description a result shows without clipping it. */
|
|
21
|
-
const DESCRIPTION_MAX = 160;
|
|
22
|
-
|
|
23
17
|
/**
|
|
24
18
|
* What a site never says about itself, in the words it would say it in. A
|
|
25
19
|
* snippet naming a repository, a tracker or a licence is both a promise the
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The route table a build writes beside its page, for the server that hands the
|
|
3
|
+
* page out: it titles every address from it, lists it in `sitemap.xml` and links
|
|
4
|
+
* it from the crawl path. The app's own table is the one thing that knows the
|
|
5
|
+
* pages, so there is one table rather than two that drift.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { RouteMeta } from './routes.ts';
|
|
9
|
+
import { assertRoutes } from './routes.ts';
|
|
10
|
+
|
|
11
|
+
/** The file the table is written to, next to `index.html`. */
|
|
12
|
+
export const ROUTE_TABLE_FILE = 'routes.json';
|
|
13
|
+
|
|
14
|
+
/** A field of a route the table can carry. */
|
|
15
|
+
export type RouteField = keyof RouteMeta;
|
|
16
|
+
|
|
17
|
+
/** Every field of a route, in the order they are written. */
|
|
18
|
+
export const ROUTE_FIELDS: readonly RouteField[] = [
|
|
19
|
+
'path',
|
|
20
|
+
'title',
|
|
21
|
+
'description',
|
|
22
|
+
'short',
|
|
23
|
+
'note',
|
|
24
|
+
'indexed',
|
|
25
|
+
'prefix',
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
/** The fields a route cannot be read without. */
|
|
29
|
+
const REQUIRED_FIELDS: readonly RouteField[] = ['path', 'title', 'description'];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Write a route table as the file a server reads back.
|
|
33
|
+
* @param routes - Every address the site answers.
|
|
34
|
+
* @param fields - The fields written; `path`, `title` and `description` are
|
|
35
|
+
* always written, since a route cannot be read without them.
|
|
36
|
+
* @returns The JSON document, ending with a newline.
|
|
37
|
+
*/
|
|
38
|
+
export function serializeRouteTable(
|
|
39
|
+
routes: readonly RouteMeta[],
|
|
40
|
+
fields: readonly RouteField[] = ROUTE_FIELDS,
|
|
41
|
+
): string {
|
|
42
|
+
const written = new Set<RouteField>([...REQUIRED_FIELDS, ...fields]);
|
|
43
|
+
const order = ROUTE_FIELDS.filter((field) => written.has(field));
|
|
44
|
+
const table = routes.map((route) => {
|
|
45
|
+
const entry: Record<string, unknown> = {};
|
|
46
|
+
for (const field of order) {
|
|
47
|
+
if (route[field] !== undefined) entry[field] = route[field];
|
|
48
|
+
}
|
|
49
|
+
return entry;
|
|
50
|
+
});
|
|
51
|
+
return `${JSON.stringify(table, null, 2)}\n`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Read a route table back, refusing anything the build did not write: an empty
|
|
56
|
+
* table, an entry missing its path, title or description, a field of the wrong
|
|
57
|
+
* type, or a table `assertRoutes` refuses.
|
|
58
|
+
* @param value - The parsed JSON.
|
|
59
|
+
* @returns The routes, carrying only the fields a route has, or `undefined`
|
|
60
|
+
* when the value is not a route table.
|
|
61
|
+
*/
|
|
62
|
+
export function parseRouteTable(value: unknown): RouteMeta[] | undefined {
|
|
63
|
+
if (!Array.isArray(value) || value.length === 0) return undefined;
|
|
64
|
+
const routes: RouteMeta[] = [];
|
|
65
|
+
for (const entry of value) {
|
|
66
|
+
const route = readRoute(entry);
|
|
67
|
+
if (route === undefined) return undefined;
|
|
68
|
+
routes.push(route);
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
assertRoutes(routes);
|
|
72
|
+
} catch {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
return routes;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function readRoute(value: unknown): RouteMeta | undefined {
|
|
79
|
+
if (typeof value !== 'object' || value === null) return undefined;
|
|
80
|
+
const entry = value as Record<string, unknown>;
|
|
81
|
+
const { path, title, description, short, note, indexed, prefix } = entry;
|
|
82
|
+
if (
|
|
83
|
+
typeof path !== 'string' ||
|
|
84
|
+
typeof title !== 'string' ||
|
|
85
|
+
typeof description !== 'string' ||
|
|
86
|
+
!isOptional(short, 'string') ||
|
|
87
|
+
!isOptional(note, 'string') ||
|
|
88
|
+
!isOptional(indexed, 'boolean') ||
|
|
89
|
+
!isOptional(prefix, 'boolean')
|
|
90
|
+
) {
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
const route: RouteMeta = { path, title, description };
|
|
94
|
+
if (typeof short === 'string') route.short = short;
|
|
95
|
+
if (typeof note === 'string') route.note = note;
|
|
96
|
+
if (typeof indexed === 'boolean') route.indexed = indexed;
|
|
97
|
+
if (typeof prefix === 'boolean') route.prefix = prefix;
|
|
98
|
+
return route;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function isOptional(value: unknown, type: 'string' | 'boolean'): boolean {
|
|
102
|
+
return value === undefined || typeof value === type;
|
|
103
|
+
}
|
package/src/seo/vite/index.ts
CHANGED
|
@@ -2,3 +2,5 @@ export type { OgCardOptions } from './ogCard.ts';
|
|
|
2
2
|
export { OG_HEIGHT, OG_WIDTH, ogCardHtml } from './ogCard.ts';
|
|
3
3
|
export type { PrerenderOptions } from './prerender.ts';
|
|
4
4
|
export { cheminfoPrerender } from './prerender.ts';
|
|
5
|
+
export type { RouteTableOptions } from './routeTable.ts';
|
|
6
|
+
export { cheminfoRouteTable } from './routeTable.ts';
|
|
@@ -36,6 +36,8 @@ import { withLanguagePath } from '../../language/core/languagePath.ts';
|
|
|
36
36
|
import { trimTrailingSlash } from '../../router/core/address.ts';
|
|
37
37
|
import type { NoscriptText } from '../core/noscript.ts';
|
|
38
38
|
import { noscriptIndex } from '../core/noscript.ts';
|
|
39
|
+
import type { PageContentRecord } from '../core/pageContent.ts';
|
|
40
|
+
import { pageContentOf } from '../core/pageContent.ts';
|
|
39
41
|
import { pageHeadTags } from '../core/pageMeta.ts';
|
|
40
42
|
import type { PageContent } from '../core/pageProse.ts';
|
|
41
43
|
import type { RobotsDisallow } from '../core/robots.ts';
|
|
@@ -124,6 +126,15 @@ export interface PrerenderOptions {
|
|
|
124
126
|
* @default undefined — every page carries the menu alone
|
|
125
127
|
*/
|
|
126
128
|
content?: (route: RouteMeta, language: Language) => PageContent | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* The pages written for, by path — or a function giving them per language —
|
|
131
|
+
* for a site that would otherwise write `content` only to look a path up in
|
|
132
|
+
* them. Every other address then says the name and the sentence its route
|
|
133
|
+
* is indexed under, so none ships the bare menu. `content`, when given, is
|
|
134
|
+
* read instead.
|
|
135
|
+
* @default undefined — `content` alone decides
|
|
136
|
+
*/
|
|
137
|
+
pages?: PageContentRecord;
|
|
127
138
|
/**
|
|
128
139
|
* Every language the site is written in, the default one included.
|
|
129
140
|
*
|
|
@@ -306,7 +317,7 @@ function crawlPathOf(
|
|
|
306
317
|
const noscript =
|
|
307
318
|
typeof declared === 'function' ? declared(language) : declared;
|
|
308
319
|
if (noscript === false) return '';
|
|
309
|
-
const content = options
|
|
320
|
+
const content = contentOf(options, route, language);
|
|
310
321
|
const { routes: listed, ...prose } = noscript === true ? {} : noscript;
|
|
311
322
|
// The crawl path of a translated page links to that language's addresses: a
|
|
312
323
|
// French page listing the English ones is a crawler's only route out of it,
|
|
@@ -351,3 +362,17 @@ function withHtmlLang(template: string, language: Language): string {
|
|
|
351
362
|
`<html$<attributes> lang="${language}"`,
|
|
352
363
|
);
|
|
353
364
|
}
|
|
365
|
+
|
|
366
|
+
// What a page says for itself: the site's own function when it wrote one, and
|
|
367
|
+
// otherwise the page it wrote for that path, or the route's name and sentence.
|
|
368
|
+
function contentOf(
|
|
369
|
+
options: PrerenderOptions,
|
|
370
|
+
route: RouteMeta,
|
|
371
|
+
language: Language,
|
|
372
|
+
): PageContent | undefined {
|
|
373
|
+
const { content, pages } = options;
|
|
374
|
+
if (content !== undefined) return content(route, language);
|
|
375
|
+
return pages === undefined
|
|
376
|
+
? undefined
|
|
377
|
+
: pageContentOf(pages)(route, language);
|
|
378
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Write the route table beside the page a server hands out.
|
|
3
|
+
*
|
|
4
|
+
* A site with a backend titles every address it answers, lists it in
|
|
5
|
+
* `sitemap.xml` and links it from the crawl path — and the app's own route table
|
|
6
|
+
* is the one thing that knows those addresses. So the build writes it next to
|
|
7
|
+
* `index.html`, from the very table the app reads, and `readRouteTable` in
|
|
8
|
+
* `react-cheminfo/server` reads it back: a page added to the site is indexed
|
|
9
|
+
* without anybody remembering to.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { writeFileSync } from 'node:fs';
|
|
13
|
+
import { join, resolve } from 'node:path';
|
|
14
|
+
|
|
15
|
+
import type { Plugin } from 'vite';
|
|
16
|
+
|
|
17
|
+
import type { RouteField } from '../core/routeTable.ts';
|
|
18
|
+
import {
|
|
19
|
+
ROUTE_FIELDS,
|
|
20
|
+
ROUTE_TABLE_FILE,
|
|
21
|
+
serializeRouteTable,
|
|
22
|
+
} from '../core/routeTable.ts';
|
|
23
|
+
import type { RouteMeta } from '../core/routes.ts';
|
|
24
|
+
import { assertRoutes } from '../core/routes.ts';
|
|
25
|
+
|
|
26
|
+
/** Options of {@link cheminfoRouteTable}. */
|
|
27
|
+
export interface RouteTableOptions {
|
|
28
|
+
/** Every address the site answers, each with its title and description. */
|
|
29
|
+
routes: readonly RouteMeta[];
|
|
30
|
+
/**
|
|
31
|
+
* The fields written for each route. `path`, `title` and `description` are
|
|
32
|
+
* always written: a server cannot read a route without them.
|
|
33
|
+
* @default every field of a route
|
|
34
|
+
*/
|
|
35
|
+
fields?: readonly RouteField[];
|
|
36
|
+
/**
|
|
37
|
+
* The file written in the build.
|
|
38
|
+
* @default 'routes.json'
|
|
39
|
+
*/
|
|
40
|
+
fileName?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The Vite plugin writing the route table.
|
|
45
|
+
*
|
|
46
|
+
* The table is author configuration, so it is checked when the build starts —
|
|
47
|
+
* an address written twice, or one climbing out of the site, fails the build
|
|
48
|
+
* rather than shipping two sitemap entries for one page.
|
|
49
|
+
* @param options - The table, and which fields it carries.
|
|
50
|
+
* @returns The Vite plugin.
|
|
51
|
+
*/
|
|
52
|
+
export function cheminfoRouteTable(options: RouteTableOptions): Plugin {
|
|
53
|
+
const {
|
|
54
|
+
routes,
|
|
55
|
+
fields = ROUTE_FIELDS,
|
|
56
|
+
fileName = ROUTE_TABLE_FILE,
|
|
57
|
+
} = options;
|
|
58
|
+
let root = process.cwd();
|
|
59
|
+
let outDir = 'dist';
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
name: 'cheminfo-route-table',
|
|
63
|
+
apply: 'build',
|
|
64
|
+
configResolved(config) {
|
|
65
|
+
root = config.root;
|
|
66
|
+
outDir = config.build.outDir;
|
|
67
|
+
},
|
|
68
|
+
buildStart() {
|
|
69
|
+
assertRoutes(routes);
|
|
70
|
+
},
|
|
71
|
+
writeBundle(output) {
|
|
72
|
+
const directory = output.dir ?? resolve(root, outDir);
|
|
73
|
+
writeFileSync(
|
|
74
|
+
join(directory, fileName),
|
|
75
|
+
serializeRouteTable(routes, fields),
|
|
76
|
+
);
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|