react-cheminfo 0.64.0 → 0.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +282 -0
- package/lib/card/core/cardAddress.d.ts +70 -0
- package/lib/card/core/cardAddress.d.ts.map +1 -0
- package/lib/card/core/cardAddress.js +59 -0
- package/lib/card/core/cardAddress.js.map +1 -0
- package/lib/card/core/cardPageUrl.d.ts +49 -0
- package/lib/card/core/cardPageUrl.d.ts.map +1 -0
- package/lib/card/core/cardPageUrl.js +59 -0
- package/lib/card/core/cardPageUrl.js.map +1 -0
- package/lib/card/core/index.d.ts +7 -0
- package/lib/card/core/index.d.ts.map +1 -0
- package/lib/card/core/index.js +4 -0
- package/lib/card/core/index.js.map +1 -0
- package/lib/card/core/panelRoom.d.ts +40 -0
- package/lib/card/core/panelRoom.d.ts.map +1 -0
- package/lib/card/core/panelRoom.js +40 -0
- package/lib/card/core/panelRoom.js.map +1 -0
- package/lib/card/ui/CardDetailsButton.d.ts +38 -0
- package/lib/card/ui/CardDetailsButton.d.ts.map +1 -0
- package/lib/card/ui/CardDetailsButton.js +50 -0
- package/lib/card/ui/CardDetailsButton.js.map +1 -0
- package/lib/card/ui/CardFigure.d.ts +51 -0
- package/lib/card/ui/CardFigure.d.ts.map +1 -0
- package/lib/card/ui/CardFigure.js +27 -0
- package/lib/card/ui/CardFigure.js.map +1 -0
- package/lib/card/ui/CardFrame.d.ts +30 -0
- package/lib/card/ui/CardFrame.d.ts.map +1 -0
- package/lib/card/ui/CardFrame.js +20 -0
- package/lib/card/ui/CardFrame.js.map +1 -0
- package/lib/card/ui/CopyTableButton.d.ts +37 -0
- package/lib/card/ui/CopyTableButton.d.ts.map +1 -0
- package/lib/card/ui/CopyTableButton.js +19 -0
- package/lib/card/ui/CopyTableButton.js.map +1 -0
- package/lib/card/ui/cardTooltip.d.ts +14 -0
- package/lib/card/ui/cardTooltip.d.ts.map +1 -0
- package/lib/card/ui/cardTooltip.js +15 -0
- package/lib/card/ui/cardTooltip.js.map +1 -0
- package/lib/card/ui/embed.d.ts +15 -0
- package/lib/card/ui/embed.d.ts.map +1 -0
- package/lib/card/ui/embed.js +24 -0
- package/lib/card/ui/embed.js.map +1 -0
- package/lib/card/ui/fitCardToFrame.d.ts +31 -0
- package/lib/card/ui/fitCardToFrame.d.ts.map +1 -0
- package/lib/card/ui/fitCardToFrame.js +66 -0
- package/lib/card/ui/fitCardToFrame.js.map +1 -0
- package/lib/card/ui/holdRoomForPanels.d.ts +16 -0
- package/lib/card/ui/holdRoomForPanels.d.ts.map +1 -0
- package/lib/card/ui/holdRoomForPanels.js +76 -0
- package/lib/card/ui/holdRoomForPanels.js.map +1 -0
- package/lib/card/ui/index.d.ts +11 -0
- package/lib/card/ui/index.d.ts.map +1 -0
- package/lib/card/ui/index.js +7 -0
- package/lib/card/ui/index.js.map +1 -0
- package/lib/card/ui/openPanels.d.ts +25 -0
- package/lib/card/ui/openPanels.d.ts.map +1 -0
- package/lib/card/ui/openPanels.js +85 -0
- package/lib/card/ui/openPanels.js.map +1 -0
- package/lib/card.d.ts +13 -0
- package/lib/card.d.ts.map +1 -0
- package/lib/card.js +13 -0
- package/lib/card.js.map +1 -0
- package/lib/conformers.d.ts +1 -0
- package/lib/conformers.d.ts.map +1 -1
- package/lib/conformers.js +1 -0
- package/lib/conformers.js.map +1 -1
- package/lib/core.d.ts +4 -0
- package/lib/core.d.ts.map +1 -1
- package/lib/core.js +5 -0
- package/lib/core.js.map +1 -1
- package/lib/fetch/core/apiError.d.ts +56 -0
- package/lib/fetch/core/apiError.d.ts.map +1 -0
- package/lib/fetch/core/apiError.js +43 -0
- package/lib/fetch/core/apiError.js.map +1 -0
- package/lib/fetch/core/fetchJson.d.ts +47 -0
- package/lib/fetch/core/fetchJson.d.ts.map +1 -0
- package/lib/fetch/core/fetchJson.js +109 -0
- package/lib/fetch/core/fetchJson.js.map +1 -0
- package/lib/fetch/core/index.d.ts +5 -0
- package/lib/fetch/core/index.d.ts.map +1 -0
- package/lib/fetch/core/index.js +3 -0
- package/lib/fetch/core/index.js.map +1 -0
- package/lib/formula/core/formulaText.d.ts +46 -0
- package/lib/formula/core/formulaText.d.ts.map +1 -0
- package/lib/formula/core/formulaText.js +74 -0
- package/lib/formula/core/formulaText.js.map +1 -0
- package/lib/formula/core/index.d.ts +6 -0
- package/lib/formula/core/index.d.ts.map +1 -0
- package/lib/formula/core/index.js +4 -0
- package/lib/formula/core/index.js.map +1 -0
- package/lib/formula/core/normalizeFormula.d.ts +22 -0
- package/lib/formula/core/normalizeFormula.d.ts.map +1 -0
- package/lib/formula/core/normalizeFormula.js +46 -0
- package/lib/formula/core/normalizeFormula.js.map +1 -0
- package/lib/formula/core/readFormula.d.ts +73 -0
- package/lib/formula/core/readFormula.d.ts.map +1 -0
- package/lib/formula/core/readFormula.js +132 -0
- package/lib/formula/core/readFormula.js.map +1 -0
- package/lib/formula/ui/CopyableFormula.d.ts +31 -0
- package/lib/formula/ui/CopyableFormula.d.ts.map +1 -0
- package/lib/formula/ui/CopyableFormula.js +19 -0
- package/lib/formula/ui/CopyableFormula.js.map +1 -0
- package/lib/formula/ui/FormulaInput.d.ts +29 -0
- package/lib/formula/ui/FormulaInput.d.ts.map +1 -0
- package/lib/formula/ui/FormulaInput.js +16 -0
- package/lib/formula/ui/FormulaInput.js.map +1 -0
- package/lib/formula/ui/QuestionFormula.d.ts +14 -0
- package/lib/formula/ui/QuestionFormula.d.ts.map +1 -0
- package/lib/formula/ui/QuestionFormula.js +13 -0
- package/lib/formula/ui/QuestionFormula.js.map +1 -0
- package/lib/formula/ui/index.d.ts +7 -0
- package/lib/formula/ui/index.d.ts.map +1 -0
- package/lib/formula/ui/index.js +4 -0
- package/lib/formula/ui/index.js.map +1 -0
- package/lib/formula.d.ts +11 -0
- package/lib/formula.d.ts.map +1 -0
- package/lib/formula.js +11 -0
- package/lib/formula.js.map +1 -0
- package/lib/hooks/ui/index.d.ts +1 -0
- package/lib/hooks/ui/index.d.ts.map +1 -1
- package/lib/hooks/ui/index.js.map +1 -1
- package/lib/hooks/ui/keyTargets.d.ts +4 -2
- package/lib/hooks/ui/keyTargets.d.ts.map +1 -1
- package/lib/hooks/ui/keyTargets.js +5 -3
- package/lib/hooks/ui/keyTargets.js.map +1 -1
- package/lib/hooks/ui/useAsync.d.ts +20 -5
- package/lib/hooks/ui/useAsync.d.ts.map +1 -1
- package/lib/hooks/ui/useAsync.js +29 -14
- package/lib/hooks/ui/useAsync.js.map +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
- package/lib/locales/de.json +37 -0
- package/lib/locales/en.json +37 -0
- package/lib/locales/es.json +37 -0
- package/lib/locales/fr.json +37 -0
- package/lib/locales/it.json +37 -0
- package/lib/molecule3d/core/highlight.d.ts.map +1 -1
- package/lib/molecule3d/core/highlight.js +2 -8
- package/lib/molecule3d/core/highlight.js.map +1 -1
- package/lib/molecule3d/core/index.d.ts +1 -1
- package/lib/molecule3d/core/index.d.ts.map +1 -1
- package/lib/molecule3d/core/index.js +1 -1
- package/lib/molecule3d/core/index.js.map +1 -1
- package/lib/molecule3d/core/measurement.d.ts +17 -0
- package/lib/molecule3d/core/measurement.d.ts.map +1 -1
- package/lib/molecule3d/core/measurement.js +43 -0
- package/lib/molecule3d/core/measurement.js.map +1 -1
- package/lib/molecule3d/ui/drawScene.d.ts +4 -2
- package/lib/molecule3d/ui/drawScene.d.ts.map +1 -1
- package/lib/molecule3d/ui/drawScene.js +1 -1
- package/lib/molecule3d/ui/drawScene.js.map +1 -1
- package/lib/molecule3d/ui/moleculeViewer3DProps.d.ts +3 -1
- package/lib/molecule3d/ui/moleculeViewer3DProps.d.ts.map +1 -1
- package/lib/molecule3d/ui/sceneDrawer.d.ts +47 -0
- package/lib/molecule3d/ui/sceneDrawer.d.ts.map +1 -0
- package/lib/molecule3d/ui/sceneDrawer.js +103 -0
- package/lib/molecule3d/ui/sceneDrawer.js.map +1 -0
- package/lib/molecule3d/ui/useMoleculeScene.d.ts +2 -1
- package/lib/molecule3d/ui/useMoleculeScene.d.ts.map +1 -1
- package/lib/molecule3d/ui/useMoleculeScene.js +13 -22
- package/lib/molecule3d/ui/useMoleculeScene.js.map +1 -1
- package/lib/molecule3d/ui/useSharedCamera.d.ts +1 -3
- package/lib/molecule3d/ui/useSharedCamera.d.ts.map +1 -1
- package/lib/molecule3d/ui/useSharedCamera.js.map +1 -1
- package/lib/moleculesClient/core/index.d.ts +5 -0
- package/lib/moleculesClient/core/index.d.ts.map +1 -0
- package/lib/moleculesClient/core/index.js +3 -0
- package/lib/moleculesClient/core/index.js.map +1 -0
- package/lib/moleculesClient/core/moleculesClient.d.ts +12 -0
- package/lib/moleculesClient/core/moleculesClient.d.ts.map +1 -0
- package/lib/moleculesClient/core/moleculesClient.js +105 -0
- package/lib/moleculesClient/core/moleculesClient.js.map +1 -0
- package/lib/moleculesClient/core/moleculesClientApi.d.ts +100 -0
- package/lib/moleculesClient/core/moleculesClientApi.d.ts.map +1 -0
- package/lib/moleculesClient/core/moleculesClientApi.js +20 -0
- package/lib/moleculesClient/core/moleculesClientApi.js.map +1 -0
- package/lib/moleculesClient/core/moleculesTypes.d.ts +154 -0
- package/lib/moleculesClient/core/moleculesTypes.d.ts.map +1 -0
- package/lib/moleculesClient/core/moleculesTypes.js +2 -0
- package/lib/moleculesClient/core/moleculesTypes.js.map +1 -0
- package/lib/moleculesClient/core/requestRetry.d.ts +50 -0
- package/lib/moleculesClient/core/requestRetry.d.ts.map +1 -0
- package/lib/moleculesClient/core/requestRetry.js +108 -0
- package/lib/moleculesClient/core/requestRetry.js.map +1 -0
- package/lib/molstar/core/camera.d.ts +2 -1
- package/lib/molstar/core/camera.d.ts.map +1 -1
- package/lib/molstar/core/camera.js +3 -2
- package/lib/molstar/core/camera.js.map +1 -1
- package/lib/molstar/core/framing.d.ts +102 -0
- package/lib/molstar/core/framing.d.ts.map +1 -0
- package/lib/molstar/core/framing.js +120 -0
- package/lib/molstar/core/framing.js.map +1 -0
- package/lib/molstar/core/hover.d.ts +16 -0
- package/lib/molstar/core/hover.d.ts.map +1 -1
- package/lib/molstar/core/hover.js +14 -0
- package/lib/molstar/core/hover.js.map +1 -1
- package/lib/molstar/core/index.d.ts +4 -1
- package/lib/molstar/core/index.d.ts.map +1 -1
- package/lib/molstar/core/index.js +2 -1
- package/lib/molstar/core/index.js.map +1 -1
- package/lib/pedagogy/core/answers.d.ts +46 -0
- package/lib/pedagogy/core/answers.d.ts.map +1 -0
- package/lib/pedagogy/core/answers.js +77 -0
- package/lib/pedagogy/core/answers.js.map +1 -0
- package/lib/pedagogy/core/attempts.d.ts +86 -0
- package/lib/pedagogy/core/attempts.d.ts.map +1 -0
- package/lib/pedagogy/core/attempts.js +117 -0
- package/lib/pedagogy/core/attempts.js.map +1 -0
- package/lib/pedagogy/core/index.d.ts +8 -0
- package/lib/pedagogy/core/index.d.ts.map +1 -1
- package/lib/pedagogy/core/index.js +4 -0
- package/lib/pedagogy/core/index.js.map +1 -1
- package/lib/pedagogy/core/progressController.d.ts +64 -0
- package/lib/pedagogy/core/progressController.d.ts.map +1 -0
- package/lib/pedagogy/core/progressController.js +56 -0
- package/lib/pedagogy/core/progressController.js.map +1 -0
- package/lib/pedagogy/core/seed.d.ts +96 -0
- package/lib/pedagogy/core/seed.d.ts.map +1 -0
- package/lib/pedagogy/core/seed.js +128 -0
- package/lib/pedagogy/core/seed.js.map +1 -0
- package/lib/pedagogy/core/series.d.ts +77 -0
- package/lib/pedagogy/core/series.d.ts.map +1 -0
- package/lib/pedagogy/core/series.js +10 -0
- package/lib/pedagogy/core/series.js.map +1 -0
- package/lib/pedagogy/ui/AnswerFields.d.ts +21 -0
- package/lib/pedagogy/ui/AnswerFields.d.ts.map +1 -0
- package/lib/pedagogy/ui/AnswerFields.js +24 -0
- package/lib/pedagogy/ui/AnswerFields.js.map +1 -0
- package/lib/pedagogy/ui/ExerciseList.d.ts +82 -0
- package/lib/pedagogy/ui/ExerciseList.d.ts.map +1 -0
- package/lib/pedagogy/ui/ExerciseList.js +53 -0
- package/lib/pedagogy/ui/ExerciseList.js.map +1 -0
- package/lib/pedagogy/ui/ExerciseSeries.d.ts +95 -0
- package/lib/pedagogy/ui/ExerciseSeries.d.ts.map +1 -0
- package/lib/pedagogy/ui/ExerciseSeries.js +74 -0
- package/lib/pedagogy/ui/ExerciseSeries.js.map +1 -0
- package/lib/pedagogy/ui/QuestionCard.d.ts +64 -0
- package/lib/pedagogy/ui/QuestionCard.d.ts.map +1 -0
- package/lib/pedagogy/ui/QuestionCard.js +73 -0
- package/lib/pedagogy/ui/QuestionCard.js.map +1 -0
- package/lib/pedagogy/ui/index.d.ts +10 -0
- package/lib/pedagogy/ui/index.d.ts.map +1 -1
- package/lib/pedagogy/ui/index.js +6 -0
- package/lib/pedagogy/ui/index.js.map +1 -1
- package/lib/pedagogy/ui/seriesCounts.d.ts +17 -0
- package/lib/pedagogy/ui/seriesCounts.d.ts.map +1 -0
- package/lib/pedagogy/ui/seriesCounts.js +27 -0
- package/lib/pedagogy/ui/seriesCounts.js.map +1 -0
- package/lib/pedagogy/ui/seriesParts.d.ts +55 -0
- package/lib/pedagogy/ui/seriesParts.d.ts.map +1 -0
- package/lib/pedagogy/ui/seriesParts.js +38 -0
- package/lib/pedagogy/ui/seriesParts.js.map +1 -0
- package/lib/pedagogy/ui/useAttemptRecords.d.ts +10 -0
- package/lib/pedagogy/ui/useAttemptRecords.d.ts.map +1 -0
- package/lib/pedagogy/ui/useAttemptRecords.js +11 -0
- package/lib/pedagogy/ui/useAttemptRecords.js.map +1 -0
- package/lib/periodic/ui/PeriodicTable.d.ts.map +1 -1
- package/lib/periodic/ui/PeriodicTable.js +6 -3
- package/lib/periodic/ui/PeriodicTable.js.map +1 -1
- package/lib/property/core/copyableText.d.ts +14 -0
- package/lib/property/core/copyableText.d.ts.map +1 -0
- package/lib/property/core/copyableText.js +21 -0
- package/lib/property/core/copyableText.js.map +1 -0
- package/lib/property/core/index.d.ts +2 -0
- package/lib/property/core/index.d.ts.map +1 -0
- package/lib/property/core/index.js +2 -0
- package/lib/property/core/index.js.map +1 -0
- package/lib/property/ui/PropertyTable.d.ts +43 -0
- package/lib/property/ui/PropertyTable.d.ts.map +1 -0
- package/lib/property/ui/PropertyTable.js +19 -0
- package/lib/property/ui/PropertyTable.js.map +1 -0
- package/lib/property/ui/index.d.ts +3 -0
- package/lib/property/ui/index.d.ts.map +1 -0
- package/lib/property/ui/index.js +2 -0
- package/lib/property/ui/index.js.map +1 -0
- package/lib/router/core/history.d.ts +24 -3
- package/lib/router/core/history.d.ts.map +1 -1
- package/lib/router/core/history.js +55 -7
- package/lib/router/core/history.js.map +1 -1
- package/lib/router/core/index.d.ts +3 -3
- package/lib/router/core/index.d.ts.map +1 -1
- package/lib/router/core/index.js +2 -2
- package/lib/router/core/index.js.map +1 -1
- package/lib/router/core/languageRoute.d.ts +61 -0
- package/lib/router/core/languageRoute.d.ts.map +1 -0
- package/lib/router/core/languageRoute.js +96 -0
- package/lib/router/core/languageRoute.js.map +1 -0
- package/lib/router/core/siteAddresses.d.ts +23 -0
- package/lib/router/core/siteAddresses.d.ts.map +1 -1
- package/lib/router/core/siteAddresses.js +26 -0
- package/lib/router/core/siteAddresses.js.map +1 -1
- package/lib/router/core/tabRouter.d.ts +2 -108
- package/lib/router/core/tabRouter.d.ts.map +1 -1
- package/lib/router/core/tabRouter.js +38 -5
- package/lib/router/core/tabRouter.js.map +1 -1
- package/lib/router/core/tabRouterTypes.d.ts +154 -0
- package/lib/router/core/tabRouterTypes.d.ts.map +1 -0
- package/lib/router/core/tabRouterTypes.js +2 -0
- package/lib/router/core/tabRouterTypes.js.map +1 -0
- package/lib/seo/core/fitDescription.d.ts +40 -0
- package/lib/seo/core/fitDescription.d.ts.map +1 -0
- package/lib/seo/core/fitDescription.js +45 -0
- package/lib/seo/core/fitDescription.js.map +1 -0
- package/lib/seo/core/index.d.ts +7 -0
- package/lib/seo/core/index.d.ts.map +1 -1
- package/lib/seo/core/index.js +4 -0
- package/lib/seo/core/index.js.map +1 -1
- package/lib/seo/core/limits.d.ts +24 -0
- package/lib/seo/core/limits.d.ts.map +1 -0
- package/lib/seo/core/limits.js +24 -0
- package/lib/seo/core/limits.js.map +1 -0
- package/lib/seo/core/pageContent.d.ts +25 -0
- package/lib/seo/core/pageContent.d.ts.map +1 -0
- package/lib/seo/core/pageContent.js +25 -0
- package/lib/seo/core/pageContent.js.map +1 -0
- package/lib/seo/core/plainDescription.d.ts.map +1 -1
- package/lib/seo/core/plainDescription.js +3 -2
- package/lib/seo/core/plainDescription.js.map +1 -1
- package/lib/seo/core/routeProblems.d.ts.map +1 -1
- package/lib/seo/core/routeProblems.js +1 -6
- package/lib/seo/core/routeProblems.js.map +1 -1
- package/lib/seo/core/routeTable.d.ts +31 -0
- package/lib/seo/core/routeTable.d.ts.map +1 -0
- package/lib/seo/core/routeTable.js +96 -0
- package/lib/seo/core/routeTable.js.map +1 -0
- package/lib/seo/vite/index.d.ts +2 -0
- package/lib/seo/vite/index.d.ts.map +1 -1
- package/lib/seo/vite/index.js +1 -0
- package/lib/seo/vite/index.js.map +1 -1
- package/lib/seo/vite/prerender.d.ts +10 -0
- package/lib/seo/vite/prerender.d.ts.map +1 -1
- package/lib/seo/vite/prerender.js +12 -1
- package/lib/seo/vite/prerender.js.map +1 -1
- package/lib/seo/vite/routeTable.d.ts +40 -0
- package/lib/seo/vite/routeTable.d.ts.map +1 -0
- package/lib/seo/vite/routeTable.js +44 -0
- package/lib/seo/vite/routeTable.js.map +1 -0
- package/lib/server/answerAddresses.d.ts +51 -0
- package/lib/server/answerAddresses.d.ts.map +1 -0
- package/lib/server/answerAddresses.js +72 -0
- package/lib/server/answerAddresses.js.map +1 -0
- package/lib/server/cardMeta.d.ts +57 -0
- package/lib/server/cardMeta.d.ts.map +1 -0
- package/lib/server/cardMeta.js +52 -0
- package/lib/server/cardMeta.js.map +1 -0
- package/lib/server/config.d.ts +72 -0
- package/lib/server/config.d.ts.map +1 -0
- package/lib/server/config.js +67 -0
- package/lib/server/config.js.map +1 -0
- package/lib/server/envNumber.d.ts +35 -0
- package/lib/server/envNumber.d.ts.map +1 -0
- package/lib/server/envNumber.js +42 -0
- package/lib/server/envNumber.js.map +1 -0
- package/lib/server/healthRoute.d.ts +26 -0
- package/lib/server/healthRoute.d.ts.map +1 -0
- package/lib/server/healthRoute.js +22 -0
- package/lib/server/healthRoute.js.map +1 -0
- package/lib/server/listenSite.d.ts +38 -0
- package/lib/server/listenSite.d.ts.map +1 -0
- package/lib/server/listenSite.js +60 -0
- package/lib/server/listenSite.js.map +1 -0
- package/lib/server/mcpServer.d.ts +8 -0
- package/lib/server/mcpServer.d.ts.map +1 -0
- package/lib/server/mcpServer.js +11 -0
- package/lib/server/mcpServer.js.map +1 -0
- package/lib/server/repositoryVersion.d.ts +16 -0
- package/lib/server/repositoryVersion.d.ts.map +1 -0
- package/lib/server/repositoryVersion.js +33 -0
- package/lib/server/repositoryVersion.js.map +1 -0
- package/lib/server/routeOptions.d.ts +23 -0
- package/lib/server/routeOptions.d.ts.map +1 -0
- package/lib/server/routeOptions.js +20 -0
- package/lib/server/routeOptions.js.map +1 -0
- package/lib/server/routeTable.d.ts +14 -0
- package/lib/server/routeTable.d.ts.map +1 -0
- package/lib/server/routeTable.js +32 -0
- package/lib/server/routeTable.js.map +1 -0
- package/lib/server/siteView.d.ts +29 -0
- package/lib/server/siteView.d.ts.map +1 -0
- package/lib/server/siteView.js +21 -0
- package/lib/server/siteView.js.map +1 -0
- package/lib/server/spaPages.d.ts +32 -0
- package/lib/server/spaPages.d.ts.map +1 -0
- package/lib/server/spaPages.js +126 -0
- package/lib/server/spaPages.js.map +1 -0
- package/lib/server/spaSite.d.ts +30 -0
- package/lib/server/spaSite.d.ts.map +1 -0
- package/lib/server/spaSite.js +170 -0
- package/lib/server/spaSite.js.map +1 -0
- package/lib/server/spaSiteOptions.d.ts +126 -0
- package/lib/server/spaSiteOptions.d.ts.map +1 -0
- package/lib/server/spaSiteOptions.js +2 -0
- package/lib/server/spaSiteOptions.js.map +1 -0
- package/lib/server/staticSite.d.ts +9 -0
- package/lib/server/staticSite.d.ts.map +1 -1
- package/lib/server/staticSite.js +41 -19
- package/lib/server/staticSite.js.map +1 -1
- package/lib/server/toolSiteServer.d.ts +77 -0
- package/lib/server/toolSiteServer.d.ts.map +1 -0
- package/lib/server/toolSiteServer.js +58 -0
- package/lib/server/toolSiteServer.js.map +1 -0
- package/lib/server/trustProxy.d.ts +20 -0
- package/lib/server/trustProxy.d.ts.map +1 -0
- package/lib/server/trustProxy.js +32 -0
- package/lib/server/trustProxy.js.map +1 -0
- package/lib/server/types.d.ts +13 -0
- package/lib/server/types.d.ts.map +1 -0
- package/lib/server/types.js +2 -0
- package/lib/server/types.js.map +1 -0
- package/lib/server.d.ts +22 -0
- package/lib/server.d.ts.map +1 -1
- package/lib/server.js +12 -0
- package/lib/server.js.map +1 -1
- package/lib/share/core/config.d.ts +18 -0
- package/lib/share/core/config.d.ts.map +1 -1
- package/lib/share/core/config.js +33 -2
- package/lib/share/core/config.js.map +1 -1
- package/lib/share/core/index.d.ts +3 -1
- package/lib/share/core/index.d.ts.map +1 -1
- package/lib/share/core/index.js +2 -1
- package/lib/share/core/index.js.map +1 -1
- package/lib/share/core/keySetParam.d.ts +40 -0
- package/lib/share/core/keySetParam.d.ts.map +1 -0
- package/lib/share/core/keySetParam.js +60 -0
- package/lib/share/core/keySetParam.js.map +1 -0
- package/lib/share/core/vocabulary.d.ts +8 -0
- package/lib/share/core/vocabulary.d.ts.map +1 -1
- package/lib/shell/ui/ShareControl.d.ts +75 -0
- package/lib/shell/ui/ShareControl.d.ts.map +1 -0
- package/lib/shell/ui/ShareControl.js +40 -0
- package/lib/shell/ui/ShareControl.js.map +1 -0
- package/lib/shell/ui/ShellFrame.d.ts +14 -0
- package/lib/shell/ui/ShellFrame.d.ts.map +1 -0
- package/lib/shell/ui/ShellFrame.js +45 -0
- package/lib/shell/ui/ShellFrame.js.map +1 -0
- package/lib/shell/ui/SiteShell.d.ts +251 -0
- package/lib/shell/ui/SiteShell.d.ts.map +1 -0
- package/lib/shell/ui/SiteShell.js +39 -0
- package/lib/shell/ui/SiteShell.js.map +1 -0
- package/lib/shell/ui/index.d.ts +5 -0
- package/lib/shell/ui/index.d.ts.map +1 -0
- package/lib/shell/ui/index.js +3 -0
- package/lib/shell/ui/index.js.map +1 -0
- package/lib/state/core/index.d.ts +1 -0
- package/lib/state/core/index.d.ts.map +1 -1
- package/lib/state/core/index.js.map +1 -1
- package/lib/state/core/legacyEntries.d.ts +30 -0
- package/lib/state/core/legacyEntries.d.ts.map +1 -0
- package/lib/state/core/legacyEntries.js +51 -0
- package/lib/state/core/legacyEntries.js.map +1 -0
- package/lib/state/core/persistBucket.d.ts +26 -2
- package/lib/state/core/persistBucket.d.ts.map +1 -1
- package/lib/state/core/persistBucket.js +26 -9
- package/lib/state/core/persistBucket.js.map +1 -1
- package/lib/state/core/persistSignalBucket.d.ts +26 -0
- package/lib/state/core/persistSignalBucket.d.ts.map +1 -1
- package/lib/state/core/persistSignalBucket.js +31 -0
- package/lib/state/core/persistSignalBucket.js.map +1 -1
- package/lib/state/core/storageEntry.d.ts +15 -0
- package/lib/state/core/storageEntry.d.ts.map +1 -1
- package/lib/state/core/storageEntry.js +33 -0
- package/lib/state/core/storageEntry.js.map +1 -1
- package/lib/structure/ui/StructureExportButton.d.ts +27 -0
- package/lib/structure/ui/StructureExportButton.d.ts.map +1 -0
- package/lib/structure/ui/StructureExportButton.js +21 -0
- package/lib/structure/ui/StructureExportButton.js.map +1 -0
- package/lib/structure/ui/index.d.ts +4 -0
- package/lib/structure/ui/index.d.ts.map +1 -1
- package/lib/structure/ui/index.js +2 -0
- package/lib/structure/ui/index.js.map +1 -1
- package/lib/structure/ui/useStructureDraft.d.ts +32 -0
- package/lib/structure/ui/useStructureDraft.d.ts.map +1 -0
- package/lib/structure/ui/useStructureDraft.js +20 -0
- package/lib/structure/ui/useStructureDraft.js.map +1 -0
- package/lib/ui.d.ts +2 -0
- package/lib/ui.d.ts.map +1 -1
- package/lib/ui.js +2 -0
- package/lib/ui.js.map +1 -1
- package/lib/worker/core/index.d.ts +1 -1
- package/lib/worker/core/index.d.ts.map +1 -1
- package/lib/worker/core/messages.d.ts +4 -2
- package/lib/worker/core/messages.d.ts.map +1 -1
- package/lib/worker/core/messages.js.map +1 -1
- package/lib/worker/core/oclResourcesUrl.d.ts +16 -0
- package/lib/worker/core/oclResourcesUrl.d.ts.map +1 -0
- package/lib/worker/core/oclResourcesUrl.js +19 -0
- package/lib/worker/core/oclResourcesUrl.js.map +1 -0
- package/lib/worker/core/serveWorkerRequests.d.ts +8 -0
- package/lib/worker/core/serveWorkerRequests.d.ts.map +1 -1
- package/lib/worker/core/serveWorkerRequests.js +15 -2
- package/lib/worker/core/serveWorkerRequests.js.map +1 -1
- package/lib/worker/core/workerChannel.d.ts +3 -4
- package/lib/worker/core/workerChannel.d.ts.map +1 -1
- package/lib/worker/core/workerChannel.js +72 -67
- package/lib/worker/core/workerChannel.js.map +1 -1
- package/lib/worker/core/workerChannelParts.d.ts +17 -6
- package/lib/worker/core/workerChannelParts.d.ts.map +1 -1
- package/lib/worker/core/workerChannelParts.js +20 -4
- package/lib/worker/core/workerChannelParts.js.map +1 -1
- package/lib/worker/core/workerChannelTypes.d.ts +46 -2
- package/lib/worker/core/workerChannelTypes.d.ts.map +1 -1
- package/lib/worker/core/workerSlot.d.ts +66 -0
- package/lib/worker/core/workerSlot.d.ts.map +1 -0
- package/lib/worker/core/workerSlot.js +107 -0
- package/lib/worker/core/workerSlot.js.map +1 -0
- package/package.json +16 -1
- package/src/card/core/cardAddress.ts +100 -0
- package/src/card/core/cardPageUrl.ts +97 -0
- package/src/card/core/index.ts +6 -0
- package/src/card/core/panelRoom.ts +66 -0
- package/src/card/ui/CardDetailsButton.tsx +104 -0
- package/src/card/ui/CardFigure.tsx +86 -0
- package/src/card/ui/CardFrame.tsx +46 -0
- package/src/card/ui/CopyTableButton.tsx +81 -0
- package/src/card/ui/cardTooltip.ts +18 -0
- package/src/card/ui/embed.ts +27 -0
- package/src/card/ui/fitCardToFrame.ts +76 -0
- package/src/card/ui/holdRoomForPanels.ts +83 -0
- package/src/card/ui/index.ts +14 -0
- package/src/card/ui/openPanels.ts +106 -0
- package/src/card.ts +13 -0
- package/src/conformers.ts +4 -0
- package/src/core.ts +5 -0
- package/src/fetch/core/apiError.ts +65 -0
- package/src/fetch/core/fetchJson.ts +129 -0
- package/src/fetch/core/index.ts +4 -0
- package/src/formula/core/formulaText.ts +96 -0
- package/src/formula/core/index.ts +20 -0
- package/src/formula/core/normalizeFormula.ts +50 -0
- package/src/formula/core/readFormula.ts +211 -0
- package/src/formula/ui/CopyableFormula.tsx +51 -0
- package/src/formula/ui/FormulaInput.tsx +50 -0
- package/src/formula/ui/QuestionFormula.tsx +20 -0
- package/src/formula/ui/index.ts +6 -0
- package/src/formula.ts +11 -0
- package/src/hooks/ui/index.ts +1 -0
- package/src/hooks/ui/keyTargets.ts +5 -3
- package/src/hooks/ui/useAsync.ts +50 -14
- package/src/locales/de.json +37 -0
- package/src/locales/en.json +37 -0
- package/src/locales/es.json +37 -0
- package/src/locales/fr.json +37 -0
- package/src/locales/it.json +37 -0
- package/src/molecule3d/core/highlight.ts +2 -8
- package/src/molecule3d/core/index.ts +1 -0
- package/src/molecule3d/core/measurement.ts +47 -0
- package/src/molecule3d/ui/drawScene.ts +13 -2
- package/src/molecule3d/ui/moleculeViewer3DProps.ts +3 -1
- package/src/molecule3d/ui/sceneDrawer.ts +132 -0
- package/src/molecule3d/ui/useMoleculeScene.ts +16 -26
- package/src/molecule3d/ui/useSharedCamera.ts +1 -3
- package/src/moleculesClient/core/index.ts +19 -0
- package/src/moleculesClient/core/moleculesClient.ts +175 -0
- package/src/moleculesClient/core/moleculesClientApi.ts +120 -0
- package/src/moleculesClient/core/moleculesTypes.ts +163 -0
- package/src/moleculesClient/core/requestRetry.ts +118 -0
- package/src/molstar/core/camera.ts +3 -2
- package/src/molstar/core/framing.ts +200 -0
- package/src/molstar/core/hover.ts +26 -0
- package/src/molstar/core/index.ts +21 -1
- package/src/pedagogy/core/answers.ts +94 -0
- package/src/pedagogy/core/attempts.ts +205 -0
- package/src/pedagogy/core/index.ts +36 -0
- package/src/pedagogy/core/progressController.ts +116 -0
- package/src/pedagogy/core/seed.ts +177 -0
- package/src/pedagogy/core/series.ts +82 -0
- package/src/pedagogy/ui/AnswerFields.tsx +63 -0
- package/src/pedagogy/ui/ExerciseList.tsx +202 -0
- package/src/pedagogy/ui/ExerciseSeries.tsx +250 -0
- package/src/pedagogy/ui/QuestionCard.tsx +231 -0
- package/src/pedagogy/ui/index.ts +18 -0
- package/src/pedagogy/ui/seriesCounts.ts +34 -0
- package/src/pedagogy/ui/seriesParts.tsx +127 -0
- package/src/pedagogy/ui/useAttemptRecords.ts +16 -0
- package/src/periodic/ui/PeriodicTable.tsx +6 -3
- package/src/property/core/copyableText.ts +20 -0
- package/src/property/core/index.ts +1 -0
- package/src/property/ui/PropertyTable.tsx +83 -0
- package/src/property/ui/index.ts +2 -0
- package/src/router/core/history.ts +61 -7
- package/src/router/core/index.ts +3 -2
- package/src/router/core/languageRoute.ts +136 -0
- package/src/router/core/siteAddresses.ts +38 -0
- package/src/router/core/tabRouter.ts +59 -117
- package/src/router/core/tabRouterTypes.ts +158 -0
- package/src/seo/core/fitDescription.ts +74 -0
- package/src/seo/core/index.ts +17 -0
- package/src/seo/core/limits.ts +27 -0
- package/src/seo/core/pageContent.ts +42 -0
- package/src/seo/core/plainDescription.ts +4 -2
- package/src/seo/core/routeProblems.ts +1 -7
- package/src/seo/core/routeTable.ts +103 -0
- package/src/seo/vite/index.ts +2 -0
- package/src/seo/vite/prerender.ts +26 -1
- package/src/seo/vite/routeTable.ts +79 -0
- package/src/server/answerAddresses.ts +92 -0
- package/src/server/cardMeta.ts +88 -0
- package/src/server/config.ts +125 -0
- package/src/server/envNumber.ts +65 -0
- package/src/server/healthRoute.ts +42 -0
- package/src/server/listenSite.ts +90 -0
- package/src/server/mcpServer.ts +14 -0
- package/src/server/repositoryVersion.ts +33 -0
- package/src/server/routeOptions.ts +26 -0
- package/src/server/routeTable.ts +35 -0
- package/src/server/siteView.ts +42 -0
- package/src/server/spaPages.ts +179 -0
- package/src/server/spaSite.ts +216 -0
- package/src/server/spaSiteOptions.ts +133 -0
- package/src/server/staticSite.ts +65 -35
- package/src/server/toolSiteServer.ts +127 -0
- package/src/server/trustProxy.ts +32 -0
- package/src/server/types.ts +25 -0
- package/src/server.ts +40 -0
- package/src/share/core/config.ts +45 -2
- package/src/share/core/index.ts +4 -0
- package/src/share/core/keySetParam.ts +92 -0
- package/src/share/core/vocabulary.ts +8 -0
- package/src/shell/ui/ShareControl.tsx +150 -0
- package/src/shell/ui/ShellFrame.tsx +180 -0
- package/src/shell/ui/SiteShell.tsx +297 -0
- package/src/shell/ui/index.ts +9 -0
- package/src/state/core/index.ts +1 -0
- package/src/state/core/legacyEntries.ts +76 -0
- package/src/state/core/persistBucket.ts +50 -10
- package/src/state/core/persistSignalBucket.ts +52 -0
- package/src/state/core/storageEntry.ts +32 -0
- package/src/structure/ui/StructureExportButton.tsx +57 -0
- package/src/structure/ui/index.ts +4 -0
- package/src/structure/ui/useStructureDraft.ts +47 -0
- package/src/ui.ts +2 -0
- package/src/worker/core/index.ts +1 -0
- package/src/worker/core/messages.ts +4 -3
- package/src/worker/core/oclResourcesUrl.ts +21 -0
- package/src/worker/core/serveWorkerRequests.ts +30 -2
- package/src/worker/core/workerChannel.ts +74 -74
- package/src/worker/core/workerChannelParts.ts +33 -13
- package/src/worker/core/workerChannelTypes.ts +47 -2
- package/src/worker/core/workerSlot.ts +181 -0
- package/styles/card.css +145 -0
- package/styles/chrome.css +248 -0
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* script can import a module that uses it.
|
|
9
9
|
*/
|
|
10
10
|
import { EMBED_PARAM, HIDE_PARAM } from "../../share/core/config.js";
|
|
11
|
+
import { stripBasePath } from "./basePath.js";
|
|
11
12
|
import { pageHistory, pageLocation } from "./pageAddress.js";
|
|
12
13
|
import { formatQueryEntries } from "./query.js";
|
|
13
14
|
/**
|
|
@@ -20,13 +21,17 @@ export const ROUTE_CHANGE_EVENT = 'cheminfo:routechange';
|
|
|
20
21
|
*
|
|
21
22
|
* A link written before the site routed by path — `/#/tutorial/3` — is replaced
|
|
22
23
|
* in place, once, by the address the router writes for it, when the router
|
|
23
|
-
* adopts such links.
|
|
24
|
+
* adopts such links. So is a `?lang=` a sibling site handed the language over
|
|
25
|
+
* in, on a router given `languages`: the language moves into the path, so one
|
|
26
|
+
* reader's bookmark and the next one's are the same address. The language of a
|
|
27
|
+
* prefixed address never changes: `/fr/tutorial?lang=de` stays French.
|
|
24
28
|
* @param router - The site's router.
|
|
25
29
|
* @returns The route of the address on screen, or of `/` where there is no browser.
|
|
26
30
|
*/
|
|
27
31
|
export function readRoute(router) {
|
|
28
32
|
const address = currentAddress();
|
|
29
|
-
const
|
|
33
|
+
const legacy = router.legacyAddress(address);
|
|
34
|
+
const adopted = router.languageAddress?.(legacy ?? address) ?? legacy;
|
|
30
35
|
if (adopted === null)
|
|
31
36
|
return router.parse(address);
|
|
32
37
|
const history = pageHistory();
|
|
@@ -34,14 +39,45 @@ export function readRoute(router) {
|
|
|
34
39
|
globalThis.dispatchEvent?.(new Event(ROUTE_CHANGE_EVENT));
|
|
35
40
|
return router.parse(adopted);
|
|
36
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Read the route the site opens on, the reader's own language applied to a
|
|
44
|
+
* bare root.
|
|
45
|
+
*
|
|
46
|
+
* A bare `/` — no page, no query, no fragment — names no language, so the one
|
|
47
|
+
* the reader last chose may decide which front page opens, and the address is
|
|
48
|
+
* rewritten in place to say it. Nothing else is steered: a deep link opens what
|
|
49
|
+
* it names for everybody, so `/tutorial` handed out in a course is English and
|
|
50
|
+
* `/fr/tutorial` French, whatever either reader last read.
|
|
51
|
+
* @param router - The site's router, given `languages`.
|
|
52
|
+
* @param preferred - The language the reader last chose; `undefined`, or one
|
|
53
|
+
* the router does not write, steers nothing.
|
|
54
|
+
* @returns The route to open on.
|
|
55
|
+
*/
|
|
56
|
+
export function openingRoute(router, preferred) {
|
|
57
|
+
const bare = isBareRoot(router);
|
|
58
|
+
const route = readRoute(router);
|
|
59
|
+
const steered = bare &&
|
|
60
|
+
preferred !== undefined &&
|
|
61
|
+
preferred !== route.language &&
|
|
62
|
+
router.languages?.includes(preferred) === true;
|
|
63
|
+
if (!steered)
|
|
64
|
+
return route;
|
|
65
|
+
const address = router.format({ ...route, language: preferred });
|
|
66
|
+
const history = pageHistory();
|
|
67
|
+
history?.replaceState(history.state, '', address);
|
|
68
|
+
globalThis.dispatchEvent?.(new Event(ROUTE_CHANGE_EVENT));
|
|
69
|
+
return router.parse(address);
|
|
70
|
+
}
|
|
37
71
|
/**
|
|
38
72
|
* Point the browser at a route.
|
|
39
73
|
*
|
|
40
74
|
* The share parameters of the address on screen, and the preference names in
|
|
41
75
|
* `keep`, survive the move, so an embedded page stays embedded after its first
|
|
42
76
|
* click. A parameter the route names itself — even as `null` or `undefined`, to
|
|
43
|
-
* remove it — is the route's.
|
|
44
|
-
*
|
|
77
|
+
* remove it — is the route's. On a router given `languages`, a route naming no
|
|
78
|
+
* language keeps the one on screen, and changing language counts as changing
|
|
79
|
+
* tab. Writing the address already on screen does nothing, so echoing state
|
|
80
|
+
* back into the address cannot loop.
|
|
45
81
|
* @param router - The site's router.
|
|
46
82
|
* @param route - Where to go.
|
|
47
83
|
* @param options - How the move is recorded and which parameters survive it.
|
|
@@ -60,7 +96,9 @@ export function writeRoute(router, route, options = {}) {
|
|
|
60
96
|
if (shown === address)
|
|
61
97
|
return address;
|
|
62
98
|
const mode = options.history ?? 'auto';
|
|
63
|
-
const
|
|
99
|
+
const from = router.parse(current);
|
|
100
|
+
const to = router.parse(address);
|
|
101
|
+
const sameTab = from.tab === to.tab && from.language === to.language;
|
|
64
102
|
if (mode === 'replace' || (mode === 'auto' && sameTab)) {
|
|
65
103
|
history.replaceState(history.state, '', address);
|
|
66
104
|
}
|
|
@@ -99,9 +137,11 @@ export function currentAddress() {
|
|
|
99
137
|
return `${location.pathname}${location.search}${location.hash}`;
|
|
100
138
|
}
|
|
101
139
|
function withKeptParams(router, route, current, keep) {
|
|
102
|
-
const
|
|
140
|
+
const onScreen = router.parse(current);
|
|
141
|
+
const language = route.language ?? onScreen.language;
|
|
142
|
+
const target = router.format(language === undefined ? route : { ...route, language });
|
|
103
143
|
const named = route.params ?? {};
|
|
104
|
-
const shown =
|
|
144
|
+
const shown = onScreen.params;
|
|
105
145
|
const kept = [];
|
|
106
146
|
for (const key of new Set([EMBED_PARAM, HIDE_PARAM, ...keep])) {
|
|
107
147
|
if (Object.hasOwn(named, key))
|
|
@@ -115,4 +155,12 @@ function withKeptParams(router, route, current, keep) {
|
|
|
115
155
|
const separator = target.includes('?') ? '&' : '?';
|
|
116
156
|
return `${target}${separator}${formatQueryEntries(kept)}`;
|
|
117
157
|
}
|
|
158
|
+
function isBareRoot(router) {
|
|
159
|
+
const location = pageLocation();
|
|
160
|
+
if (location === undefined)
|
|
161
|
+
return false;
|
|
162
|
+
if (location.search !== '' || location.hash !== '')
|
|
163
|
+
return false;
|
|
164
|
+
return stripBasePath(router.basePath ?? '', location.pathname) === '/';
|
|
165
|
+
}
|
|
118
166
|
//# sourceMappingURL=history.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../../src/router/core/history.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../../src/router/core/history.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAErE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9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IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACzC,IAAI,QAAQ,CAAC,MAAM,KAAK,EAAE,IAAI,QAAQ,CAAC,IAAI,KAAK,EAAE;QAAE,OAAO,KAAK,CAAC;IACjE,OAAO,aAAa,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,EAAE,QAAQ,CAAC,QAAQ,CAAC,KAAK,GAAG,CAAC;AACzE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { trimTrailingSlash } from './address.ts';
|
|
2
2
|
export { basePathOf, joinBasePath, normalizeBasePath, readMountPath, stripBasePath, } from './basePath.ts';
|
|
3
3
|
export type { WriteRouteOptions } from './history.ts';
|
|
4
|
-
export { ROUTE_CHANGE_EVENT, readRoute, subscribeToRoute, writeRoute, } from './history.ts';
|
|
4
|
+
export { ROUTE_CHANGE_EVENT, openingRoute, readRoute, subscribeToRoute, writeRoute, } from './history.ts';
|
|
5
5
|
export type { AdoptLegacyHashOptions, LegacyHashOptions, } from './legacyHash.ts';
|
|
6
6
|
export { adoptLegacyHashAddress, pathFromLegacyHash } from './legacyHash.ts';
|
|
7
7
|
export type { PageHistory, PageLocation } from './pageAddress.ts';
|
|
@@ -9,7 +9,7 @@ export { holdPageAddress, isPageAddressHeld, pageHistory, pageLocation, releaseP
|
|
|
9
9
|
export type { QueryEntry, QueryStringOptions } from './query.ts';
|
|
10
10
|
export { firstQueryValues, formatQueryEntries, formatQueryString, parseQueryEntries, parseQueryString, } from './query.ts';
|
|
11
11
|
export type { SiteAddresses, SiteAddressesOptions } from './siteAddresses.ts';
|
|
12
|
-
export { createSiteAddresses } from './siteAddresses.ts';
|
|
13
|
-
export type { TabDefinition, TabRoute, TabRouteInput, TabRouter, TabRouterOptions, } from './
|
|
12
|
+
export { anchorHref, createSiteAddresses } from './siteAddresses.ts';
|
|
13
|
+
export type { TabDefinition, TabRoute, TabRouteInput, TabRouter, TabRouterOptions, } from './tabRouterTypes.ts';
|
|
14
14
|
export { createTabRouter } from './tabRouter.ts';
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/router/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EACL,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,gBAAgB,EAChB,UAAU,GACX,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC7E,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/router/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EACL,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,UAAU,GACX,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC7E,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACrE,YAAY,EACV,aAAa,EACb,QAAQ,EACR,aAAa,EACb,SAAS,EACT,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
|
package/lib/router/core/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { trimTrailingSlash } from "./address.js";
|
|
2
2
|
export { basePathOf, joinBasePath, normalizeBasePath, readMountPath, stripBasePath, } from "./basePath.js";
|
|
3
|
-
export { ROUTE_CHANGE_EVENT, readRoute, subscribeToRoute, writeRoute, } from "./history.js";
|
|
3
|
+
export { ROUTE_CHANGE_EVENT, openingRoute, readRoute, subscribeToRoute, writeRoute, } from "./history.js";
|
|
4
4
|
export { adoptLegacyHashAddress, pathFromLegacyHash } from "./legacyHash.js";
|
|
5
5
|
export { holdPageAddress, isPageAddressHeld, pageHistory, pageLocation, releasePageAddress, } from "./pageAddress.js";
|
|
6
6
|
export { firstQueryValues, formatQueryEntries, formatQueryString, parseQueryEntries, parseQueryString, } from "./query.js";
|
|
7
|
-
export { createSiteAddresses } from "./siteAddresses.js";
|
|
7
|
+
export { anchorHref, createSiteAddresses } from "./siteAddresses.js";
|
|
8
8
|
export { createTabRouter } from "./tabRouter.js";
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/router/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EACL,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,aAAa,GACd,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,gBAAgB,EAChB,UAAU,GACX,MAAM,cAAc,CAAC;AAKtB,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE7E,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/router/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EACL,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,aAAa,GACd,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,UAAU,GACX,MAAM,cAAc,CAAC;AAKtB,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE7E,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAQrE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The language half of a translated site's routes: the prefix a page is
|
|
3
|
+
* written under, and the `?lang=` a sibling site hands the language over in.
|
|
4
|
+
*
|
|
5
|
+
* Inside a translated site the language is the path — `/fr/tutorial` — so each
|
|
6
|
+
* language is an address of its own a crawler indexes and a course hands out.
|
|
7
|
+
* Between sites it travels as a parameter, because the site being linked to
|
|
8
|
+
* may not speak it, and a parameter it does not know is ignored where a prefix
|
|
9
|
+
* it does not have is a 404. So a route reads the parameter only where the
|
|
10
|
+
* prefix says nothing, and the prefix always wins: `/fr/tutorial?lang=de` is
|
|
11
|
+
* the French tutorial for everybody.
|
|
12
|
+
*/
|
|
13
|
+
import type { Language } from '../../i18n/core/languages.ts';
|
|
14
|
+
import type { QueryStringOptions } from './query.ts';
|
|
15
|
+
/** The language a route is read in, and what is left of its address. */
|
|
16
|
+
export interface RouteLanguage {
|
|
17
|
+
/** The language the page is read in. */
|
|
18
|
+
language: Language;
|
|
19
|
+
/** The path from the site's own root, the prefix taken off. */
|
|
20
|
+
path: string;
|
|
21
|
+
/** The parameters, without a `lang` that names a language of the site. */
|
|
22
|
+
params: Record<string, string>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Read the language of a route off its path and its parameters.
|
|
26
|
+
* @param path - The path from the site's own root, the mount already off.
|
|
27
|
+
* @param params - The decoded query parameters.
|
|
28
|
+
* @param languages - The languages the site is written in.
|
|
29
|
+
* @returns The language, the path without its prefix, and the parameters.
|
|
30
|
+
*/
|
|
31
|
+
export declare function readRouteLanguage(path: string, params: Record<string, string>, languages: readonly Language[]): RouteLanguage;
|
|
32
|
+
/**
|
|
33
|
+
* Write a path from the site's own root under a language's prefix.
|
|
34
|
+
* @param language - The language asked for, if any.
|
|
35
|
+
* @param path - The path from the site's own root.
|
|
36
|
+
* @param languages - The languages the site is written in.
|
|
37
|
+
* @returns The path under the prefix; a language the site does not speak is
|
|
38
|
+
* written as the default one, with no prefix.
|
|
39
|
+
*/
|
|
40
|
+
export declare function writeRouteLanguage(language: Language | undefined, path: string, languages: readonly Language[]): string;
|
|
41
|
+
/** How {@link adoptLanguageParam} reads an address. */
|
|
42
|
+
export interface AdoptLanguageOptions {
|
|
43
|
+
/** The mount path, normalised. */
|
|
44
|
+
basePath: string;
|
|
45
|
+
/** The languages the site is written in. */
|
|
46
|
+
languages: readonly Language[];
|
|
47
|
+
/** How the query string is read and written back. */
|
|
48
|
+
queryOptions: QueryStringOptions;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The address to put in place of one carrying a `?lang=` the site speaks.
|
|
52
|
+
*
|
|
53
|
+
* Only the language moves: the page named stays the page written, whether the
|
|
54
|
+
* router knows it or not, and every other parameter and the fragment are kept.
|
|
55
|
+
* @param address - A browser address: mount, prefix, page, query and fragment.
|
|
56
|
+
* @param options - The mount, the languages and how the query is read.
|
|
57
|
+
* @returns The address with the language in its path, or `null` when the
|
|
58
|
+
* address names no language of the site in its query.
|
|
59
|
+
*/
|
|
60
|
+
export declare function adoptLanguageParam(address: string, options: AdoptLanguageOptions): string | null;
|
|
61
|
+
//# sourceMappingURL=languageRoute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"languageRoute.d.ts","sourceRoot":"","sources":["../../../src/router/core/languageRoute.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAU7D,OAAO,KAAK,EAAc,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGjE,wEAAwE;AACxE,MAAM,WAAW,aAAa;IAC5B,wCAAwC;IACxC,QAAQ,EAAE,QAAQ,CAAC;IACnB,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,SAAS,EAAE,SAAS,QAAQ,EAAE,GAC7B,aAAa,CAUf;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAC9B,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,SAAS,QAAQ,EAAE,GAC7B,MAAM,CAMR;AAED,uDAAuD;AACvD,MAAM,WAAW,oBAAoB;IACnC,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,SAAS,EAAE,SAAS,QAAQ,EAAE,CAAC;IAC/B,qDAAqD;IACrD,YAAY,EAAE,kBAAkB,CAAC;CAClC;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,oBAAoB,GAC5B,MAAM,GAAG,IAAI,CAsBf"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The language half of a translated site's routes: the prefix a page is
|
|
3
|
+
* written under, and the `?lang=` a sibling site hands the language over in.
|
|
4
|
+
*
|
|
5
|
+
* Inside a translated site the language is the path — `/fr/tutorial` — so each
|
|
6
|
+
* language is an address of its own a crawler indexes and a course hands out.
|
|
7
|
+
* Between sites it travels as a parameter, because the site being linked to
|
|
8
|
+
* may not speak it, and a parameter it does not know is ignored where a prefix
|
|
9
|
+
* it does not have is a 404. So a route reads the parameter only where the
|
|
10
|
+
* prefix says nothing, and the prefix always wins: `/fr/tutorial?lang=de` is
|
|
11
|
+
* the French tutorial for everybody.
|
|
12
|
+
*/
|
|
13
|
+
import { DEFAULT_LANGUAGE } from "../../i18n/core/languages.js";
|
|
14
|
+
import { LANGUAGE_PARAM } from "../../language/core/languageParam.js";
|
|
15
|
+
import { readLanguagePath, withLanguagePath, } from "../../language/core/languagePath.js";
|
|
16
|
+
import { splitAddress } from "./address.js";
|
|
17
|
+
import { joinBasePath, stripBasePath } from "./basePath.js";
|
|
18
|
+
import { formatQueryEntries, parseQueryEntries } from "./query.js";
|
|
19
|
+
/**
|
|
20
|
+
* Read the language of a route off its path and its parameters.
|
|
21
|
+
* @param path - The path from the site's own root, the mount already off.
|
|
22
|
+
* @param params - The decoded query parameters.
|
|
23
|
+
* @param languages - The languages the site is written in.
|
|
24
|
+
* @returns The language, the path without its prefix, and the parameters.
|
|
25
|
+
*/
|
|
26
|
+
export function readRouteLanguage(path, params, languages) {
|
|
27
|
+
const read = readLanguagePath(path, languages);
|
|
28
|
+
const named = siteLanguage(params[LANGUAGE_PARAM], languages);
|
|
29
|
+
if (named === undefined)
|
|
30
|
+
return { ...read, params };
|
|
31
|
+
const kept = {};
|
|
32
|
+
for (const [key, value] of Object.entries(params)) {
|
|
33
|
+
if (key !== LANGUAGE_PARAM)
|
|
34
|
+
kept[key] = value;
|
|
35
|
+
}
|
|
36
|
+
const language = read.language === DEFAULT_LANGUAGE ? named : read.language;
|
|
37
|
+
return { language, path: read.path, params: kept };
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Write a path from the site's own root under a language's prefix.
|
|
41
|
+
* @param language - The language asked for, if any.
|
|
42
|
+
* @param path - The path from the site's own root.
|
|
43
|
+
* @param languages - The languages the site is written in.
|
|
44
|
+
* @returns The path under the prefix; a language the site does not speak is
|
|
45
|
+
* written as the default one, with no prefix.
|
|
46
|
+
*/
|
|
47
|
+
export function writeRouteLanguage(language, path, languages) {
|
|
48
|
+
const written = language !== undefined && languages.includes(language)
|
|
49
|
+
? language
|
|
50
|
+
: DEFAULT_LANGUAGE;
|
|
51
|
+
return withLanguagePath(written, path);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The address to put in place of one carrying a `?lang=` the site speaks.
|
|
55
|
+
*
|
|
56
|
+
* Only the language moves: the page named stays the page written, whether the
|
|
57
|
+
* router knows it or not, and every other parameter and the fragment are kept.
|
|
58
|
+
* @param address - A browser address: mount, prefix, page, query and fragment.
|
|
59
|
+
* @param options - The mount, the languages and how the query is read.
|
|
60
|
+
* @returns The address with the language in its path, or `null` when the
|
|
61
|
+
* address names no language of the site in its query.
|
|
62
|
+
*/
|
|
63
|
+
export function adoptLanguageParam(address, options) {
|
|
64
|
+
const { basePath, languages, queryOptions } = options;
|
|
65
|
+
const { path, search, fragment } = splitAddress(address);
|
|
66
|
+
const entries = parseQueryEntries(search, queryOptions);
|
|
67
|
+
let named;
|
|
68
|
+
const kept = [];
|
|
69
|
+
for (const entry of entries) {
|
|
70
|
+
const language = entry[0] === LANGUAGE_PARAM
|
|
71
|
+
? siteLanguage(entry[1], languages)
|
|
72
|
+
: undefined;
|
|
73
|
+
if (language === undefined)
|
|
74
|
+
kept.push(entry);
|
|
75
|
+
else
|
|
76
|
+
named ??= language;
|
|
77
|
+
}
|
|
78
|
+
if (named === undefined)
|
|
79
|
+
return null;
|
|
80
|
+
const read = readLanguagePath(stripBasePath(basePath, path), languages);
|
|
81
|
+
const language = read.language === DEFAULT_LANGUAGE ? named : read.language;
|
|
82
|
+
const opened = joinBasePath(basePath, withLanguagePath(language, read.path));
|
|
83
|
+
const query = formatQueryEntries(kept);
|
|
84
|
+
const withQuery = query === '' ? opened : `${opened}?${query}`;
|
|
85
|
+
return fragment === '' ? withQuery : `${withQuery}#${fragment}`;
|
|
86
|
+
}
|
|
87
|
+
function siteLanguage(value, languages) {
|
|
88
|
+
if (value === undefined)
|
|
89
|
+
return undefined;
|
|
90
|
+
for (const language of languages) {
|
|
91
|
+
if (language === value)
|
|
92
|
+
return language;
|
|
93
|
+
}
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=languageRoute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"languageRoute.js","sourceRoot":"","sources":["../../../src/router/core/languageRoute.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EACL,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE5D,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAYnE;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAC/B,IAAY,EACZ,MAA8B,EAC9B,SAA8B;IAE9B,MAAM,IAAI,GAAG,gBAAgB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAC/C,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,SAAS,CAAC,CAAC;IAC9D,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,CAAC;IACpD,MAAM,IAAI,GAA2B,EAAE,CAAC;IACxC,KA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that identifier.
|
|
15
15
|
*/
|
|
16
16
|
export declare function createSiteAddresses(siteId: SiteId, options?: SiteAddressesOptions): SiteAddresses;
|
|
17
|
+
/**
|
|
18
|
+
* A link to an anchor on the page being read.
|
|
19
|
+
*
|
|
20
|
+
* Every page of ours carries a `<base>`, so a bare `#id` resolves against the
|
|
21
|
+
* mount rather than against the address open, and clicking it leaves the page
|
|
22
|
+
* instead of scrolling down it. The link names the page's own address and its
|
|
23
|
+
* query instead — the browser's, since that is the document a click scrolls.
|
|
24
|
+
* @param id - The `id` of the element to jump to.
|
|
25
|
+
* @returns The address of that anchor on the page on screen, or `#id` where
|
|
26
|
+
* there is no page.
|
|
27
|
+
*/
|
|
28
|
+
export declare function anchorHref(id: string): string;
|
|
17
29
|
/** How {@link createSiteAddresses} reads the mount. */
|
|
18
30
|
export interface SiteAddressesOptions {
|
|
19
31
|
/**
|
|
@@ -45,5 +57,16 @@ export interface SiteAddresses {
|
|
|
45
57
|
* it says something, the site's own address otherwise.
|
|
46
58
|
*/
|
|
47
59
|
configuredSiteUrl: () => string;
|
|
60
|
+
/** A link to an anchor on the page on screen; see {@link anchorHref}. */
|
|
61
|
+
anchorHref: (id: string) => string;
|
|
62
|
+
/**
|
|
63
|
+
* The address of something a backend stored and the page shows — an
|
|
64
|
+
* uploaded picture — as this deployment serves it. A backend names those
|
|
65
|
+
* from its own root, `/uploads/<name>`, because a proxy mounting the site
|
|
66
|
+
* under a path strips the path before the request reaches it; so a
|
|
67
|
+
* root-relative address is put under the mount, and one carrying its own
|
|
68
|
+
* scheme or origin, or relative already, is handed back untouched.
|
|
69
|
+
*/
|
|
70
|
+
storedAssetSrc: (url: string) => string;
|
|
48
71
|
}
|
|
49
72
|
//# sourceMappingURL=siteAddresses.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"siteAddresses.d.ts","sourceRoot":"","sources":["../../../src/router/core/siteAddresses.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAU5D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,oBAAyB,GACjC,aAAa,
|
|
1
|
+
{"version":3,"file":"siteAddresses.d.ts","sourceRoot":"","sources":["../../../src/router/core/siteAddresses.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAU5D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,oBAAyB,GACjC,aAAa,CA0Cf;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAI7C;AAKD,uDAAuD;AACvD,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,+CAA+C;AAC/C,MAAM,WAAW,aAAa;IAC5B,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,CAAC;IACjB,mEAAmE;IACnE,QAAQ,EAAE,MAAM,CAAC;IACjB,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACnC,iEAAiE;IACjE,eAAe,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9C;;;OAGG;IACH,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACtC;;;OAGG;IACH,iBAAiB,EAAE,MAAM,MAAM,CAAC;IAChC,yEAAyE;IACzE,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;IACnC;;;;;;;OAOG;IACH,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;CACzC"}
|
|
@@ -34,6 +34,11 @@ export function createSiteAddresses(siteId, options = {}) {
|
|
|
34
34
|
const environment = globalThis.process?.env?.SITE_URL;
|
|
35
35
|
return environment || ownUrl;
|
|
36
36
|
}
|
|
37
|
+
function storedAssetSrc(url) {
|
|
38
|
+
if (OWN_ORIGIN.test(url) || url.startsWith('//'))
|
|
39
|
+
return url;
|
|
40
|
+
return url.startsWith('/') ? withBase(url) : url;
|
|
41
|
+
}
|
|
37
42
|
return {
|
|
38
43
|
basePath,
|
|
39
44
|
siteName: siteDisplayName(site),
|
|
@@ -42,6 +47,27 @@ export function createSiteAddresses(siteId, options = {}) {
|
|
|
42
47
|
pathWithoutBase,
|
|
43
48
|
absoluteUrl,
|
|
44
49
|
configuredSiteUrl,
|
|
50
|
+
anchorHref,
|
|
51
|
+
storedAssetSrc,
|
|
45
52
|
};
|
|
46
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* A link to an anchor on the page being read.
|
|
56
|
+
*
|
|
57
|
+
* Every page of ours carries a `<base>`, so a bare `#id` resolves against the
|
|
58
|
+
* mount rather than against the address open, and clicking it leaves the page
|
|
59
|
+
* instead of scrolling down it. The link names the page's own address and its
|
|
60
|
+
* query instead — the browser's, since that is the document a click scrolls.
|
|
61
|
+
* @param id - The `id` of the element to jump to.
|
|
62
|
+
* @returns The address of that anchor on the page on screen, or `#id` where
|
|
63
|
+
* there is no page.
|
|
64
|
+
*/
|
|
65
|
+
export function anchorHref(id) {
|
|
66
|
+
const location = globalThis.location;
|
|
67
|
+
if (location === undefined)
|
|
68
|
+
return `#${id}`;
|
|
69
|
+
return `${location.pathname}${location.search}#${id}`;
|
|
70
|
+
}
|
|
71
|
+
// A scheme names its own origin: `https:`, `data:`, `blob:`.
|
|
72
|
+
const OWN_ORIGIN = /^[a-z][\w+.-]*:/i;
|
|
47
73
|
//# sourceMappingURL=siteAddresses.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"siteAddresses.js","sourceRoot":"","sources":["../../../src/router/core/siteAddresses.ts"],"names":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GAAG,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,OAAO,GAAG,CAAC;QAC7D,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACnD,CAAC;IAED,OAAO;QACL,QAAQ;QACR,QAAQ,EAAE,eAAe,CAAC,IAAI,CAAC;QAC/B,OAAO,EAAE,MAAM;QACf,QAAQ;QACR,eAAe;QACf,WAAW;QACX,iBAAiB;QACjB,UAAU;QACV,cAAc;KACf,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,UAAU,CAAC,EAAU;IACnC,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAgC,CAAC;IAC7D,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,IAAI,EAAE,EAAE,CAAC;IAC5C,OAAO,GAAG,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;AACxD,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,GAAG,kBAAkB,CAAC"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { TabRouter, TabRouterOptions } from './tabRouterTypes.ts';
|
|
2
|
+
export type { TabDefinition, TabRoute, TabRouteInput, TabRouter, TabRouterOptions, } from './tabRouterTypes.ts';
|
|
1
3
|
/**
|
|
2
4
|
* The two directions between an address and the page it names.
|
|
3
5
|
*
|
|
@@ -9,112 +11,4 @@
|
|
|
9
11
|
* @returns The parser, the serialiser, and the test for a known tab.
|
|
10
12
|
*/
|
|
11
13
|
export declare function createTabRouter<Tab extends string>(options: TabRouterOptions<Tab>): TabRouter<Tab>;
|
|
12
|
-
/** A tab whose address carries more than the tab's own name. */
|
|
13
|
-
export interface TabDefinition<Tab extends string = string> {
|
|
14
|
-
/** Identifier of the tab, as the state and the components name it. */
|
|
15
|
-
id: Tab;
|
|
16
|
-
/**
|
|
17
|
-
* The address of the tab, from the site's own root. The home tab is always
|
|
18
|
-
* written as `/`, whatever it declares here, so the site has one address for
|
|
19
|
-
* it instead of two holding the same thing.
|
|
20
|
-
* @default `/${id}`
|
|
21
|
-
*/
|
|
22
|
-
path?: string;
|
|
23
|
-
/**
|
|
24
|
-
* Whether the tab addresses one of its items in a second path segment — a
|
|
25
|
-
* tutorial step, an exercise, an element — so a lecturer can hand out a deep
|
|
26
|
-
* link and a crawler indexes each item as a page of its own.
|
|
27
|
-
* @default false
|
|
28
|
-
*/
|
|
29
|
-
takesId?: boolean;
|
|
30
|
-
}
|
|
31
|
-
/** How the addresses of a site's tabs are read and written. */
|
|
32
|
-
export interface TabRouterOptions<Tab extends string> {
|
|
33
|
-
/** Every tab of the site, named on its own or described in full. */
|
|
34
|
-
tabs: ReadonlyArray<Tab | TabDefinition<Tab>>;
|
|
35
|
-
/**
|
|
36
|
-
* The tab living at the root, and the one an address the site does not know
|
|
37
|
-
* opens — a link written before a rename still lands somewhere.
|
|
38
|
-
*/
|
|
39
|
-
home: Tab;
|
|
40
|
-
/**
|
|
41
|
-
* Whether the address is the path or the fragment. A public tool must use
|
|
42
|
-
* `'path'`: a `#` is dropped by half the tools that pass links around, the
|
|
43
|
-
* server never sees it, and a crawler indexes the whole site as one page.
|
|
44
|
-
* `'hash'` exists only so a site already routing that way can adopt this
|
|
45
|
-
* router before it moves.
|
|
46
|
-
* @default 'path'
|
|
47
|
-
*/
|
|
48
|
-
mode?: 'path' | 'hash';
|
|
49
|
-
/**
|
|
50
|
-
* The path the site is served under: nothing on a host of its own, `/surge`
|
|
51
|
-
* as one tool among several on a shared one.
|
|
52
|
-
* @default ''
|
|
53
|
-
*/
|
|
54
|
-
basePath?: string;
|
|
55
|
-
/**
|
|
56
|
-
* Read a `+` in a value as the character it is rather than as a space.
|
|
57
|
-
* Without it a shared SMILES breaks.
|
|
58
|
-
* @default true
|
|
59
|
-
*/
|
|
60
|
-
literalPlus?: boolean;
|
|
61
|
-
/**
|
|
62
|
-
* Write a parameter carrying nothing back as the bare key, so a hand-typed
|
|
63
|
-
* `?embed` survives the round trip.
|
|
64
|
-
* @default false
|
|
65
|
-
*/
|
|
66
|
-
keepEmptyValues?: boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Also read an address whose page is named by an old `#/tab/item` fragment,
|
|
69
|
-
* so links handed out before the site routed by path keep working.
|
|
70
|
-
* @default false
|
|
71
|
-
*/
|
|
72
|
-
adoptLegacyHash?: boolean;
|
|
73
|
-
}
|
|
74
|
-
/** Where the app is: which tab, what it has open, and how it is set up. */
|
|
75
|
-
export interface TabRoute<Tab extends string = string> {
|
|
76
|
-
/** The tab the address opens. */
|
|
77
|
-
tab: Tab;
|
|
78
|
-
/** The item its second segment names, `null` on a tab that takes none. */
|
|
79
|
-
id: string | null;
|
|
80
|
-
/** Decoded query parameters, the tool's own and the share configuration's. */
|
|
81
|
-
params: Record<string, string>;
|
|
82
|
-
}
|
|
83
|
-
/** A route as a caller writes it, the parts it does not carry left out. */
|
|
84
|
-
export interface TabRouteInput<Tab extends string = string> {
|
|
85
|
-
/** The tab to open; one the router does not know falls back to the home tab. */
|
|
86
|
-
tab: Tab;
|
|
87
|
-
/**
|
|
88
|
-
* The item the tab has open, ignored by a tab that addresses none.
|
|
89
|
-
* @default null
|
|
90
|
-
*/
|
|
91
|
-
id?: string | null;
|
|
92
|
-
/**
|
|
93
|
-
* Query parameters to carry; an empty, `undefined` or `null` value is left out.
|
|
94
|
-
* @default {}
|
|
95
|
-
*/
|
|
96
|
-
params?: Record<string, string | undefined | null>;
|
|
97
|
-
}
|
|
98
|
-
/** The string ↔ route mapping of a site. */
|
|
99
|
-
export interface TabRouter<Tab extends string = string> {
|
|
100
|
-
/** Whether the route lives in the path or in the fragment. */
|
|
101
|
-
mode: 'path' | 'hash';
|
|
102
|
-
/**
|
|
103
|
-
* The route an address denotes. An unknown tab, a trailing slash, an empty
|
|
104
|
-
* address and an escape that does not decode all resolve to something
|
|
105
|
-
* sensible rather than throwing.
|
|
106
|
-
*/
|
|
107
|
-
parse: (address: string) => TabRoute<Tab>;
|
|
108
|
-
/** The address a route is reachable at, mount path and query included. */
|
|
109
|
-
format: (route: TabRouteInput<Tab>) => string;
|
|
110
|
-
/** Whether a string read out of an address names one of the site's tabs. */
|
|
111
|
-
isTab: (value: string) => value is Tab;
|
|
112
|
-
/**
|
|
113
|
-
* The address to put in the bar in place of a link written before the site
|
|
114
|
-
* routed by path: the page it names as this router writes it, with the query
|
|
115
|
-
* string kept as it was. `null` when the address is no such link, or when the
|
|
116
|
-
* router does not adopt them.
|
|
117
|
-
*/
|
|
118
|
-
legacyAddress: (address: string) => string | null;
|
|
119
|
-
}
|
|
120
14
|
//# sourceMappingURL=tabRouter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabRouter.d.ts","sourceRoot":"","sources":["../../../src/router/core/tabRouter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tabRouter.d.ts","sourceRoot":"","sources":["../../../src/router/core/tabRouter.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAGV,SAAS,EACT,gBAAgB,EACjB,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EACV,aAAa,EACb,QAAQ,EACR,aAAa,EACb,SAAS,EACT,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,GAAG,SAAS,MAAM,EAChD,OAAO,EAAE,gBAAgB,CAAC,GAAG,CAAC,GAC7B,SAAS,CAAC,GAAG,CAAC,CAuGhB"}
|