@diplodoc/transform 4.77.0 → 4.77.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/js/anchor.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type {Lang} from 'src/transform/typings';
1
+ import type {Lang} from '../transform/typings';
2
2
 
3
3
  import {createTooltipFactory} from './tooltip';
4
4
  import {copyToClipboard, getEventTarget, isCustom} from './utils';
@@ -1,4 +1,4 @@
1
- import type {Lang} from 'src/transform/typings';
1
+ import type {Lang} from '../transform/typings';
2
2
 
3
3
  export const COPIED_LANG_TOKEN: Record<Lang, string> = {
4
4
  ru: 'Скопировано',
@@ -1,4 +1,4 @@
1
- import type {Lang} from 'src/transform/typings';
1
+ import type {Lang} from '../../transform/typings';
2
2
 
3
3
  import {createTooltipFactory} from '../tooltip';
4
4
  import {copyToClipboard, getEventTarget, isCustom} from '../utils';
@@ -178,6 +178,16 @@ export function openDefinition(target: HTMLElement) {
178
178
 
179
179
  export function closeDefinition(definition: HTMLElement) {
180
180
  definition.classList.remove(openClass);
181
+
182
+ // Restore the off-screen position declared in CSS so the (still laid-out)
183
+ // definition box does not extend the page's scrollable area. Inline
184
+ // top/left were set by setDefinitionPosition() while the definition was
185
+ // open; without this reset they would keep the box in the document flow.
186
+ definition.style.top = '';
187
+ definition.style.left = '';
188
+ definition.removeAttribute('relativeX');
189
+ definition.removeAttribute('relativeY');
190
+
181
191
  const term = getTermByDefinition(definition);
182
192
  const termParent = termParentElement(term);
183
193
 
@@ -21,6 +21,14 @@
21
21
  visibility: hidden;
22
22
  opacity: 0;
23
23
 
24
+ // Keep the closed definition off-screen so its (still laid-out) box
25
+ // does not extend the page's scrollable area. Inline top/left set by
26
+ // setDefinitionPosition() are cleared in closeDefinition() to restore
27
+ // these values. Negative-direction overflow does not create a
28
+ // scrollable region, while the box stays measurable for positioning.
29
+ top: -9999px;
30
+ left: -9999px;
31
+
24
32
  padding: 10px;
25
33
 
26
34
  background-color: var(
@@ -1,5 +1,5 @@
1
1
  import type Token from 'markdown-it/lib/token';
2
- import type {Logger} from 'src/transform/log';
2
+ import type {Logger} from '../../log';
3
3
  import type {CacheContext, StateCore} from '../../typings';
4
4
  import type {MarkdownItPluginCb, MarkdownItPluginOpts} from '../typings';
5
5
  import type {MarkdownItIncluded} from '../includes/types';