UNPKG

lib0

Version:

isomorphic utility functions

52 lines • 1.99 kB
/** * Stateless transformer (holds only its `conf`); a single shared instance per template suffices. * * @extends {Transformer<any,any>} */ export class AttributionToFormatTransformer extends Transformer<any, any> { /** * @param {import('../../schema.js').Schema<delta.Delta<any>>} $in * @param {import('../../schema.js').Schema<delta.Delta<any>>} $out * @param {Conf} conf */ constructor($in: import("../../schema.js").Schema<delta.Delta<any>>, $out: import("../../schema.js").Schema<delta.Delta<any>>, conf: Conf); conf: Conf; } /** * Template for {@link AttributionToFormatTransformer}. * * @template {delta.DeltaConf} [IN=any] * @extends {Template<IN, any>} */ export class AttributionToFormat<IN extends delta.DeltaConf = any> extends Template<IN, any> { /** * @param {import('../../schema.js').Schema<delta.Delta<IN>>} $d * @param {Conf} conf */ constructor($d: import("../../schema.js").Schema<delta.Delta<IN>>, conf: Conf); /** * @type {Conf} */ conf: Conf; } export function attributionToFormat<IN extends delta.DeltaConf>($d: import("../../schema.js").Schema<delta.Delta<IN>>, conf: Conf): AttributionToFormat<IN>; /** * Maps an attribution object to the format value placed under its namespaced key (or `null` to clear * that key, `{}`/`undefined` to leave it unchanged). */ export type Handler = (attribution: import("../delta.js").Attribution) => any; /** * Per-dimension handlers. Each fires when the op's attribution has a key with that dimension's prefix * (`insert`/`insertAt` → `insert`, etc.); the whole attribution object is passed in. A missing handler * means "do not render that dimension". */ export type Conf = { insert?: Handler; delete?: Handler; format?: Handler; attrs?: Handler; }; import { Transformer } from './core.js'; import * as delta from '../delta.js'; import { Template } from './core.js'; //# sourceMappingURL=attribution-to-format.d.ts.map