/** * @typedef {object} LineDiffData * @property {number} length - length of the diff. * @property {import("../../utils/compute-line-info.js").DiffTypeValues} type - The type of diff * @property {number} offset - The offset along the X axis where the diff starts. * @property {string} offsetValue - The characters prior to the current char diff * @property {string} value - The current characters in the diff * @property {string} lineValue - The current value from diffInfo for the line. Mainly used for debugging. */ /** * A minimal version of ``. It does not implement PrismJS for syntax highlighting. * @customElement * @tagname basic-diff-view-element * @documentation https://konnorrogers.github.io/diff-view-element/components/basic-diff-view-element * @status experimental * @since 1.0 */ export default class BasicDiffViewElement extends BaseElement { /** * @override */ static override styles: import("lit").CSSResult[]; /** * @override */ static override get properties(): { readonly view: {}; readonly newValue: { readonly attribute: "new-value"; }; readonly oldValue: { readonly attribute: "old-value"; }; readonly preserveWhitespace: { readonly type: BooleanConstructor; readonly attribute: "preserve-whitespace"; }; readonly disableLineNumbers: { readonly type: BooleanConstructor; readonly reflect: true; readonly attribute: "disable-line-numbers"; }; readonly lineNumberStart: { readonly type: NumberConstructor; readonly attribute: "line-number-start"; }; readonly wrap: { readonly reflect: true; readonly attribute: "wrap"; }; readonly language: { readonly reflect: true; }; }; /** * The value to be displayed on the right in a split view * @type {string} */ newValue: string; /** * The value to be displayed on the left in a split view * @type {string} */ oldValue: string; /** * Side by side comparison of the diff. Currently the only view supported is "split" view (side by side). * @type {"split"} */ view: "split"; /** * The language to highlight for. This won't do much for ``, but makes rendering consistent. * Supported languages out of the box are "plaintext", "html", "javascript", "markdown", "css", "js", "ts" * For more on how to add additional languages, check out the docs. * [Adding languages for highlighting](/guides/adding-languages-for-highlighting) * @type {string} */ language: string; /** * @type {Boolean} * Whether or not to preserve white spaces from templates and attempt to dedent and chomp new lines. */ preserveWhitespace: boolean; /** * @type {boolean} whether or not to disable line numbers */ disableLineNumbers: boolean; /** * Where to start counting indexes in the gutter. Note, this is purely for display purposes. * @type {number} */ lineNumberStart: number; /** * We will take the code, wrap it in `
` and run it through Prism.js. * @type {string} */ code: string; /** * @property * @type {"soft" | "hard"} * If `wrap="soft"`, lines will wrap when they reach the edge of their container. If `wrap="none"`, lines will not wrap instead all the user to scroll horizontally to see more code. */ wrap: "soft" | "hard"; /** * Whether or not to transform `</script>` into `` from slotted content. * @internal * @param {string} text */ unescapeTags(text: string): string; } export type LineDiffData = { /** * - length of the diff. */ length: number; /** * - The type of diff */ type: import("../../utils/compute-line-info.js").DiffTypeValues; /** * - The offset along the X axis where the diff starts. */ offset: number; /** * - The characters prior to the current char diff */ offsetValue: string; /** * - The current characters in the diff */ value: string; /** * - The current value from diffInfo for the line. Mainly used for debugging. */ lineValue: string; }; import { BaseElement } from "../../../internal/base-element.js"; import { computeLineInformation } from "../../utils/compute-line-info.js";