@redocly/theme 0.70.0-next.8 → 0.70.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/LoadProgressBar/LoadProgressBar.d.ts +8 -0
- package/lib/components/LoadProgressBar/LoadProgressBar.js +122 -0
- package/lib/core/constants/index.d.ts +1 -0
- package/lib/core/constants/index.js +1 -0
- package/lib/core/constants/prompt.d.ts +9 -0
- package/lib/core/constants/prompt.js +33 -0
- package/lib/core/hooks/index.d.ts +3 -0
- package/lib/core/hooks/index.js +3 -0
- package/lib/core/hooks/prompt/use-prompt-actions.d.ts +7 -0
- package/lib/core/hooks/prompt/use-prompt-actions.js +19 -0
- package/lib/core/hooks/prompt/use-prompt-text-limit.d.ts +19 -0
- package/lib/core/hooks/prompt/use-prompt-text-limit.js +35 -0
- package/lib/core/hooks/use-page-actions.js +4 -8
- package/lib/core/hooks/use-pointer-border-highlight.d.ts +7 -0
- package/lib/core/hooks/use-pointer-border-highlight.js +29 -0
- package/lib/core/hooks/use-telemetry-fallback.d.ts +2 -0
- package/lib/core/hooks/use-telemetry-fallback.js +2 -0
- package/lib/core/styles/dark.js +14 -12
- package/lib/core/styles/global.js +16 -54
- package/lib/core/types/index.d.ts +1 -0
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/prompt.d.ts +9 -0
- package/lib/core/types/prompt.js +3 -0
- package/lib/core/utils/get-ai-prompt-link.d.ts +15 -0
- package/lib/core/utils/get-ai-prompt-link.js +29 -0
- package/lib/core/utils/index.d.ts +1 -0
- package/lib/core/utils/index.js +1 -0
- package/lib/core/utils/urls.js +1 -1
- package/lib/core/utils/with-load-progress.d.ts +3 -0
- package/lib/core/utils/with-load-progress.js +24 -19
- package/lib/ext/configure.d.ts +1 -1
- package/lib/ext/configure.js +0 -1
- package/lib/icons/LinkIcon/LinkIconSymbol.d.ts +12 -0
- package/lib/icons/LinkIcon/LinkIconSymbol.js +41 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/markdoc/components/Cards/Card.js +1 -1
- package/lib/markdoc/components/Prompt/Prompt.d.ts +15 -0
- package/lib/markdoc/components/Prompt/Prompt.js +163 -0
- package/lib/markdoc/components/Prompt/PromptActions.d.ts +13 -0
- package/lib/markdoc/components/Prompt/PromptActions.js +43 -0
- package/lib/markdoc/components/Prompt/PromptBody.d.ts +14 -0
- package/lib/markdoc/components/Prompt/PromptBody.js +99 -0
- package/lib/markdoc/components/Prompt/PromptCopyButton.d.ts +10 -0
- package/lib/markdoc/components/Prompt/PromptCopyButton.js +28 -0
- package/lib/markdoc/components/Prompt/PromptHeader.d.ts +9 -0
- package/lib/markdoc/components/Prompt/PromptHeader.js +57 -0
- package/lib/markdoc/components/Prompt/PromptShowHideButton.d.ts +7 -0
- package/lib/markdoc/components/Prompt/PromptShowHideButton.js +21 -0
- package/lib/markdoc/components/Prompt/PromptToggleLabel.d.ts +7 -0
- package/lib/markdoc/components/Prompt/PromptToggleLabel.js +28 -0
- package/lib/markdoc/components/Prompt/variables.d.ts +1 -0
- package/lib/markdoc/components/Prompt/variables.dark.d.ts +1 -0
- package/lib/markdoc/components/Prompt/variables.dark.js +8 -0
- package/lib/markdoc/components/Prompt/variables.js +44 -0
- package/lib/markdoc/components/default.d.ts +1 -0
- package/lib/markdoc/components/default.js +1 -0
- package/lib/markdoc/default.d.ts +2 -0
- package/lib/markdoc/default.js +2 -0
- package/lib/markdoc/tags/code-walkthrough.d.ts +1 -1
- package/lib/markdoc/tags/code-walkthrough.js +3 -5
- package/lib/markdoc/tags/prompt.d.ts +2 -0
- package/lib/markdoc/tags/prompt.js +56 -0
- package/package.json +2 -7
- package/src/components/LoadProgressBar/LoadProgressBar.tsx +113 -0
- package/src/core/constants/index.ts +1 -0
- package/src/core/constants/prompt.ts +34 -0
- package/src/core/hooks/__mocks__/index.ts +3 -0
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +2 -0
- package/src/core/hooks/index.ts +3 -0
- package/src/core/hooks/prompt/use-prompt-actions.ts +28 -0
- package/src/core/hooks/prompt/use-prompt-text-limit.ts +59 -0
- package/src/core/hooks/use-page-actions.ts +4 -9
- package/src/core/hooks/use-pointer-border-highlight.ts +46 -0
- package/src/core/hooks/use-telemetry-fallback.ts +2 -0
- package/src/core/styles/dark.ts +2 -0
- package/src/core/styles/global.ts +2 -40
- package/src/core/types/index.ts +1 -0
- package/src/core/types/l10n.ts +11 -0
- package/src/core/types/prompt.ts +11 -0
- package/src/core/utils/get-ai-prompt-link.ts +30 -0
- package/src/core/utils/index.ts +1 -0
- package/src/core/utils/urls.ts +1 -1
- package/src/core/utils/with-load-progress.ts +23 -18
- package/src/ext/configure.ts +1 -1
- package/src/icons/LinkIcon/LinkIconSymbol.tsx +51 -0
- package/src/index.ts +1 -0
- package/src/markdoc/components/Cards/Card.tsx +1 -1
- package/src/markdoc/components/Prompt/Prompt.tsx +219 -0
- package/src/markdoc/components/Prompt/PromptActions.tsx +104 -0
- package/src/markdoc/components/Prompt/PromptBody.tsx +107 -0
- package/src/markdoc/components/Prompt/PromptCopyButton.tsx +73 -0
- package/src/markdoc/components/Prompt/PromptHeader.tsx +81 -0
- package/src/markdoc/components/Prompt/PromptShowHideButton.tsx +43 -0
- package/src/markdoc/components/Prompt/PromptToggleLabel.tsx +41 -0
- package/src/markdoc/components/Prompt/variables.dark.ts +5 -0
- package/src/markdoc/components/Prompt/variables.ts +41 -0
- package/src/markdoc/components/default.ts +1 -0
- package/src/markdoc/default.ts +2 -0
- package/src/markdoc/tags/code-walkthrough.ts +4 -12
- package/src/markdoc/tags/prompt.ts +58 -0
package/lib/core/types/l10n.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TOptions } from 'i18next';
|
|
2
|
-
export type TranslationKey = 'dev.newApp' | 'dev.newApp.text' | 'dev.sidebar.header' | 'dev.sidebar.footer.text' | 'dev.create.app.dialog.appName.placeholder' | 'dev.create.app.dialog.appName.error' | 'dev.create.app.dialog.selectAPIs' | 'dev.create.app.dialog.description' | 'dev.create.app.dialog.description.placeholder' | 'dev.create.app.dialog.create' | 'dev.create.app.dialog.cancel' | 'dev.main.tab.appKeys' | 'dev.main.tab.logs' | 'dev.app.description.title' | 'dev.edit.description.dialog.title' | 'dev.edit.description.dialog.save' | 'dev.edit.description.dialog.cancel' | 'dev.create.app.dialog.callbackUrls' | 'dev.create.app.dialog.callbackUrls.placeholder' | 'dev.create.app.dialog.callbackUrls.hint' | 'dev.app.callbackUrls.title' | 'dev.edit.callbackUrls.dialog.title' | 'dev.edit.callbackUrls.dialog.placeholder' | 'dev.edit.callbackUrls.dialog.hint' | 'dev.edit.callbackUrls.dialog.save' | 'dev.edit.callbackUrls.dialog.cancel' | 'dev.edit.apis.dialog.selectedAPIs' | 'dev.app.key.create' | 'dev.create.key.dialog.title' | 'dev.create.key.dialog.create' | 'dev.create.key.dialog.cancel' | 'dev.app.edit' | 'dev.app.delete' | 'dev.edit.app.dialog.title' | 'dev.edit.app.dialog.save' | 'dev.edit.app.dialog.cancel' | 'dev.delete.app.dialog.title' | 'dev.delete.app.dialog.confirmation' | 'dev.delete.app.dialog.delete' | 'dev.delete.app.dialog.cancel' | 'dev.app.key.roll' | 'dev.roll.key.dialog.title' | 'dev.roll.key.dialog.apiKey' | 'dev.roll.key.dialog.expires' | 'dev.roll.key.dialog.confirmation' | 'dev.roll.key.dialog.cancel' | 'dev.roll.key.dialog.roll' | 'dev.update.key.dialog.title' | 'dev.update.key.dialog.update' | 'dev.update.key.dialog.cancel' | 'dev.app.key.api.name' | 'dev.app.key.api.status' | 'dev.app.key.api.edit' | 'dev.edit.apis.dialog.title' | 'dev.edit.apis.dialog.apiKey' | 'dev.edit.apis.dialog.save' | 'dev.edit.apis.dialog.cancel' | 'dev.select.placeholder' | 'dev.app.overview.status.pending' | 'dev.app.overview.status.approved' | 'dev.app.overview.status.revoked' | 'dev.app.overview.status' | 'dev.app.overview.non-production' | 'dev.app.overview.production' | 'dev.app.overview.clientId' | 'dev.app.overview.apiKey' | 'dev.app.key.revoke' | 'dev.revoke.key.dialog.title' | 'dev.revoke.key.dialog.apiKey' | 'dev.revoke.key.dialog.expires' | 'dev.revoke.key.dialog.confirmation' | 'dev.revoke.key.dialog.revoke' | 'dev.revoke.key.dialog.cancel' | 'dev.app.overview.expires' | 'dev.app.overview.created' | 'dev.app.overview.visibilityToggle.hide' | 'dev.app.overview.visibilityToggle.show' | 'search.loading' | 'search.noResults.title' | 'search.keys.navigate' | 'search.keys.select' | 'search.keys.exit' | 'search.label' | 'search.cancel' | 'search.recent' | 'search.navbar.label' | 'search.suggested' | 'search.showMore' | 'search.error.title' | 'search.error.button' | 'search.filter.title' | 'search.filter.reset' | 'search.filter.field.reset' | 'search.ai.welcomeText' | 'search.ai.newConversation' | 'search.ai.backToSearch' | 'search.ai.back' | 'search.ai.assistant' | 'search.ai.placeholder' | 'search.ai.generatingResponse' | 'search.ai.followUpQuestion' | 'search.ai.send' | 'search.ai.suggestionsTitle' | 'search.ai.thinkingText' | 'search.ai.resourcesFound' | 'search.ai.resourcesFound.basedOn' | 'search.ai.resourcesFound.resources' | 'search.ai.feedback.title' | 'search.ai.feedback.detailsPlaceholder' | 'search.ai.feedback.thanks' | 'search.ai.toolCall.executed' | 'search.ai.toolCall.executing' | 'search.ai.toolCall.usedTools' | 'search.ai.button' | 'search.ai.label' | 'search.ai.disclaimer' | 'search.ai.error.description' | 'search.ai.error.description.forbidden' | 'search.ai.error.description.unauthorized' | 'search.ai.error.header' | 'search.ai.error.header.forbidden' | 'search.ai.error.header.unauthorized' | 'search.ai.feedback.more' | 'search.ai.actions.copy' | 'search.ai.actions.like' | 'search.ai.actions.dislike' | 'search.searchItem.deprecated' | 'search.searchItem.enum' | 'search.searchItem.example' | 'search.groups.all' | 'search.filter.field.footer' | 'aiAssistant.trigger' | 'toc.header' | 'footer.copyrightText' | 'page.homeButton' | 'page.forbidden.title' | 'page.forbidden.description' | 'page.notFound.title' | 'page.notFound.description' | 'page.apiNotFound.title' | 'page.apiNotFound.description' | 'page.apiNotFound.hint' | 'page.apiNotFound.backButton' | 'page.mcpNotAllowed.title' | 'page.mcpNotAllowed.description' | 'page.mcpNotAllowed.publicNote' | 'page.mcpNotAllowed.publicEndpointHint' | 'page.mcpNotAllowed.mainEndpointHint' | 'page.mcpNotAllowed.snippets.terminal.hint' | 'page.mcpNotAllowed.snippets.claudeCode.headline' | 'page.mcpNotAllowed.snippets.claudeDesktop.headline' | 'page.mcpNotAllowed.snippets.claudeDesktop.accountHint' | 'page.mcpNotAllowed.snippets.claudeDesktop.instruction' | 'page.mcpNotAllowed.snippets.chatgptApp.headline' | 'page.mcpNotAllowed.snippets.chatgptApp.instruction' | 'page.mcpNotAllowed.snippets.codexCli.headline' | 'page.mcpNotAllowed.snippets.prompt.headline' | 'page.mcpNotAllowed.snippets.prompt.hint' | 'page.mcpNotAllowed.snippets.json.hint' | 'page.mcpNotAllowed.tabs.claude' | 'page.mcpNotAllowed.tabs.chatgpt' | 'page.mcpNotAllowed.tabs.json' | 'page.lastUpdated.timeago' | 'page.lastUpdated.on' | 'catalog.filters.placeholder' | 'catalog.filters.title' | 'catalog.filters.add' | 'catalog.filters.clearAll' | 'catalog.filters.select.addFilter' | 'catalog.filters.select.all' | 'catalog.filters.done' | 'catalog.catalogs.all.title' | 'catalog.catalogs.all.description' | 'catalog.catalogs.all.switcherLabel' | 'catalog.catalogs.service.title' | 'catalog.catalogs.service.description' | 'catalog.catalogs.service.switcherLabel' | 'catalog.catalogs.user.title' | 'catalog.catalogs.user.description' | 'catalog.catalogs.user.switcherLabel' | 'catalog.catalogs.team.title' | 'catalog.catalogs.team.description' | 'catalog.catalogs.team.switcherLabel' | 'catalog.catalogs.domain.title' | 'catalog.catalogs.domain.description' | 'catalog.catalogs.domain.switcherLabel' | 'catalog.catalogs.apiDescription.title' | 'catalog.catalogs.apiDescription.description' | 'catalog.catalogs.apiDescription.switcherLabel' | 'catalog.catalogs.dataSchema.title' | 'catalog.catalogs.dataSchema.description' | 'catalog.catalogs.dataSchema.switcherLabel' | 'catalog.catalogs.apiOperation.title' | 'catalog.catalogs.apiOperation.description' | 'catalog.catalogs.apiOperation.switcherLabel' | 'catalog.entity.metadata.title' | 'catalog.entity.schema.title' | 'catalog.entity.properties.apiDescription.title' | 'catalog.backToAllLabel' | 'catalog.notConnected' | 'catalog.tags.label' | 'catalog.sort' | 'catalog.catalogs.label' | 'catalog.owners.label' | 'catalog.repositories.label' | 'catalog.email.label' | 'catalog.format.label' | 'catalog.entityType.label' | 'catalog.domains.label' | 'catalog.contact.label' | 'catalog.methodAndPath.label' | 'catalog.links.label' | 'catalog.metadata.domains' | 'catalog.metadata.owners' | 'catalog.history.button.label' | 'catalog.history.sidebar.title' | 'catalog.history.sidebar.close' | 'catalog.history.version.label' | 'catalog.filters.close' | 'catalog.history.version.notSpecified' | 'catalog.history.version.default' | 'catalog.history.revisions.limitMessage' | 'catalog.history.revision.current' | 'catalog.history.revisions.showLess' | 'catalog.history.revisions.showMore' | 'navigationTabs.label' | 'sidebar.menu.backLabel' | 'sidebar.menu.backToLabel' | 'sidebar.actions.show' | 'sidebar.actions.hide' | 'sidebar.actions.changeToSingleColumn' | 'sidebar.actions.changeToTwoColumns' | 'sidebar.actions.singleColumn' | 'sidebar.actions.twoColumns' | 'versionPicker.label' | 'versionPicker.unversioned' | 'codeSnippet.copy.buttonText' | 'codeSnippet.copy.tooltipText' | 'codeSnippet.copy.toasterText' | 'markdown.editPage.text' | 'feedback.settings.comment.submitText' | 'feedback.settings.comment.label' | 'feedback.settings.comment.send' | 'feedback.settings.comment.cancel' | 'feedback.settings.comment.maxLength' | 'feedback.settings.comment.satisfiedLabel' | 'feedback.settings.comment.neutralLabel' | 'feedback.settings.comment.dissatisfiedLabel' | 'feedback.settings.submitText' | 'feedback.settings.label' | 'feedback.settings.reasons.label' | 'feedback.submit' | 'feedback.cancel' | 'feedback.settings.comment.likeLabel' | 'feedback.settings.comment.dislikeLabel' | 'feedback.sentiment.thumbUp' | 'feedback.sentiment.thumbDown' | 'feedback.settings.leftScaleLabel' | 'feedback.settings.rightScaleLabel' | 'feedback.settings.optionalEmail.placeholder' | 'feedback.settings.optionalEmail.label' | 'codeSnippet.report.buttonText' | 'codeSnippet.report.tooltipText' | 'codeSnippet.report.label' | 'codeSnippet.expand.tooltipText' | 'codeSnippet.collapse.tooltipText' | 'jsonViewer.showMore' | 'jsonViewer.showLess' | 'userMenu.login' | 'userMenu.logout' | 'userMenu.devOnboardingLabel' | 'mobileMenu.mainMenu' | 'mobileMenu.previous' | 'mobileMenu.products' | 'mobileMenu.version' | 'navbar.label' | 'navbar.products' | 'page.nextButton' | 'page.previousButton' | 'page.actions.copyButtonText' | 'page.actions.copyTitle' | 'page.actions.copyDescription' | 'page.actions.viewAsMdTitle' | 'page.actions.viewAsMdButtonText' | 'page.actions.viewAsMdDescription' | 'page.actions.chatGptTitle' | 'page.actions.chatGptButtonText' | 'page.actions.chatGptDescription' | 'page.actions.claudeTitle' | 'page.actions.claudeButtonText' | 'page.actions.claudeDescription' | 'page.actions.cursorMcpButtonText' | 'page.actions.cursorMcpTitle' | 'page.actions.cursorMcpDescription' | 'page.actions.connectMcp' | 'page.actions.connectMcp.cursor' | 'page.actions.connectMcp.cursorDescription' | 'page.actions.connectMcp.vscode' | 'page.actions.connectMcp.vscodeDescription' | 'page.actions.connectMcp.claude' | 'page.actions.connectMcp.claudeDescription' | 'page.actions.connectMcp.claudeCode' | 'page.actions.connectMcp.claudeCodeDescription' | 'page.actions.connectMcp.codex' | 'page.actions.connectMcp.codexDescription' | 'page.actions.connectMcp.copyConfig' | 'page.actions.connectMcp.copyConfigDescription' | 'page.actions.connectMcp.moreOptions' | 'page.actions.moreActions' | 'openapi.download.description.title' | 'openapi.info.title' | 'openapi.info.contact.url' | 'openapi.info.contact.name' | 'openapi.info.license' | 'openapi.info.termsOfService' | 'openapi.info.metadata.title' | 'graphql.info.metadata.title' | 'openapi.key' | 'openapi.value' | 'openapi.enum' | 'openapi.items' | 'openapi.default' | 'openapi.variable' | 'openapi.variables' | 'openapi.actions.show' | 'openapi.actions.hide' | 'openapi.actions.more' | 'openapi.languages.title' | 'openapi.languages.moreButton.tooltipText' | 'openapi.servers.title' | 'openapi.operations' | 'openapi.schemas' | 'openapi.webhooks' | 'openapi.description' | 'openapi.badges.deprecated' | 'openapi.badges.required' | 'openapi.badges.webhook' | 'openapi.request' | 'openapi.path' | 'openapi.query' | 'openapi.querystring' | 'openapi.cookie' | 'openapi.header' | 'openapi.body' | 'openapi.responses' | 'openapi.response' | 'openapi.callbacks' | 'openapi.callbackRequest' | 'openapi.callbackResponse' | 'openapi.payload' | 'openapi.discriminator' | 'openapi.contentType' | 'openapi.tryIt' | 'openapi.loading' | 'openapi.example' | 'openapi.examples' | 'openapi.additionalProperties' | 'openapi.patternProperties' | 'openapi.required' | 'openapi.recursive' | 'openapi.complex' | 'openapi.property' | 'openapi.properties' | 'openapi.details' | 'openapi.hideExample' | 'openapi.showExample' | 'openapi.expandAll' | 'openapi.deepLink.tooltip' | 'openapi.collapseAll' | 'openapi.viewSecurityDetails' | 'openapi.noResponseExample' | 'openapi.discriminator.searchPlaceholder' | 'openapi.discriminator.searchNoResults' | 'openapi.discriminator.defaultMapping' | 'openapi.discriminator.defaultMappingTooltip' | 'openapi.noResponseContent' | 'openapi.noRequestPayload' | 'openapi.noRequestData' | 'openapi.hidePattern' | 'openapi.showPattern' | 'openapi.authorizationUrl' | 'openapi.tokenUrl' | 'openapi.refreshUrl' | 'openapi.showOptionalScopes' | 'openapi.hideOptionalScopes' | 'openapi.security' | 'openapi.httpAuthorizationScheme' | 'openapi.bearerFormat' | 'openapi.parameterName' | 'openapi.flowType' | 'openapi.connectUrl' | 'openapi.requiredScopes' | 'openapi.unsupportedLanguage' | 'openapi.failedToGenerateCodeSample' | 'openapi.schemaCatalogLink.title' | 'openapi.schemaCatalogLink.copyButtonTooltip' | 'openapi.schemaCatalogLink.copiedTooltip' | 'openapi.mcp.title' | 'openapi.mcp.endpoint' | 'openapi.mcp.tools' | 'openapi.mcp.protocolVersion' | 'openapi.mcp.capabilities' | 'openapi.mcp.experimentalCapabilities' | 'openapi.mcp.inputSchema' | 'openapi.mcp.inputExample' | 'openapi.mcp.outputSchema' | 'openapi.mcp.outputExample' | 'openapi.mcp.exampleTitle' | 'openapi.mcp.argumentsExample' | 'asyncapi.download.description.title' | 'asyncapi.info.title' | 'asyncapi.info.contact.url' | 'asyncapi.info.contact.name' | 'asyncapi.info.license' | 'asyncapi.info.termsOfService' | 'asyncapi.key' | 'asyncapi.value' | 'asyncapi.variables' | 'asyncapi.required' | 'asyncapi.requiredScopes' | 'asyncapi.viewSecurityDetails' | 'graphql.download.description.title' | 'graphql.info.title' | 'graphql.info.contact.url' | 'graphql.info.contact.name' | 'graphql.info.license' | 'graphql.info.termsOfService' | 'graphql.overview' | 'graphql.metadata' | 'graphql.key' | 'graphql.value' | 'graphql.queries' | 'graphql.mutations' | 'graphql.subscriptions' | 'graphql.directives' | 'graphql.objects' | 'graphql.interfaces' | 'graphql.unions' | 'graphql.enums' | 'graphql.inputs' | 'graphql.scalars' | 'graphql.actions.show' | 'graphql.actions.hide' | 'graphql.actions.more' | 'graphql.fields' | 'graphql.inputFields' | 'graphql.values' | 'graphql.arguments.label' | 'graphql.arguments.show' | 'graphql.arguments.hide' | 'graphql.arguments.here' | 'graphql.returnTypes.label' | 'graphql.returnTypes.show' | 'graphql.returnTypes.hide' | 'graphql.possibleTypes' | 'graphql.defaultValue' | 'graphql.deprecationReason' | 'graphql.requiredScopes' | 'graphql.viewSecurityDetails' | 'graphql.objectScopes' | 'graphql.fieldScopes' | 'graphql.implementedInterfaces' | 'graphql.implementedBy' | 'graphql.nonNull' | 'graphql.required' | 'asyncapi.badges.deprecated' | 'graphql.badges.deprecated' | 'asyncapi.actions.show' | 'asyncapi.actions.hide' | 'asyncapi.actions.more' | 'asyncapi.payload' | 'asyncapi.parameters' | 'asyncapi.messages' | 'asyncapi.contentType' | 'asyncapi.moreDetails' | 'asyncapi.property' | 'asyncapi.properties' | 'asyncapi.details' | 'asyncapi.reply' | 'asyncapi.servers.title' | 'graphql.variables' | 'graphql.querySample' | 'graphql.mutationSample' | 'graphql.subscriptionSample' | 'graphql.responseSample' | 'graphql.locations' | 'graphql.sample' | 'graphql.referenced' | 'graphql.content.fragment' | 'button.download.tooltipText' | 'button.externalLink.tooltipText' | 'button.email.tooltipText' | 'codeWalkthrough.download' | 'codeWalkthrough.preview' | 'time.justNow' | 'time.past.second' | 'time.past.seconds' | 'time.past.minute' | 'time.past.minutes' | 'time.past.hour' | 'time.past.hours' | 'time.past.day' | 'time.past.days' | 'time.past.week' | 'time.past.weeks' | 'time.past.month' | 'time.past.months' | 'time.past.year' | 'time.past.years' | 'page.internalServerError.title' | 'page.internalServerError.description' | 'page.skipToContent.label' | 'select.noResults' | 'loaders.loading' | 'filter.dateRange.from' | 'filter.dateRange.to' | 'diagram.openFullscreen' | 'diagram.zoomIn' | 'diagram.zoomOut' | 'diagram.reset' | 'diagram.close' | 'diagram.viewer' | 'consent.title' | 'consent.message' | 'consent.privacyPolicy' | 'consent.customize' | 'consent.rejectAll' | 'consent.acceptAll' | 'consent.acceptAllCookies' | 'consent.savePreferences' | 'consent.dialog.title' | 'consent.dialog.description' | 'consent.dialog.close' | 'consent.alwaysOn' | 'consent.alwaysOff' | 'consent.gpcNotice' | 'consent.category.necessary.title' | 'consent.category.necessary.description' | 'consent.category.analytics.title' | 'consent.category.analytics.description' | 'consent.category.marketing.title' | 'consent.category.marketing.description' | 'consent.settingsLink';
|
|
2
|
+
export type TranslationKey = 'dev.newApp' | 'dev.newApp.text' | 'dev.sidebar.header' | 'dev.sidebar.footer.text' | 'dev.create.app.dialog.appName.placeholder' | 'dev.create.app.dialog.appName.error' | 'dev.create.app.dialog.selectAPIs' | 'dev.create.app.dialog.description' | 'dev.create.app.dialog.description.placeholder' | 'dev.create.app.dialog.create' | 'dev.create.app.dialog.cancel' | 'dev.main.tab.appKeys' | 'dev.main.tab.logs' | 'dev.app.description.title' | 'dev.edit.description.dialog.title' | 'dev.edit.description.dialog.save' | 'dev.edit.description.dialog.cancel' | 'dev.create.app.dialog.callbackUrls' | 'dev.create.app.dialog.callbackUrls.placeholder' | 'dev.create.app.dialog.callbackUrls.hint' | 'dev.app.callbackUrls.title' | 'dev.edit.callbackUrls.dialog.title' | 'dev.edit.callbackUrls.dialog.placeholder' | 'dev.edit.callbackUrls.dialog.hint' | 'dev.edit.callbackUrls.dialog.save' | 'dev.edit.callbackUrls.dialog.cancel' | 'dev.edit.apis.dialog.selectedAPIs' | 'dev.app.key.create' | 'dev.create.key.dialog.title' | 'dev.create.key.dialog.create' | 'dev.create.key.dialog.cancel' | 'dev.app.edit' | 'dev.app.delete' | 'dev.edit.app.dialog.title' | 'dev.edit.app.dialog.save' | 'dev.edit.app.dialog.cancel' | 'dev.delete.app.dialog.title' | 'dev.delete.app.dialog.confirmation' | 'dev.delete.app.dialog.delete' | 'dev.delete.app.dialog.cancel' | 'dev.app.key.roll' | 'dev.roll.key.dialog.title' | 'dev.roll.key.dialog.apiKey' | 'dev.roll.key.dialog.expires' | 'dev.roll.key.dialog.confirmation' | 'dev.roll.key.dialog.cancel' | 'dev.roll.key.dialog.roll' | 'dev.update.key.dialog.title' | 'dev.update.key.dialog.update' | 'dev.update.key.dialog.cancel' | 'dev.app.key.api.name' | 'dev.app.key.api.status' | 'dev.app.key.api.edit' | 'dev.edit.apis.dialog.title' | 'dev.edit.apis.dialog.apiKey' | 'dev.edit.apis.dialog.save' | 'dev.edit.apis.dialog.cancel' | 'dev.select.placeholder' | 'dev.app.overview.status.pending' | 'dev.app.overview.status.approved' | 'dev.app.overview.status.revoked' | 'dev.app.overview.status' | 'dev.app.overview.non-production' | 'dev.app.overview.production' | 'dev.app.overview.clientId' | 'dev.app.overview.apiKey' | 'dev.app.key.revoke' | 'dev.revoke.key.dialog.title' | 'dev.revoke.key.dialog.apiKey' | 'dev.revoke.key.dialog.expires' | 'dev.revoke.key.dialog.confirmation' | 'dev.revoke.key.dialog.revoke' | 'dev.revoke.key.dialog.cancel' | 'dev.app.overview.expires' | 'dev.app.overview.created' | 'dev.app.overview.visibilityToggle.hide' | 'dev.app.overview.visibilityToggle.show' | 'search.loading' | 'search.noResults.title' | 'search.keys.navigate' | 'search.keys.select' | 'search.keys.exit' | 'search.label' | 'search.cancel' | 'search.recent' | 'search.navbar.label' | 'search.suggested' | 'search.showMore' | 'search.error.title' | 'search.error.button' | 'search.filter.title' | 'search.filter.reset' | 'search.filter.field.reset' | 'search.ai.welcomeText' | 'search.ai.newConversation' | 'search.ai.backToSearch' | 'search.ai.back' | 'search.ai.assistant' | 'search.ai.placeholder' | 'search.ai.generatingResponse' | 'search.ai.followUpQuestion' | 'search.ai.send' | 'search.ai.suggestionsTitle' | 'search.ai.thinkingText' | 'search.ai.resourcesFound' | 'search.ai.resourcesFound.basedOn' | 'search.ai.resourcesFound.resources' | 'search.ai.feedback.title' | 'search.ai.feedback.detailsPlaceholder' | 'search.ai.feedback.thanks' | 'search.ai.toolCall.executed' | 'search.ai.toolCall.executing' | 'search.ai.toolCall.usedTools' | 'search.ai.button' | 'search.ai.label' | 'search.ai.disclaimer' | 'search.ai.error.description' | 'search.ai.error.description.forbidden' | 'search.ai.error.description.unauthorized' | 'search.ai.error.header' | 'search.ai.error.header.forbidden' | 'search.ai.error.header.unauthorized' | 'search.ai.feedback.more' | 'search.ai.actions.copy' | 'search.ai.actions.like' | 'search.ai.actions.dislike' | 'search.searchItem.deprecated' | 'search.searchItem.enum' | 'search.searchItem.example' | 'search.groups.all' | 'search.filter.field.footer' | 'aiAssistant.trigger' | 'toc.header' | 'footer.copyrightText' | 'page.homeButton' | 'page.forbidden.title' | 'page.forbidden.description' | 'page.notFound.title' | 'page.notFound.description' | 'page.apiNotFound.title' | 'page.apiNotFound.description' | 'page.apiNotFound.hint' | 'page.apiNotFound.backButton' | 'page.mcpNotAllowed.title' | 'page.mcpNotAllowed.description' | 'page.mcpNotAllowed.publicNote' | 'page.mcpNotAllowed.publicEndpointHint' | 'page.mcpNotAllowed.mainEndpointHint' | 'page.mcpNotAllowed.snippets.terminal.hint' | 'page.mcpNotAllowed.snippets.claudeCode.headline' | 'page.mcpNotAllowed.snippets.claudeDesktop.headline' | 'page.mcpNotAllowed.snippets.claudeDesktop.accountHint' | 'page.mcpNotAllowed.snippets.claudeDesktop.instruction' | 'page.mcpNotAllowed.snippets.chatgptApp.headline' | 'page.mcpNotAllowed.snippets.chatgptApp.instruction' | 'page.mcpNotAllowed.snippets.codexCli.headline' | 'page.mcpNotAllowed.snippets.prompt.headline' | 'page.mcpNotAllowed.snippets.prompt.hint' | 'page.mcpNotAllowed.snippets.json.hint' | 'page.mcpNotAllowed.tabs.claude' | 'page.mcpNotAllowed.tabs.chatgpt' | 'page.mcpNotAllowed.tabs.json' | 'page.lastUpdated.timeago' | 'page.lastUpdated.on' | 'catalog.filters.placeholder' | 'catalog.filters.title' | 'catalog.filters.add' | 'catalog.filters.clearAll' | 'catalog.filters.select.addFilter' | 'catalog.filters.select.all' | 'catalog.filters.done' | 'catalog.catalogs.all.title' | 'catalog.catalogs.all.description' | 'catalog.catalogs.all.switcherLabel' | 'catalog.catalogs.service.title' | 'catalog.catalogs.service.description' | 'catalog.catalogs.service.switcherLabel' | 'catalog.catalogs.user.title' | 'catalog.catalogs.user.description' | 'catalog.catalogs.user.switcherLabel' | 'catalog.catalogs.team.title' | 'catalog.catalogs.team.description' | 'catalog.catalogs.team.switcherLabel' | 'catalog.catalogs.domain.title' | 'catalog.catalogs.domain.description' | 'catalog.catalogs.domain.switcherLabel' | 'catalog.catalogs.apiDescription.title' | 'catalog.catalogs.apiDescription.description' | 'catalog.catalogs.apiDescription.switcherLabel' | 'catalog.catalogs.dataSchema.title' | 'catalog.catalogs.dataSchema.description' | 'catalog.catalogs.dataSchema.switcherLabel' | 'catalog.catalogs.apiOperation.title' | 'catalog.catalogs.apiOperation.description' | 'catalog.catalogs.apiOperation.switcherLabel' | 'catalog.entity.metadata.title' | 'catalog.entity.schema.title' | 'catalog.entity.properties.apiDescription.title' | 'catalog.backToAllLabel' | 'catalog.notConnected' | 'catalog.tags.label' | 'catalog.sort' | 'catalog.catalogs.label' | 'catalog.owners.label' | 'catalog.repositories.label' | 'catalog.email.label' | 'catalog.format.label' | 'catalog.entityType.label' | 'catalog.domains.label' | 'catalog.contact.label' | 'catalog.methodAndPath.label' | 'catalog.links.label' | 'catalog.metadata.domains' | 'catalog.metadata.owners' | 'catalog.history.button.label' | 'catalog.history.sidebar.title' | 'catalog.history.sidebar.close' | 'catalog.history.version.label' | 'catalog.filters.close' | 'catalog.history.version.notSpecified' | 'catalog.history.version.default' | 'catalog.history.revisions.limitMessage' | 'catalog.history.revision.current' | 'catalog.history.revisions.showLess' | 'catalog.history.revisions.showMore' | 'navigationTabs.label' | 'sidebar.menu.backLabel' | 'sidebar.menu.backToLabel' | 'sidebar.actions.show' | 'sidebar.actions.hide' | 'sidebar.actions.changeToSingleColumn' | 'sidebar.actions.changeToTwoColumns' | 'sidebar.actions.singleColumn' | 'sidebar.actions.twoColumns' | 'versionPicker.label' | 'versionPicker.unversioned' | 'codeSnippet.copy.buttonText' | 'codeSnippet.copy.tooltipText' | 'codeSnippet.copy.toasterText' | 'markdown.editPage.text' | 'feedback.settings.comment.submitText' | 'feedback.settings.comment.label' | 'feedback.settings.comment.send' | 'feedback.settings.comment.cancel' | 'feedback.settings.comment.maxLength' | 'feedback.settings.comment.satisfiedLabel' | 'feedback.settings.comment.neutralLabel' | 'feedback.settings.comment.dissatisfiedLabel' | 'feedback.settings.submitText' | 'feedback.settings.label' | 'feedback.settings.reasons.label' | 'feedback.submit' | 'feedback.cancel' | 'feedback.settings.comment.likeLabel' | 'feedback.settings.comment.dislikeLabel' | 'feedback.sentiment.thumbUp' | 'feedback.sentiment.thumbDown' | 'feedback.settings.leftScaleLabel' | 'feedback.settings.rightScaleLabel' | 'feedback.settings.optionalEmail.placeholder' | 'feedback.settings.optionalEmail.label' | 'codeSnippet.report.buttonText' | 'codeSnippet.report.tooltipText' | 'codeSnippet.report.label' | 'codeSnippet.expand.tooltipText' | 'codeSnippet.collapse.tooltipText' | 'jsonViewer.showMore' | 'jsonViewer.showLess' | 'userMenu.login' | 'userMenu.logout' | 'userMenu.devOnboardingLabel' | 'mobileMenu.mainMenu' | 'mobileMenu.previous' | 'mobileMenu.products' | 'mobileMenu.version' | 'navbar.label' | 'navbar.products' | 'page.nextButton' | 'page.previousButton' | 'page.actions.copyButtonText' | 'page.actions.copyTitle' | 'page.actions.copyDescription' | 'page.actions.viewAsMdTitle' | 'page.actions.viewAsMdButtonText' | 'page.actions.viewAsMdDescription' | 'page.actions.chatGptTitle' | 'page.actions.chatGptButtonText' | 'page.actions.chatGptDescription' | 'page.actions.claudeTitle' | 'page.actions.claudeButtonText' | 'page.actions.claudeDescription' | 'page.actions.cursorMcpButtonText' | 'page.actions.cursorMcpTitle' | 'page.actions.cursorMcpDescription' | 'page.actions.connectMcp' | 'page.actions.connectMcp.cursor' | 'page.actions.connectMcp.cursorDescription' | 'page.actions.connectMcp.vscode' | 'page.actions.connectMcp.vscodeDescription' | 'page.actions.connectMcp.claude' | 'page.actions.connectMcp.claudeDescription' | 'page.actions.connectMcp.claudeCode' | 'page.actions.connectMcp.claudeCodeDescription' | 'page.actions.connectMcp.codex' | 'page.actions.connectMcp.codexDescription' | 'page.actions.connectMcp.copyConfig' | 'page.actions.connectMcp.copyConfigDescription' | 'page.actions.connectMcp.moreOptions' | 'page.actions.moreActions' | 'promptTag.copy.buttonText' | 'promptTag.showPrompt' | 'promptTag.hidePrompt' | 'promptTag.showFullPrompt' | 'promptTag.showLess' | 'promptTag.openIn.cursor' | 'promptTag.openIn.cursorDescription' | 'promptTag.openIn.claude' | 'promptTag.openIn.claudeDescription' | 'promptTag.openIn.chatgpt' | 'promptTag.openIn.chatgptDescription' | 'openapi.download.description.title' | 'openapi.info.title' | 'openapi.info.contact.url' | 'openapi.info.contact.name' | 'openapi.info.license' | 'openapi.info.termsOfService' | 'openapi.info.metadata.title' | 'graphql.info.metadata.title' | 'openapi.key' | 'openapi.value' | 'openapi.enum' | 'openapi.items' | 'openapi.default' | 'openapi.variable' | 'openapi.variables' | 'openapi.actions.show' | 'openapi.actions.hide' | 'openapi.actions.more' | 'openapi.languages.title' | 'openapi.languages.moreButton.tooltipText' | 'openapi.servers.title' | 'openapi.operations' | 'openapi.schemas' | 'openapi.webhooks' | 'openapi.description' | 'openapi.badges.deprecated' | 'openapi.badges.required' | 'openapi.badges.webhook' | 'openapi.request' | 'openapi.path' | 'openapi.query' | 'openapi.querystring' | 'openapi.cookie' | 'openapi.header' | 'openapi.body' | 'openapi.responses' | 'openapi.response' | 'openapi.callbacks' | 'openapi.callbackRequest' | 'openapi.callbackResponse' | 'openapi.payload' | 'openapi.discriminator' | 'openapi.contentType' | 'openapi.tryIt' | 'openapi.loading' | 'openapi.example' | 'openapi.examples' | 'openapi.additionalProperties' | 'openapi.patternProperties' | 'openapi.required' | 'openapi.recursive' | 'openapi.complex' | 'openapi.property' | 'openapi.properties' | 'openapi.details' | 'openapi.hideExample' | 'openapi.showExample' | 'openapi.expandAll' | 'openapi.deepLink.tooltip' | 'openapi.collapseAll' | 'openapi.viewSecurityDetails' | 'openapi.noResponseExample' | 'openapi.discriminator.searchPlaceholder' | 'openapi.discriminator.searchNoResults' | 'openapi.discriminator.defaultMapping' | 'openapi.discriminator.defaultMappingTooltip' | 'openapi.noResponseContent' | 'openapi.noRequestPayload' | 'openapi.noRequestData' | 'openapi.hidePattern' | 'openapi.showPattern' | 'openapi.authorizationUrl' | 'openapi.tokenUrl' | 'openapi.refreshUrl' | 'openapi.showOptionalScopes' | 'openapi.hideOptionalScopes' | 'openapi.security' | 'openapi.httpAuthorizationScheme' | 'openapi.bearerFormat' | 'openapi.parameterName' | 'openapi.flowType' | 'openapi.connectUrl' | 'openapi.requiredScopes' | 'openapi.unsupportedLanguage' | 'openapi.failedToGenerateCodeSample' | 'openapi.schemaCatalogLink.title' | 'openapi.schemaCatalogLink.copyButtonTooltip' | 'openapi.schemaCatalogLink.copiedTooltip' | 'openapi.mcp.title' | 'openapi.mcp.endpoint' | 'openapi.mcp.tools' | 'openapi.mcp.protocolVersion' | 'openapi.mcp.capabilities' | 'openapi.mcp.experimentalCapabilities' | 'openapi.mcp.inputSchema' | 'openapi.mcp.inputExample' | 'openapi.mcp.outputSchema' | 'openapi.mcp.outputExample' | 'openapi.mcp.exampleTitle' | 'openapi.mcp.argumentsExample' | 'asyncapi.download.description.title' | 'asyncapi.info.title' | 'asyncapi.info.contact.url' | 'asyncapi.info.contact.name' | 'asyncapi.info.license' | 'asyncapi.info.termsOfService' | 'asyncapi.key' | 'asyncapi.value' | 'asyncapi.variables' | 'asyncapi.required' | 'asyncapi.requiredScopes' | 'asyncapi.viewSecurityDetails' | 'graphql.download.description.title' | 'graphql.info.title' | 'graphql.info.contact.url' | 'graphql.info.contact.name' | 'graphql.info.license' | 'graphql.info.termsOfService' | 'graphql.overview' | 'graphql.metadata' | 'graphql.key' | 'graphql.value' | 'graphql.queries' | 'graphql.mutations' | 'graphql.subscriptions' | 'graphql.directives' | 'graphql.objects' | 'graphql.interfaces' | 'graphql.unions' | 'graphql.enums' | 'graphql.inputs' | 'graphql.scalars' | 'graphql.actions.show' | 'graphql.actions.hide' | 'graphql.actions.more' | 'graphql.fields' | 'graphql.inputFields' | 'graphql.values' | 'graphql.arguments.label' | 'graphql.arguments.show' | 'graphql.arguments.hide' | 'graphql.arguments.here' | 'graphql.returnTypes.label' | 'graphql.returnTypes.show' | 'graphql.returnTypes.hide' | 'graphql.possibleTypes' | 'graphql.defaultValue' | 'graphql.deprecationReason' | 'graphql.requiredScopes' | 'graphql.viewSecurityDetails' | 'graphql.objectScopes' | 'graphql.fieldScopes' | 'graphql.implementedInterfaces' | 'graphql.implementedBy' | 'graphql.nonNull' | 'graphql.required' | 'asyncapi.badges.deprecated' | 'graphql.badges.deprecated' | 'asyncapi.actions.show' | 'asyncapi.actions.hide' | 'asyncapi.actions.more' | 'asyncapi.payload' | 'asyncapi.parameters' | 'asyncapi.messages' | 'asyncapi.contentType' | 'asyncapi.moreDetails' | 'asyncapi.property' | 'asyncapi.properties' | 'asyncapi.details' | 'asyncapi.reply' | 'asyncapi.servers.title' | 'graphql.variables' | 'graphql.querySample' | 'graphql.mutationSample' | 'graphql.subscriptionSample' | 'graphql.responseSample' | 'graphql.locations' | 'graphql.sample' | 'graphql.referenced' | 'graphql.content.fragment' | 'button.download.tooltipText' | 'button.externalLink.tooltipText' | 'button.email.tooltipText' | 'codeWalkthrough.download' | 'codeWalkthrough.preview' | 'time.justNow' | 'time.past.second' | 'time.past.seconds' | 'time.past.minute' | 'time.past.minutes' | 'time.past.hour' | 'time.past.hours' | 'time.past.day' | 'time.past.days' | 'time.past.week' | 'time.past.weeks' | 'time.past.month' | 'time.past.months' | 'time.past.year' | 'time.past.years' | 'page.internalServerError.title' | 'page.internalServerError.description' | 'page.skipToContent.label' | 'select.noResults' | 'loaders.loading' | 'filter.dateRange.from' | 'filter.dateRange.to' | 'diagram.openFullscreen' | 'diagram.zoomIn' | 'diagram.zoomOut' | 'diagram.reset' | 'diagram.close' | 'diagram.viewer' | 'consent.title' | 'consent.message' | 'consent.privacyPolicy' | 'consent.customize' | 'consent.rejectAll' | 'consent.acceptAll' | 'consent.acceptAllCookies' | 'consent.savePreferences' | 'consent.dialog.title' | 'consent.dialog.description' | 'consent.dialog.close' | 'consent.alwaysOn' | 'consent.alwaysOff' | 'consent.gpcNotice' | 'consent.category.necessary.title' | 'consent.category.necessary.description' | 'consent.category.analytics.title' | 'consent.category.analytics.description' | 'consent.category.marketing.title' | 'consent.category.marketing.description' | 'consent.settingsLink';
|
|
3
3
|
export type Locale = {
|
|
4
4
|
code: string;
|
|
5
5
|
name: string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AI_PROMPT_TARGETS } from '../constants/prompt';
|
|
2
|
+
import type { TranslationKey } from './l10n';
|
|
3
|
+
export type AiPromptTarget = (typeof AI_PROMPT_TARGETS)[keyof typeof AI_PROMPT_TARGETS];
|
|
4
|
+
export type AiPromptActionOption = {
|
|
5
|
+
titleTranslationKey: TranslationKey;
|
|
6
|
+
titleDefault: string;
|
|
7
|
+
descriptionTranslationKey: TranslationKey;
|
|
8
|
+
descriptionDefault: string;
|
|
9
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AiPromptTarget } from '../types/prompt';
|
|
2
|
+
/**
|
|
3
|
+
* Builds a link that opens an AI tool with the prompt prefilled.
|
|
4
|
+
*
|
|
5
|
+
* @param target - The AI tool to open.
|
|
6
|
+
* @param prompt - The plain-text prompt to prefill.
|
|
7
|
+
* @returns The absolute URL with the encoded prompt in the query string.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* getAiPromptLink('claude', 'Summarize this page');
|
|
12
|
+
* // 'https://claude.ai/new?q=Summarize+this+page'
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function getAiPromptLink(target: AiPromptTarget, prompt: string): string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAiPromptLink = getAiPromptLink;
|
|
4
|
+
const AI_PROMPT_ENDPOINTS = {
|
|
5
|
+
chatgpt: { baseUrl: 'https://chat.openai.com', queryParam: 'q' },
|
|
6
|
+
claude: { baseUrl: 'https://claude.ai/new', queryParam: 'q' },
|
|
7
|
+
// Encoding: https://cursor.com/docs/integrations/deeplinks
|
|
8
|
+
cursor: { baseUrl: 'https://cursor.com/link/prompt', queryParam: 'text' },
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Builds a link that opens an AI tool with the prompt prefilled.
|
|
12
|
+
*
|
|
13
|
+
* @param target - The AI tool to open.
|
|
14
|
+
* @param prompt - The plain-text prompt to prefill.
|
|
15
|
+
* @returns The absolute URL with the encoded prompt in the query string.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* getAiPromptLink('claude', 'Summarize this page');
|
|
20
|
+
* // 'https://claude.ai/new?q=Summarize+this+page'
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
function getAiPromptLink(target, prompt) {
|
|
24
|
+
const { baseUrl, queryParam } = AI_PROMPT_ENDPOINTS[target];
|
|
25
|
+
const url = new URL(baseUrl);
|
|
26
|
+
url.searchParams.set(queryParam, prompt);
|
|
27
|
+
return url.toString();
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=get-ai-prompt-link.js.map
|
package/lib/core/utils/index.js
CHANGED
|
@@ -69,4 +69,5 @@ __exportStar(require("./RenderWithLink"), exports);
|
|
|
69
69
|
__exportStar(require("./consent-settings-link-placement"), exports);
|
|
70
70
|
__exportStar(require("./assign-ref"), exports);
|
|
71
71
|
__exportStar(require("./dropdown"), exports);
|
|
72
|
+
__exportStar(require("./get-ai-prompt-link"), exports);
|
|
72
73
|
//# sourceMappingURL=index.js.map
|
package/lib/core/utils/urls.js
CHANGED
|
@@ -17,7 +17,7 @@ exports.getLocaleFromPathname = getLocaleFromPathname;
|
|
|
17
17
|
const common_1 = require("../constants/common");
|
|
18
18
|
function combineUrls(baseURL, ...relativeURLs) {
|
|
19
19
|
let res = baseURL;
|
|
20
|
-
for (
|
|
20
|
+
for (const relativeURL of relativeURLs) {
|
|
21
21
|
res = relativeURL
|
|
22
22
|
? res.replace(/(?<![/\\])[/\\]+$/, '') + '/' + relativeURL.replace(/^[/\\]+/, '')
|
|
23
23
|
: res;
|
|
@@ -1 +1,4 @@
|
|
|
1
|
+
/** Shows the load progress bar until the most recent `withLoadProgress` load settles. */
|
|
1
2
|
export declare function withLoadProgress<T>(loadTarget: Promise<T>): Promise<T>;
|
|
3
|
+
export declare function subscribeToLoadProgress(listener: () => void): () => void;
|
|
4
|
+
export declare function isLoadInProgress(): boolean;
|
|
@@ -8,31 +8,36 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.withLoadProgress = withLoadProgress;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
exports.subscribeToLoadProgress = subscribeToLoadProgress;
|
|
14
|
+
exports.isLoadInProgress = isLoadInProgress;
|
|
15
|
+
let latestLoad = null;
|
|
16
|
+
const listeners = new Set();
|
|
17
|
+
function setLatestLoad(load) {
|
|
18
|
+
latestLoad = load;
|
|
19
|
+
// e2e suites wait for this class, named after the progress library it replaced, to clear.
|
|
20
|
+
document.documentElement.classList.toggle('nprogress-busy', load !== null);
|
|
21
|
+
listeners.forEach((listener) => listener());
|
|
22
|
+
}
|
|
23
|
+
/** Shows the load progress bar until the most recent `withLoadProgress` load settles. */
|
|
23
24
|
function withLoadProgress(loadTarget) {
|
|
24
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
// Cancel any existing progress and restart
|
|
28
|
-
nprogress_1.default.done();
|
|
29
|
-
nprogress_1.default.start();
|
|
26
|
+
const load = Symbol();
|
|
27
|
+
setLatestLoad(load);
|
|
30
28
|
return loadTarget.finally(() => {
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
nprogress_1.default.remove();
|
|
34
|
-
}
|
|
29
|
+
if (latestLoad === load)
|
|
30
|
+
setLatestLoad(null);
|
|
35
31
|
});
|
|
36
32
|
});
|
|
37
33
|
}
|
|
34
|
+
function subscribeToLoadProgress(listener) {
|
|
35
|
+
listeners.add(listener);
|
|
36
|
+
return () => {
|
|
37
|
+
listeners.delete(listener);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function isLoadInProgress() {
|
|
41
|
+
return latestLoad !== null;
|
|
42
|
+
}
|
|
38
43
|
//# sourceMappingURL=with-load-progress.js.map
|
package/lib/ext/configure.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { UserClaims, OpenAPIServer } from '../core/types';
|
|
2
|
-
export * from '../ext/configure-helpers';
|
|
2
|
+
export type * from '../ext/configure-helpers';
|
|
3
3
|
export * from '../ext/helpers/is-direct-configure-request-values';
|
|
4
4
|
import type { ConfigureRequestValues, ConfigureServerRequestValues } from '../ext/configure-helpers';
|
|
5
5
|
type Configure = {
|
package/lib/ext/configure.js
CHANGED
|
@@ -15,7 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.configure = configure;
|
|
18
|
-
__exportStar(require("../ext/configure-helpers"), exports);
|
|
19
18
|
__exportStar(require("../ext/helpers/is-direct-configure-request-values"), exports);
|
|
20
19
|
function configure(_context) {
|
|
21
20
|
// const exampleDefaultRequestValues: ConfigureRequestValues = {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { IconProps } from '../../icons/types';
|
|
3
|
+
/**
|
|
4
|
+
* The link icon drawing as a hidden SVG symbol, which every `SharedLinkIcon` refers to. Render it
|
|
5
|
+
* once per page that shows a `SharedLinkIcon`; without it the icon is empty.
|
|
6
|
+
*/
|
|
7
|
+
export declare function LinkIconSymbol(): JSX.Element;
|
|
8
|
+
/**
|
|
9
|
+
* `LinkIcon` drawn from the page's `LinkIconSymbol`, so a page with many of them carries one copy.
|
|
10
|
+
* `color` fills the glyph; `--link-icon-bg-color` overrides the background.
|
|
11
|
+
*/
|
|
12
|
+
export declare function SharedLinkIcon({ color, size, ...props }: IconProps): JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.LinkIconSymbol = LinkIconSymbol;
|
|
18
|
+
exports.SharedLinkIcon = SharedLinkIcon;
|
|
19
|
+
const react_1 = __importDefault(require("react"));
|
|
20
|
+
const utils_1 = require("../../core/utils");
|
|
21
|
+
const LINK_ICON_SYMBOL_ID = 'redocly-link-icon';
|
|
22
|
+
/**
|
|
23
|
+
* The link icon drawing as a hidden SVG symbol, which every `SharedLinkIcon` refers to. Render it
|
|
24
|
+
* once per page that shows a `SharedLinkIcon`; without it the icon is empty.
|
|
25
|
+
*/
|
|
26
|
+
function LinkIconSymbol() {
|
|
27
|
+
return (react_1.default.createElement("svg", { "data-component-name": "icons/LinkIcon/LinkIconSymbol", display: "none", "aria-hidden": "true", focusable: "false" },
|
|
28
|
+
react_1.default.createElement("symbol", { id: LINK_ICON_SYMBOL_ID, viewBox: "0 0 20 20" },
|
|
29
|
+
react_1.default.createElement("path", { d: "M0 6C0 2.68629 2.68629 0 6 0H14C17.3137 0 20 2.68629 20 6V14C20 17.3137 17.3137 20 14 20H6C2.68629 20 0 17.3137 0 14V6Z", fill: "var(--link-icon-bg-color, var(--layer-color))" }),
|
|
30
|
+
react_1.default.createElement("path", { d: "M7.37318 9.56229H12.6232C12.7392 9.56229 12.8505 9.60838 12.9325 9.69043C13.0146 9.77247 13.0607 9.88375 13.0607 9.99979C13.0607 10.1158 13.0146 10.2271 12.9325 10.3091C12.8505 10.3912 12.7392 10.4373 12.6232 10.4373H7.37318C7.25714 10.4373 7.14586 10.3912 7.06382 10.3091C6.98177 10.2271 6.93568 10.1158 6.93568 9.99979C6.93568 9.88375 6.98177 9.77247 7.06382 9.69043C7.14586 9.60838 7.25714 9.56229 7.37318 9.56229ZM8.6853 12.1875H6.4978C5.91764 12.1875 5.36124 11.957 4.95101 11.5468C4.54077 11.1366 4.3103 10.5802 4.3103 10C4.3103 9.41984 4.54077 8.86344 4.95101 8.4532C5.36124 8.04297 5.91764 7.8125 6.4978 7.8125H8.6853C8.80133 7.8125 8.91262 7.76641 8.99466 7.68436C9.07671 7.60231 9.1228 7.49103 9.1228 7.375C9.1228 7.25897 9.07671 7.14769 8.99466 7.06564C8.91262 6.98359 8.80133 6.9375 8.6853 6.9375H6.4978C5.68558 6.9375 4.90662 7.26016 4.33229 7.83449C3.75796 8.40882 3.4353 9.18777 3.4353 10C3.4353 10.8122 3.75796 11.5912 4.33229 12.1655C4.90662 12.7398 5.68558 13.0625 6.4978 13.0625H8.6853C8.80133 13.0625 8.91262 13.0164 8.99466 12.9344C9.07671 12.8523 9.1228 12.741 9.1228 12.625C9.1228 12.509 9.07671 12.3977 8.99466 12.3156C8.91262 12.2336 8.80133 12.1875 8.6853 12.1875ZM13.4982 6.9375H11.3107C11.1946 6.9375 11.0834 6.98359 11.0013 7.06564C10.9193 7.14769 10.8732 7.25897 10.8732 7.375C10.8732 7.49103 10.9193 7.60231 11.0013 7.68436C11.0834 7.76641 11.1946 7.8125 11.3107 7.8125H13.4982C14.0783 7.8125 14.6347 8.04297 15.045 8.4532C15.4552 8.86344 15.6857 9.41984 15.6857 10C15.6857 10.5802 15.4552 11.1366 15.045 11.5468C14.6347 11.957 14.0783 12.1875 13.4982 12.1875H11.3107C11.1946 12.1875 11.0834 12.2336 11.0013 12.3156C10.9193 12.3977 10.8732 12.509 10.8732 12.625C10.8732 12.741 10.9193 12.8523 11.0013 12.9344C11.0834 13.0164 11.1946 13.0625 11.3107 13.0625H13.4982C14.3104 13.0625 15.0894 12.7398 15.6637 12.1655C16.238 11.5912 16.5607 10.8122 16.5607 10C16.5607 9.18777 16.238 8.40882 15.6637 7.83449C15.0894 7.26016 14.3104 6.9375 13.4982 6.9375Z" }))));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* `LinkIcon` drawn from the page's `LinkIconSymbol`, so a page with many of them carries one copy.
|
|
34
|
+
* `color` fills the glyph; `--link-icon-bg-color` overrides the background.
|
|
35
|
+
*/
|
|
36
|
+
function SharedLinkIcon(_a) {
|
|
37
|
+
var { color, size = '20px' } = _a, props = __rest(_a, ["color", "size"]);
|
|
38
|
+
return (react_1.default.createElement("svg", Object.assign({ "data-component-name": "icons/LinkIcon/SharedLinkIcon", width: size, height: size, viewBox: "0 0 20 20", fill: (0, utils_1.getCssColorVariable)(color), xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
39
|
+
react_1.default.createElement("use", { href: `#${LINK_ICON_SYMBOL_ID}` })));
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=LinkIconSymbol.js.map
|
package/lib/index.d.ts
CHANGED
|
@@ -228,6 +228,7 @@ export * from './icons/MoonIcon/MoonIcon';
|
|
|
228
228
|
export * from './icons/SunIcon/SunIcon';
|
|
229
229
|
export * from './icons/ContrastIcon/ContrastIcon';
|
|
230
230
|
export * from './icons/LinkIcon/LinkIcon';
|
|
231
|
+
export * from './icons/LinkIcon/LinkIconSymbol';
|
|
231
232
|
export * from './icons/LaunchIcon/LaunchIcon';
|
|
232
233
|
export * from './icons/MinimizeIcon/MinimizeIcon';
|
|
233
234
|
export * from './icons/MaximizeIcon/MaximizeIcon';
|
package/lib/index.js
CHANGED
|
@@ -292,6 +292,7 @@ __exportStar(require("./icons/MoonIcon/MoonIcon"), exports);
|
|
|
292
292
|
__exportStar(require("./icons/SunIcon/SunIcon"), exports);
|
|
293
293
|
__exportStar(require("./icons/ContrastIcon/ContrastIcon"), exports);
|
|
294
294
|
__exportStar(require("./icons/LinkIcon/LinkIcon"), exports);
|
|
295
|
+
__exportStar(require("./icons/LinkIcon/LinkIconSymbol"), exports);
|
|
295
296
|
__exportStar(require("./icons/LaunchIcon/LaunchIcon"), exports);
|
|
296
297
|
__exportStar(require("./icons/MinimizeIcon/MinimizeIcon"), exports);
|
|
297
298
|
__exportStar(require("./icons/MaximizeIcon/MaximizeIcon"), exports);
|
|
@@ -176,7 +176,7 @@ const CardWrapper = styled_components_1.default.div.attrs(({ $isCardLink, $varia
|
|
|
176
176
|
}
|
|
177
177
|
`;
|
|
178
178
|
const getCardWrapperClass = ($isCardLink, $variant) => {
|
|
179
|
-
|
|
179
|
+
const classes = [];
|
|
180
180
|
classes.push(`card-variant-${$variant}`);
|
|
181
181
|
if ($isCardLink) {
|
|
182
182
|
classes.push('card-link');
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { AiPromptTarget } from '../../../core/types';
|
|
3
|
+
export type PromptProps = {
|
|
4
|
+
/** Raw Markdown source of the prompt; rendered and copied as plain text. */
|
|
5
|
+
prompt: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
icon?: string;
|
|
8
|
+
iconRawContent?: string;
|
|
9
|
+
actions?: AiPromptTarget[];
|
|
10
|
+
hidePrompt?: boolean;
|
|
11
|
+
singleLine?: boolean;
|
|
12
|
+
buttonOnly?: boolean;
|
|
13
|
+
className?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare function Prompt(props: PromptProps): JSX.Element;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.Prompt = Prompt;
|
|
37
|
+
const react_1 = __importStar(require("react"));
|
|
38
|
+
const styled_components_1 = __importStar(require("styled-components"));
|
|
39
|
+
const constants_1 = require("../../../core/constants");
|
|
40
|
+
const hooks_1 = require("../../../core/hooks");
|
|
41
|
+
const PromptActions_1 = require("../../../markdoc/components/Prompt/PromptActions");
|
|
42
|
+
const PromptBody_1 = require("../../../markdoc/components/Prompt/PromptBody");
|
|
43
|
+
const PromptShowHideButton_1 = require("../../../markdoc/components/Prompt/PromptShowHideButton");
|
|
44
|
+
const PromptCopyButton_1 = require("../../../markdoc/components/Prompt/PromptCopyButton");
|
|
45
|
+
const PromptHeader_1 = require("../../../markdoc/components/Prompt/PromptHeader");
|
|
46
|
+
function Prompt(props) {
|
|
47
|
+
const { prompt, title, icon, iconRawContent, actions = [], hidePrompt = false, singleLine = false, buttonOnly = false, className, } = props;
|
|
48
|
+
const [isPromptVisible, setIsPromptVisible] = (0, react_1.useState)(!hidePrompt);
|
|
49
|
+
const { reportCopy, openIn } = (0, hooks_1.usePromptActions)(prompt);
|
|
50
|
+
const { textRef, textLimit, isExpanded, hasHiddenText, toggleExpanded } = (0, hooks_1.usePromptTextLimit)({
|
|
51
|
+
prompt,
|
|
52
|
+
singleLine,
|
|
53
|
+
isPromptVisible,
|
|
54
|
+
});
|
|
55
|
+
const borderHighlight = (0, hooks_1.usePointerBorderHighlight)();
|
|
56
|
+
if (buttonOnly) {
|
|
57
|
+
const copyButton = (react_1.default.createElement(PromptCopyButton_1.PromptCopyButton, { prompt: prompt, placement: "standalone", onCopy: reportCopy }));
|
|
58
|
+
return (react_1.default.createElement(PromptButtonOnlyWrapper, { "data-component-name": "Markdoc/Prompt/Prompt", className: className }, actions.length > 0 ? (react_1.default.createElement(PromptActions_1.PromptActions, { actions: actions, onOpen: openIn, button: copyButton, alignment: "start" })) : (copyButton)));
|
|
59
|
+
}
|
|
60
|
+
const hasHeader = Boolean(title) || Boolean(icon) || actions.length > 0 || hidePrompt;
|
|
61
|
+
const headerControls = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
62
|
+
hidePrompt ? (react_1.default.createElement(PromptShowHideButton_1.PromptShowHideButton, { isPromptVisible: isPromptVisible, onToggle: () => setIsPromptVisible(!isPromptVisible) })) : null,
|
|
63
|
+
react_1.default.createElement(HeaderCopyWrapper, { $alwaysVisible: hidePrompt },
|
|
64
|
+
react_1.default.createElement(PromptCopyButton_1.PromptCopyButton, { prompt: prompt, placement: "header", onCopy: reportCopy }))));
|
|
65
|
+
return (react_1.default.createElement(PromptWrapper, { "data-component-name": "Markdoc/Prompt/Prompt", className: className },
|
|
66
|
+
react_1.default.createElement(PromptCardWrapper, { ref: borderHighlight.ref, onPointerMove: borderHighlight.onPointerMove, onPointerLeave: borderHighlight.onPointerLeave },
|
|
67
|
+
hasHeader ? (react_1.default.createElement(PromptHeader_1.PromptHeader, { title: title, icon: icon, iconRawContent: iconRawContent, controls: headerControls })) : null,
|
|
68
|
+
actions.length > 0 ? react_1.default.createElement(HeaderActionsWrapper, { actions: actions, onOpen: openIn }) : null,
|
|
69
|
+
isPromptVisible ? (react_1.default.createElement(PromptBody_1.PromptBody, { prompt: prompt, textRef: textRef, textLimit: textLimit, isExpanded: isExpanded, hasHiddenText: hasHiddenText, onToggleExpanded: toggleExpanded, controls: hidePrompt ? null : (react_1.default.createElement(BodyCopyWrapper, { $hiddenWhenNarrow: hasHeader },
|
|
70
|
+
react_1.default.createElement(PromptCopyButton_1.PromptCopyButton, { prompt: prompt, placement: "body", onCopy: reportCopy }))) })) : null)));
|
|
71
|
+
}
|
|
72
|
+
/* The card cannot query its own width, so the container query sits on this wrapper. */
|
|
73
|
+
const PromptWrapper = styled_components_1.default.div `
|
|
74
|
+
container: prompt / inline-size;
|
|
75
|
+
margin: var(--prompt-margin);
|
|
76
|
+
`;
|
|
77
|
+
/* Below 440px the block is a phone screen or a narrow column: the actions get their own
|
|
78
|
+
full-width row under the header, and the copy button moves from the prompt zone to the
|
|
79
|
+
header. The DOM order (header, actions, prompt) is the same in both layouts. */
|
|
80
|
+
const NARROW_BLOCK = `@container prompt (width < ${constants_1.PROMPT_NARROW_BLOCK_MAX_WIDTH})`;
|
|
81
|
+
const PromptCardWrapper = styled_components_1.default.div `
|
|
82
|
+
position: relative;
|
|
83
|
+
display: flex;
|
|
84
|
+
flex-wrap: wrap;
|
|
85
|
+
align-items: center;
|
|
86
|
+
row-gap: var(--prompt-gap);
|
|
87
|
+
column-gap: var(--prompt-header-actions-gap);
|
|
88
|
+
padding: var(--prompt-padding-vertical) var(--prompt-padding-horizontal);
|
|
89
|
+
|
|
90
|
+
> [data-component-name='Markdoc/Prompt/PromptHeader'] {
|
|
91
|
+
flex: 1 1 0;
|
|
92
|
+
min-width: 0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
> [data-component-name='Markdoc/Prompt/PromptBody'] {
|
|
96
|
+
flex: 1 1 100%;
|
|
97
|
+
}
|
|
98
|
+
background-color: var(--prompt-bg-color);
|
|
99
|
+
border: var(--prompt-border-width) var(--border-style) var(--prompt-border-color);
|
|
100
|
+
border-radius: var(--prompt-border-radius);
|
|
101
|
+
|
|
102
|
+
/* A gradient ring over the border, lit around the pointer. The mask keeps only the
|
|
103
|
+
border-width frame of the gradient; --pointer-* come from usePointerBorderHighlight. */
|
|
104
|
+
&::before {
|
|
105
|
+
content: '';
|
|
106
|
+
position: absolute;
|
|
107
|
+
inset: calc(-1 * var(--prompt-border-width));
|
|
108
|
+
padding: var(--prompt-border-width);
|
|
109
|
+
border-radius: var(--prompt-border-radius);
|
|
110
|
+
background: radial-gradient(
|
|
111
|
+
var(--prompt-border-highlight-size) circle at var(--pointer-x, 50%) var(--pointer-y, 50%),
|
|
112
|
+
var(--prompt-border-highlight-color-start),
|
|
113
|
+
var(--prompt-border-highlight-color-end) 40%,
|
|
114
|
+
transparent 80%
|
|
115
|
+
);
|
|
116
|
+
mask:
|
|
117
|
+
linear-gradient(currentColor 0 0) content-box,
|
|
118
|
+
linear-gradient(currentColor 0 0);
|
|
119
|
+
mask-composite: exclude;
|
|
120
|
+
opacity: var(--pointer-edge-proximity, 0);
|
|
121
|
+
transition: var(--prompt-border-highlight-transition);
|
|
122
|
+
pointer-events: none;
|
|
123
|
+
}
|
|
124
|
+
`;
|
|
125
|
+
const HeaderActionsWrapper = (0, styled_components_1.default)(PromptActions_1.PromptActions) `
|
|
126
|
+
flex: 0 0 auto;
|
|
127
|
+
|
|
128
|
+
${NARROW_BLOCK} {
|
|
129
|
+
flex-basis: 100%;
|
|
130
|
+
display: flex;
|
|
131
|
+
|
|
132
|
+
[data-component-name='SplitButton/SplitButton'],
|
|
133
|
+
[data-component-name='Button/ButtonGroup'] {
|
|
134
|
+
width: 100%;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
[data-component-name='Button/ButtonGroup'] > .button:first-child {
|
|
138
|
+
flex: 1;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
`;
|
|
142
|
+
const HeaderCopyWrapper = styled_components_1.default.div `
|
|
143
|
+
display: ${({ $alwaysVisible }) => ($alwaysVisible ? 'flex' : 'none')};
|
|
144
|
+
|
|
145
|
+
${NARROW_BLOCK} {
|
|
146
|
+
display: flex;
|
|
147
|
+
}
|
|
148
|
+
`;
|
|
149
|
+
const BodyCopyWrapper = styled_components_1.default.div `
|
|
150
|
+
display: flex;
|
|
151
|
+
|
|
152
|
+
${({ $hiddenWhenNarrow }) => $hiddenWhenNarrow &&
|
|
153
|
+
(0, styled_components_1.css) `
|
|
154
|
+
${NARROW_BLOCK} {
|
|
155
|
+
display: none;
|
|
156
|
+
}
|
|
157
|
+
`}
|
|
158
|
+
`;
|
|
159
|
+
const PromptButtonOnlyWrapper = styled_components_1.default.div `
|
|
160
|
+
display: flex;
|
|
161
|
+
margin: var(--prompt-margin);
|
|
162
|
+
`;
|
|
163
|
+
//# sourceMappingURL=Prompt.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { JSX, ReactElement } from 'react';
|
|
2
|
+
import type { ButtonProps } from '../../../components/Button/Button';
|
|
3
|
+
import type { AiPromptTarget } from '../../../core/types';
|
|
4
|
+
export type PromptActionsProps = {
|
|
5
|
+
actions: AiPromptTarget[];
|
|
6
|
+
onOpen: (target: AiPromptTarget) => void;
|
|
7
|
+
/** Main button of the split button; without it, the first action is the main button. */
|
|
8
|
+
button?: ReactElement<ButtonProps>;
|
|
9
|
+
/** Side of the split button the menu lines up with. */
|
|
10
|
+
alignment?: 'start' | 'end';
|
|
11
|
+
className?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function PromptActions({ actions, onOpen, button, alignment, className, }: PromptActionsProps): JSX.Element | null;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PromptActions = PromptActions;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const Button_1 = require("../../../components/Button/Button");
|
|
10
|
+
const SplitButton_1 = require("../../../components/SplitButton/SplitButton");
|
|
11
|
+
const DropdownMenu_1 = require("../../../components/Dropdown/DropdownMenu");
|
|
12
|
+
const DropdownMenuItem_1 = require("../../../components/Dropdown/DropdownMenuItem");
|
|
13
|
+
const DropdownMenuItemContent_1 = require("../../../components/Dropdown/DropdownMenuItemContent");
|
|
14
|
+
const ChatGptIcon_1 = require("../../../icons/ChatGptIcon/ChatGptIcon");
|
|
15
|
+
const ClaudeIcon_1 = require("../../../icons/ClaudeIcon/ClaudeIcon");
|
|
16
|
+
const CursorIcon_1 = require("../../../icons/CursorIcon/CursorIcon");
|
|
17
|
+
const hooks_1 = require("../../../core/hooks");
|
|
18
|
+
const constants_1 = require("../../../core/constants");
|
|
19
|
+
const ACTION_ICONS = {
|
|
20
|
+
cursor: CursorIcon_1.CursorIcon,
|
|
21
|
+
claude: ClaudeIcon_1.ClaudeIcon,
|
|
22
|
+
chatgpt: ChatGptIcon_1.ChatGptIcon,
|
|
23
|
+
};
|
|
24
|
+
function PromptActions({ actions, onOpen, button, alignment = 'end', className, }) {
|
|
25
|
+
const { useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
26
|
+
const { translate } = useTranslate();
|
|
27
|
+
const [firstAction, ...restActions] = actions;
|
|
28
|
+
if (!firstAction)
|
|
29
|
+
return null;
|
|
30
|
+
const menuActions = button ? actions : restActions;
|
|
31
|
+
const primaryButton = button !== null && button !== void 0 ? button : (react_1.default.createElement(Button_1.Button, { variant: "secondary", size: "small", icon: react_1.default.createElement(PromptActionIcon, { action: firstAction }), onClick: () => onOpen(firstAction) }, translate(constants_1.AI_PROMPT_ACTION_OPTIONS[firstAction].titleTranslationKey, constants_1.AI_PROMPT_ACTION_OPTIONS[firstAction].titleDefault)));
|
|
32
|
+
return (react_1.default.createElement(PromptActionsWrapper, { "data-component-name": "Markdoc/Prompt/PromptActions", className: className },
|
|
33
|
+
react_1.default.createElement(SplitButton_1.SplitButton, { variant: "secondary", size: "small", alignment: alignment, portalled: true, toggleAriaLabel: translate('page.actions.moreActions', 'More actions'), button: primaryButton }, menuActions.length > 0 ? (react_1.default.createElement(DropdownMenu_1.DropdownMenu, null, menuActions.map((action) => (react_1.default.createElement(DropdownMenuItem_1.DropdownMenuItem, { key: action, onAction: () => onOpen(action) },
|
|
34
|
+
react_1.default.createElement(DropdownMenuItemContent_1.DropdownMenuItemContent, { icon: react_1.default.createElement(PromptActionIcon, { action: action }), title: translate(constants_1.AI_PROMPT_ACTION_OPTIONS[action].titleTranslationKey, constants_1.AI_PROMPT_ACTION_OPTIONS[action].titleDefault), description: translate(constants_1.AI_PROMPT_ACTION_OPTIONS[action].descriptionTranslationKey, constants_1.AI_PROMPT_ACTION_OPTIONS[action].descriptionDefault) })))))) : null)));
|
|
35
|
+
}
|
|
36
|
+
function PromptActionIcon({ action }) {
|
|
37
|
+
const Icon = ACTION_ICONS[action];
|
|
38
|
+
return react_1.default.createElement(Icon, null);
|
|
39
|
+
}
|
|
40
|
+
const PromptActionsWrapper = styled_components_1.default.div `
|
|
41
|
+
display: inline-flex;
|
|
42
|
+
`;
|
|
43
|
+
//# sourceMappingURL=PromptActions.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { JSX, ReactNode, RefObject } from 'react';
|
|
2
|
+
import type { PromptTextLimit } from '../../../core/hooks';
|
|
3
|
+
export type PromptBodyProps = {
|
|
4
|
+
prompt: string;
|
|
5
|
+
textRef: RefObject<HTMLDivElement | null>;
|
|
6
|
+
textLimit: PromptTextLimit;
|
|
7
|
+
isExpanded: boolean;
|
|
8
|
+
hasHiddenText: boolean;
|
|
9
|
+
onToggleExpanded: () => void;
|
|
10
|
+
/** Shown inside the prompt zone; omitted when the header owns the copy button. */
|
|
11
|
+
controls?: ReactNode;
|
|
12
|
+
className?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function PromptBody({ prompt, textRef, textLimit, isExpanded, hasHiddenText, onToggleExpanded, controls, className, }: PromptBodyProps): JSX.Element;
|