UNPKG

lib0

Version:

isomorphic utility functions

41 lines • 1.78 kB
/** * Relabels a node: side B carries the configured `name`, side A keeps the source node's original * name. Otherwise identity. Useful to mark a `children`-mapped collection as `lib0:inline` (so a * downstream {@link import('./inline.js').inline}`(['lib0:inline'])` splices it into its parent) or * simply to rename the container (e.g. a data collection projected as a `<ul>`). * * @extends {Transformer<any,any>} */ export class RenameTransformer extends Transformer<any, any> { /** * @param {import('../../schema.js').Schema<delta.Delta<any>>} $in * @param {import('../../schema.js').Schema<delta.Delta<any>>} $out * @param {string} name */ constructor($in: import("../../schema.js").Schema<delta.Delta<any>>, $out: import("../../schema.js").Schema<delta.Delta<any>>, name: string); target: string; /** @type {string|undefined} */ srcName: string | undefined; } /** * Template for {@link RenameTransformer}. * * @template {string} Name * @template {delta.DeltaConf} [IN=any] * @extends {Template<IN, delta.DeltaConfOverwrite<IN, { name: Name }>>} */ export class Rename<Name extends string, IN extends delta.DeltaConf = any> extends Template<IN, delta.DeltaConfOverwrite<IN, { name: Name; }>> { /** * @param {import('../../schema.js').Schema<delta.Delta<IN>>} $d * @param {Name} name */ constructor($d: import("../../schema.js").Schema<delta.Delta<IN>>, name: Name); target: Name; } export function rename<IN extends delta.DeltaConf, Name extends string>($d: import("../../schema.js").Schema<delta.Delta<IN>>, name: Name): Rename<Name, IN>; import { Transformer } from './core.js'; import * as delta from '../delta.js'; import { Template } from './core.js'; //# sourceMappingURL=rename.d.ts.map