UNPKG

laif-ds

Version:

Design System di Laif con componenti React basati su principi di Atomic Design

35 lines (34 loc) 937 B
"use client"; import { checkEmphasis as b } from "../util/check-emphasis.js"; import { encodeCharacterReference as h } from "../util/encode-character-reference.js"; import { encodeInfo as d } from "../util/encode-info.js"; k.peek = C; function k(c, p, o, n) { const r = b(o), u = o.enter("emphasis"), t = o.createTracker(n), i = t.move(r); let e = t.move( o.containerPhrasing(c, { after: r, before: i, ...t.current() }) ); const s = e.charCodeAt(0), a = d( n.before.charCodeAt(n.before.length - 1), s, r ); a.inside && (e = h(s) + e.slice(1)); const f = e.charCodeAt(e.length - 1), m = d(n.after.charCodeAt(0), f, r); m.inside && (e = e.slice(0, -1) + h(f)); const l = t.move(r); return u(), o.attentionEncodeSurroundingInfo = { after: m.outside, before: a.outside }, i + e + l; } function C(c, p, o) { return o.options.emphasis || "*"; } export { k as emphasis };