MCPcopy
hub / github.com/benjamine/jsondiffpatch / showUnchanged

Function showUnchanged

packages/jsondiffpatch/src/formatters/html.ts:274–330  ·  view source on GitHub ↗
(
  show?: boolean,
  node?: Element | null,
  delay?: number,
)

Source from the content-addressed store, hash-verified

272};
273
274export const showUnchanged = (
275 show?: boolean,
276 node?: Element | null,
277 delay?: number,
278) => {
279 const el = node || document.body;
280 const prefix = 'jsondiffpatch-unchanged-';
281 const classes = {
282 showing: `${prefix}showing`,
283 hiding: `${prefix}hiding`,
284 visible: `${prefix}visible`,
285 hidden: `${prefix}hidden`,
286 };
287 const list = el.classList;
288 if (!list) {
289 return;
290 }
291 if (!delay) {
292 list.remove(classes.showing);
293 list.remove(classes.hiding);
294 list.remove(classes.visible);
295 list.remove(classes.hidden);
296 if (show === false) {
297 list.add(classes.hidden);
298 }
299 return;
300 }
301 if (show === false) {
302 list.remove(classes.showing);
303 list.add(classes.visible);
304 setTimeout(() => {
305 list.add(classes.hiding);
306 }, 10);
307 } else {
308 list.remove(classes.hiding);
309 list.add(classes.showing);
310 list.remove(classes.hidden);
311 }
312 const intervalId = setInterval(() => {
313 adjustArrows(el);
314 }, 100);
315 setTimeout(() => {
316 list.remove(classes.showing);
317 list.remove(classes.hiding);
318 if (show === false) {
319 list.add(classes.hidden);
320 list.remove(classes.visible);
321 } else {
322 list.add(classes.visible);
323 list.remove(classes.hidden);
324 }
325 setTimeout(() => {
326 list.remove(classes.visible);
327 clearInterval(intervalId);
328 }, delay + 400);
329 }, delay);
330};
331

Callers 1

hideUnchangedFunction · 0.85

Calls 2

adjustArrowsFunction · 0.85
removeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…