/** * A diff viewer complete with PrismJS for syntax highlighting. * @customElement * @tagname diff-view-element * @documentation https://konnorrogers.github.io/diff-view-elements/components/diff-view-element * @status experimental * @since 1.0 */ export default class DiffViewElement extends BasicDiffViewElement { /** * @override */ static override get properties(): { readonly highlighter: { readonly attribute: false; readonly state: true; }; 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; }; }; /** * Points to an instance of Prism from "prism-esm" for adjusting highlighting, adding plugins, etc. * @type {ReturnType} */ highlighter: ReturnType; /** * A plugin for Prism to add line numbers. * @param {import("../../utils/compute-line-info.js").LineInformation[]} lineInfo * @param {"right" | "left"} side */ lineNumberPlugin(lineInfo: import("../../utils/compute-line-info.js").LineInformation[], side: "right" | "left"): import("../../../internal/prism-highlight.js").Hook; /** * a "wrap" plugin for Prism to add parts to every token. Useful for external styling. * IE: `` becomes `` * @param {any} env */ diffPartPlugin(env: any): void; /** * The meat and potatos of the PrismJS highlighter. It runs the tokenizer and adds the per-character diffs as well as applicable highlights. * @param {import("../../utils/compute-line-info.js").LineInformation[]} lineInfo */ syntaxHighlight(lineInfo: import("../../utils/compute-line-info.js").LineInformation[]): void; lineInfo: import("../../utils/compute-line-info.js").LineInformation[] | undefined; /** * Modify tokens from Prism. * @param {Token} token * @param {LineDiffData[]} data_array */ modifyTokens(token: Token, data_array: LineDiffData[]): void; /** * Modifies a "TokenStreamItem" from Prism. T * @param {import("prism-esm/prism-core.js").TokenStreamItem} token * @param {LineDiffData} data * @param {{ offset: number, count: number, value: string, offsetValue: string }} [currentData={offset: 0, count: 0, value: "", offsetValue: ""}] - The current number of characters modified. Once this reaches data.length, terminates. */ modifyToken(token: import("prism-esm/prism-core.js").TokenStreamItem, data: LineDiffData, currentData?: { offset: number; count: number; value: string; offsetValue: string; } | undefined): void; /** * @param {import("prism-esm/prism-core.js").TokenStreamItem & { touched: boolean; touchedIndexes: Set }} token * @param {null | number} index * @param {LineDiffData} data * @param {*} currentData */ modifyTokenContent(token: import("prism-esm/prism-core.js").TokenStreamItem & { touched: boolean; touchedIndexes: Set; }, index: null | number, data: LineDiffData, currentData: any): void; } export type LineDiffData = import("../basic-diff-view-element/basic-diff-view-element.js").LineDiffData; import BasicDiffViewElement from "../basic-diff-view-element/basic-diff-view-element-register.js"; import { createPrismInstance } from "../../../internal/prism-highlight.js"; import { Token } from "prism-esm";