@treeseed/core 0.1.2
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 +145 -0
- package/dist/agents/index.js +5 -0
- package/dist/agents/registry-helper.js +14 -0
- package/dist/agents/registry.js +88 -0
- package/dist/components/DevWatchReload.astro +45 -0
- package/dist/components/SiteTitle.astro +51 -0
- package/dist/components/content/ContentStatusLegend.astro +18 -0
- package/dist/components/content/StatusBadge.astro +11 -0
- package/dist/components/docs/BookFontControls.astro +180 -0
- package/dist/components/docs/DesktopSidebarToggle.astro +88 -0
- package/dist/components/docs/DownloadBook.astro +34 -0
- package/dist/components/docs/Footer.astro +196 -0
- package/dist/components/docs/Header.astro +150 -0
- package/dist/components/docs/PageFrame.astro +260 -0
- package/dist/components/docs/PageSidebar.astro +63 -0
- package/dist/components/docs/PageTitle.astro +39 -0
- package/dist/components/docs/Sidebar.astro +41 -0
- package/dist/components/docs/ThemeSelect.astro +3 -0
- package/dist/components/forms/ContactForm.astro +234 -0
- package/dist/components/forms/FooterSubscribeForm.astro +189 -0
- package/dist/components/site/BookList.astro +27 -0
- package/dist/components/site/CTASection.astro +24 -0
- package/dist/components/site/ChronicleList.astro +33 -0
- package/dist/components/site/Hero.astro +18 -0
- package/dist/components/site/NotesList.astro +18 -0
- package/dist/components/site/PathCard.astro +16 -0
- package/dist/components/site/ProfileList.astro +30 -0
- package/dist/components/site/SectionIntro.astro +9 -0
- package/dist/components/site/StageBanner.astro +8 -0
- package/dist/components/site/TrustCallout.astro +9 -0
- package/dist/components/starlight.js +6 -0
- package/dist/config.js +8 -0
- package/dist/content-config.js +9 -0
- package/dist/content.js +230 -0
- package/dist/contracts.d.ts +130 -0
- package/dist/contracts.js +0 -0
- package/dist/deploy/config.d.ts +4 -0
- package/dist/deploy/config.js +154 -0
- package/dist/deploy/runtime.js +77 -0
- package/dist/env.yaml +322 -0
- package/dist/environment.d.ts +130 -0
- package/dist/environment.js +324 -0
- package/dist/index.js +81 -0
- package/dist/layouts/AuthoredEntryLayout.astro +87 -0
- package/dist/layouts/BookLayout.astro +35 -0
- package/dist/layouts/BridgeLayout.astro +11 -0
- package/dist/layouts/ContentLayout.astro +24 -0
- package/dist/layouts/MainLayout.astro +203 -0
- package/dist/layouts/NoteLayout.astro +26 -0
- package/dist/layouts/ProfileLayout.astro +81 -0
- package/dist/middleware/starlightRouteData.js +45 -0
- package/dist/pages/404.astro +29 -0
- package/dist/pages/[slug].astro +30 -0
- package/dist/pages/agents/[slug].astro +29 -0
- package/dist/pages/agents/index.astro +27 -0
- package/dist/pages/api/form/submit.js +14 -0
- package/dist/pages/books/[slug].astro +19 -0
- package/dist/pages/books/index.astro +28 -0
- package/dist/pages/contact.astro +27 -0
- package/dist/pages/feed.xml.js +34 -0
- package/dist/pages/index.astro +290 -0
- package/dist/pages/notes/[slug].astro +19 -0
- package/dist/pages/notes/index.astro +21 -0
- package/dist/pages/objectives/[slug].astro +31 -0
- package/dist/pages/objectives/index.astro +30 -0
- package/dist/pages/people/[slug].astro +29 -0
- package/dist/pages/people/index.astro +28 -0
- package/dist/pages/questions/[slug].astro +31 -0
- package/dist/pages/questions/index.astro +30 -0
- package/dist/plugin-default.js +4 -0
- package/dist/plugins/builtin/default-plugin.d.ts +21 -0
- package/dist/plugins/builtin/default-plugin.js +32 -0
- package/dist/plugins/constants.d.ts +21 -0
- package/dist/plugins/constants.js +28 -0
- package/dist/plugins/plugin.d.ts +42 -0
- package/dist/plugins/plugin.js +6 -0
- package/dist/plugins/runtime.d.ts +31 -0
- package/dist/plugins/runtime.js +120 -0
- package/dist/scripts/aggregate-book.js +112 -0
- package/dist/scripts/assert-release-tag-version.js +21 -0
- package/dist/scripts/build-dist.js +384 -0
- package/dist/scripts/build-tenant-worker.js +36 -0
- package/dist/scripts/package-tools.js +88 -0
- package/dist/scripts/patch-starlight-content-path.js +172 -0
- package/dist/scripts/paths.js +11 -0
- package/dist/scripts/publish-package.js +20 -0
- package/dist/scripts/release-verify.js +52 -0
- package/dist/scripts/run-fixture-astro-command.js +21 -0
- package/dist/scripts/tenant-astro-command.js +3 -0
- package/dist/scripts/tenant-build.js +16 -0
- package/dist/scripts/tenant-check.js +7 -0
- package/dist/scripts/test-smoke.js +105 -0
- package/dist/server.js +53 -0
- package/dist/site-resources.d.ts +29 -0
- package/dist/site-resources.js +127 -0
- package/dist/site.js +313 -0
- package/dist/styles/global.css +683 -0
- package/dist/styles/prose.css +89 -0
- package/dist/styles/tokens.css +24 -0
- package/dist/tenant/bridge.js +5 -0
- package/dist/tenant/config.d.ts +9 -0
- package/dist/tenant/config.js +124 -0
- package/dist/tenant/runtime-config.js +20 -0
- package/dist/tsconfigs/strict.json +3 -0
- package/dist/types/agents.d.ts +1 -0
- package/dist/types/agents.js +1 -0
- package/dist/types/astro-build.d.js +0 -0
- package/dist/types/cloudflare-sockets.d.js +0 -0
- package/dist/types/cloudflare.d.ts +1 -0
- package/dist/types/cloudflare.js +1 -0
- package/dist/types/forms.js +4 -0
- package/dist/utils/agents/adapters/execution.js +90 -0
- package/dist/utils/agents/adapters/mutations.js +30 -0
- package/dist/utils/agents/adapters/notification.js +16 -0
- package/dist/utils/agents/adapters/repository.js +61 -0
- package/dist/utils/agents/adapters/research.js +25 -0
- package/dist/utils/agents/adapters/verification.js +62 -0
- package/dist/utils/agents/cli-tools.js +5 -0
- package/dist/utils/agents/contracts/messages.d.ts +88 -0
- package/dist/utils/agents/contracts/messages.js +138 -0
- package/dist/utils/agents/contracts/run.d.ts +20 -0
- package/dist/utils/agents/contracts/run.js +0 -0
- package/dist/utils/agents/runtime-types.d.ts +117 -0
- package/dist/utils/agents/runtime-types.js +4 -0
- package/dist/utils/books-data.js +82 -0
- package/dist/utils/content-status.js +38 -0
- package/dist/utils/forms/config.js +87 -0
- package/dist/utils/forms/constants.js +27 -0
- package/dist/utils/forms/contact-submissions-local.js +19 -0
- package/dist/utils/forms/contact-submissions.js +72 -0
- package/dist/utils/forms/crypto.js +64 -0
- package/dist/utils/forms/guard.js +76 -0
- package/dist/utils/forms/http.js +51 -0
- package/dist/utils/forms/provider-core.js +88 -0
- package/dist/utils/forms/routing-core.js +7 -0
- package/dist/utils/forms/routing.js +13 -0
- package/dist/utils/forms/runtime-core.js +17 -0
- package/dist/utils/forms/runtime.js +27 -0
- package/dist/utils/forms/service-core.js +256 -0
- package/dist/utils/forms/service.js +55 -0
- package/dist/utils/forms/session.js +57 -0
- package/dist/utils/forms/smtp-cloudflare.js +107 -0
- package/dist/utils/forms/smtp-node.js +27 -0
- package/dist/utils/forms/smtp.js +10 -0
- package/dist/utils/forms/subscribers-local.js +21 -0
- package/dist/utils/forms/subscribers.js +53 -0
- package/dist/utils/forms/turnstile.js +31 -0
- package/dist/utils/forms/validation.js +58 -0
- package/dist/utils/hub-content.js +28 -0
- package/dist/utils/plugin-runtime.js +158 -0
- package/dist/utils/routes.js +17 -0
- package/dist/utils/seo.js +4 -0
- package/dist/utils/site-config-schema.js +282 -0
- package/dist/utils/site-config.js +122 -0
- package/dist/utils/starlight-nav.js +62 -0
- package/dist/utils/theme.js +49 -0
- package/dist/vendor/starlight/components/AnchorHeading.astro +53 -0
- package/dist/vendor/starlight/components/Banner.astro +23 -0
- package/dist/vendor/starlight/components/ContentNotice.astro +33 -0
- package/dist/vendor/starlight/components/ContentPanel.astro +27 -0
- package/dist/vendor/starlight/components/DraftContentNotice.astro +5 -0
- package/dist/vendor/starlight/components/EditLink.astro +28 -0
- package/dist/vendor/starlight/components/FallbackContentNotice.astro +5 -0
- package/dist/vendor/starlight/components/Footer.astro +61 -0
- package/dist/vendor/starlight/components/Head.astro +5 -0
- package/dist/vendor/starlight/components/Header.astro +94 -0
- package/dist/vendor/starlight/components/Hero.astro +143 -0
- package/dist/vendor/starlight/components/Icons.js +121 -0
- package/dist/vendor/starlight/components/LanguageSelect.astro +57 -0
- package/dist/vendor/starlight/components/LastUpdated.astro +14 -0
- package/dist/vendor/starlight/components/MarkdownContent.astro +5 -0
- package/dist/vendor/starlight/components/MobileMenuFooter.astro +35 -0
- package/dist/vendor/starlight/components/MobileMenuToggle.astro +107 -0
- package/dist/vendor/starlight/components/MobileTableOfContents.astro +151 -0
- package/dist/vendor/starlight/components/Page.astro +126 -0
- package/dist/vendor/starlight/components/PageFrame.astro +97 -0
- package/dist/vendor/starlight/components/PageSidebar.astro +59 -0
- package/dist/vendor/starlight/components/PageTitle.astro +17 -0
- package/dist/vendor/starlight/components/Pagination.astro +79 -0
- package/dist/vendor/starlight/components/Search.astro +488 -0
- package/dist/vendor/starlight/components/Select.astro +99 -0
- package/dist/vendor/starlight/components/Sidebar.astro +15 -0
- package/dist/vendor/starlight/components/SidebarPersistState.js +43 -0
- package/dist/vendor/starlight/components/SidebarPersister.astro +78 -0
- package/dist/vendor/starlight/components/SidebarRestorePoint.astro +12 -0
- package/dist/vendor/starlight/components/SidebarSublist.astro +154 -0
- package/dist/vendor/starlight/components/SiteTitle.astro +59 -0
- package/dist/vendor/starlight/components/SkipLink.astro +26 -0
- package/dist/vendor/starlight/components/SocialIcons.astro +32 -0
- package/dist/vendor/starlight/components/StarlightPage.astro +17 -0
- package/dist/vendor/starlight/components/TableOfContents/TableOfContentsList.astro +79 -0
- package/dist/vendor/starlight/components/TableOfContents/starlight-toc.js +93 -0
- package/dist/vendor/starlight/components/TableOfContents.astro +18 -0
- package/dist/vendor/starlight/components/ThemeProvider.astro +38 -0
- package/dist/vendor/starlight/components/ThemeSelect.astro +73 -0
- package/dist/vendor/starlight/components/TwoColumnContent.astro +54 -0
- package/dist/vendor/starlight/components.js +26 -0
- package/dist/vendor/starlight/constants.js +4 -0
- package/dist/vendor/starlight/expressive-code.d.js +1 -0
- package/dist/vendor/starlight/global.d.js +0 -0
- package/dist/vendor/starlight/i18n.d.js +1 -0
- package/dist/vendor/starlight/index.js +119 -0
- package/dist/vendor/starlight/integrations/asides-error.js +12 -0
- package/dist/vendor/starlight/integrations/asides.js +179 -0
- package/dist/vendor/starlight/integrations/code-rtl-support.js +21 -0
- package/dist/vendor/starlight/integrations/expressive-code/hast.d.js +1 -0
- package/dist/vendor/starlight/integrations/expressive-code/index.js +63 -0
- package/dist/vendor/starlight/integrations/expressive-code/preprocessor.js +92 -0
- package/dist/vendor/starlight/integrations/expressive-code/themes/night-owl-dark.jsonc +1796 -0
- package/dist/vendor/starlight/integrations/expressive-code/themes/night-owl-dark.jsonc.js +1 -0
- package/dist/vendor/starlight/integrations/expressive-code/themes/night-owl-light.jsonc +1695 -0
- package/dist/vendor/starlight/integrations/expressive-code/themes/night-owl-light.jsonc.js +1 -0
- package/dist/vendor/starlight/integrations/expressive-code/theming.js +62 -0
- package/dist/vendor/starlight/integrations/expressive-code/translations.js +29 -0
- package/dist/vendor/starlight/integrations/heading-links.js +61 -0
- package/dist/vendor/starlight/integrations/pagefind.js +43 -0
- package/dist/vendor/starlight/integrations/remark-rehype.js +68 -0
- package/dist/vendor/starlight/integrations/shared/absolutePathToLang.js +15 -0
- package/dist/vendor/starlight/integrations/shared/localeToLang.js +9 -0
- package/dist/vendor/starlight/integrations/shared/slugToLocale.js +10 -0
- package/dist/vendor/starlight/integrations/sitemap.js +20 -0
- package/dist/vendor/starlight/integrations/virtual-user-config.js +110 -0
- package/dist/vendor/starlight/integrations/vite-layer-order.js +42 -0
- package/dist/vendor/starlight/internal.js +6 -0
- package/dist/vendor/starlight/loaders.js +36 -0
- package/dist/vendor/starlight/locals.d.js +0 -0
- package/dist/vendor/starlight/locals.js +30 -0
- package/dist/vendor/starlight/package.json +231 -0
- package/dist/vendor/starlight/package.json.js +248 -0
- package/dist/vendor/starlight/props.js +0 -0
- package/dist/vendor/starlight/route-data.js +6 -0
- package/dist/vendor/starlight/routes/common.astro +23 -0
- package/dist/vendor/starlight/routes/ssr/404.astro +7 -0
- package/dist/vendor/starlight/routes/ssr/index.astro +14 -0
- package/dist/vendor/starlight/routes/static/404.astro +7 -0
- package/dist/vendor/starlight/routes/static/index.astro +12 -0
- package/dist/vendor/starlight/schema.js +102 -0
- package/dist/vendor/starlight/schemas/badge.js +26 -0
- package/dist/vendor/starlight/schemas/components.js +235 -0
- package/dist/vendor/starlight/schemas/expressiveCode.js +12 -0
- package/dist/vendor/starlight/schemas/favicon.js +33 -0
- package/dist/vendor/starlight/schemas/head.js +32 -0
- package/dist/vendor/starlight/schemas/hero.js +57 -0
- package/dist/vendor/starlight/schemas/i18n.js +101 -0
- package/dist/vendor/starlight/schemas/icon.js +7 -0
- package/dist/vendor/starlight/schemas/logo.js +24 -0
- package/dist/vendor/starlight/schemas/pagefind.js +108 -0
- package/dist/vendor/starlight/schemas/prevNextLink.js +14 -0
- package/dist/vendor/starlight/schemas/sidebar.js +80 -0
- package/dist/vendor/starlight/schemas/site-title.js +19 -0
- package/dist/vendor/starlight/schemas/social.js +19 -0
- package/dist/vendor/starlight/schemas/tableOfContents.js +16 -0
- package/dist/vendor/starlight/style/anchor-links.css +131 -0
- package/dist/vendor/starlight/style/asides.css +51 -0
- package/dist/vendor/starlight/style/layers.css +1 -0
- package/dist/vendor/starlight/style/markdown.css +253 -0
- package/dist/vendor/starlight/style/print.css +175 -0
- package/dist/vendor/starlight/style/props.css +188 -0
- package/dist/vendor/starlight/style/reset.css +52 -0
- package/dist/vendor/starlight/style/util.css +63 -0
- package/dist/vendor/starlight/translations/ar.json +30 -0
- package/dist/vendor/starlight/translations/ar.json.js +32 -0
- package/dist/vendor/starlight/translations/ca.json +43 -0
- package/dist/vendor/starlight/translations/ca.json.js +45 -0
- package/dist/vendor/starlight/translations/cs.json +43 -0
- package/dist/vendor/starlight/translations/cs.json.js +45 -0
- package/dist/vendor/starlight/translations/da.json +30 -0
- package/dist/vendor/starlight/translations/da.json.js +32 -0
- package/dist/vendor/starlight/translations/de.json +30 -0
- package/dist/vendor/starlight/translations/de.json.js +32 -0
- package/dist/vendor/starlight/translations/el.json +30 -0
- package/dist/vendor/starlight/translations/el.json.js +32 -0
- package/dist/vendor/starlight/translations/en.json +30 -0
- package/dist/vendor/starlight/translations/en.json.js +32 -0
- package/dist/vendor/starlight/translations/es.json +43 -0
- package/dist/vendor/starlight/translations/es.json.js +45 -0
- package/dist/vendor/starlight/translations/fa.json +30 -0
- package/dist/vendor/starlight/translations/fa.json.js +32 -0
- package/dist/vendor/starlight/translations/fi.json +30 -0
- package/dist/vendor/starlight/translations/fi.json.js +32 -0
- package/dist/vendor/starlight/translations/fr.json +33 -0
- package/dist/vendor/starlight/translations/fr.json.js +35 -0
- package/dist/vendor/starlight/translations/gl.json +43 -0
- package/dist/vendor/starlight/translations/gl.json.js +45 -0
- package/dist/vendor/starlight/translations/he.json +30 -0
- package/dist/vendor/starlight/translations/he.json.js +32 -0
- package/dist/vendor/starlight/translations/hi.json +30 -0
- package/dist/vendor/starlight/translations/hi.json.js +32 -0
- package/dist/vendor/starlight/translations/hu.json +43 -0
- package/dist/vendor/starlight/translations/hu.json.js +45 -0
- package/dist/vendor/starlight/translations/id.json +30 -0
- package/dist/vendor/starlight/translations/id.json.js +32 -0
- package/dist/vendor/starlight/translations/index.js +77 -0
- package/dist/vendor/starlight/translations/it.json +30 -0
- package/dist/vendor/starlight/translations/it.json.js +32 -0
- package/dist/vendor/starlight/translations/ja.json +30 -0
- package/dist/vendor/starlight/translations/ja.json.js +32 -0
- package/dist/vendor/starlight/translations/ko.json +30 -0
- package/dist/vendor/starlight/translations/ko.json.js +32 -0
- package/dist/vendor/starlight/translations/lv.json +30 -0
- package/dist/vendor/starlight/translations/lv.json.js +32 -0
- package/dist/vendor/starlight/translations/nb.json +30 -0
- package/dist/vendor/starlight/translations/nb.json.js +32 -0
- package/dist/vendor/starlight/translations/nl.json +30 -0
- package/dist/vendor/starlight/translations/nl.json.js +32 -0
- package/dist/vendor/starlight/translations/pl.json +33 -0
- package/dist/vendor/starlight/translations/pl.json.js +35 -0
- package/dist/vendor/starlight/translations/pt.json +30 -0
- package/dist/vendor/starlight/translations/pt.json.js +32 -0
- package/dist/vendor/starlight/translations/ro.json +30 -0
- package/dist/vendor/starlight/translations/ro.json.js +32 -0
- package/dist/vendor/starlight/translations/ru.json +33 -0
- package/dist/vendor/starlight/translations/ru.json.js +35 -0
- package/dist/vendor/starlight/translations/sk.json +30 -0
- package/dist/vendor/starlight/translations/sk.json.js +32 -0
- package/dist/vendor/starlight/translations/sv.json +30 -0
- package/dist/vendor/starlight/translations/sv.json.js +32 -0
- package/dist/vendor/starlight/translations/th.json +30 -0
- package/dist/vendor/starlight/translations/th.json.js +32 -0
- package/dist/vendor/starlight/translations/tr.json +30 -0
- package/dist/vendor/starlight/translations/tr.json.js +32 -0
- package/dist/vendor/starlight/translations/uk.json +30 -0
- package/dist/vendor/starlight/translations/uk.json.js +32 -0
- package/dist/vendor/starlight/translations/vi.json +30 -0
- package/dist/vendor/starlight/translations/vi.json.js +32 -0
- package/dist/vendor/starlight/translations/zh-CN.json +30 -0
- package/dist/vendor/starlight/translations/zh-CN.json.js +32 -0
- package/dist/vendor/starlight/translations/zh-TW.json +30 -0
- package/dist/vendor/starlight/translations/zh-TW.json.js +32 -0
- package/dist/vendor/starlight/types.js +0 -0
- package/dist/vendor/starlight/user-components/Aside.astro +40 -0
- package/dist/vendor/starlight/user-components/Badge.astro +148 -0
- package/dist/vendor/starlight/user-components/Card.astro +68 -0
- package/dist/vendor/starlight/user-components/CardGrid.astro +38 -0
- package/dist/vendor/starlight/user-components/FileTree.astro +137 -0
- package/dist/vendor/starlight/user-components/Icon.astro +42 -0
- package/dist/vendor/starlight/user-components/LinkButton.astro +78 -0
- package/dist/vendor/starlight/user-components/LinkCard.astro +78 -0
- package/dist/vendor/starlight/user-components/Steps.astro +90 -0
- package/dist/vendor/starlight/user-components/TabItem.astro +19 -0
- package/dist/vendor/starlight/user-components/Tabs.astro +268 -0
- package/dist/vendor/starlight/user-components/file-tree-icons.js +608 -0
- package/dist/vendor/starlight/user-components/rehype-file-tree.js +160 -0
- package/dist/vendor/starlight/user-components/rehype-steps.js +53 -0
- package/dist/vendor/starlight/user-components/rehype-tabs.js +73 -0
- package/dist/vendor/starlight/utils/base.js +14 -0
- package/dist/vendor/starlight/utils/canonical.js +13 -0
- package/dist/vendor/starlight/utils/collection-fs.js +13 -0
- package/dist/vendor/starlight/utils/collection.js +16 -0
- package/dist/vendor/starlight/utils/createPathFormatter.js +39 -0
- package/dist/vendor/starlight/utils/createTranslationSystem.js +60 -0
- package/dist/vendor/starlight/utils/error-map.js +110 -0
- package/dist/vendor/starlight/utils/format-path.js +9 -0
- package/dist/vendor/starlight/utils/generateToC.js +18 -0
- package/dist/vendor/starlight/utils/git.js +92 -0
- package/dist/vendor/starlight/utils/gitInlined.js +13 -0
- package/dist/vendor/starlight/utils/head.js +156 -0
- package/dist/vendor/starlight/utils/i18n.js +121 -0
- package/dist/vendor/starlight/utils/localizedUrl.js +37 -0
- package/dist/vendor/starlight/utils/navigation.js +320 -0
- package/dist/vendor/starlight/utils/path.js +52 -0
- package/dist/vendor/starlight/utils/plugins.js +355 -0
- package/dist/vendor/starlight/utils/routing/data.js +116 -0
- package/dist/vendor/starlight/utils/routing/index.js +107 -0
- package/dist/vendor/starlight/utils/routing/middleware.js +40 -0
- package/dist/vendor/starlight/utils/routing/types.js +0 -0
- package/dist/vendor/starlight/utils/routing.js +1 -0
- package/dist/vendor/starlight/utils/slugs.js +70 -0
- package/dist/vendor/starlight/utils/starlight-page.js +123 -0
- package/dist/vendor/starlight/utils/translations-fs.js +31 -0
- package/dist/vendor/starlight/utils/translations.js +31 -0
- package/dist/vendor/starlight/utils/types.js +0 -0
- package/dist/vendor/starlight/utils/url.js +5 -0
- package/dist/vendor/starlight/utils/user-config.js +255 -0
- package/dist/vendor/starlight/utils/validateLogoImports.js +22 -0
- package/dist/vendor/starlight/virtual-internal.d.js +0 -0
- package/dist/vendor/starlight/virtual.d.js +0 -0
- package/dist/worker/forms-worker.js +141 -0
- package/package.json +156 -0
- package/style/anchor-links.css +131 -0
- package/templates/github/deploy.workflow.yml +47 -0
- package/tsconfigs/strict.json +3 -0
- package/utils/git.ts +121 -0
- package/utils/gitInlined.ts +20 -0
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { parse as parseYaml } from 'yaml';
|
|
2
|
+
|
|
3
|
+
function isRecord(value) {
|
|
4
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function expectRecord(value, path) {
|
|
8
|
+
if (!isRecord(value)) {
|
|
9
|
+
throw new Error(`Expected ${path} to be an object.`);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function expectString(value, path) {
|
|
16
|
+
if (typeof value !== 'string' || value.trim().length === 0) {
|
|
17
|
+
throw new Error(`Expected ${path} to be a non-empty string.`);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return value.trim();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function optionalString(value, path) {
|
|
24
|
+
if (value === undefined || value === null || value === '') {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return expectString(value, path);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function optionalBoolean(value, path) {
|
|
32
|
+
if (value === undefined || value === null) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (typeof value !== 'boolean') {
|
|
37
|
+
throw new Error(`Expected ${path} to be a boolean.`);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function optionalRecord(value, path) {
|
|
44
|
+
if (value === undefined || value === null) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return expectRecord(value, path);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function stringArray(value, path) {
|
|
52
|
+
if (value === undefined || value === null) {
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (!Array.isArray(value)) {
|
|
57
|
+
throw new Error(`Expected ${path} to be an array.`);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return value.map((entry, index) => expectString(entry, `${path}[${index}]`));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function parseMenuGroups(value, path) {
|
|
64
|
+
if (!Array.isArray(value)) {
|
|
65
|
+
throw new Error(`Expected ${path} to be an array.`);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return value.map((group, groupIndex) => {
|
|
69
|
+
const parsedGroup = expectRecord(group, `${path}[${groupIndex}]`);
|
|
70
|
+
const items = parsedGroup.items;
|
|
71
|
+
if (!Array.isArray(items) || items.length === 0) {
|
|
72
|
+
throw new Error(`Expected ${path}[${groupIndex}].items to contain at least one menu item.`);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
label: expectString(parsedGroup.label, `${path}[${groupIndex}].label`),
|
|
77
|
+
items: items.map((item, itemIndex) => {
|
|
78
|
+
const parsedItem = expectRecord(item, `${path}[${groupIndex}].items[${itemIndex}]`);
|
|
79
|
+
return {
|
|
80
|
+
label: expectString(parsedItem.label, `${path}[${groupIndex}].items[${itemIndex}].label`),
|
|
81
|
+
href: expectString(parsedItem.href, `${path}[${groupIndex}].items[${itemIndex}].href`),
|
|
82
|
+
};
|
|
83
|
+
}),
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function parseContactRouting(value, path) {
|
|
89
|
+
const parsedValue = expectRecord(value ?? {}, path);
|
|
90
|
+
const keys = ['default', 'question', 'feedback', 'collaboration', 'issue'];
|
|
91
|
+
|
|
92
|
+
return Object.fromEntries(
|
|
93
|
+
keys.flatMap((key) => {
|
|
94
|
+
if (!(key in parsedValue)) {
|
|
95
|
+
return [];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return [[key, stringArray(parsedValue[key], `${path}.${key}`)]];
|
|
99
|
+
}),
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function parseTheme(value, path) {
|
|
104
|
+
const theme = optionalRecord(value, path);
|
|
105
|
+
if (!theme) {
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const surfaces = optionalRecord(theme.surfaces, `${path}.surfaces`);
|
|
110
|
+
const text = optionalRecord(theme.text, `${path}.text`);
|
|
111
|
+
const border = optionalRecord(theme.border, `${path}.border`);
|
|
112
|
+
const accent = optionalRecord(theme.accent, `${path}.accent`);
|
|
113
|
+
const info = optionalRecord(theme.info, `${path}.info`);
|
|
114
|
+
const warm = optionalRecord(theme.warm, `${path}.warm`);
|
|
115
|
+
|
|
116
|
+
return {
|
|
117
|
+
surfaces: surfaces
|
|
118
|
+
? {
|
|
119
|
+
background: optionalString(surfaces.background, `${path}.surfaces.background`),
|
|
120
|
+
backgroundElevated: optionalString(
|
|
121
|
+
surfaces.backgroundElevated,
|
|
122
|
+
`${path}.surfaces.backgroundElevated`,
|
|
123
|
+
),
|
|
124
|
+
backgroundSoft: optionalString(surfaces.backgroundSoft, `${path}.surfaces.backgroundSoft`),
|
|
125
|
+
panel: optionalString(surfaces.panel, `${path}.surfaces.panel`),
|
|
126
|
+
panelStrong: optionalString(surfaces.panelStrong, `${path}.surfaces.panelStrong`),
|
|
127
|
+
}
|
|
128
|
+
: undefined,
|
|
129
|
+
text: text
|
|
130
|
+
? {
|
|
131
|
+
body: optionalString(text.body, `${path}.text.body`),
|
|
132
|
+
muted: optionalString(text.muted, `${path}.text.muted`),
|
|
133
|
+
soft: optionalString(text.soft, `${path}.text.soft`),
|
|
134
|
+
}
|
|
135
|
+
: undefined,
|
|
136
|
+
border: border
|
|
137
|
+
? {
|
|
138
|
+
base: optionalString(border.base, `${path}.border.base`),
|
|
139
|
+
strong: optionalString(border.strong, `${path}.border.strong`),
|
|
140
|
+
grid: optionalString(border.grid, `${path}.border.grid`),
|
|
141
|
+
}
|
|
142
|
+
: undefined,
|
|
143
|
+
accent: accent
|
|
144
|
+
? {
|
|
145
|
+
base: optionalString(accent.base, `${path}.accent.base`),
|
|
146
|
+
strong: optionalString(accent.strong, `${path}.accent.strong`),
|
|
147
|
+
soft: optionalString(accent.soft, `${path}.accent.soft`),
|
|
148
|
+
}
|
|
149
|
+
: undefined,
|
|
150
|
+
info: info
|
|
151
|
+
? {
|
|
152
|
+
base: optionalString(info.base, `${path}.info.base`),
|
|
153
|
+
strong: optionalString(info.strong, `${path}.info.strong`),
|
|
154
|
+
soft: optionalString(info.soft, `${path}.info.soft`),
|
|
155
|
+
}
|
|
156
|
+
: undefined,
|
|
157
|
+
warm: warm
|
|
158
|
+
? {
|
|
159
|
+
base: optionalString(warm.base, `${path}.warm.base`),
|
|
160
|
+
strong: optionalString(warm.strong, `${path}.warm.strong`),
|
|
161
|
+
}
|
|
162
|
+
: undefined,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* @param {string} source
|
|
168
|
+
*/
|
|
169
|
+
export function parseSiteConfig(source) {
|
|
170
|
+
const parsed = expectRecord(parseYaml(source), 'config');
|
|
171
|
+
const site = expectRecord(parsed.site, 'site');
|
|
172
|
+
const models = expectRecord(parsed.models ?? {}, 'models');
|
|
173
|
+
const pageModel = expectRecord(models.pages ?? {}, 'models.pages');
|
|
174
|
+
const noteModel = expectRecord(models.notes ?? {}, 'models.notes');
|
|
175
|
+
const questionModel = expectRecord(models.questions ?? {}, 'models.questions');
|
|
176
|
+
const objectiveModel = expectRecord(models.objectives ?? {}, 'models.objectives');
|
|
177
|
+
const peopleModel = expectRecord(models.people ?? {}, 'models.people');
|
|
178
|
+
const agentModel = expectRecord(models.agents ?? {}, 'models.agents');
|
|
179
|
+
const bookModel = expectRecord(models.books ?? {}, 'models.books');
|
|
180
|
+
const docsModel = expectRecord(models.docs ?? {}, 'models.docs');
|
|
181
|
+
const pageDefaults = expectRecord(pageModel.defaults ?? {}, 'models.pages.defaults');
|
|
182
|
+
const noteDefaults = expectRecord(noteModel.defaults ?? {}, 'models.notes.defaults');
|
|
183
|
+
const questionDefaults = expectRecord(questionModel.defaults ?? {}, 'models.questions.defaults');
|
|
184
|
+
const objectiveDefaults = expectRecord(objectiveModel.defaults ?? {}, 'models.objectives.defaults');
|
|
185
|
+
const peopleDefaults = expectRecord(peopleModel.defaults ?? {}, 'models.people.defaults');
|
|
186
|
+
const agentDefaults = expectRecord(agentModel.defaults ?? {}, 'models.agents.defaults');
|
|
187
|
+
const bookDefaults = expectRecord(bookModel.defaults ?? {}, 'models.books.defaults');
|
|
188
|
+
const docsDefaults = expectRecord(docsModel.defaults ?? {}, 'models.docs.defaults');
|
|
189
|
+
const logo = expectRecord(site.logo, 'site.logo');
|
|
190
|
+
const forms = expectRecord(site.forms ?? {}, 'site.forms');
|
|
191
|
+
const emailNotifications = expectRecord(site.emailNotifications, 'site.emailNotifications');
|
|
192
|
+
|
|
193
|
+
return {
|
|
194
|
+
site: {
|
|
195
|
+
logo: {
|
|
196
|
+
src: expectString(logo.src, 'site.logo.src'),
|
|
197
|
+
alt: expectString(logo.alt, 'site.logo.alt'),
|
|
198
|
+
},
|
|
199
|
+
name: expectString(site.name, 'site.name'),
|
|
200
|
+
statement: expectString(site.statement, 'site.statement'),
|
|
201
|
+
siteUrl: expectString(site.siteUrl, 'site.siteUrl'),
|
|
202
|
+
githubRepository: expectString(site.githubRepository, 'site.githubRepository'),
|
|
203
|
+
discordLink: expectString(site.discordLink, 'site.discordLink'),
|
|
204
|
+
headerMenu: parseMenuGroups(site.headerMenu, 'site.headerMenu'),
|
|
205
|
+
footerMenu: parseMenuGroups(site.footerMenu, 'site.footerMenu'),
|
|
206
|
+
forms: {
|
|
207
|
+
apiBaseUrl: optionalString(forms.apiBaseUrl, 'site.forms.apiBaseUrl'),
|
|
208
|
+
},
|
|
209
|
+
emailNotifications: {
|
|
210
|
+
contactRouting: parseContactRouting(
|
|
211
|
+
emailNotifications.contactRouting,
|
|
212
|
+
'site.emailNotifications.contactRouting',
|
|
213
|
+
),
|
|
214
|
+
subscribeRecipients: stringArray(
|
|
215
|
+
emailNotifications.subscribeRecipients,
|
|
216
|
+
'site.emailNotifications.subscribeRecipients',
|
|
217
|
+
),
|
|
218
|
+
},
|
|
219
|
+
summary: expectString(site.summary, 'site.summary'),
|
|
220
|
+
projectStage: expectString(site.projectStage, 'site.projectStage'),
|
|
221
|
+
projectStageDetail: expectString(site.projectStageDetail, 'site.projectStageDetail'),
|
|
222
|
+
theme: parseTheme(site.theme, 'site.theme'),
|
|
223
|
+
},
|
|
224
|
+
models: {
|
|
225
|
+
pages: {
|
|
226
|
+
defaults: {
|
|
227
|
+
pageLayout: optionalString(pageDefaults.pageLayout, 'models.pages.defaults.pageLayout'),
|
|
228
|
+
status: optionalString(pageDefaults.status, 'models.pages.defaults.status'),
|
|
229
|
+
stage: optionalString(pageDefaults.stage, 'models.pages.defaults.stage'),
|
|
230
|
+
audience: stringArray(pageDefaults.audience, 'models.pages.defaults.audience'),
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
notes: {
|
|
234
|
+
defaults: {
|
|
235
|
+
author: optionalString(noteDefaults.author, 'models.notes.defaults.author'),
|
|
236
|
+
draft: optionalBoolean(noteDefaults.draft, 'models.notes.defaults.draft'),
|
|
237
|
+
tags: stringArray(noteDefaults.tags, 'models.notes.defaults.tags'),
|
|
238
|
+
status: optionalString(noteDefaults.status, 'models.notes.defaults.status'),
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
questions: {
|
|
242
|
+
defaults: {
|
|
243
|
+
draft: optionalBoolean(questionDefaults.draft, 'models.questions.defaults.draft'),
|
|
244
|
+
tags: stringArray(questionDefaults.tags, 'models.questions.defaults.tags'),
|
|
245
|
+
status: optionalString(questionDefaults.status, 'models.questions.defaults.status'),
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
objectives: {
|
|
249
|
+
defaults: {
|
|
250
|
+
draft: optionalBoolean(objectiveDefaults.draft, 'models.objectives.defaults.draft'),
|
|
251
|
+
tags: stringArray(objectiveDefaults.tags, 'models.objectives.defaults.tags'),
|
|
252
|
+
status: optionalString(objectiveDefaults.status, 'models.objectives.defaults.status'),
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
people: {
|
|
256
|
+
defaults: {
|
|
257
|
+
status: optionalString(peopleDefaults.status, 'models.people.defaults.status'),
|
|
258
|
+
tags: stringArray(peopleDefaults.tags, 'models.people.defaults.tags'),
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
agents: {
|
|
262
|
+
defaults: {
|
|
263
|
+
tags: stringArray(agentDefaults.tags, 'models.agents.defaults.tags'),
|
|
264
|
+
runtimeStatus: optionalString(
|
|
265
|
+
agentDefaults.runtimeStatus,
|
|
266
|
+
'models.agents.defaults.runtimeStatus',
|
|
267
|
+
),
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
books: {
|
|
271
|
+
defaults: {
|
|
272
|
+
tags: stringArray(bookDefaults.tags, 'models.books.defaults.tags'),
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
docs: {
|
|
276
|
+
defaults: {
|
|
277
|
+
tags: stringArray(docsDefaults.tags, 'models.docs.defaults.tags'),
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
};
|
|
282
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { RUNTIME_SITE_CONFIG, RUNTIME_TENANT } from "../tenant/runtime-config.js";
|
|
2
|
+
import { buildTenantThemeCss } from "./theme.js";
|
|
3
|
+
function requireRuntimeSiteConfig() {
|
|
4
|
+
if (!RUNTIME_SITE_CONFIG) {
|
|
5
|
+
throw new Error(
|
|
6
|
+
`Treeseed runtime site config was not injected for tenant config at "${RUNTIME_TENANT.siteConfigPath}".`
|
|
7
|
+
);
|
|
8
|
+
}
|
|
9
|
+
return RUNTIME_SITE_CONFIG;
|
|
10
|
+
}
|
|
11
|
+
const SITE_CONFIG = requireRuntimeSiteConfig();
|
|
12
|
+
const SITE = {
|
|
13
|
+
logo: SITE_CONFIG.site.logo,
|
|
14
|
+
name: SITE_CONFIG.site.name,
|
|
15
|
+
statement: SITE_CONFIG.site.statement,
|
|
16
|
+
description: SITE_CONFIG.site.summary,
|
|
17
|
+
summary: SITE_CONFIG.site.summary,
|
|
18
|
+
url: SITE_CONFIG.site.siteUrl,
|
|
19
|
+
githubRepository: SITE_CONFIG.site.githubRepository,
|
|
20
|
+
discordLink: SITE_CONFIG.site.discordLink,
|
|
21
|
+
projectStage: SITE_CONFIG.site.projectStage,
|
|
22
|
+
projectStageDetail: SITE_CONFIG.site.projectStageDetail,
|
|
23
|
+
theme: SITE_CONFIG.site.theme,
|
|
24
|
+
headerMenu: SITE_CONFIG.site.headerMenu,
|
|
25
|
+
footerMenu: SITE_CONFIG.site.footerMenu,
|
|
26
|
+
forms: SITE_CONFIG.site.forms,
|
|
27
|
+
emailNotifications: SITE_CONFIG.site.emailNotifications
|
|
28
|
+
};
|
|
29
|
+
const SITE_HEADER_MENU = SITE.headerMenu;
|
|
30
|
+
const SITE_FOOTER_MENU = SITE.footerMenu;
|
|
31
|
+
const SITE_FORMS = SITE.forms;
|
|
32
|
+
const SITE_EMAIL_NOTIFICATIONS = SITE.emailNotifications;
|
|
33
|
+
const SITE_THEME_CSS = buildTenantThemeCss(SITE.theme);
|
|
34
|
+
const PAGE_MODEL_DEFAULTS = SITE_CONFIG.models.pages.defaults;
|
|
35
|
+
const NOTE_MODEL_DEFAULTS = SITE_CONFIG.models.notes.defaults;
|
|
36
|
+
const QUESTION_MODEL_DEFAULTS = SITE_CONFIG.models.questions.defaults;
|
|
37
|
+
const OBJECTIVE_MODEL_DEFAULTS = SITE_CONFIG.models.objectives.defaults;
|
|
38
|
+
const PEOPLE_MODEL_DEFAULTS = SITE_CONFIG.models.people.defaults;
|
|
39
|
+
const AGENT_MODEL_DEFAULTS = SITE_CONFIG.models.agents.defaults;
|
|
40
|
+
const BOOK_MODEL_DEFAULTS = SITE_CONFIG.models.books.defaults;
|
|
41
|
+
const TREESEED_MODEL_DEFAULTS = SITE_CONFIG.models.docs.defaults;
|
|
42
|
+
function applyPageModelDefaults(value) {
|
|
43
|
+
return {
|
|
44
|
+
...PAGE_MODEL_DEFAULTS,
|
|
45
|
+
...value,
|
|
46
|
+
audience: value.audience ?? PAGE_MODEL_DEFAULTS.audience ?? []
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function applyNoteModelDefaults(value) {
|
|
50
|
+
return {
|
|
51
|
+
...NOTE_MODEL_DEFAULTS,
|
|
52
|
+
...value,
|
|
53
|
+
tags: value.tags ?? NOTE_MODEL_DEFAULTS.tags ?? []
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function applyQuestionModelDefaults(value) {
|
|
57
|
+
return {
|
|
58
|
+
...QUESTION_MODEL_DEFAULTS,
|
|
59
|
+
...value,
|
|
60
|
+
tags: value.tags ?? QUESTION_MODEL_DEFAULTS.tags ?? []
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function applyObjectiveModelDefaults(value) {
|
|
64
|
+
return {
|
|
65
|
+
...OBJECTIVE_MODEL_DEFAULTS,
|
|
66
|
+
...value,
|
|
67
|
+
tags: value.tags ?? OBJECTIVE_MODEL_DEFAULTS.tags ?? []
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function applyPeopleModelDefaults(value) {
|
|
71
|
+
return {
|
|
72
|
+
...PEOPLE_MODEL_DEFAULTS,
|
|
73
|
+
...value,
|
|
74
|
+
tags: value.tags ?? PEOPLE_MODEL_DEFAULTS.tags ?? []
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function applyAgentModelDefaults(value) {
|
|
78
|
+
return {
|
|
79
|
+
...AGENT_MODEL_DEFAULTS,
|
|
80
|
+
...value,
|
|
81
|
+
tags: value.tags ?? AGENT_MODEL_DEFAULTS.tags ?? []
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function applyBookModelDefaults(value) {
|
|
85
|
+
return {
|
|
86
|
+
...BOOK_MODEL_DEFAULTS,
|
|
87
|
+
...value,
|
|
88
|
+
tags: value.tags ?? BOOK_MODEL_DEFAULTS.tags ?? []
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function applyDocsModelDefaults(value) {
|
|
92
|
+
return {
|
|
93
|
+
...TREESEED_MODEL_DEFAULTS,
|
|
94
|
+
...value,
|
|
95
|
+
tags: value.tags ?? TREESEED_MODEL_DEFAULTS.tags ?? []
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export {
|
|
99
|
+
AGENT_MODEL_DEFAULTS,
|
|
100
|
+
BOOK_MODEL_DEFAULTS,
|
|
101
|
+
NOTE_MODEL_DEFAULTS,
|
|
102
|
+
OBJECTIVE_MODEL_DEFAULTS,
|
|
103
|
+
PAGE_MODEL_DEFAULTS,
|
|
104
|
+
PEOPLE_MODEL_DEFAULTS,
|
|
105
|
+
QUESTION_MODEL_DEFAULTS,
|
|
106
|
+
SITE,
|
|
107
|
+
SITE_CONFIG,
|
|
108
|
+
SITE_EMAIL_NOTIFICATIONS,
|
|
109
|
+
SITE_FOOTER_MENU,
|
|
110
|
+
SITE_FORMS,
|
|
111
|
+
SITE_HEADER_MENU,
|
|
112
|
+
SITE_THEME_CSS,
|
|
113
|
+
TREESEED_MODEL_DEFAULTS,
|
|
114
|
+
applyAgentModelDefaults,
|
|
115
|
+
applyBookModelDefaults,
|
|
116
|
+
applyDocsModelDefaults,
|
|
117
|
+
applyNoteModelDefaults,
|
|
118
|
+
applyObjectiveModelDefaults,
|
|
119
|
+
applyPageModelDefaults,
|
|
120
|
+
applyPeopleModelDefaults,
|
|
121
|
+
applyQuestionModelDefaults
|
|
122
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { BOOKS, BOOKS_LINK, TREESEED_LIBRARY_DOWNLOAD, TREESEED_LINKS } from "./books-data.js";
|
|
2
|
+
const normalizeHref = (href) => href.endsWith("/") ? href : `${href}/`;
|
|
3
|
+
function buildBookSidebarFromRuntime(runtime2, bookSlug) {
|
|
4
|
+
const book = runtime2.BOOKS.find((candidate) => candidate.slug === bookSlug);
|
|
5
|
+
if (!book) {
|
|
6
|
+
throw new Error(`Unknown book slug: ${bookSlug}`);
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
label: book.sectionLabel,
|
|
10
|
+
items: book.sidebarItems
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function getStarlightSidebarConfigFromRuntime(runtime2) {
|
|
14
|
+
return [runtime2.BOOKS_LINK, ...runtime2.BOOKS.map((book) => buildBookSidebarFromRuntime(runtime2, book.slug))];
|
|
15
|
+
}
|
|
16
|
+
function getBookForPathFromRuntime(runtime2, pathname) {
|
|
17
|
+
const normalizedPath = normalizeHref(pathname);
|
|
18
|
+
return runtime2.BOOKS.find((book) => normalizedPath.startsWith(normalizeHref(book.basePath)));
|
|
19
|
+
}
|
|
20
|
+
function getDocsDownloadForPathFromRuntime(runtime2, pathname) {
|
|
21
|
+
const normalizedPath = normalizeHref(pathname);
|
|
22
|
+
if (normalizedPath === normalizeHref(runtime2.TREESEED_LINKS.home)) {
|
|
23
|
+
return runtime2.TREESEED_LIBRARY_DOWNLOAD;
|
|
24
|
+
}
|
|
25
|
+
const book = getBookForPathFromRuntime(runtime2, normalizedPath);
|
|
26
|
+
if (!book) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
downloadFileName: book.downloadFileName,
|
|
31
|
+
downloadHref: book.downloadHref,
|
|
32
|
+
downloadTitle: book.downloadTitle
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const runtime = { BOOKS, BOOKS_LINK, TREESEED_LIBRARY_DOWNLOAD, TREESEED_LINKS };
|
|
36
|
+
function buildBookSidebar(bookSlug) {
|
|
37
|
+
return buildBookSidebarFromRuntime(runtime, bookSlug);
|
|
38
|
+
}
|
|
39
|
+
function getStarlightSidebarConfig() {
|
|
40
|
+
return getStarlightSidebarConfigFromRuntime(runtime);
|
|
41
|
+
}
|
|
42
|
+
function getBookForPath(pathname) {
|
|
43
|
+
return getBookForPathFromRuntime(runtime, pathname);
|
|
44
|
+
}
|
|
45
|
+
function getDocsDownloadForPath(pathname) {
|
|
46
|
+
return getDocsDownloadForPathFromRuntime(runtime, pathname);
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
BOOKS,
|
|
50
|
+
BOOKS_LINK,
|
|
51
|
+
TREESEED_LIBRARY_DOWNLOAD,
|
|
52
|
+
TREESEED_LINKS,
|
|
53
|
+
buildBookSidebar,
|
|
54
|
+
buildBookSidebarFromRuntime,
|
|
55
|
+
getBookForPath,
|
|
56
|
+
getBookForPathFromRuntime,
|
|
57
|
+
getDocsDownloadForPath,
|
|
58
|
+
getDocsDownloadForPathFromRuntime,
|
|
59
|
+
getStarlightSidebarConfig,
|
|
60
|
+
getStarlightSidebarConfigFromRuntime,
|
|
61
|
+
normalizeHref
|
|
62
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const THEME_TOKEN_MAP = {
|
|
2
|
+
"surfaces.background": "--site-bg",
|
|
3
|
+
"surfaces.backgroundElevated": "--site-bg-elevated",
|
|
4
|
+
"surfaces.backgroundSoft": "--site-bg-soft",
|
|
5
|
+
"surfaces.panel": "--site-panel",
|
|
6
|
+
"surfaces.panelStrong": "--site-panel-strong",
|
|
7
|
+
"text.body": "--site-text",
|
|
8
|
+
"text.muted": "--site-text-muted",
|
|
9
|
+
"text.soft": "--site-text-soft",
|
|
10
|
+
"border.base": "--site-border",
|
|
11
|
+
"border.strong": "--site-border-strong",
|
|
12
|
+
"border.grid": "--site-grid",
|
|
13
|
+
"accent.base": "--site-accent",
|
|
14
|
+
"accent.strong": "--site-accent-strong",
|
|
15
|
+
"accent.soft": "--site-accent-soft",
|
|
16
|
+
"info.base": "--site-blue",
|
|
17
|
+
"info.strong": "--site-blue-strong",
|
|
18
|
+
"info.soft": "--site-blue-soft",
|
|
19
|
+
"warm.base": "--site-warm",
|
|
20
|
+
"warm.strong": "--site-warm-strong"
|
|
21
|
+
};
|
|
22
|
+
function getThemeValue(theme, dottedPath) {
|
|
23
|
+
if (!theme) return void 0;
|
|
24
|
+
return dottedPath.split(".").reduce((value, segment) => {
|
|
25
|
+
if (!value || typeof value !== "object") {
|
|
26
|
+
return void 0;
|
|
27
|
+
}
|
|
28
|
+
return value[segment];
|
|
29
|
+
}, theme);
|
|
30
|
+
}
|
|
31
|
+
function buildTenantThemeCss(theme) {
|
|
32
|
+
if (!theme) {
|
|
33
|
+
return "";
|
|
34
|
+
}
|
|
35
|
+
const declarations = Object.entries(THEME_TOKEN_MAP).map(([themePath, cssVariable]) => {
|
|
36
|
+
const value = getThemeValue(theme, themePath);
|
|
37
|
+
return typeof value === "string" && value.trim().length > 0 ? ` ${cssVariable}: ${value.trim()};` : null;
|
|
38
|
+
}).filter((entry) => Boolean(entry));
|
|
39
|
+
if (declarations.length === 0) {
|
|
40
|
+
return "";
|
|
41
|
+
}
|
|
42
|
+
return `:root {
|
|
43
|
+
${declarations.join("\n")}
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
buildTenantThemeCss
|
|
49
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types';
|
|
3
|
+
import { transform } from 'ultrahtml';
|
|
4
|
+
import sanitize from 'ultrahtml/transformers/sanitize';
|
|
5
|
+
// These styles are included globally by default, but can be removed when `markdown.headingLinks` is
|
|
6
|
+
// set to `false`. We import them here to ensure they are included if the component is used with the
|
|
7
|
+
// global Markdown option disabled.
|
|
8
|
+
import '../style/anchor-links.css';
|
|
9
|
+
import { AstroError } from 'astro/errors';
|
|
10
|
+
|
|
11
|
+
const headingLevels = [1, 2, 3, 4, 5, 6, '1', '2', '3', '4', '5', '6'] as const;
|
|
12
|
+
interface Props extends HTMLAttributes<'h1'> {
|
|
13
|
+
level: 1 | 2 | 3 | 4 | 5 | 6 | `${1 | 2 | 3 | 4 | 5 | 6}`;
|
|
14
|
+
id: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const { level, id, ...attrs } = Astro.props;
|
|
18
|
+
|
|
19
|
+
if (!id) {
|
|
20
|
+
throw new AstroError(
|
|
21
|
+
'Missing `id` attribute passed to `<AnchorHeading>` component',
|
|
22
|
+
`The \`<AnchorHeading>\` component requires an \`id\` attribute, but received \`${typeof id === 'string' ? '""' : id}\`.`
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
if (!headingLevels.includes(level)) {
|
|
26
|
+
throw new AstroError(
|
|
27
|
+
'Invalid `level` attribute passed to `<AnchorHeading>` component',
|
|
28
|
+
`The \`<AnchorHeading>\` component expects a \`level\` attribute of \`1 | 2 | 3 | 4 | 5 | 6\`, but received \`${level}\`.`
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const HeadingElement = `h${level}` as const;
|
|
33
|
+
const headingHTML = await Astro.slots.render('default');
|
|
34
|
+
const headingString = await transform(headingHTML, [sanitize({ unblockElements: [] })]);
|
|
35
|
+
const accessibleLabel = Astro.locals.t('heading.anchorLabel', {
|
|
36
|
+
title: headingString,
|
|
37
|
+
interpolation: { escapeValue: false },
|
|
38
|
+
})
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
{/* The spacing in this component is a little awkward to ensure whitespace matches what the rehype plugin produces. */}
|
|
42
|
+
<div class={`sl-heading-wrapper level-h${level}`}
|
|
43
|
+
><HeadingElement {id} {...attrs} set:html={headingHTML} /><a class="sl-anchor-link" href={`#${id}`}
|
|
44
|
+
><span aria-hidden="true" class="sl-anchor-icon"
|
|
45
|
+
><svg width="16" height="16" viewBox="0 0 24 24"
|
|
46
|
+
><path
|
|
47
|
+
fill="currentcolor"
|
|
48
|
+
d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"
|
|
49
|
+
></path></svg
|
|
50
|
+
></span
|
|
51
|
+
><span class="sr-only" data-pagefind-ignore="" set:text={accessibleLabel} /></a
|
|
52
|
+
></div
|
|
53
|
+
>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
const { banner } = Astro.locals.starlightRoute.entry.data;
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
{banner && <div class="sl-banner" data-pagefind-ignore set:html={banner.content} />}
|
|
6
|
+
|
|
7
|
+
<style>
|
|
8
|
+
@layer starlight.core {
|
|
9
|
+
.sl-banner {
|
|
10
|
+
--__sl-banner-text: var(--sl-color-banner-text, var(--sl-color-text-invert));
|
|
11
|
+
padding: var(--sl-nav-pad-y) var(--sl-nav-pad-x);
|
|
12
|
+
background-color: var(--sl-color-banner-bg, var(--sl-color-bg-accent));
|
|
13
|
+
color: var(--__sl-banner-text);
|
|
14
|
+
line-height: var(--sl-line-height-headings);
|
|
15
|
+
text-align: center;
|
|
16
|
+
text-wrap: balance;
|
|
17
|
+
box-shadow: var(--sl-shadow-sm);
|
|
18
|
+
}
|
|
19
|
+
.sl-banner :global(a) {
|
|
20
|
+
color: var(--__sl-banner-text);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
</style>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { StarlightIcon } from '../components/Icons';
|
|
3
|
+
import Icon from '../user-components/Icon.astro';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
icon: StarlightIcon;
|
|
7
|
+
label: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const { icon, label } = Astro.props;
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<p class="sl-flex">
|
|
14
|
+
<Icon name={icon} size="1.5em" color="var(--sl-color-orange-high)" />
|
|
15
|
+
<span>{label}</span>
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
<style>
|
|
19
|
+
@layer starlight.core {
|
|
20
|
+
p {
|
|
21
|
+
border: 1px solid var(--sl-color-orange);
|
|
22
|
+
padding: 0.75em 1em;
|
|
23
|
+
background-color: var(--sl-color-orange-low);
|
|
24
|
+
color: var(--sl-color-orange-high);
|
|
25
|
+
width: max-content;
|
|
26
|
+
max-width: 100%;
|
|
27
|
+
align-items: center;
|
|
28
|
+
gap: 0.75em;
|
|
29
|
+
font-size: var(--sl-text-body-sm);
|
|
30
|
+
line-height: var(--sl-line-height-headings);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
</style>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<div class="content-panel">
|
|
2
|
+
<div class="sl-container"><slot /></div>
|
|
3
|
+
</div>
|
|
4
|
+
|
|
5
|
+
<style>
|
|
6
|
+
@layer starlight.core {
|
|
7
|
+
.content-panel {
|
|
8
|
+
padding: 1.5rem var(--sl-content-pad-x);
|
|
9
|
+
}
|
|
10
|
+
.content-panel + .content-panel {
|
|
11
|
+
border-top: 1px solid var(--sl-color-hairline);
|
|
12
|
+
}
|
|
13
|
+
.sl-container {
|
|
14
|
+
max-width: var(--sl-content-width);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.sl-container > :global(* + *) {
|
|
18
|
+
margin-top: 1.5rem;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@media (min-width: 72rem) {
|
|
22
|
+
.sl-container {
|
|
23
|
+
margin-inline: var(--sl-content-margin-inline, auto);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
</style>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Icon from '../user-components/Icon.astro';
|
|
3
|
+
|
|
4
|
+
const { editUrl } = Astro.locals.starlightRoute;
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
{
|
|
8
|
+
editUrl && (
|
|
9
|
+
<a href={editUrl} class="sl-flex print:hidden">
|
|
10
|
+
<Icon name="pencil" size="1.2em" />
|
|
11
|
+
{Astro.locals.t('page.editLink')}
|
|
12
|
+
</a>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
<style>
|
|
17
|
+
@layer starlight.core {
|
|
18
|
+
a {
|
|
19
|
+
gap: 0.5rem;
|
|
20
|
+
align-items: center;
|
|
21
|
+
text-decoration: none;
|
|
22
|
+
color: var(--sl-color-gray-3);
|
|
23
|
+
}
|
|
24
|
+
a:hover {
|
|
25
|
+
color: var(--sl-color-white);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
</style>
|