@redocly/framework 1.0.0-next.12 → 1.0.0-next.14
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 +0 -1
- package/dist/bundler/build/dependency-pack.js +1 -1
- package/dist/bundler/build/output-metadata.js +1 -1
- package/dist/bundler/build/run.js +1 -1
- package/dist/bundler/build/theme-global-stylesheets.js +1 -1
- package/dist/bundler/build/vite-config.js +2 -2
- package/dist/bundler/dev/dev-content-build.js +1 -1
- package/dist/bundler/dev/routes/dev-problems-route.js +1 -1
- package/dist/bundler/dev/routes/source-sync-route.js +1 -1
- package/dist/bundler/dev/run.js +1 -1
- package/dist/bundler/dev/runtime-app.js +1 -1
- package/dist/bundler/dev/vite-chunk-url.js +1 -1
- package/dist/bundler/user-markdoc-schema.js +1 -1
- package/dist/bundler/vite-config.base.js +5 -5
- package/dist/cli/api-docs-build-event.js +1 -1
- package/dist/cli/args.js +1 -1
- package/dist/cli/commands/build.js +1 -1
- package/dist/cli/commands/dev.js +1 -1
- package/dist/cli/commands/ingest.js +1 -1
- package/dist/cli/commands/translate.js +1 -1
- package/dist/cli/problems-output.js +3 -3
- package/dist/cli/validate-react-pages.js +1 -1
- package/dist/client/UnversionedVersionButton.js +1 -1
- package/dist/client/VersionPicker.js +343 -0
- package/dist/client/ai-search/use-ai-search.js +1 -1
- package/dist/client/analytics-page-view.js +1 -1
- package/dist/client/app.js +2 -2
- package/dist/client/classic-webview-sync.js +1 -1
- package/dist/client/client-entry.js +1 -1
- package/dist/client/contexts.js +1 -1
- package/dist/client/feedback.js +1 -1
- package/dist/client/history-mount.js +6 -5
- package/dist/client/l10n/ssr-l10n.js +1 -1
- package/dist/client/l10n/use-l10n-config.js +1 -1
- package/dist/client/products.js +1 -1
- package/dist/client/review/ReviewBar.js +31 -31
- package/dist/client/review/login-url.js +1 -1
- package/dist/client/review/use-review.js +1 -1
- package/dist/client/revisions-history.js +1 -1
- package/dist/client/sidebar/SidebarDataProvider.js +1 -1
- package/dist/client/sidebar/drilldown.js +1 -1
- package/dist/client/ssr.js +1 -1
- package/dist/client/telemetry/config.js +1 -1
- package/dist/client/theme-logo.js +1 -1
- package/dist/client/use-entity-revisions.js +1 -1
- package/dist/client/use-page-versions.js +1 -1
- package/dist/client/use-search.js +1 -1
- package/dist/client/webmcp/tools/shared.js +1 -1
- package/dist/client/webmcp/tools/site-tools.js +1 -1
- package/dist/client/webmcp/use-webmcp-tools.js +1 -1
- package/dist/content-layer/config-schema.js +1 -1
- package/dist/content-layer/config.d.ts +8 -0
- package/dist/content-layer/config.js +1 -1
- package/dist/content-layer/context-state.js +1 -1
- package/dist/content-layer/context.d.ts +6 -0
- package/dist/content-layer/context.js +1 -1
- package/dist/content-layer/database/assets.js +1 -1
- package/dist/content-layer/database/blobs.js +1 -1
- package/dist/content-layer/database/entities.d.ts +2 -0
- package/dist/content-layer/database/entities.js +1 -1
- package/dist/content-layer/database/entity-store.js +1 -1
- package/dist/content-layer/database/files.js +1 -1
- package/dist/content-layer/database/finalize.js +1 -1
- package/dist/content-layer/database/invalidation.js +26 -26
- package/dist/content-layer/database/link-refs.js +1 -1
- package/dist/content-layer/database/origins.d.ts +2 -1
- package/dist/content-layer/database/origins.js +1 -1
- package/dist/content-layer/database/problems.js +1 -1
- package/dist/content-layer/database/reset.js +1 -1
- package/dist/content-layer/database/route-query-deps.d.ts +19 -3
- package/dist/content-layer/database/route-query-deps.js +1 -1
- package/dist/content-layer/database/search-vocab.js +2 -2
- package/dist/content-layer/database/static-files.js +1 -1
- package/dist/content-layer/ingest/extract-all-phase.js +1 -1
- package/dist/content-layer/ingest/finalize-phase.js +1 -1
- package/dist/content-layer/ingest/git-last-modified.d.ts +20 -0
- package/dist/content-layer/ingest/git-last-modified.js +5 -4
- package/dist/content-layer/ingest/hash.js +1 -1
- package/dist/content-layer/ingest/hook-inputs.js +1 -1
- package/dist/content-layer/ingest/l10n-warnings.js +1 -1
- package/dist/content-layer/ingest/markdoc-schema-problem.js +1 -1
- package/dist/content-layer/ingest/normalize-artifacts.js +1 -1
- package/dist/content-layer/ingest/run.js +1 -1
- package/dist/content-layer/ingest/scan.js +1 -1
- package/dist/content-layer/ingest/search-sync.js +1 -1
- package/dist/content-layer/ingest/sync.js +1 -1
- package/dist/content-layer/link-checker/config-links.js +1 -1
- package/dist/content-layer/link-checker/delta.js +1 -1
- package/dist/content-layer/link-checker/fingerprint.js +1 -1
- package/dist/content-layer/link-checker/load-view.js +1 -1
- package/dist/content-layer/link-checker/node-ref.js +1 -1
- package/dist/content-layer/link-checker/run-build.js +1 -1
- package/dist/content-layer/link-checker/validate.js +1 -1
- package/dist/content-layer/loaders/context.js +1 -1
- package/dist/content-layer/markdown/client/JsonSchemaTag.js +1 -1
- package/dist/content-layer/markdown/client/markdown-text.js +1 -1
- package/dist/content-layer/markdown/constants/builtin-tags.js +1 -1
- package/dist/content-layer/markdown/nodes/fence.js +1 -1
- package/dist/content-layer/markdown/nodes/heading.js +1 -1
- package/dist/content-layer/markdown/nodes/table.js +1 -1
- package/dist/content-layer/markdown/resolve/ast.d.ts +2 -0
- package/dist/content-layer/markdown/resolve/ast.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/file-reference.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/operation-samples.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/partial.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/svg-content.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc.js +1 -1
- package/dist/content-layer/markdown/resolve/references.js +1 -1
- package/dist/content-layer/markdown/search/to-markdown.js +3 -3
- package/dist/content-layer/markdown/search/to-sections.js +1 -1
- package/dist/content-layer/markdown/search/to-text.js +5 -5
- package/dist/content-layer/markdown/server/render.js +1 -1
- package/dist/content-layer/markdown/service.js +1 -1
- package/dist/content-layer/markdown/tags/variant.js +1 -1
- package/dist/content-layer/markdown/utils/collect-anchors.js +1 -1
- package/dist/content-layer/markdown/utils/first-heading.js +1 -1
- package/dist/content-layer/markdown/utils/parse-cache.d.ts +5 -1
- package/dist/content-layer/markdown/utils/parse-cache.js +1 -1
- package/dist/content-layer/materialization/asset-reconcile.js +1 -1
- package/dist/content-layer/materialization/entity.js +1 -1
- package/dist/content-layer/materialization/materializer.js +1 -1
- package/dist/content-layer/materialization/static-files.js +1 -1
- package/dist/content-layer/plugins/execute.js +1 -1
- package/dist/content-layer/plugins/index.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/client/template.js +2 -2
- package/dist/content-layer/plugins/internal/api-docs/index.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/server/build-definition.d.ts +4 -1
- package/dist/content-layer/plugins/internal/api-docs/server/build-definition.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/server/markdown-copy.js +12 -10
- package/dist/content-layer/plugins/internal/api-docs/server/options.d.ts +1 -1
- package/dist/content-layer/plugins/internal/api-docs/server/options.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/server/search-documents.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/server/spec-download.js +1 -1
- package/dist/content-layer/plugins/internal/api-functions/server/dispatch.js +1 -1
- package/dist/content-layer/plugins/internal/app-data/index.js +1 -1
- package/dist/content-layer/plugins/internal/app-data/logo.js +1 -1
- package/dist/content-layer/plugins/internal/app-data/products.js +1 -1
- package/dist/content-layer/plugins/internal/assets/index.js +1 -1
- package/dist/content-layer/plugins/internal/catalog-classic/client/use-catalog-classic.js +1 -1
- package/dist/content-layer/plugins/internal/catalog-classic/index.js +1 -1
- package/dist/content-layer/plugins/internal/catalog-classic/resolve-items.js +1 -1
- package/dist/content-layer/plugins/internal/index.js +1 -1
- package/dist/content-layer/plugins/internal/l10n/index.js +1 -1
- package/dist/content-layer/plugins/internal/l10n/translations-loader.js +1 -1
- package/dist/content-layer/plugins/internal/markdoc/client/template.js +1 -1
- package/dist/content-layer/plugins/internal/markdoc/index.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/app-data.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/constants.d.ts +4 -3
- package/dist/content-layer/plugins/internal/mcp/constants.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/content-tools.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/ignored-routes.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/index.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/agent-card.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/audit.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/auth.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/codemode/constants.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/codemode/execute-schema.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/codemode/prompts.js +8 -8
- package/dist/content-layer/plugins/internal/mcp/server/config-gate.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/custom-tools.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/call-api.js +2 -2
- package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-handler.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-page/form-page.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-page/site-branding.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/elicitation.js +6 -6
- package/dist/content-layer/plugins/internal/mcp/server/gateway/index.js +3 -3
- package/dist/content-layer/plugins/internal/mcp/server/gateway/subject.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/tool-list.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/tools.js +4 -4
- package/dist/content-layer/plugins/internal/mcp/server/handler.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/mcp-server.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/mcp-telemetry.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/authorize.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/callback.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/client-metadata.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/discovery.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/register.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/token.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/server-card.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/server-info.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/skills-resources.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/tools/pages-navigation.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/tools/pages.js +2 -2
- package/dist/content-layer/plugins/internal/mcp/server/tools/schemas.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/tools/search.js +2 -2
- package/dist/content-layer/plugins/internal/mcp/server/workflows/resolve-workflows.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/workflows/schemas.js +2 -1
- package/dist/content-layer/plugins/internal/mcp/server/workflows/tools.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/setup-page.js +1 -1
- package/dist/content-layer/plugins/internal/mock/server/handler.js +1 -1
- package/dist/content-layer/plugins/internal/react-page/index.js +1 -1
- package/dist/content-layer/plugins/internal/scorecard-classic/client/template.js +1 -1
- package/dist/content-layer/plugins/internal/scorecard-classic/index.js +1 -1
- package/dist/content-layer/plugins/internal/sidebar/bundle.js +1 -1
- package/dist/content-layer/plugins/internal/sidebar/index.js +2 -2
- package/dist/content-layer/plugins/internal/skills/index.js +1 -1
- package/dist/content-layer/plugins/internal/skills/server/routes.js +1 -1
- package/dist/content-layer/plugins/io.js +1 -1
- package/dist/content-layer/plugins/project/load.js +2 -2
- package/dist/content-layer/plugins/source-file.js +1 -1
- package/dist/content-layer/plugins/utils/link-access.js +1 -1
- package/dist/content-layer/plugins/utils/route-index.js +1 -1
- package/dist/content-layer/revisions/delete.js +1 -1
- package/dist/content-layer/revisions/read.js +1 -1
- package/dist/content-layer/search/engine/core/search-engine.js +1 -1
- package/dist/content-layer/search/postings/postings-store.js +1 -1
- package/dist/content-layer/server/database.js +1 -1
- package/dist/content-layer/static/registry.js +1 -1
- package/dist/content-layer/templates/template-set.js +1 -1
- package/dist/content-layer/versions/redirect.js +1 -1
- package/dist/content-layer/versions/resolve.js +1 -1
- package/dist/server/app.js +3 -3
- package/dist/server/ask-ai/feature-gate.js +1 -1
- package/dist/server/ask-ai/route.js +1 -1
- package/dist/server/auth/middleware.js +1 -1
- package/dist/server/auth/request.js +1 -1
- package/dist/server/auth/routes.js +1 -1
- package/dist/server/content.js +12 -12
- package/dist/server/cors-proxy/handler.js +1 -1
- package/dist/server/feedback/route.js +1 -1
- package/dist/server/lambda-entry.js +1 -1
- package/dist/server/manifest-assets.js +4 -4
- package/dist/server/node-entry.js +1 -1
- package/dist/server/page-handlers.js +2 -2
- package/dist/server/plugin-context.js +1 -1
- package/dist/server/rbac/content-asset-access.js +1 -1
- package/dist/server/runtime-config.js +1 -1
- package/dist/server/search/route.js +1 -1
- package/dist/server/seo-tags.js +2 -2
- package/dist/server/sitemap.js +1 -1
- package/dist/server/static-files/serve.js +1 -1
- package/dist/server/subprocess/child-entry.js +1 -1
- package/dist/server/subprocess/host.js +1 -1
- package/dist/server/template-ids.js +1 -1
- package/dist/shared/constants/system-routes.js +1 -1
- package/dist/shared/rbac/engine.js +0 -0
- package/dist/shared/rbac/l10n-rules.js +1 -1
- package/dist/shared/rbac/route-scope.js +1 -1
- package/dist/shared/rbac/team-templates.js +1 -1
- package/dist/shared/types/config.d.ts +2 -1
- package/dist/shared/utils/l10n.js +1 -1
- package/dist/shared/utils/routes/file-path-to-route-slug.js +1 -1
- package/package.json +4 -5
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import e from"styled-components";const t=e.div`
|
|
2
|
-
margin: var(--sidebar-offset-top) var(--sidebar-margin-horizontal) 0
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
margin: var(--sidebar-offset-top) calc(var(--sidebar-margin-horizontal) + 6px) 0
|
|
3
|
+
var(--sidebar-margin-horizontal);
|
|
4
|
+
|
|
5
|
+
[data-component-name='Menu/MenuMobile'] & {
|
|
6
|
+
margin: var(--spacing-xxs) var(--sidebar-margin-horizontal) var(--spacing-sm);
|
|
7
|
+
}
|
|
7
8
|
`;export{t as HistoryMount};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{DEFAULT_LOCALE_PLACEHOLDER as e}from"../../shared/constants/l10n/defaults.js";import"../../shared/utils/l10n.js";import{createTranslate as t}from"../../shared/utils/l10n/create-translate.js";import{buildI18nConfig as n}from"../../shared/utils/l10n/build-i18n-config.js";import{collectTranslationKeys as r}from"./use-translation-keys.js";import i from"i18next";const a=/* @__PURE__ */ new WeakMap,o={};function s(t){let r=t??o,s=a.get(r);return s||(s=(async()=>{let r=i.createInstance(),a=t?.defaultLocale||e;return await r.init(await n(t,a)),r})(),s.catch(()=>a.delete(r)),a.set(r,s)),s}async function c(e,n){let i=await s(e),a;return{lang:n,translate:t(i.getFixedT(n)),changeLanguage:async()=>i.getFixedT(n),getKeys:()=>(a||=r(i,n),a)}}export{c as createSsrL10nContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{DEFAULT_LOCALE_PLACEHOLDER as e}from"../../shared/constants/l10n/defaults.js";import"../../shared/utils/l10n.js";import{readAppData as t}from"../../shared/utils/app-data.js";import{LoaderDataContext as n}from"../contexts.js";import{routableLocales as r}from"../../shared/utils/l10n/routable-locales.js";import{useContext as i,useMemo as a}from"react";import{UNSAFE_LocationContext as o,useLocation as s}from"react-router";import{getLocaleFromPathname as c}from"@redocly/theme/core/utils";const l=[];function u(e){return t(e).l10n}function d(t){let o=s(),d=i(n),f=u(t??d),p=f?.locales??l,m=f?.defaultLocale??e,h=a(()=>r(f),[f]);return{currentLocale:a(()=>c(o.pathname,m,h),[o,h,m]),defaultLocale:m,locales:p}}function f(){let e=i(o)?.location,t=u(i(n));return a(()=>e&&t?p(t,e.pathname):void 0,[e,t])}function p(t,n){let i=typeof t.defaultLocale==`string`?t.defaultLocale:e;return c(n,i,r(t))}export{u as getL10nAppData,p as localeOfPathname,d as useL10nConfig,f as useRouteLocale};
|
package/dist/client/products.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{DEFAULT_LOCALE_PLACEHOLDER as e}from"../shared/constants/l10n/defaults.js";import"../shared/utils/l10n.js";import{withPathPrefix as t}from"../shared/path-prefix.js";import{readAppData as n}from"../shared/utils/app-data.js";import{routableLocales as r}from"../shared/utils/l10n/routable-locales.js";import{getL10nAppData as i}from"./l10n/use-l10n-config.js";import{findProductForSlug as a}from"../shared/products.js";import{getPathnameForLocale as o}from"@redocly/theme/core/utils";function s(e,t,n){let r=o(t,n.defaultLocale,n.defaultLocale,n.locales);return a(e,r)}function c(t,a){let o=i(t);return s(n(t).pageProducts??[],a,{defaultLocale:o?.defaultLocale||e,locales:r(o)})}function l(e,n,r){return Object.values(e.products??{}).map(i=>{let a={name:i.name,folder:i.folder,slug:i.slug,link:n(i.link)};if(i.icon!==void 0&&(a.icon=t(i.icon)),i.configOverride){let t=r({...e,...i.configOverride});a.configOverride=Object.fromEntries(Object.keys(i.configOverride).map(e=>[e,t[e]]))}return a})}export{s as findCurrentProduct,c as findPageProduct,l as toProductUiConfigs};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import{PageContext as e}from"../contexts.js";import{useBarPosition as t}from"../use-bar-position.js";import{changedPageNavigation as n,filterChangedPages as r,isSamePage as i}from"./changed-pages.js";import{reviewLoginUrl as a}from"./login-url.js";import{reviewTimeline as o}from"./timeline.js";import{useReview as s}from"./use-review.js";import{createContext as c,useCallback as l,useContext as u,useEffect as d,useRef as f,useState as p}from"react";import m,{css as h,keyframes as g}from"styled-components";import{Button as _}from"@redocly/theme/components/Button/Button";import{breakpoints as v,hiddenWhileMobileMenuOpen as y}from"@redocly/theme/core/utils";import{Fragment as b,jsx as x,jsxs as S}from"react/jsx-runtime";import{useTimeAgo as C}from"@redocly/theme/core/hooks";import{DraggableIcon as ee}from"@redocly/theme/icons/DraggableIcon/DraggableIcon";import{Spinner as te}from"@redocly/theme/icons/Spinner/Spinner";import{Link as w}from"@redocly/theme/components/Link/Link";import{linkCss as T}from"@redocly/theme/components/Markdown/styles/links";import{Segmented as E}from"@redocly/theme/components/Segmented/Segmented";import{Tag as D}from"@redocly/theme/components/Tag/Tag";import{Tooltip as O}from"@redocly/theme/components/Tooltip/Tooltip";import{ChatIcon as k}from"@redocly/theme/icons/ChatIcon/ChatIcon";import{CheckmarkIcon as ne}from"@redocly/theme/icons/CheckmarkIcon/CheckmarkIcon";import{CloseIcon as A}from"@redocly/theme/icons/CloseIcon/CloseIcon";import{ChevronLeftIcon as j}from"@redocly/theme/icons/ChevronLeftIcon/ChevronLeftIcon";import{ChevronRightIcon as re}from"@redocly/theme/icons/ChevronRightIcon/ChevronRightIcon";import{MinimizeIcon as ie}from"@redocly/theme/icons/MinimizeIcon/MinimizeIcon";import{SearchIcon as ae}from"@redocly/theme/icons/SearchIcon/SearchIcon";import{TrashCanIcon as M}from"@redocly/theme/icons/TrashCanIcon/TrashCanIcon";import{WarningAltIcon as oe}from"@redocly/theme/icons/WarningAltIcon/WarningAltIcon";const N=`realm.review-bar-used`,P=[{value:`all`,label:`All`},{value:`modified`,label:`Modified`},{value:`added`,label:`Added`},{value:`removed`,label:`Removed`}],F=/Mac|iPhone|iPad/.test(navigator.platform)?`⌘ Enter`:`Ctrl Enter`,I={added:`Added`,modified:`Modified`,removed:`Removed`},L={APPROVED:`approved`,REQUESTED_CHANGES:`requested changes on`,COMMENTED:`commented on`},R=c(`middle`);function se(){try{return localStorage.getItem(N)===`1`}catch{return!1}}function z(){try{localStorage.setItem(N,`1`)}catch{}}function B({children:e,...t}){let n=u(R);return/* @__PURE__ */ x(O,{...t,placement:`top`,fallbackPlacements:[],arrowPosition:n===`middle`?`center`:n,children:e})}function V(){let n=u(e),{state:r,error:o,submitting:c,addComment:f,deleteComment:m}=s(),[h,g]=p(null),{barRef:v,slot:y,dragging:C,style:w,onDragStart:T}=t({storageKey:`realm.review-bar-slot`,defaultSlot:`left`,frozen:h!==null}),[E,D]=p(!1),[O,j]=p(!1),[re,ae]=p(0),[M,N]=p(se),P=l(()=>{let e=v.current?.getBoundingClientRect().width;!e||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?N(!0):g(e)},[v]);if(d(()=>{if(M||h!==null||E||O)return;let e=e=>{e.target instanceof Node&&v.current?.contains(e.target)||P()};return window.addEventListener(`wheel`,e,{passive:!0}),window.addEventListener(`touchmove`,e,{passive:!0}),()=>{window.removeEventListener(`wheel`,e),window.removeEventListener(`touchmove`,e)}},[M,h,E,O,v,P]),d(()=>{if(!E&&!O)return;let e=e=>{e.key===`Escape`&&(O?j(!1):D(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[E,O]),window.self!==window.top)return null;let F=n?.slug??`/`,I=r?.signedIn?r.pullRequest:null,L=E&&I!==null,V=I?.pageComments.filter(e=>!e.replyToId&&!e.isResolved&&i(e.pageSlug,F)).length??0,H=/* @__PURE__ */ S(b,{children:[/* @__PURE__ */ x(B,{tip:`Drag to move`,disabled:C,children:/* @__PURE__ */ x(xe,{type:`button`,"aria-label":`Drag the review bar`,onPointerDown:T,$dragging:C,children:/* @__PURE__ */ x(ee,{size:`16px`,color:`var(--icon-color-secondary)`})})}),r===null&&!o&&/* @__PURE__ */ x(q,{children:/* @__PURE__ */ x(te,{size:`16px`,color:`var(--icon-color-secondary)`})}),r?.signedIn===!1&&/* @__PURE__ */ x(_,{variant:`primary`,onClick:()=>{z(),window.location.assign(a(n?.path??`/`))},children:`Log in to review`}),r?.signedIn&&!I&&/* @__PURE__ */ x(Y,{children:`No open pull request`}),I&&/* @__PURE__ */ S(b,{children:[/* @__PURE__ */ S(K,{children:[/* @__PURE__ */ x(B,{tip:`${I.title} — open in Platform`,children:/* @__PURE__ */ S(_,{variant:`text`,to:I.url,external:!0,children:[`#`,I.number]})}),/* @__PURE__ */ x(J,{})]}),/* @__PURE__ */ x(le,{pullRequest:I,currentSlug:F,open:O,onToggle:()=>{z(),ae(v.current?.getBoundingClientRect().top??0),j(e=>!e)}}),L?/* @__PURE__ */ S(b,{children:[/* @__PURE__ */ x(ye,{}),/* @__PURE__ */ x(B,{tip:`Close`,children:/* @__PURE__ */ x(_,{variant:`text`,icon:/* @__PURE__ */ x(A,{color:`currentColor`}),"aria-label":`Close the review`,onClick:()=>D(!1)})})]}):/* @__PURE__ */ S(b,{children:[/* @__PURE__ */ x(J,{}),/* @__PURE__ */ x(B,{tip:I.decision===`APPROVED`?`You approved`:I.decision===`REQUESTED_CHANGES`?`You requested changes`:`Comment on pages, then finish your review in Platform`,children:/* @__PURE__ */ S(_,{variant:`primary`,"aria-expanded":!1,onClick:()=>{z(),j(!1),D(!0)},icon:I.decision===`APPROVED`?/* @__PURE__ */ x(ne,{color:`currentColor`}):I.decision===`REQUESTED_CHANGES`?/* @__PURE__ */ x(A,{color:`currentColor`}):void 0,children:[`Review`,V>0&&/* @__PURE__ */ S(Ie,{"aria-label":`${V} open comments on this page`,children:[/* @__PURE__ */ x(k,{size:`12px`,color:`currentColor`}),V]})]})})]})]}),o&&/* @__PURE__ */ x(B,{tip:o,children:/* @__PURE__ */ x(q,{role:`alert`,"aria-label":o,children:/* @__PURE__ */ x(oe,{size:`16px`,color:`var(--color-error-base)`})})}),!L&&/* @__PURE__ */ x(B,{tip:`Collapse`,children:/* @__PURE__ */ x(_,{variant:`text`,icon:/* @__PURE__ */ x(ie,{color:`currentColor`}),"aria-label":`Collapse the review bar`,onClick:()=>{z(),j(!1),P()}})})]}),U=o??(r?.signedIn===!1?`Log in to review`:r?.signedIn&&!I?`No open pull request`:`Review`),W=/* @__PURE__ */ x(B,{tip:U,children:/* @__PURE__ */ S(ge,{type:`button`,"aria-label":U,"aria-expanded":!1,onClick:()=>{z(),N(!1)},children:[/* @__PURE__ */ x(k,{size:`18px`,color:`var(--icon-color-primary)`}),o?/* @__PURE__ */ x(G,{role:`alert`,$tone:`error`}):r?.signedIn===!1?/* @__PURE__ */ x(G,{$tone:`info`}):V>0?/* @__PURE__ */ x(_e,{children:V}):null]})});return/* @__PURE__ */ x(R.Provider,{value:y,children:/* @__PURE__ */ S(he,{ref:v,style:h===null?w:{...w,"--review-bar-collapse-from":`${h}px`},$dragging:C,$expanded:L,$collapsed:M,$collapsing:h!==null,onAnimationEnd:e=>{e.target===e.currentTarget&&h!==null&&(g(null),N(!0))},"data-testid":`review-bar`,children:[M?W:L?/* @__PURE__ */ S(b,{children:[/* @__PURE__ */ x(ve,{children:H}),/* @__PURE__ */ x(be,{children:/* @__PURE__ */ x(ce,{pullRequest:I,currentSlug:F,submitting:c,onComment:e=>f({pageSlug:F,text:e}),onDelete:m})})]}):H,!M&&O&&I&&/* @__PURE__ */ x(Ce,{$slot:y,style:{maxHeight:`min(50vh, calc(${re}px - 2 * var(--spacing-xs)))`},children:/* @__PURE__ */ x(ue,{pages:I.changedPages??[],currentSlug:F,onOpen:()=>j(!1)})})]})})}function ce({pullRequest:e,currentSlug:t,submitting:n,onComment:r,onDelete:i}){let a=e.pageComments.filter(e=>e.isPending).length;return/* @__PURE__ */ S(b,{children:[/* @__PURE__ */ x(H,{pullRequest:e,currentSlug:t,submitting:n,onSubmit:r,onDelete:i}),/* @__PURE__ */ S(Fe,{children:[/* @__PURE__ */ x($,{children:a===0?`Comments are posted when you finish your review.`:`${a} pending ${a===1?`comment`:`comments`}`}),e.url&&/* @__PURE__ */ x(B,{tip:`Approve or request changes in Platform`,children:/* @__PURE__ */ x(_,{variant:`primary`,to:`${e.url}/review?finishReview=true`,external:!0,children:`Finish review`})})]})]})}function H({pullRequest:e,currentSlug:t,submitting:n,onSubmit:r,onDelete:a}){let[s,c]=p(``),[l,u]=p(!1),m=f(null),h=!n&&s.trim()!==``,g=o(e).filter(e=>l||e.kind===`comment`&&i(e.comment.pageSlug,t));d(()=>{m.current?.scrollTo({top:m.current.scrollHeight})},[g.length]);let v=n=>{if(i(n,t))return/* @__PURE__ */ x(Xe,{children:`this page`});let r=e.changedPages?.find(e=>i(e.slug,n));return/* @__PURE__ */ x(Ze,{to:n,languageInsensitive:!0,children:r?.name||n})};return/* @__PURE__ */ S(b,{children:[/* @__PURE__ */ x(Re,{children:/* @__PURE__ */ x(E,{size:`small`,value:l,onChange:({value:e})=>u(e),options:[{value:!1,label:`This page`},{value:!0,label:`All pages`}]})}),g.length===0?/* @__PURE__ */ x(ze,{children:l?`No reviews or comments yet.`:`No comments on this page yet.`}):/* @__PURE__ */ x(Be,{ref:m,children:g.map(e=>e.kind===`review`?/* @__PURE__ */ x(U,{author:e.review.author,createdAt:e.review.createdAt,action:/* @__PURE__ */ S(b,{children:[L[e.review.status],` `,/* @__PURE__ */ x(Xe,{children:`the pull request`})]}),text:e.review.comment},e.review.id):/* @__PURE__ */ x(U,{author:e.comment.author,createdAt:e.comment.createdAt,action:/* @__PURE__ */ S(b,{children:[`commented on `,v(e.comment.pageSlug)]}),text:e.comment.comment,tag:e.comment.isPending?/* @__PURE__ */ x(D,{children:`Pending`}):e.comment.isResolved&&/* @__PURE__ */ x(D,{children:`Resolved`}),aside:e.comment.isPending&&/* @__PURE__ */ x(B,{tip:`Delete pending comment`,children:/* @__PURE__ */ x(_,{variant:`text`,size:`small`,icon:/* @__PURE__ */ x(M,{color:`currentColor`}),"aria-label":`Delete pending comment`,disabled:n,onClick:()=>void a(e.comment.id)})}),children:e.replies.length>0&&/* @__PURE__ */ x(Ve,{children:e.replies.map(e=>/* @__PURE__ */ x(U,{author:e.author,createdAt:e.createdAt,action:`replied`,text:e.comment},e.id))})},e.comment.id))}),/* @__PURE__ */ x(we,{onSubmit:async e=>{e.preventDefault(),h&&await r(s.trim())&&c(``)},children:/* @__PURE__ */ S(Te,{children:[/* @__PURE__ */ x(Ee,{autoFocus:!0,rows:2,placeholder:`Comment on this page`,value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),/* @__PURE__ */ S(De,{children:[/* @__PURE__ */ x($,{children:F}),/* @__PURE__ */ x(_,{type:`submit`,size:`small`,disabled:!h,children:`Comment`})]})]})})]})}function U({author:e,createdAt:t,action:n,text:r,tag:i,aside:a,children:o}){let{format:s}=C();return/* @__PURE__ */ S(He,{children:[e.avatarUrl?/* @__PURE__ */ x(We,{src:e.avatarUrl,alt:``}):/* @__PURE__ */ x(Ge,{"aria-hidden":!0,children:W(e.name)}),/* @__PURE__ */ S(Ke,{children:[/* @__PURE__ */ S(qe,{children:[/* @__PURE__ */ x(`strong`,{children:e.name||`Someone`}),/* @__PURE__ */ x(Je,{dateTime:t,children:s(new Date(t))}),i]}),/* @__PURE__ */ x(Ye,{children:n}),r&&/* @__PURE__ */ x(Qe,{children:r}),o]}),a]})}function W(e){return e.split(/\s+/).filter(Boolean).slice(0,2).map(e=>e.charAt(0).toUpperCase()).join(``)||`?`}function le({pullRequest:e,currentSlug:t,open:r,onToggle:i}){if(e.changedPages===null)return/* @__PURE__ */ x(B,{tip:`Platform has not compared this preview with production yet`,children:/* @__PURE__ */ x(Y,{children:`…`})});if(e.changedPages.length===0)return/* @__PURE__ */ x(B,{tip:`No page content changed; navigation, styles, or config can still differ`,children:/* @__PURE__ */ x(Y,{children:`No changed pages`})});let{openable:a,index:o,previous:s,next:c}=n(e.changedPages,t);return/* @__PURE__ */ S(Se,{children:[/* @__PURE__ */ x(B,{tip:s?`Previous: ${s.name||s.slug}`:``,disabled:!s,children:/* @__PURE__ */ x(_,{variant:`text`,icon:/* @__PURE__ */ x(j,{color:`currentColor`}),to:s?.slug,languageInsensitive:!0,disabled:!s,"aria-label":`Previous changed page`})}),/* @__PURE__ */ x(B,{tip:`Changed pages`,disabled:r,children:/* @__PURE__ */ x(_,{variant:`text`,onClick:i,"aria-expanded":r,children:o>=0?`${o+1}/${a.length}`:`${a.length} changed`})}),/* @__PURE__ */ x(B,{tip:c?`Next: ${c.name||c.slug}`:``,disabled:!c,children:/* @__PURE__ */ x(_,{variant:`text`,icon:/* @__PURE__ */ x(re,{color:`currentColor`}),to:c?.slug,languageInsensitive:!0,disabled:!c,"aria-label":`Next changed page`})})]})}function ue({pages:e,currentSlug:t,onOpen:a}){let[o,s]=p(``),[c,l]=p(`all`),u=e.length>5,m=r(e,c,o),h=m.slice(0,500),[g,_]=p(()=>Math.max(h.findIndex(e=>i(e.slug,t)),0)),v=f(null),{openable:y,index:C}=n(e,t);return d(()=>{v.current?.querySelector(`[data-active]`)?.scrollIntoView({block:`nearest`})},[g,o,c]),/* @__PURE__ */ S(b,{children:[u&&/* @__PURE__ */ S(Oe,{children:[/* @__PURE__ */ S(ke,{children:[/* @__PURE__ */ x(ae,{size:`16px`,color:`var(--icon-color-secondary)`}),/* @__PURE__ */ x(Ae,{autoFocus:!0,"aria-label":`Search changed pages`,placeholder:`Search ${e.length} changed pages`,value:o,onChange:e=>{s(e.target.value),_(0)},onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:-1;_(e=>Math.min(Math.max(e+t,0),h.length-1))}else e.key===`Enter`&&(e.preventDefault(),v.current?.querySelector(`[data-active] a`)?.click())}})]}),/* @__PURE__ */ x(je,{children:/* @__PURE__ */ x(E,{size:`small`,value:c,onChange:({value:e})=>{l(e),_(0)},options:P.map(({value:t,label:n})=>({value:t,label:n,element:/* @__PURE__ */ S(b,{children:[n,` `,/* @__PURE__ */ x(Me,{children:r(e,t,``).length})]})}))})})]}),/* @__PURE__ */ S($e,{ref:v,children:[h.map((e,n)=>{let r=i(e.slug,t),o=/* @__PURE__ */ S(b,{children:[/* @__PURE__ */ S(nt,{children:[/* @__PURE__ */ x(rt,{children:e.name||e.slug}),e.name&&e.name!==e.slug&&/* @__PURE__ */ x(it,{children:e.slug})]}),r?/* @__PURE__ */ x(at,{children:`Current`}):!u&&e.mode&&/* @__PURE__ */ x(at,{children:I[e.mode]})]});return/* @__PURE__ */ x(`li`,{"data-active":u&&n===g?``:void 0,children:e.mode===`removed`?/* @__PURE__ */ x(ot,{children:o}):/* @__PURE__ */ x(tt,{to:e.slug,languageInsensitive:!0,onClick:a,$current:r,children:o})},e.slug)}),h.length===0&&/* @__PURE__ */ x(Le,{children:`No changed pages match.`})]}),m.length>h.length&&/* @__PURE__ */ S(Le,{children:[`Showing `,h.length,` of `,m.length,` changed pages. Search to narrow them down.`]}),u&&/* @__PURE__ */ S(Ne,{children:[/* @__PURE__ */ x(`span`,{children:C>=0?`Page ${C+1} of ${y.length}`:`${y.length} changed pages`}),/* @__PURE__ */ x(K,{children:/* @__PURE__ */ S(Pe,{children:[/* @__PURE__ */ x(Q,{children:`↑`}),` `,/* @__PURE__ */ x(Q,{children:`↓`}),` to move · `,/* @__PURE__ */ x(Q,{children:`Enter`}),` to open`]})})]})]})}const de=g`
|
|
1
|
+
import{PageContext as e}from"../contexts.js";import{useBarPosition as t}from"../use-bar-position.js";import{changedPageNavigation as n,filterChangedPages as r,isSamePage as i}from"./changed-pages.js";import{reviewLoginUrl as a}from"./login-url.js";import{reviewTimeline as o}from"./timeline.js";import{useReview as s}from"./use-review.js";import{createContext as c,useCallback as l,useContext as u,useEffect as d,useRef as f,useState as p}from"react";import m,{css as h,keyframes as g}from"styled-components";import{Button as _}from"@redocly/theme/components/Button/Button";import{breakpoints as v,hiddenWhileMobileMenuOpen as y}from"@redocly/theme/core/utils";import{Fragment as b,jsx as x,jsxs as S}from"react/jsx-runtime";import{useTimeAgo as C}from"@redocly/theme/core/hooks";import{Link as w}from"@redocly/theme/components/Link/Link";import{CheckmarkIcon as ee}from"@redocly/theme/icons/CheckmarkIcon/CheckmarkIcon";import{ChevronRightIcon as T}from"@redocly/theme/icons/ChevronRightIcon/ChevronRightIcon";import{SearchIcon as E}from"@redocly/theme/icons/SearchIcon/SearchIcon";import{DraggableIcon as te}from"@redocly/theme/icons/DraggableIcon/DraggableIcon";import{Spinner as ne}from"@redocly/theme/icons/Spinner/Spinner";import{linkCss as D}from"@redocly/theme/components/Markdown/styles/links";import{Segmented as O}from"@redocly/theme/components/Segmented/Segmented";import{Tag as k}from"@redocly/theme/components/Tag/Tag";import{Tooltip as A}from"@redocly/theme/components/Tooltip/Tooltip";import{ChatIcon as j}from"@redocly/theme/icons/ChatIcon/ChatIcon";import{CloseIcon as M}from"@redocly/theme/icons/CloseIcon/CloseIcon";import{ChevronLeftIcon as N}from"@redocly/theme/icons/ChevronLeftIcon/ChevronLeftIcon";import{MinimizeIcon as re}from"@redocly/theme/icons/MinimizeIcon/MinimizeIcon";import{TrashCanIcon as P}from"@redocly/theme/icons/TrashCanIcon/TrashCanIcon";import{WarningAltIcon as ie}from"@redocly/theme/icons/WarningAltIcon/WarningAltIcon";const F=`realm.review-bar-used`,I=[{value:`all`,label:`All`},{value:`modified`,label:`Modified`},{value:`added`,label:`Added`},{value:`removed`,label:`Removed`}],L=/Mac|iPhone|iPad/.test(navigator.platform)?`⌘ Enter`:`Ctrl Enter`,R={added:`Added`,modified:`Modified`,removed:`Removed`},z={APPROVED:`approved`,REQUESTED_CHANGES:`requested changes on`,COMMENTED:`commented on`},B=c(`middle`);function ae(){try{return localStorage.getItem(F)===`1`}catch{return!1}}function V(){try{localStorage.setItem(F,`1`)}catch{}}function H({children:e,...t}){let n=u(B);return/* @__PURE__ */ x(A,{...t,placement:`top`,fallbackPlacements:[],arrowPosition:n===`middle`?`center`:n,children:e})}function U(){let n=u(e),{state:r,error:o,submitting:c,addComment:f,deleteComment:m}=s(),[h,g]=p(null),{barRef:v,slot:y,dragging:C,style:w,onDragStart:T}=t({storageKey:`realm.review-bar-slot`,defaultSlot:`left`,frozen:h!==null}),[E,D]=p(!1),[O,k]=p(!1),[A,N]=p(0),[P,F]=p(ae),I=l(()=>{let e=v.current?.getBoundingClientRect().width;!e||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?F(!0):g(e)},[v]);if(d(()=>{if(P||h!==null||E||O)return;let e=e=>{e.target instanceof Node&&v.current?.contains(e.target)||I()};return window.addEventListener(`wheel`,e,{passive:!0}),window.addEventListener(`touchmove`,e,{passive:!0}),()=>{window.removeEventListener(`wheel`,e),window.removeEventListener(`touchmove`,e)}},[P,h,E,O,v,I]),d(()=>{if(!E&&!O)return;let e=e=>{e.key===`Escape`&&(O?k(!1):D(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[E,O]),window.self!==window.top)return null;let L=n?.slug??`/`,R=r?.signedIn?r.pullRequest:null,z=E&&R!==null,U=R?.pageComments.filter(e=>!e.replyToId&&!e.isResolved&&i(e.pageSlug,L)).length??0,W=/* @__PURE__ */ S(b,{children:[/* @__PURE__ */ x(H,{tip:`Drag to move`,disabled:C,children:/* @__PURE__ */ x(ye,{type:`button`,"aria-label":`Drag the review bar`,onPointerDown:T,$dragging:C,children:/* @__PURE__ */ x(te,{size:`16px`,color:`var(--icon-color-secondary)`})})}),r===null&&!o&&/* @__PURE__ */ x(Y,{children:/* @__PURE__ */ x(ne,{size:`16px`,color:`var(--icon-color-secondary)`})}),r?.signedIn===!1&&/* @__PURE__ */ x(_,{variant:`primary`,onClick:()=>{V(),window.location.assign(a(n?.path??`/`))},children:`Log in to review`}),r?.signedIn&&!R&&/* @__PURE__ */ x(Z,{children:`No open pull request`}),R&&/* @__PURE__ */ S(b,{children:[/* @__PURE__ */ S(J,{children:[/* @__PURE__ */ x(H,{tip:`${R.title} — open in Platform`,children:/* @__PURE__ */ S(_,{variant:`text`,to:R.url,external:!0,children:[`#`,R.number]})}),/* @__PURE__ */ x(X,{})]}),/* @__PURE__ */ x(se,{pullRequest:R,currentSlug:L,open:O,onToggle:()=>{V(),N(v.current?.getBoundingClientRect().top??0),k(e=>!e)}}),z?/* @__PURE__ */ S(b,{children:[/* @__PURE__ */ x(_e,{}),/* @__PURE__ */ x(H,{tip:`Close`,children:/* @__PURE__ */ x(_,{variant:`text`,icon:/* @__PURE__ */ x(M,{color:`currentColor`}),"aria-label":`Close the review`,onClick:()=>D(!1)})})]}):/* @__PURE__ */ S(b,{children:[/* @__PURE__ */ x(X,{}),/* @__PURE__ */ x(H,{tip:R.decision===`APPROVED`?`You approved`:R.decision===`REQUESTED_CHANGES`?`You requested changes`:`Comment on pages, then finish your review in Platform`,children:/* @__PURE__ */ S(_,{variant:`primary`,"aria-expanded":!1,onClick:()=>{V(),k(!1),D(!0)},icon:R.decision===`APPROVED`?/* @__PURE__ */ x(ee,{color:`currentColor`}):R.decision===`REQUESTED_CHANGES`?/* @__PURE__ */ x(M,{color:`currentColor`}):void 0,children:[`Review`,U>0&&/* @__PURE__ */ S(Ie,{"aria-label":`${U} open comments on this page`,children:[/* @__PURE__ */ x(j,{size:`12px`,color:`currentColor`}),U]})]})})]})]}),o&&/* @__PURE__ */ x(H,{tip:o,children:/* @__PURE__ */ x(Y,{role:`alert`,"aria-label":o,children:/* @__PURE__ */ x(ie,{size:`16px`,color:`var(--color-error-base)`})})}),!z&&/* @__PURE__ */ x(H,{tip:`Collapse`,children:/* @__PURE__ */ x(_,{variant:`text`,icon:/* @__PURE__ */ x(re,{color:`currentColor`}),"aria-label":`Collapse the review bar`,onClick:()=>{V(),k(!1),I()}})})]}),G=o??(r?.signedIn===!1?`Log in to review`:r?.signedIn&&!R?`No open pull request`:`Review`),K=/* @__PURE__ */ x(H,{tip:G,children:/* @__PURE__ */ S(me,{type:`button`,"aria-label":G,"aria-expanded":!1,onClick:()=>{V(),F(!1)},children:[/* @__PURE__ */ x(j,{size:`18px`,color:`var(--icon-color-primary)`}),o?/* @__PURE__ */ x(q,{role:`alert`,$tone:`error`}):r?.signedIn===!1?/* @__PURE__ */ x(q,{$tone:`info`}):U>0?/* @__PURE__ */ x(he,{children:U}):null]})});return/* @__PURE__ */ x(B.Provider,{value:y,children:/* @__PURE__ */ S(pe,{ref:v,style:h===null?w:{...w,"--review-bar-collapse-from":`${h}px`},$dragging:C,$expanded:z,$collapsed:P,$collapsing:h!==null,onAnimationEnd:e=>{e.target===e.currentTarget&&h!==null&&(g(null),F(!0))},"data-testid":`review-bar`,children:[P?K:z?/* @__PURE__ */ S(b,{children:[/* @__PURE__ */ x(ge,{children:W}),/* @__PURE__ */ x(ve,{children:/* @__PURE__ */ x(oe,{pullRequest:R,currentSlug:L,submitting:c,onComment:e=>f({pageSlug:L,text:e}),onDelete:m})})]}):W,!P&&O&&R&&/* @__PURE__ */ x(xe,{$slot:y,style:{maxHeight:`min(50vh, calc(${A}px - 2 * var(--spacing-xs)))`},children:/* @__PURE__ */ x(ce,{pages:R.changedPages??[],currentSlug:L,onOpen:()=>k(!1)})})]})})}function oe({pullRequest:e,currentSlug:t,submitting:n,onComment:r,onDelete:i}){let a=e.pageComments.filter(e=>e.isPending).length;return/* @__PURE__ */ S(b,{children:[/* @__PURE__ */ x(W,{pullRequest:e,currentSlug:t,submitting:n,onSubmit:r,onDelete:i}),/* @__PURE__ */ S(Fe,{children:[/* @__PURE__ */ x($,{children:a===0?`Comments are posted when you finish your review.`:`${a} pending ${a===1?`comment`:`comments`}`}),e.url&&/* @__PURE__ */ x(H,{tip:`Approve or request changes in Platform`,children:/* @__PURE__ */ x(_,{variant:`primary`,to:`${e.url}/review?finishReview=true`,external:!0,children:`Finish review`})})]})]})}function W({pullRequest:e,currentSlug:t,submitting:n,onSubmit:r,onDelete:a}){let[s,c]=p(``),[l,u]=p(!1),m=f(null),h=!n&&s.trim()!==``,g=o(e).filter(e=>l||e.kind===`comment`&&i(e.comment.pageSlug,t));d(()=>{m.current?.scrollTo({top:m.current.scrollHeight})},[g.length]);let v=n=>{if(i(n,t))return/* @__PURE__ */ x(Xe,{children:`this page`});let r=e.changedPages?.find(e=>i(e.slug,n));return/* @__PURE__ */ x(Ze,{to:n,languageInsensitive:!0,children:r?.name||n})};return/* @__PURE__ */ S(b,{children:[/* @__PURE__ */ x(Re,{children:/* @__PURE__ */ x(O,{size:`small`,value:l,onChange:({value:e})=>u(e),options:[{value:!1,label:`This page`},{value:!0,label:`All pages`}]})}),g.length===0?/* @__PURE__ */ x(ze,{children:l?`No reviews or comments yet.`:`No comments on this page yet.`}):/* @__PURE__ */ x(Be,{ref:m,children:g.map(e=>e.kind===`review`?/* @__PURE__ */ x(G,{author:e.review.author,createdAt:e.review.createdAt,action:/* @__PURE__ */ S(b,{children:[z[e.review.status],` `,/* @__PURE__ */ x(Xe,{children:`the pull request`})]}),text:e.review.comment},e.review.id):/* @__PURE__ */ x(G,{author:e.comment.author,createdAt:e.comment.createdAt,action:/* @__PURE__ */ S(b,{children:[`commented on `,v(e.comment.pageSlug)]}),text:e.comment.comment,tag:e.comment.isPending?/* @__PURE__ */ x(k,{children:`Pending`}):e.comment.isResolved&&/* @__PURE__ */ x(k,{children:`Resolved`}),aside:e.comment.isPending&&/* @__PURE__ */ x(H,{tip:`Delete pending comment`,children:/* @__PURE__ */ x(_,{variant:`text`,size:`small`,icon:/* @__PURE__ */ x(P,{color:`currentColor`}),"aria-label":`Delete pending comment`,disabled:n,onClick:()=>void a(e.comment.id)})}),children:e.replies.length>0&&/* @__PURE__ */ x(Ve,{children:e.replies.map(e=>/* @__PURE__ */ x(G,{author:e.author,createdAt:e.createdAt,action:`replied`,text:e.comment},e.id))})},e.comment.id))}),/* @__PURE__ */ x(Se,{onSubmit:async e=>{e.preventDefault(),h&&await r(s.trim())&&c(``)},children:/* @__PURE__ */ S(Te,{children:[/* @__PURE__ */ x(Ee,{autoFocus:!0,rows:2,placeholder:`Comment on this page`,value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),/* @__PURE__ */ S(De,{children:[/* @__PURE__ */ x($,{children:L}),/* @__PURE__ */ x(_,{type:`submit`,size:`small`,disabled:!h,children:`Comment`})]})]})})]})}function G({author:e,createdAt:t,action:n,text:r,tag:i,aside:a,children:o}){let{format:s}=C();return/* @__PURE__ */ S(He,{children:[e.avatarUrl?/* @__PURE__ */ x(We,{src:e.avatarUrl,alt:``}):/* @__PURE__ */ x(Ge,{"aria-hidden":!0,children:K(e.name)}),/* @__PURE__ */ S(Ke,{children:[/* @__PURE__ */ S(qe,{children:[/* @__PURE__ */ x(`strong`,{children:e.name||`Someone`}),/* @__PURE__ */ x(Je,{dateTime:t,children:s(new Date(t))}),i]}),/* @__PURE__ */ x(Ye,{children:n}),r&&/* @__PURE__ */ x(Qe,{children:r}),o]}),a]})}function K(e){return e.split(/\s+/).filter(Boolean).slice(0,2).map(e=>e.charAt(0).toUpperCase()).join(``)||`?`}function se({pullRequest:e,currentSlug:t,open:r,onToggle:i}){if(e.changedPages===null)return/* @__PURE__ */ x(H,{tip:`Platform has not compared this preview with production yet`,children:/* @__PURE__ */ x(Z,{children:`…`})});if(e.changedPages.length===0)return/* @__PURE__ */ x(H,{tip:`No page content changed; navigation, styles, or config can still differ`,children:/* @__PURE__ */ x(Z,{children:`No changed pages`})});let{openable:a,index:o,previous:s,next:c}=n(e.changedPages,t);return/* @__PURE__ */ S(be,{children:[/* @__PURE__ */ x(H,{tip:s?`Previous: ${s.name||s.slug}`:``,disabled:!s,children:/* @__PURE__ */ x(_,{variant:`text`,icon:/* @__PURE__ */ x(N,{color:`currentColor`}),to:s?.slug,languageInsensitive:!0,disabled:!s,"aria-label":`Previous changed page`})}),/* @__PURE__ */ x(H,{tip:`Changed pages`,disabled:r,children:/* @__PURE__ */ x(_,{variant:`text`,onClick:i,"aria-expanded":r,children:o>=0?`${o+1}/${a.length}`:`${a.length} changed`})}),/* @__PURE__ */ x(H,{tip:c?`Next: ${c.name||c.slug}`:``,disabled:!c,children:/* @__PURE__ */ x(_,{variant:`text`,icon:/* @__PURE__ */ x(T,{color:`currentColor`}),to:c?.slug,languageInsensitive:!0,disabled:!c,"aria-label":`Next changed page`})})]})}function ce({pages:e,currentSlug:t,onOpen:a}){let[o,s]=p(``),[c,l]=p(`all`),u=e.length>5,m=r(e,c,o),h=m.slice(0,500),[g,_]=p(()=>Math.max(h.findIndex(e=>i(e.slug,t)),0)),v=f(null),{openable:y,index:C}=n(e,t);return d(()=>{v.current?.querySelector(`[data-active]`)?.scrollIntoView({block:`nearest`})},[g,o,c]),/* @__PURE__ */ S(b,{children:[u&&/* @__PURE__ */ S(Oe,{children:[/* @__PURE__ */ S(ke,{children:[/* @__PURE__ */ x(E,{size:`16px`,color:`var(--icon-color-secondary)`}),/* @__PURE__ */ x(Ae,{autoFocus:!0,"aria-label":`Search changed pages`,placeholder:`Search ${e.length} changed pages`,value:o,onChange:e=>{s(e.target.value),_(0)},onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:-1;_(e=>Math.min(Math.max(e+t,0),h.length-1))}else e.key===`Enter`&&(e.preventDefault(),v.current?.querySelector(`[data-active] a`)?.click())}})]}),/* @__PURE__ */ x(je,{children:/* @__PURE__ */ x(O,{size:`small`,value:c,onChange:({value:e})=>{l(e),_(0)},options:I.map(({value:t,label:n})=>({value:t,label:n,element:/* @__PURE__ */ S(b,{children:[n,` `,/* @__PURE__ */ x(Me,{children:r(e,t,``).length})]})}))})})]}),/* @__PURE__ */ S($e,{ref:v,children:[h.map((e,n)=>{let r=i(e.slug,t),o=/* @__PURE__ */ S(b,{children:[/* @__PURE__ */ S(nt,{children:[/* @__PURE__ */ x(rt,{children:e.name||e.slug}),e.name&&e.name!==e.slug&&/* @__PURE__ */ x(it,{children:e.slug})]}),r?/* @__PURE__ */ x(at,{children:`Current`}):!u&&e.mode&&/* @__PURE__ */ x(at,{children:R[e.mode]})]});return/* @__PURE__ */ x(`li`,{"data-active":u&&n===g?``:void 0,children:e.mode===`removed`?/* @__PURE__ */ x(ot,{children:o}):/* @__PURE__ */ x(tt,{to:e.slug,languageInsensitive:!0,onClick:a,$current:r,children:o})},e.slug)}),h.length===0&&/* @__PURE__ */ x(Le,{children:`No changed pages match.`})]}),m.length>h.length&&/* @__PURE__ */ S(Le,{children:[`Showing `,h.length,` of `,m.length,` changed pages. Search to narrow them down.`]}),u&&/* @__PURE__ */ S(Ne,{children:[/* @__PURE__ */ x(`span`,{children:C>=0?`Page ${C+1} of ${y.length}`:`${y.length} changed pages`}),/* @__PURE__ */ x(J,{children:/* @__PURE__ */ S(Pe,{children:[/* @__PURE__ */ x(Q,{children:`↑`}),` `,/* @__PURE__ */ x(Q,{children:`↓`}),` to move · `,/* @__PURE__ */ x(Q,{children:`Enter`}),` to open`]})})]})]})}const le=g`
|
|
2
2
|
from {
|
|
3
3
|
opacity: 0;
|
|
4
4
|
}
|
|
5
|
-
`,
|
|
5
|
+
`,ue=g`
|
|
6
6
|
to {
|
|
7
7
|
opacity: 0;
|
|
8
8
|
}
|
|
9
|
-
`,
|
|
9
|
+
`,de=g`
|
|
10
10
|
from {
|
|
11
11
|
width: var(--review-bar-collapse-from);
|
|
12
12
|
}
|
|
@@ -14,12 +14,12 @@ import{PageContext as e}from"../contexts.js";import{useBarPosition as t}from"../
|
|
|
14
14
|
width: var(--ai-assistant-button-icon-size);
|
|
15
15
|
border-radius: calc(var(--ai-assistant-button-icon-size) / 2);
|
|
16
16
|
}
|
|
17
|
-
`,
|
|
17
|
+
`,fe=g`
|
|
18
18
|
from {
|
|
19
19
|
opacity: 0;
|
|
20
20
|
transform: scale(0.6);
|
|
21
21
|
}
|
|
22
|
-
`,
|
|
22
|
+
`,pe=m.div`
|
|
23
23
|
position: fixed;
|
|
24
24
|
bottom: var(--ai-assistant-button-bottom);
|
|
25
25
|
display: inline-flex;
|
|
@@ -42,7 +42,7 @@ import{PageContext as e}from"../contexts.js";import{useBarPosition as t}from"../
|
|
|
42
42
|
|
|
43
43
|
@media (prefers-reduced-motion: no-preference) {
|
|
44
44
|
& > * {
|
|
45
|
-
animation: ${
|
|
45
|
+
animation: ${le} 160ms ease-out;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -71,14 +71,14 @@ import{PageContext as e}from"../contexts.js";import{useBarPosition as t}from"../
|
|
|
71
71
|
overflow: hidden;
|
|
72
72
|
|
|
73
73
|
@media (prefers-reduced-motion: no-preference) {
|
|
74
|
-
animation: ${
|
|
74
|
+
animation: ${de} 220ms ease-in-out forwards;
|
|
75
75
|
|
|
76
76
|
& > * {
|
|
77
|
-
animation: ${
|
|
77
|
+
animation: ${ue} 120ms ease-in forwards;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
`}
|
|
81
|
-
`,
|
|
81
|
+
`,me=m.button`
|
|
82
82
|
position: relative;
|
|
83
83
|
display: inline-flex;
|
|
84
84
|
flex: 1;
|
|
@@ -91,13 +91,13 @@ import{PageContext as e}from"../contexts.js";import{useBarPosition as t}from"../
|
|
|
91
91
|
cursor: pointer;
|
|
92
92
|
|
|
93
93
|
@media (prefers-reduced-motion: no-preference) {
|
|
94
|
-
animation: ${
|
|
94
|
+
animation: ${fe} 180ms ease-out;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
&:hover {
|
|
98
98
|
background: var(--bg-color-hover);
|
|
99
99
|
}
|
|
100
|
-
`,
|
|
100
|
+
`,q=m.span`
|
|
101
101
|
position: absolute;
|
|
102
102
|
top: var(--spacing-xs);
|
|
103
103
|
right: var(--spacing-xs);
|
|
@@ -106,7 +106,7 @@ import{PageContext as e}from"../contexts.js";import{useBarPosition as t}from"../
|
|
|
106
106
|
border-radius: 50%;
|
|
107
107
|
background: ${({$tone:e})=>e===`error`?`var(--color-error-base)`:`var(--color-info-base)`};
|
|
108
108
|
box-shadow: 0 0 0 2px var(--bg-color-raised);
|
|
109
|
-
`,
|
|
109
|
+
`,he=m.span`
|
|
110
110
|
position: absolute;
|
|
111
111
|
top: calc(-1 * var(--spacing-xxs));
|
|
112
112
|
right: calc(-1 * var(--spacing-xxs));
|
|
@@ -119,27 +119,27 @@ import{PageContext as e}from"../contexts.js";import{useBarPosition as t}from"../
|
|
|
119
119
|
font-size: var(--font-size-sm);
|
|
120
120
|
line-height: 16px;
|
|
121
121
|
text-align: center;
|
|
122
|
-
`,
|
|
122
|
+
`,ge=m.div`
|
|
123
123
|
display: flex;
|
|
124
124
|
align-items: center;
|
|
125
125
|
gap: var(--spacing-xxs);
|
|
126
126
|
white-space: nowrap;
|
|
127
|
-
`,
|
|
127
|
+
`,_e=m.span`
|
|
128
128
|
flex: 1;
|
|
129
|
-
`,
|
|
129
|
+
`,ve=m.div`
|
|
130
130
|
display: flex;
|
|
131
131
|
flex-direction: column;
|
|
132
132
|
min-height: 0;
|
|
133
133
|
border-top: 1px solid var(--border-color-secondary);
|
|
134
134
|
user-select: text;
|
|
135
135
|
cursor: auto;
|
|
136
|
-
`,
|
|
136
|
+
`,J=m.span`
|
|
137
137
|
display: contents;
|
|
138
138
|
|
|
139
139
|
@media screen and (max-width: ${v.small}) {
|
|
140
140
|
display: none;
|
|
141
141
|
}
|
|
142
|
-
`,
|
|
142
|
+
`,ye=m.button`
|
|
143
143
|
display: inline-flex;
|
|
144
144
|
align-items: center;
|
|
145
145
|
align-self: stretch;
|
|
@@ -148,21 +148,21 @@ import{PageContext as e}from"../contexts.js";import{useBarPosition as t}from"../
|
|
|
148
148
|
background: transparent;
|
|
149
149
|
touch-action: none;
|
|
150
150
|
cursor: ${({$dragging:e})=>e?`grabbing`:`grab`};
|
|
151
|
-
`,
|
|
151
|
+
`,Y=m.span`
|
|
152
152
|
display: inline-flex;
|
|
153
153
|
padding: 0 var(--spacing-xs);
|
|
154
|
-
`,
|
|
154
|
+
`,be=m.span`
|
|
155
155
|
display: inline-flex;
|
|
156
156
|
align-items: center;
|
|
157
|
-
`,
|
|
157
|
+
`,X=m.span`
|
|
158
158
|
align-self: stretch;
|
|
159
159
|
width: 1px;
|
|
160
160
|
margin: var(--spacing-xs) 0;
|
|
161
161
|
background: var(--border-color-secondary);
|
|
162
|
-
`,
|
|
162
|
+
`,Z=m.span`
|
|
163
163
|
padding: 0 var(--spacing-xs);
|
|
164
164
|
color: var(--text-color-description);
|
|
165
|
-
`,
|
|
165
|
+
`,xe=m.div`
|
|
166
166
|
position: absolute;
|
|
167
167
|
display: flex;
|
|
168
168
|
flex-direction: column;
|
|
@@ -178,10 +178,10 @@ import{PageContext as e}from"../contexts.js";import{useBarPosition as t}from"../
|
|
|
178
178
|
white-space: normal;
|
|
179
179
|
user-select: text;
|
|
180
180
|
cursor: auto;
|
|
181
|
-
`,
|
|
181
|
+
`,Se=m.form`
|
|
182
182
|
padding: var(--spacing-xs);
|
|
183
183
|
border-top: 1px solid var(--border-color-secondary);
|
|
184
|
-
`,
|
|
184
|
+
`,Ce=h`
|
|
185
185
|
border: 1px solid var(--input-border-color);
|
|
186
186
|
border-radius: var(--input-border-radius);
|
|
187
187
|
background: var(--input-bg-color);
|
|
@@ -194,7 +194,7 @@ import{PageContext as e}from"../contexts.js";import{useBarPosition as t}from"../
|
|
|
194
194
|
border-color: var(--text-color-disabled);
|
|
195
195
|
box-shadow: 0 0 0 2px var(--border-color-secondary);
|
|
196
196
|
}
|
|
197
|
-
`,
|
|
197
|
+
`,we=h`
|
|
198
198
|
border: 0;
|
|
199
199
|
outline: none;
|
|
200
200
|
background: transparent;
|
|
@@ -205,12 +205,12 @@ import{PageContext as e}from"../contexts.js";import{useBarPosition as t}from"../
|
|
|
205
205
|
color: var(--input-content-placeholder-color);
|
|
206
206
|
}
|
|
207
207
|
`,Te=m.div`
|
|
208
|
-
${
|
|
208
|
+
${Ce}
|
|
209
209
|
display: flex;
|
|
210
210
|
flex-direction: column;
|
|
211
211
|
padding: var(--spacing-xxs) var(--spacing-xs);
|
|
212
212
|
`,Ee=m.textarea`
|
|
213
|
-
${
|
|
213
|
+
${we}
|
|
214
214
|
box-sizing: border-box;
|
|
215
215
|
width: 100%;
|
|
216
216
|
padding: var(--spacing-xxs);
|
|
@@ -227,13 +227,13 @@ import{PageContext as e}from"../contexts.js";import{useBarPosition as t}from"../
|
|
|
227
227
|
padding: var(--spacing-xs);
|
|
228
228
|
border-bottom: 1px solid var(--border-color-secondary);
|
|
229
229
|
`,ke=m.label`
|
|
230
|
-
${
|
|
230
|
+
${Ce}
|
|
231
231
|
display: flex;
|
|
232
232
|
align-items: center;
|
|
233
233
|
gap: var(--spacing-xs);
|
|
234
234
|
padding: var(--spacing-xxs) var(--spacing-sm);
|
|
235
235
|
`,Ae=m.input`
|
|
236
|
-
${
|
|
236
|
+
${we}
|
|
237
237
|
flex: 1;
|
|
238
238
|
min-width: 0;
|
|
239
239
|
padding: 0;
|
|
@@ -351,7 +351,7 @@ import{PageContext as e}from"../contexts.js";import{useBarPosition as t}from"../
|
|
|
351
351
|
color: var(--text-color-primary);
|
|
352
352
|
font-weight: var(--font-weight-medium);
|
|
353
353
|
`,Ze=m(w)`
|
|
354
|
-
${
|
|
354
|
+
${D}
|
|
355
355
|
`,Qe=m.p`
|
|
356
356
|
margin: var(--spacing-xxs) 0 0;
|
|
357
357
|
color: var(--text-color-primary);
|
|
@@ -412,4 +412,4 @@ import{PageContext as e}from"../contexts.js";import{useBarPosition as t}from"../
|
|
|
412
412
|
${rt} {
|
|
413
413
|
text-decoration: line-through;
|
|
414
414
|
}
|
|
415
|
-
`;export{
|
|
415
|
+
`;export{U as ReviewBar};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{IDP_LOGIN_ROUTE_PATH as e,PLATFORM_LOGIN_PARAM as t}from"../../shared/constants/review.js";import{withPathPrefix as n}from"../../shared/path-prefix.js";function r(r){return n(`${e}?redirectTo=${encodeURIComponent(r)}&${t}=true`)}export{r as reviewLoginUrl};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{REVIEW_ROUTE_PATH as e}from"../../shared/constants/review.js";import{withPathPrefix as t}from"../../shared/path-prefix.js";import{useCallback as n,useEffect as r,useState as i}from"react";function a(e,t){let n=t?.error;return typeof n==`string`?n:`Request failed with ${e.status}.`}function o(){let[o,s]=i(null),[c,l]=i(null),[u,d]=i(!1);r(()=>{let n=!1,r=()=>void fetch(t(e),{headers:{accept:`application/json`}}).then(async e=>{let t=await e.json().catch(()=>null);n||(t&&`signedIn`in t?s(t):l(a(e,t)))}).catch(()=>{n||l(`Could not load the review.`)});return r(),window.addEventListener(`focus`,r),()=>{n=!0,window.removeEventListener(`focus`,r)}},[]);let f=n(async(e,n)=>{d(!0),l(null);try{let r=await fetch(t(e),n),i=await r.json().catch(()=>null);return i&&`signedIn`in i?(s(i),i.signedIn):(l(a(r,i)),!1)}catch{return l(`Could not reach the server.`),!1}finally{d(!1)}},[]);return{state:o,error:c,submitting:u,addComment:n(t=>f(e,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)}),[f]),deleteComment:n(t=>f(`${e}/comments/${encodeURIComponent(t)}`,{method:`DELETE`}),[f])}}export{o as useReview};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{delocalizeRouteSlug as e,toLocaleSlug as t}from"../shared/utils/l10n.js";import{stripPathPrefix as n,withPathPrefix as r}from"../shared/path-prefix.js";import{SIDEBAR_ROUTE_DEP_KEY as i}from"../shared/constants/route-deps.js";import{LoaderDataContext as a,PageContext as o}from"./contexts.js";import{useL10nConfig as s}from"./l10n/use-l10n-config.js";import{useTranslate as c}from"./l10n/use-translate.js";import{normalizePageSlug as l}from"./utils/routes/normalize-page-slug.js";import{HistoryMount as u}from"./history-mount.js";import{VersionPicker as d}from"./VersionPicker.js";import{selectEntityRevisions as f}from"./use-entity-revisions.js";import{selectPageVersions as p}from"./use-page-versions.js";import{flattenTabItems as m,isTabbedSidebar as h}from"./sidebar/navigation-tabs.js";import{pageLoader as g}from"./app.js";import{DEFAULT_LOCALE_PLACEHOLDER as _,VERSION_NOT_SPECIFIED as v}from"@redocly/theme/core/constants";import{useContext as y,useEffect as b,useRef as x}from"react";import{useLocation as S,useNavigate as C}from"react-router";import{buildRevisionUrl as w,transformRevisionsToVersionHistory as T}from"@redocly/theme/core/utils";import{jsx as E}from"react/jsx-runtime";async function D(e,n,a,o,s=``){let c=new URL(r(t(n,s)),window.location.origin),l=await g({request:new Request(c)});if(l instanceof Response)return t(n,s);let u=l.loaderData[i],d=h(u)?m(u.tabs):u,f=p(d,{...a,slug:o});return t(f.find(t=>t.version===e)?.link??n,s)}function O({pageVersion:r,pageVersions:i}){let p=y(a),m=y(o),{key:h,pathname:g,search:O}=S(),k=C(),{entityKey:A,items:j}=f(p),{currentLocale:M,defaultLocale:N}=s(),{translate:P}=c(),F=x(null);if(b(()=>()=>{F.current=null},[h]),!A||j.length===0)return null;let I=new URLSearchParams(O),L=I.get(`revision`),R=I.get(`version`)??r??j.find(e=>e.isCurrent)?.version??null,z=R??v,B=T({revisions:j,currentRevisionDate:L??void 0,currentVersion:R,locale:M&&M!==_?M:`en-US`}).map(e=>{let t=e.version===z,n=e.link??i.find(t=>t.version===e.version)?.link,r=n??g;return{version:e.version,label:e.version===v?P(`versionPicker.unversioned`,`All versions`):e.label??e.version,link:r,isActive:t,revisions:(e.revisions??[]).map(i=>{let a=i.isCurrent===!0;return{name:i.name,date:i.date,link:a?r:w(r,i.revisionDate,n?void 0:e.version)??r,isCurrent:a,isActive:t&&(L?i.revisionDate===L:a)}})}});return B.length<2&&(B[0]?.revisions.length??0)<2?null:/* @__PURE__ */ E(u,{children:/* @__PURE__ */ E(d,{versions:B,fallbackLabel:R??void 0,onSelect:(i,a)=>{let o=j.find(e=>e.version===a.version&&e.versionLink!==void 0)?.versionLink;if(o===void 0)return;i.preventDefault();let s=M===N?``:M,c=t=>s&&e(t,s)||t,u=c(l(o)),d=c(l(n(window.location.pathname)??window.location.pathname)),f=a.version===r?Promise.resolve(t(d,s)):D(a.version,u,m,d,s).catch(()=>t(u,s)),{search:p}=new URL(a.link,window.location.origin),h={};F.current=h,f.then(e=>{F.current===h&&k(`${e}${p}`)})}})})}export{O as PageRevisionsHistory,D as resolveVersionSwitch};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{SIDEBAR_BACK_LINK_ROUTE_DEP_KEY as e,SIDEBAR_BREADCRUMBS_ROUTE_DEP_KEY as t}from"../../shared/constants/route-deps.js";import{EMPTY_SIDEBAR_DATA as n,PageContext as r,SidebarDataContext as i}from"../contexts.js";import{useL10nHref as a}from"../l10n/use-l10n-href.js";import{localizeSidebar as o}from"./localize.js";import{resolveSidebarData as s}from"./resolve-sidebar-data.js";import c,{useContext as l}from"react";import{useLocation as u}from"react-router";import{jsx as d}from"react/jsx-runtime";function f({loaderData:f,children:m}){let h=f.__sidebar,g=f[e],_=f[t],v=l(r),{pathname:y}=u(),b=a(),x=c.useMemo(()=>o(h,b),[h,b]),S=c.useMemo(()=>g?{...g,link:b(g.link)}:void 0,[g,b]),C=c.useMemo(()=>_?.map(e=>({...e,link:b(e.link)})),[_,b]),w=c.useMemo(()=>({...s({sidebar:x,page:v,pathname:y}),backLink:S,breadcrumbs:C}),[x,v,y,S,C]),T=p(w),E=c.useRef(n);return E.current.key!==T&&(E.current={key:T,...w}),/* @__PURE__ */ d(i.Provider,{value:E.current,children:m})}function p(e){return JSON.stringify([e.items??null,e.backLink??null,e.breadcrumbs??null,e.tabs?.map(e=>[e.tabId,e.label,e.link,e.menu?.map(e=>[e.tabId,e.label,e.link])])??null,e.activeTab?.tabId??null,e.activeMenuEntry?.tabId??null])}export{f as SidebarDataProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{MenuItemType as e}from"@redocly/theme/core/constants";import{getMenuItemType as t}from"@redocly/theme/core/utils";function n(e,t,n){return{active:e.link===n&&!e.external,hasActiveSubItem:t.some(e=>e.active||e.hasActiveSubItem)}}function r(e,t){return e.map(e=>{let i=r(e.items,t);return{...e,items:i,...n(e,i,t)}})}function i(e,t){let{item:n}=e;return r([...n.link?[{...n,items:[],menuStyle:void 0,separatorLine:!1}]:[],...n.items],t)}function a(n,r=[]){for(let i of n)if(i.active||i.hasActiveSubItem){if(t(i)===e.DrillDown&&r.push({item:i}),i.hasActiveSubItem)return a(i.items,r);if(i.active)return r}return r}export{i as getDrilldownPanelItems,a as getInitialDrilldownStack,n as resolveActiveState,r as withActiveState};
|
package/dist/client/ssr.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{DEFAULT_LOCALE_PLACEHOLDER as e}from"../shared/constants/l10n/defaults.js";import"../shared/utils/l10n.js";import{stripPathPrefix as t}from"../shared/path-prefix.js";import{L10nContext as n}from"./l10n/l10n-context.js";import{routableLocales as r}from"../shared/utils/l10n/routable-locales.js";import{getL10nAppData as i}from"./l10n/use-l10n-config.js";import{productClassName as a}from"../shared/products.js";import{findPageProduct as o}from"./products.js";import{ThemeGlobalStylesheetCollector as s,themeGlobalStyleTag as c}from"./ThemeGlobalStyle.js";import{translationPackChunk as l}from"../shared/constants/l10n/default-translations.js";import{translationPackCode as u}from"../shared/utils/l10n/build-i18n-config.js";import{htmlLang as d}from"./l10n/html-lang.js";import{createServerApp as f,loadPageDependencies as p}from"./app.js";import{streamPage as m}from"./ssr-stream.js";import{createSsrL10nContext as h}from"./l10n/ssr-l10n.js";import{getLocaleFromPathname as g}from"@redocly/theme/core/utils";import{jsx as _}from"react/jsx-runtime";import"virtual:realm-markdoc-schema";import"virtual:realm-server-fns";import{serverRoutes as v}from"virtual:realm-server-routes";import{serverModules as y}from"virtual:realm-server-modules";import{mcpTools as b}from"virtual:realm-mcp-tools";async function x(v,y,b,x){let{Template:S,loaderData:C}=await p(v,{resolvedLoaderData:y,ssr:!0}),w=i(C),T=new URL(b,`http://localhost`).pathname,E=w?.defaultLocale||e,D=g(T,E,r(w)),O=o(C,t(T)??T),k=O?a(O.name):void 0,A=null;try{A=await h(w,D)}catch(e){console.error(`Realm: translations failed to load; rendering untranslated chrome.`,e)}let j=d(D),M=u(w,D),N=M===void 0?void 0:l(M),P,F=await m(async e=>{let t=await f({page:v,loaderData:C,Template:e,url:b});return globalThis.SSR_HOSTNAME=x??``,/* @__PURE__ */ _(s.Provider,{value:e=>P=e,children:/* @__PURE__ */ _(n.Provider,{value:A,children:t})})},S);return{...F,styleTags:c(P)+F.styleTags,lang:j,translationPack:N,htmlClass:k}}export{b as mcpTools,x as render,y as serverModules,v as serverRoutes};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{OTEL_TRACES_ROUTE_PATH as e}from"../../shared/constants/telemetry.js";import{withPathPrefix as t}from"../../shared/path-prefix.js";import{telemetryServiceVersion as n}from"../../shared/telemetry-service-version.js";const r=process.env.REDOCLY_TELEMETRY===`on`;function i(){return new URL(t(e),window.location.origin).toString()}function a(){if(typeof window<`u`)return{collectorUrl:i(),disabled:!r,serviceVersion:n()}}export{r as CLIENT_TELEMETRY_ENABLED,a as apiDocsTelemetryConfig,i as clientTelemetryCollectorUrl};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{isObject as e}from"../shared/utils/is-object.js";import{getPathPrefix as t,withPathPrefix as n,withPathPrefixForSrcSet as r}from"../shared/path-prefix.js";function i(a){return t()===``||!Array.isArray(a)?a:a.map(t=>{if(!e(t))return t;let a={...t};return typeof t.icon==`string`&&(a.icon=n(t.icon)),typeof t.srcSet==`string`&&(a.srcSet=r(t.srcSet)),Array.isArray(t.items)&&(a.items=i(t.items)),a})}function a(i){let{logo:a}=i;if(t()===``||!e(a))return i;let o={...a};return typeof a.image==`string`&&(o.image=n(a.image)),typeof a.favicon==`string`&&(o.favicon=n(a.favicon)),typeof a.srcSet==`string`&&(o.srcSet=r(a.srcSet)),{...i,logo:o}}export{i as prefixNavbarIconUrls,a as prefixThemeLogoUrls};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{REVISIONS_ROUTE_DEP_KEY as e}from"../shared/constants/revisions.js";import{LoaderDataContext as t}from"./contexts.js";import{useContext as n}from"react";const r={entityKey:null,items:[]};function i(t){let n=t[e];return!n||!Array.isArray(n.items)?r:{entityKey:typeof n.entityKey==`string`?n.entityKey:null,items:n.items}}function a(e){let{entityKey:t,items:n}=i(e);return!!t&&n.length>0}function o(e){let{items:r}=i(n(t));return{query:{data:void 0,isLoading:!1,isError:!1},items:r}}export{a as hasEntityRevisions,i as selectEntityRevisions,o as useFetchCatalogEntityRevisions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{compareVersions as e,toPhysicalVersionedSlug as t,toPublicVersionedSlug as n,versionRoutePrefix as r}from"../shared/constants/versions.js";import{PageContext as i,SidebarDataContext as a}from"./contexts.js";import{selectEntityRevisions as o}from"./use-entity-revisions.js";import{useContext as s,useMemo as c}from"react";const l=[];function u(e){return{name:typeof e?.version==`string`?e.version:void 0,group:typeof e?.versionGroup==`string`?e.versionGroup:void 0}}function d(i,a){let{name:o,group:s}=u(a);if(s===void 0||o===void 0)return l;let c=/* @__PURE__ */ new Map,d=e=>{for(let t of e){if(typeof t!=`object`||!t)continue;let e=t;if(e.versionGroup===s&&typeof e.version==`string`&&typeof e.link==`string`){let t=c.get(e.version);t||(t={firstLink:e.link,isDefault:!1,links:/* @__PURE__ */ new Set},c.set(e.version,t)),t.links.add(e.link),e.isDefaultVersion===!0&&(t.isDefault=!0),t.label===void 0&&typeof e.versionLabel==`string`&&(t.label=e.versionLabel)}Array.isArray(e.items)&&d(e.items)}};if(d(i??[]),c.size===0)return l;let f=a?.slug??``,p=t(f,s,o),m=p===null?null:p.slice(r(s,o).length),h=(e,t)=>{if(m===null)return t.firstLink;let i=n(`${r(s,e)}${m}`,s,e,t.isDefault);return t.links.has(i)?i:t.firstLink};return[...c.entries()].sort(([t],[n])=>e(n,t)).map(([e,t])=>({version:e,label:t.label??e,link:e===o?f:h(e,t),default:t.isDefault,active:e===o,folderId:e}))}function f(e,t){let{name:n,group:i}=u(t);return i===void 0||n===void 0?[]:o(e).items.flatMap(({version:e})=>typeof e==`string`&&e!==n?[r(i,e)]:[])}function p(){let e=s(a),t=s(i);return{versions:c(()=>d(e.allItems??e.items,t),[e,t])}}export{u as selectActiveVersion,f as selectOtherVersionRoutes,d as selectPageVersions,p as usePageVersionsImpl};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SEARCH_GROUP_FACET_FIELD as e,readSearchAppData as t}from"../shared/search/facets.js";import{
|
|
1
|
+
import{SEARCH_GROUP_FACET_FIELD as e,readSearchAppData as t}from"../shared/search/facets.js";import{SEARCH_FACETS_ROUTE_PATH as n,SEARCH_ROUTE_PATH as r}from"../shared/constants/search.js";import{APP_DATA_LOADER_KEY as i}from"../shared/constants/app-data.js";import{withPathPrefix as a}from"../shared/path-prefix.js";import{readAppData as o}from"../shared/utils/app-data.js";import{LoaderDataContext as s,PageContext as c}from"./contexts.js";import{useL10nConfig as l}from"./l10n/use-l10n-config.js";import{telemetry as u}from"./telemetry/telemetry.js";import{selectActiveVersion as d}from"./use-page-versions.js";import{SEARCH_DEBOUNCE_TIME_MS as f}from"@redocly/theme/core/constants";import{useCallback as p,useContext as m,useEffect as h,useMemo as g,useRef as _,useState as v}from"react";import{getBaseDataAttributes as y}from"@redocly/theme/core/utils";import{SearchSessionContext as b}from"@redocly/theme/core/contexts";async function x(e,t,n){let r=await fetch(a(e),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t),signal:n});if(!r.ok)throw Error(r.statusText||`Search request failed (${r.status})`);return await r.json()}function S(e,t){return x(r,e,t)}function C(e){return Object.fromEntries(e.map(e=>[e.field,e.values]))}function w(e,t){return x(n,e,t)}function T(e){return o(e).theme?.aiAssistant?.hide===!1}function E(){let e=m(s),t=m(c);return{askAi:T(e)&&t?.aiAvailable===!0}}function D(e){return e.filter(e=>e.values.length>0).map(({field:e,values:t})=>({field:e,values:[...t]}))}function O(){let e=m(c),{currentLocale:t,defaultLocale:n}=l(),r=t===n?void 0:t,{name:i,group:a}=d(e);return g(()=>({locale:r,version:a!==void 0&&i!==void 0?{group:a,version:i}:void 0}),[r,a,i])}function k(e){if(!(!e||e.indexed>=e.total))return`Dev mode: ${e.indexed} of ${e.total} pages indexed. A page is indexed once it is opened or built.`}const A=(e,t)=>e.map(e=>({...e,isCounterVisible:t}));function j(n,r){let a=r===!1,{askAi:o}=E(),c=m(s),l=m(b)?.searchSessionId,d=O(),x=g(()=>t(c[i]),[c]),[T,j]=v(``),[M,N]=v([]),[ee,P]=v({}),[F,I]=v({}),[L,R]=v({}),[z,B]=v({}),[V,H]=v(!1),[te,U]=v(null),[ne,re]=v(),[W,G]=v(!1),K=_(null),q=_(null),J=_(!1),Y=g(()=>D(M),[M]),X=Y.length>0,Z=p(()=>{q.current=null,P({}),I({}),B({})},[]),Q=p((e,t,n)=>{K.current?.abort();let r=new AbortController;return K.current=r,H(!0),U(null),S(e,r.signal).then(e=>{r.signal.aborted||t(e)}).catch(e=>{r.signal.aborted||(U(e instanceof Error?e.message:`Search request failed`),n())}).finally(()=>{r.signal.aborted||H(!1)})},[]),$=p(async e=>{let t=e.trim();if(t===``&&!X){K.current?.abort(),J.current=!1,Z(),G(!1),U(null),H(!1);return}let r={query:t,...d,filter:Y,product:n};J.current=!0,await Q(r,i=>{J.current=!1,q.current=r,P(i.documents),I(i.facets??{}),B(i.groupCounts??{}),re(i.partial),G(!0),t.length>1&&u.sendSearchQueryMessage([{...y(`searchQuery`,`search`),query:e,resultCount:Object.values(i.documents).reduce((e,t)=>e+t.length,0).toString(),...l?{searchSessionId:l}:{},...n?{product:n}:{}}])},()=>{J.current=!1,Z()})},[d,Y,X,Q,Z,n,l]),ie=p(e=>{let t=typeof e==`function`?e(void 0):e,n=q.current;t&&n&&!J.current&&Q({...n,loadMore:t},e=>{let n=e.documents[t.groupKey]??[];P(e=>({...e,[t.groupKey]:[...e[t.groupKey]??[],...n]})),B(t=>({...t,...e.groupCounts}))},()=>{})},[Q]);h(()=>{if(r)return;(T.trim()!==``||X)&&H(!0);let e=setTimeout(()=>{$(T)},f);return()=>clearTimeout(e)},[T,r,X,$]),h(()=>{if(!x.advanced||!a)return;let e=new AbortController;return w({...d,product:n},e.signal).then(e=>R(C(e))).catch(()=>{e.signal.aborted||R({})}),()=>e.abort()},[x.advanced,a,d,n]),h(()=>()=>K.current?.abort(),[]);let ae=p(async()=>{await $(T)},[T,$]),oe=g(()=>x.facets.map(e=>({...e,values:W?A(F[e.field]??[],!0):A(L[e.field]??[],!1)})),[x.facets,W,F,L]);return{advancedSearch:x.advanced,askAi:o,facets:oe,filter:M,groupCounts:z,groupField:e,isSearchLoading:V,items:ee,query:T,searchError:te,setFilter:N,setLoadMore:ie,setQuery:j,retrySearch:ae,notice:k(ne)}}function M(e){let n=O(),r=m(s),a=g(()=>t(r[i]).facets.find(t=>t.field===e),[r,e]),[o,c]=v(null),[l,u]=v(null);return h(()=>{if(l===null){c(null);return}let t=new AbortController;return w({...n,field:e,query:l.query,filter:D(l.filter),facetQuery:l.facetQuery},t.signal).then(t=>{c(a?{...a,values:A(C(t)[e]??[],!0)}:null)}).catch(()=>{t.signal.aborted||c(null)}),()=>t.abort()},[e,n,l,a]),{searchFacet:o,setSearchFacet:c,setSearchFacetQuery:u}}export{S as fetchSearch,w as fetchSearchFacets,M as useFacetQuery,j as useSearch,E as useSearchFeatures,O as useSearchScope};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{normalizeRouteSlug as e}from"../../../shared/utils/routes/normalize-route-slug.js";import{splitUrlSuffix as t}from"../../../shared/utils/routes/split-url-suffix.js";import{stripPathPrefix as n}from"../../../shared/path-prefix.js";import{markdownCopyUrl as r}from"../../../shared/utils/routes/markdown-copy-url.js";function i(i){let{path:a}=t(i);return r(e(n(a)??a))}const a=`https://site.invalid`;function o(e){let t=e.trim();if(!t.startsWith(`/`))return;let n=URL.parse(t,a);if(n?.origin===a)return`${n.pathname}${n.search}${n.hash}`}async function s(e){let t=await fetch(e,{headers:{accept:`text/plain`}});if(t.ok&&!t.headers.get(`content-type`)?.startsWith(`text/html`))return await t.text()}function c(e,t,n){let r=typeof e==`number`?e:Number(e);return!Number.isFinite(r)||r<=0?t:Math.min(Math.floor(r),n)}export{c as clampLimit,s as fetchText,i as markdownPathForRoute,o as toSitePath};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isObject as e}from"../../../shared/utils/is-object.js";import{FEEDBACK_ROUTE_PATH as t}from"../../../shared/constants/feedback.js";import{SEARCH_ROUTE_PATH as n}from"../../../shared/constants/search.js";import{
|
|
1
|
+
import{isObject as e}from"../../../shared/utils/is-object.js";import{FEEDBACK_ROUTE_PATH as t}from"../../../shared/constants/feedback.js";import{SEARCH_ROUTE_PATH as n}from"../../../shared/constants/search.js";import{SKILLS_INDEX_SLUG as r}from"../../../content-layer/plugins/utils/skill-paths.js";import{clampLimit as i,fetchText as a,markdownPathForRoute as o,toSitePath as s}from"./shared.js";import{agentErrorResult as c,agentJsonResult as l,agentTextResult as u,collectOperations as d}from"@redocly/api-docs/lib/services/agent-tools/index.js";function f(e){return[...e.feedbackHidden?[]:[y(e)],{name:`get_current_page`,title:`Get current page`,description:`Report which documentation page the user is looking at right now, including the product and version in scope and whether it is an API reference page. Call this first so an answer matches what is on screen.`,inputSchema:{type:`object`,properties:{},additionalProperties:!1},annotations:{readOnlyHint:!0},execute:async()=>p(e)},{name:`search_docs`,title:`Search documentation`,description:`Search this documentation site and return matching pages with their titles and URLs. Use it to find the page that answers a question before reading it.`,inputSchema:{type:`object`,properties:{query:{type:`string`,description:`What to search for`},limit:{type:`integer`,description:`Maximum number of results, 10 by default`}},required:[`query`],additionalProperties:!1},annotations:{readOnlyHint:!0,untrustedContentHint:!0},execute:async t=>m(e,t)},{name:`read_page`,title:`Read a page`,description:`Return the full Markdown source of a documentation page. Omit the url to read the page the user is currently on.`,inputSchema:{type:`object`,properties:{url:{type:`string`,description:`Site-relative page path, for example /guides/quickstart`}},additionalProperties:!1},annotations:{readOnlyHint:!0,untrustedContentHint:!0},execute:async t=>h(e,t)},{name:`get_site_overview`,title:`Get site overview`,description:`Return the outline of this documentation site: its sections and the pages inside them, limited to what the current user may see. Use it to orient before searching.`,inputSchema:{type:`object`,properties:{},additionalProperties:!1},annotations:{readOnlyHint:!0,untrustedContentHint:!0},execute:async()=>g(e)},{name:`read_skill`,title:`Read an agent skill`,description:`List the agent skills this site publishes, or read one by name. A skill explains how to carry out a task against the documented product.`,inputSchema:{type:`object`,properties:{name:{type:`string`,description:`Skill name; omit to list every skill`}},additionalProperties:!1},annotations:{readOnlyHint:!0,untrustedContentHint:!0},execute:async t=>v(e,t)},{name:`navigate_page`,title:`Open a page`,description:`Move the browser tab to another page of this documentation site, so the user sees what an answer is based on. Accepts site-relative paths only.`,inputSchema:{type:`object`,properties:{url:{type:`string`,description:`Site-relative page path, optionally with a #section anchor`}},required:[`url`],additionalProperties:!1},annotations:{readOnlyHint:!1},execute:async t=>x(e,t)}]}async function p(e){let t=e.versions.find(e=>e.active);return l({url:e.pathname,title:e.pageTitle??document.title,locale:e.locale,product:e.product,version:t?.label??t?.version,isApiReference:!!e.apiDocs,...e.apiDocs?{apiBasePath:e.withPrefix(e.apiDocs.baseSlug),apiSpecType:e.apiDocs.store.specType,operationCount:d(e.apiDocs.items).length}:{}})}async function m(e,t){let r=typeof t.query==`string`?t.query.trim():``;if(!r)return c(`Provide a query to search for.`);let a=i(t.limit,10,50),o={query:r,...e.searchScope},s=await fetch(e.sitePathUrl(n),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(o)});if(!s.ok)return c(`Search failed with status ${s.status}.`);let{documents:d}=await s.json(),f=Object.entries(d).flatMap(([e,t])=>t.map(({document:t})=>({section:e,document:t}))).slice(0,a).map(({section:t,document:n})=>({title:n.title,url:e.withPrefix(n.url),section:t,method:n.httpMethod?.toUpperCase(),path:n.httpMethod?n.httpPath:void 0,deprecated:n.deprecated?!0:void 0,snippet:n.text.slice(0,300)}));return f.length?l({query:r,resultCount:f.length,results:f}):u(`No documentation pages matched "${r}".`)}async function h(e,t){let n=typeof t.url==`string`&&t.url.trim()?t.url.trim():e.pathname,r=s(n);if(!r)return c(`Provide a site-relative path that starts with "/".`);let i=await a(e.routeUrl(o(r)));return i?u(i):c(`${r} has no Markdown version. Either the path is wrong, or the page is built from code rather than Markdown. Use search_docs to find a documentation page.`)}async function g(e){let t=_(e.sidebarItems,e.withPrefix,0);if(t.length)return l({product:e.product,pages:t});let n=await a(e.sitePathUrl(`/llms.txt`));return n?u(n):c(`This site publishes no navigation tree.`)}function _(t,n,r){if(r>=3)return[];let i=[];for(let a of t){if(!e(a))continue;let t=typeof a.label==`string`?a.label:``,o=typeof a.link==`string`?a.link:void 0;if(!t&&!o)continue;let s=Array.isArray(a.items)?_(a.items,n,r+1):[];i.push({title:t,...o?{url:n(o)}:{},...s.length?{pages:s}:{}})}return i}async function v(t,n){let i=await fetch(t.sitePathUrl(r),{headers:{accept:`application/json`}});if(!i.ok)return c(`This site does not publish agent skills.`);let o=await i.json(),s=e(o)&&Array.isArray(o.skills)?o.skills:[],d=typeof n.name==`string`?n.name.trim():``;if(!d)return l({skills:s.map(e=>({name:e.name,description:e.description}))});let f=s.find(e=>e.name.toLowerCase()===d.toLowerCase());if(!f){let e=s.map(e=>e.name).join(`, `);return c(`No skill named "${d}". Available skills: ${e||`none`}.`)}let p=await a(t.routeUrl(f.url));return p?u(p):c(`The "${f.name}" skill could not be read.`)}function y(e){return{name:`leave_feedback`,title:`Leave feedback on a page`,description:`Report that a documentation page is wrong, outdated, confusing or incomplete. Use it only when the user agrees, and summarize the problem in their words. Reports reach the team that owns the page.`,inputSchema:{type:`object`,properties:{summary:{type:`string`,description:`One sentence naming the problem`},details:{type:`string`,description:`What is wrong and what the page should say`},url:{type:`string`,description:`Site-relative path of the page; the current page by default`}},required:[`summary`],additionalProperties:!1},annotations:{readOnlyHint:!1,consequentialHint:!0},execute:async t=>b(e,t)}}async function b(e,n){let r=typeof n.summary==`string`?n.summary.trim():``;if(!r)return c(`Describe the problem in one sentence.`);let i=typeof n.details==`string`?n.details.trim():``,a=typeof n.url==`string`&&n.url.trim()?n.url.trim():e.pathname,o=s(a);if(!o)return c(`Provide a site-relative path that starts with "/".`);let l=await fetch(e.sitePathUrl(t),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({component:`comment`,path:e.routeUrl(o),comment:i?`${r}\n\n${i}`:r,agent:`webmcp-browser-agent`,origin:`mcp`})});return l.ok?u(`Thanks. The feedback about ${o} reached the documentation team.`):c(l.status===403||l.status===404?`Feedback cannot be left for ${o}.`:`Feedback could not be sent, status ${l.status}.`)}async function x(e,t){let n=typeof t.url==`string`?s(t.url):void 0;return n?(await e.navigate(n),u(`Opened ${n}.`)):c(`Provide a site-relative path that starts with "/". This tool cannot leave the documentation site.`)}export{f as buildSiteTools};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{stripPathPrefix as e,withPathPrefix as t}from"../../shared/path-prefix.js";import{LoaderDataContext as
|
|
1
|
+
import{stripPathPrefix as e,withPathPrefix as t}from"../../shared/path-prefix.js";import{API_DOCS_RENDER_DEP_KEY as n}from"../../content-layer/plugins/internal/api-docs/server/shared.js";import{LoaderDataContext as r,PageContext as i,SidebarDataContext as a}from"../contexts.js";import{useL10nConfig as o}from"../l10n/use-l10n-config.js";import{useCurrentProduct as s}from"../ProductsProvider.js";import{telemetry as c}from"../telemetry/telemetry.js";import{usePageVersionsImpl as l}from"../use-page-versions.js";import{useSearchScope as u}from"../use-search.js";import{rebaseItemLinks as d}from"../../content-layer/plugins/internal/api-docs/client/rebase-item-links.js";import{buildApiTools as f}from"./tools/api-tools.js";import{buildSiteTools as p}from"./tools/site-tools.js";import{useContext as m,useEffect as h,useRef as g}from"react";import{useLocation as _,useNavigate as v}from"react-router";import{useThemeConfig as y}from"@redocly/theme/core/hooks";import{registerAgentTools as b}from"@redocly/api-docs/lib/services/agent-tools/index.js";import{getModelContext as x}from"@redocly/api-docs/lib/services/agent-tools/webmcp.js";function S(){let c=_(),d=v(),{currentLocale:S}=o(),w=u(),{versions:E}=l(),D=m(a).items,O=s(),k=m(i),A=m(r)[n],j=k?.slug.toLowerCase(),M=y().feedback?.hide===!0,N=k?.metadata?.seo,P={pathname:t(c.pathname),pageTitle:N?.title,locale:S,searchScope:w,product:O?.name??O?.slug,versions:E,sidebarItems:D??[],feedbackHidden:M,navigate:async t=>{let{pathname:n,search:r,hash:i}=new URL(t,window.location.origin);await d({pathname:e(n)??n,search:r,hash:i})},withPrefix:t,routeUrl:e=>new URL(e,window.location.origin).toString(),sitePathUrl:e=>new URL(t(e),window.location.origin).toString()},F=g(P);Object.assign(F.current,P),h(()=>{let e=new AbortController;return b(p(F.current),e.signal,T(`site`)),()=>e.abort()},[M]),h(()=>{if(!x())return;let e=F.current,t=C(A,j);if(e.apiDocs=t,!t)return;let n=new AbortController;return b(f(e,t),n.signal,T(`apiReference`)),()=>{n.abort(),e.apiDocs=void 0}},[A,j])}function C(e,t){if(Array.isArray(e?.items)&&t!==void 0)return{items:e.basePath===t?e.items:d(e.items,e.basePath,t),store:e.store,baseSlug:t}}const w={id:`agentTools`,object:`feature`,uri:`urn:redocly:realm:ui:feature:agentTools`};function T(e){return{registered:t=>c.sendAgentToolsRegisteredMessage([{...w,toolCount:t,scope:e}]),called:(e,t)=>c.sendAgentToolCalledMessage([{...w,toolName:e,outcome:t}])}}export{S as useWebMcpTools};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isObject as e}from"../shared/utils/is-object.js";import{interpolateEnvVariables as t,productConfigOverrideSchema as n,rootRedoclyConfigSchema as r}from"@redocly/config";const i=r.properties,a={type:`string`,pattern:`\\S`},o={...i.apis.additionalProperties,required:[`root`]},s={...i.scripts.properties.head.items,required:[`src`]},c=i.redirects.additionalProperties,l=
|
|
1
|
+
import{isObject as e}from"../shared/utils/is-object.js";import{interpolateEnvVariables as t,productConfigOverrideSchema as n,rootRedoclyConfigSchema as r}from"@redocly/config";const i=r.properties,a={type:`string`,pattern:`\\S`},o={...i.apis.additionalProperties,required:[`root`]},s={...i.scripts.properties.head.items,required:[`src`]},c=i.redirects.additionalProperties,l={type:`object`,additionalProperties:o},u={...i.scripts,properties:{head:{type:`array`,items:s},body:{type:`array`,items:s}}},d={...i.redirects,propertyNames:a,additionalProperties:{...c,properties:{...c.properties,to:a},required:[`to`]}},f={type:`object`,properties:{include:{type:`array`,items:{type:`string`,minLength:1}},max:{type:`integer`,minimum:1}},additionalProperties:!1},p={type:`object`,properties:{anchors:{type:`object`,properties:{hide:{type:`boolean`},severity:{type:`string`,enum:[`error`,`warning`]}},additionalProperties:!1}},additionalProperties:!1};function m(e){return{...r,properties:{...e,...i,apis:l,linkChecker:p,redirects:d,revisions:f,scripts:u},additionalProperties:!0}}m({});const h={...n,properties:{...n.properties,apis:l,asyncapi:i.asyncapi,graphql:i.graphql,grpc:i.grpc}},g={type:`object`,properties:{banner:i.banner}},_=Symbol(`drop`);function v(n,r,i={}){let{env:a}=i,o={problems:[],resolve:a?e=>t(e,a).value:e=>e},s=y(n,structuredClone(r),``,o);return{value:e(s)?s:{},problems:o.problems}}function y(t,n,r,i){if(t===!0)return n;if(t===!1)return A(i,r,`is not allowed`);let a=x(t,b(n,i));if(a!==void 0)return A(i,r,a);let o=n;return e(n)?o=S(t,n,r,i):Array.isArray(n)&&(o=w(t,n,r,i)),o!==_&&t.oneOf&&(o=T(t.oneOf,t.discriminator,n,o,r,i)),o!==_&&t.not!==void 0&&E(t.not,o,i)&&i.problems.push({code:`configuration/invalid`,message:`${j(r)} ${k(t.not)}.`}),o}function b(e,t){return typeof e==`string`?t.resolve(e):e}function x(e,t){if(e.type!==void 0&&!D(t,e.type))return`must be ${e.type}`;if(e.enum&&!e.enum.some(e=>O(e,t)))return`must be one of: ${e.enum.join(`, `)}`;if(e.const!==void 0&&!O(e.const,t))return`must be ${JSON.stringify(e.const)}`;if(typeof t==`string`){if(e.minLength!==void 0&&t.length<e.minLength)return e.minLength===1?`must not be empty`:`must have at least ${e.minLength} characters`;if(e.pattern!==void 0&&!new RegExp(e.pattern,`u`).test(t))return e.pattern===`\\S`?`must not be empty`:`must match the pattern ${e.pattern}`}if(typeof t==`number`&&e.minimum!==void 0&&t<e.minimum)return`must be at least ${e.minimum}`}function S(e,t,n,r){let i=[];for(let[a,o]of Object.entries(t)){let t=M(n,a);if(e.propertyNames!==void 0&&!E(e.propertyNames,a,r)){A(r,t,`has an invalid name`);continue}let s=C(e,a);if(s===void 0){r.problems.push({code:`configuration/ignored`,message:`\`${t}\` is not a known option and is ignored.`}),i.push([a,o]);continue}let c=y(s,o,t,r);c!==_&&i.push([a,c])}let a=Object.fromEntries(i),o=e.required??[],s=o.find(e=>!Object.hasOwn(t,e));if(s!==void 0)return A(r,n,`must have required property '${s}'`);if(e.minProperties!==void 0){if(Object.keys(t).length<e.minProperties)return A(r,n,e.minProperties===1?`must not be empty`:`must have at least ${e.minProperties} properties`);if(Object.keys(a).length<e.minProperties)return _}return o.every(e=>Object.hasOwn(a,e))?a:_}function C(e,t){if(e.properties&&Object.hasOwn(e.properties,t))return e.properties[t];for(let[n,r]of Object.entries(e.patternProperties??{}))if(new RegExp(n,`u`).test(t))return r;return e.additionalProperties===!1?void 0:e.additionalProperties??!0}function w(e,t,n,r){let{items:i}=e,a=i===void 0?t:t.flatMap((e,t)=>{let a=y(i,e,M(n,t),r);return a===_?[]:[a]});if(e.minItems!==void 0){if(t.length<e.minItems)return A(r,n,e.minItems===1?`must not be empty`:`must have at least ${e.minItems} items`);if(a.length<e.minItems)return _}return e.uniqueItems&&new Set(t.map(e=>JSON.stringify(e))).size<t.length?A(r,n,`must not have duplicate items`):a}function T(t,n,r,i,a,o){if(n){let r=n.propertyName,s=e(i)?b(i[r],o):void 0,c=t.find(e=>{let t=typeof e==`object`?e.properties?.[r]:void 0;return s!==void 0&&typeof t==`object`&&t.const===s});return c===void 0?A(o,a,`has an invalid value`):y(c,i,a,o)}let s=e=>t.filter(t=>E(t,e,o)).length;return s(r)===1?s(i)===1?i:_:A(o,a,`has an invalid value`)}function E(e,t,n){let r={problems:[],resolve:n.resolve};return y(e,t,``,r),r.problems.length===0}function D(t,n){switch(n){case`object`:return e(t);case`array`:return Array.isArray(t);case`integer`:return Number.isInteger(t);case`number`:return typeof t==`number`&&Number.isFinite(t);default:return typeof t===n}}function O(e,t){return JSON.stringify(e)===JSON.stringify(t)}function k(e){let t=typeof e==`object`?e.required:void 0;return t?`must not set both ${t.map(e=>`\`${e}\``).join(` and `)}`:`has a value that is not allowed`}function A(e,t,n){return e.problems.push({code:`configuration/invalid`,message:`${j(t)} ${n} and is ignored.`}),_}function j(e){return e===``?`The config`:`\`${e}\``}function M(e,t){return typeof t==`number`?`${e}[${t}]`:e===``?t:/^[A-Za-z_$][\w$]*$/.test(t)?`${e}.${t}`:`${e}[${JSON.stringify(t)}]`}export{h as NESTED_CONFIG_SCHEMA,g as PAGE_BANNER_SCHEMA,m as realmConfigSchema,v as sanitizeConfig};
|
|
@@ -92,4 +92,12 @@ export declare function normalizeRedoclyConfig(config: Record<string, unknown>,
|
|
|
92
92
|
pluginSchemas?: Readonly<Record<string, ConfigSchema>>;
|
|
93
93
|
report?: (problem: ProblemDraft) => void;
|
|
94
94
|
}): RealmConfig;
|
|
95
|
+
/**
|
|
96
|
+
* `grpc.importPaths` of the config in the content-relative folder `configDir`: the content-relative
|
|
97
|
+
* folders a parse reads, and the entries, as written, that leave the content root.
|
|
98
|
+
*/
|
|
99
|
+
export declare function resolveGrpcImportPaths(importPaths: string | string[], configDir: string): {
|
|
100
|
+
folders: string[];
|
|
101
|
+
outside: string[];
|
|
102
|
+
};
|
|
95
103
|
export declare function createEmptyRealmConfig(): RealmConfig;
|