/** * @license * Copyright 2023 Nuraly, Laabidi Aymen * SPDX-License-Identifier: MIT */ import { LitElement, nothing, PropertyValues, TemplateResult } from 'lit'; import type { ChatbotArtifact } from '../chatbot.types.js'; import { type Canonicalize } from './artifact-diff.js'; type TabId = 'json' | 'diff' | 'patch'; type ViewMode = 'auto' | TabId; /** * Renders an artifact's content with a JSON / Diff / Patch tab toggle when the * artifact carries edit metadata (`previousContent`, `patch`). For plain * artifacts only the JSON tab applies and the tab bar is hidden. The diff is a * dependency-free line-by-line LCS render styled to read like a code review. */ export declare class NrArtifactDiffViewElement extends LitElement { artifact: ChatbotArtifact; canonicalize: Canonicalize; /** 'auto' shows the JSON/Diff/Patch tab bar. A fixed view renders only that, with no tabs. */ view: ViewMode; private activeTab; private artifactKey; static styles: import("lit").CSSResult; /** * Highlight the first diff line containing `needle` and scroll it into view. * Used by hosts (e.g. the flow editor) to link a diagram node to its JSON. * No-op when the diff is not currently rendered. */ highlightByText(needle: string): boolean; clearHighlight(): void; /** * Highlight the entire object/array value of a top-level-ish property `key` * (the opening `"key": {` line through its matching close) and scroll it into * view. Block extent is found by indentation, so braces inside string values * do not break it. Falls back to a single-line highlight when the property is * a scalar. Returns false when the key is not found. */ highlightObjectByKey(key: string): boolean; /** * Scroll the highlighted block into view only when it is not already visible. * If the opening line is on screen we leave the scroll position alone, so * hovering nearby nodes does not cause the diff to jump around. */ private scrollLineIntoViewIfNeeded; private get meta(); private get previousContent(); private get isEdit(); private get canonicalMode(); private get hasDiff(); private get hasPatch(); private get tabs(); willUpdate(changed: PropertyValues): void; render(): TemplateResult | typeof nothing; private renderTabBar; private renderTab; private renderJson; private renderDiff; private renderPatch; } declare global { interface HTMLElementTagNameMap { 'nr-artifact-diff-view': NrArtifactDiffViewElement; } } export {}; //# sourceMappingURL=artifact-diff-view.component.d.ts.map