@forsakringskassan/docs-generator 2.5.0 → 2.6.0

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/README.md CHANGED
@@ -206,6 +206,10 @@ The following statuses are recognized:
206
206
 
207
207
  Document title used for `<title>` and `<nav>`
208
208
 
209
+ #### `short-title`
210
+
211
+ Document title used when a shorter title is needed, e.g. site navigation.
212
+
209
213
  #### `visible`
210
214
 
211
215
  Set to `false` to hide document from navigation menu.
@@ -218,20 +222,34 @@ Default `true`.
218
222
 
219
223
  ### Inline tags
220
224
 
221
- #### `{@link ...}`
225
+ #### `{@@link ...}`
222
226
 
223
227
  Implicit title:
224
228
 
225
229
  ```md
226
- Use the {@link MyAwesomeComponent} component.
230
+ Use the {@@link MyAwesomeComponent} component.
227
231
  ```
228
232
 
229
233
  Explicit title:
230
234
 
231
235
  ```md
232
- Use the {@link MyAwesomeComponent awesome component}.
236
+ Use the {@@link MyAwesomeComponent awesome component}.
237
+ ```
238
+
239
+ #### `{@@optional}`
240
+
241
+ Creates a tag (badge) to mark something as optional.
242
+
243
+ **Input:**
244
+
245
+ ```md
246
+ {@@optional}
233
247
  ```
234
248
 
249
+ **Output:**
250
+
251
+ {@optional}
252
+
235
253
  ### Templating
236
254
 
237
255
  The [Nunjucks](https://mozilla.github.io/nunjucks/) templating engine is used for rendering documents to HTML.
@@ -3,10 +3,10 @@
3
3
  var path$1 = require('node:path');
4
4
  var esbuild = require('esbuild');
5
5
  var vue = require('vue');
6
- var vue3 = require('./vue3-Cv0MDe04.js');
6
+ var vue3 = require('./vue3-CNEpTgeX.js');
7
7
  var path = require('node:path/posix');
8
8
  require('@vue/compiler-sfc');
9
- require('./vendor-BFdBzDIw.js');
9
+ require('./vendor-CYT__b1C.js');
10
10
  require('typescript');
11
11
  require('node:url');
12
12
  require('fs');
@@ -22,16 +22,10 @@ require('assert');
22
22
  require('path');
23
23
  require('readline');
24
24
  require('events');
25
- require('child_process');
26
- require('node:stream/promises');
27
- require('node:child_process');
28
- require('node:util');
29
25
  require('node:process');
30
- require('node:tty');
31
- require('node:timers/promises');
32
- require('node:os');
33
- require('node:v8');
34
- require('node:buffer');
26
+ require('node:util');
27
+ require('node:child_process');
28
+ require('node:stream/promises');
35
29
  require('os');
36
30
  require('http');
37
31
  require('https');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var vendor = require('./vendor-BFdBzDIw.js');
3
+ var vendor = require('./vendor-CYT__b1C.js');
4
4
  var path = require('node:path/posix');
5
5
  var path$1 = require('node:path');
6
6
  require('crypto');
@@ -81,7 +81,15 @@ class SoftError extends Error {
81
81
  }
82
82
 
83
83
  function processInlineTags(tags, doc, docs, text, handleSoftError) {
84
- return text.replace(/{@([\S}]+)([^}]*)}/g, (_, name, content) => {
84
+ return text.replace(/{@(@?)([^{}]+)}/g, (_, escape, content) => {
85
+ if (escape) {
86
+ return `{@${content}}`;
87
+ }
88
+ const match = content.match(/^(\S+)($|\s[^]+)$/);
89
+ if (!match) {
90
+ return `{@${content}}`;
91
+ }
92
+ const [, name, text2] = match;
85
93
  const tag = tags.find((it) => it.name === name);
86
94
  if (!tag) {
87
95
  return handleSoftError(
@@ -92,7 +100,7 @@ function processInlineTags(tags, doc, docs, text, handleSoftError) {
92
100
  );
93
101
  }
94
102
  try {
95
- return tag.handler(doc, docs, content.trim());
103
+ return tag.handler(doc, docs, text2.trim());
96
104
  } catch (err) {
97
105
  if (err instanceof SoftError) {
98
106
  return handleSoftError(err);
@@ -164,7 +172,15 @@ const linkTag = {
164
172
  }
165
173
  };
166
174
 
167
- const inlineTags = [linkTag];
175
+ const optionalTag = {
176
+ name: "optional",
177
+ description: "Create a tag for symbolize optional content",
178
+ handler() {
179
+ return `<span class="docs-tag docs-tag--default">Optional</span>`;
180
+ }
181
+ };
182
+
183
+ const inlineTags = [linkTag, optionalTag];
168
184
 
169
185
  function findTestId(tags) {
170
186
  const prefix = "test-id=";
@@ -461,9 +477,100 @@ function imageResources(options) {
461
477
  };
462
478
  }
463
479
 
480
+ function altContainer(context) {
481
+ const { md, env, docs } = context;
482
+ return (tokens, index) => {
483
+ const token = tokens[index];
484
+ const needle = token.info;
485
+ const doc = findDocument(docs, needle);
486
+ if (doc && doc.format === "markdown") {
487
+ return md.render(doc.body, env);
488
+ }
489
+ return md.render(token.content, env);
490
+ };
491
+ }
492
+
493
+ function apiContainer(context) {
494
+ const { md, env, docs, included, handleSoftError } = context;
495
+ return (tokens, index) => {
496
+ const token = tokens[index];
497
+ const needle = token.content.trim();
498
+ const doc = findDocument(docs, needle);
499
+ if (!doc) {
500
+ return handleSoftError(
501
+ new SoftError(
502
+ "EINCLUDETARGET",
503
+ `No document matches "${needle}" when trying to include content`,
504
+ { id: needle }
505
+ )
506
+ );
507
+ }
508
+ if (included.has(doc.id)) {
509
+ return handleSoftError(
510
+ new SoftError(
511
+ "EINCLUDERECURSION",
512
+ `Recursion detected when including document "${doc.id}"`
513
+ )
514
+ );
515
+ }
516
+ included.add(doc.id);
517
+ if (doc.format === "html") {
518
+ return doc.body;
519
+ }
520
+ const content = md.render(doc.body, env);
521
+ return (
522
+ /* HTML */
523
+ ` <div>${content}</div> `
524
+ );
525
+ };
526
+ }
527
+
528
+ const defaultTitle = {
529
+ info: "INFO",
530
+ warning: "WARNING",
531
+ danger: "DANGER"
532
+ };
533
+ function messageboxContainer(context, options, alias) {
534
+ const { md, env } = context;
535
+ function getTitle(variant, customTitle) {
536
+ if (customTitle && customTitle.length > 0) {
537
+ return customTitle.join(" ");
538
+ } else {
539
+ return options.title[variant] ?? defaultTitle[variant] ?? "";
540
+ }
541
+ }
542
+ function parseInfo(info) {
543
+ if (alias) {
544
+ const variant = alias;
545
+ const customTitle = info ? info.split(" ") : [];
546
+ const title = getTitle(variant, customTitle);
547
+ return { variant, title };
548
+ } else {
549
+ const [variant = "info", ...customTitle] = info ? info.split(" ") : [];
550
+ const title = getTitle(variant, customTitle);
551
+ return { variant, title };
552
+ }
553
+ }
554
+ return (tokens, index) => {
555
+ const token = tokens[index];
556
+ const { variant, title } = parseInfo(token.info);
557
+ const text = token.content.trim();
558
+ const content = md.render(text, env);
559
+ return (
560
+ /* HTML */
561
+ `
562
+ <div class="docs-messagebox docs-messagebox--${variant}">
563
+ ${title ? `<p class="docs-messagebox__title">${title}</p>` : ""}
564
+ ${content}
565
+ </div>
566
+ `
567
+ );
568
+ };
569
+ }
570
+
464
571
  const markerStr = ":";
465
572
  const markerChar = markerStr.charCodeAt(0);
466
- function parser(md, options) {
573
+ function containerParser(md, options) {
467
574
  function container(state, startLine, endLine, silent) {
468
575
  let pos = state.bMarks[startLine] + state.tShift[startLine];
469
576
  let max = state.eMarks[startLine];
@@ -484,8 +591,9 @@ function parser(md, options) {
484
591
  return false;
485
592
  }
486
593
  const markup = state.src.slice(mem, pos);
487
- const params = state.src.slice(pos, max).trim();
488
- const kind = params.split(" ", 2)[0];
594
+ const params = state.src.slice(pos, max).trim().split(/\s+/);
595
+ const kind = params[0];
596
+ const info = params.slice(1).join(" ");
489
597
  if (silent) {
490
598
  return true;
491
599
  }
@@ -521,7 +629,7 @@ function parser(md, options) {
521
629
  len = state.sCount[startLine];
522
630
  state.line = nextLine + (haveEndMarker ? 1 : 0);
523
631
  const token = state.push(`doc_${kind}`, "div", 0);
524
- token.info = params;
632
+ token.info = info?.trim();
525
633
  token.content = state.getLines(startLine + 1, nextLine, len, true);
526
634
  token.markup = markup;
527
635
  token.map = [startLine, state.line];
@@ -534,49 +642,28 @@ function parser(md, options) {
534
642
  md.renderer.rules[`doc_${kind}`] = fn;
535
643
  }
536
644
  }
537
- function include(docs, env, included, handleSoftError) {
645
+ function containerRenderer(docs, env, included, handleSoftError, options) {
538
646
  return function(md) {
539
- md.use(parser, {
540
- api(tokens, index) {
541
- const token = tokens[index];
542
- const needle = token.content.trim();
543
- const doc = findDocument(docs, needle);
544
- if (!doc) {
545
- return handleSoftError(
546
- new SoftError(
547
- "EINCLUDETARGET",
548
- `No document matches "${needle}" when trying to include content`,
549
- { id: needle }
550
- )
551
- );
552
- }
553
- if (included.has(doc.id)) {
554
- return handleSoftError(
555
- new SoftError(
556
- "EINCLUDERECURSION",
557
- `Recursion detected when including document "${doc.id}"`
558
- )
559
- );
560
- }
561
- included.add(doc.id);
562
- if (doc.format === "html") {
563
- return doc.body;
564
- }
565
- const content = md.render(doc.body, env);
566
- return (
567
- /* HTML */
568
- ` <div>${content}</div> `
569
- );
570
- },
571
- alt(tokens, index) {
572
- const token = tokens[index];
573
- const needle = token.info.split(" ")[1];
574
- const doc = findDocument(docs, needle);
575
- if (doc && doc.format === "markdown") {
576
- return md.render(doc.body, env);
577
- }
578
- return md.render(token.content, env);
579
- }
647
+ const context = {
648
+ md,
649
+ env,
650
+ docs,
651
+ included,
652
+ handleSoftError
653
+ };
654
+ md.use(containerParser, {
655
+ alt: altContainer(context),
656
+ api: apiContainer(context),
657
+ messagebox: messageboxContainer(context, options.messagebox),
658
+ /* aliases for messagebox containers */
659
+ info: messageboxContainer(context, options.messagebox, "info"),
660
+ tip: messageboxContainer(context, options.messagebox, "tip"),
661
+ warning: messageboxContainer(
662
+ context,
663
+ options.messagebox,
664
+ "warning"
665
+ ),
666
+ danger: messageboxContainer(context, options.messagebox, "danger")
580
667
  });
581
668
  };
582
669
  }
@@ -617,6 +704,7 @@ function createMarkdownRenderer(options) {
617
704
  const md = vendor.MarkdownIt({
618
705
  html: true
619
706
  });
707
+ md.use(vendor.deflist_plugin);
620
708
  md.use(
621
709
  codePreview({
622
710
  generateExample: options.generateExample
@@ -628,7 +716,11 @@ function createMarkdownRenderer(options) {
628
716
  addResource: options.addResource
629
717
  })
630
718
  );
631
- md.use(include(docs, env, included, options.handleSoftError));
719
+ md.use(
720
+ containerRenderer(docs, env, included, options.handleSoftError, {
721
+ messagebox: { title: {}, ...options.messagebox }
722
+ })
723
+ );
632
724
  md.use(table());
633
725
  md.use(codeInline());
634
726
  return {
package/dist/index.d.ts CHANGED
@@ -213,6 +213,35 @@ export declare interface GeneratorOptions {
213
213
  * `function setup(options: { rootComponent: string, selector: string }): void`
214
214
  */
215
215
  setupPath: string;
216
+ /**
217
+ * Options for markdown renderer.
218
+ */
219
+ markdown: {
220
+ /**
221
+ * Options for markdown messagebox container.
222
+ */
223
+ messagebox: {
224
+ /**
225
+ * Default titles for messageboxes.
226
+ *
227
+ * If a title is the empty string `""` the usage of title is
228
+ * disabled by default.
229
+ *
230
+ * @example
231
+ * ```json
232
+ * {
233
+ * "title": {
234
+ * "info": "Information",
235
+ * "tip": "Tips",
236
+ * "warning": "Varning",
237
+ * "danger": "Se upp!"
238
+ * }
239
+ * }
240
+ * ```
241
+ */
242
+ title?: Record<string, string>;
243
+ };
244
+ };
216
245
  }
217
246
 
218
247
  /**
@@ -349,6 +378,7 @@ export declare interface NavigationSection {
349
378
  */
350
379
  export declare interface NormalizedDocumentAttributes {
351
380
  title?: string;
381
+ shortTitle?: string;
352
382
  layout?: string;
353
383
  status?: string;
354
384
  badge?: DocumentBadge;
package/dist/index.js CHANGED
@@ -1,17 +1,17 @@
1
1
  'use strict';
2
2
 
3
3
  var fs = require('node:fs/promises');
4
- var vendor = require('./vendor-BFdBzDIw.js');
4
+ var vendor = require('./vendor-CYT__b1C.js');
5
5
  var path = require('node:path');
6
6
  var require$$1 = require('crypto');
7
- var createMarkdownRenderer = require('./create-markdown-renderer-iznOQQKw.js');
7
+ var createMarkdownRenderer = require('./create-markdown-renderer-Bun8U6bd.js');
8
8
  var node_child_process = require('node:child_process');
9
9
  var path$1 = require('node:path/posix');
10
10
  require('node:crypto');
11
11
  var util = require('node:util');
12
12
  var fs$1 = require('node:fs');
13
13
  var vue = require('vue');
14
- var vue3 = require('./vue3-Cv0MDe04.js');
14
+ var vue3 = require('./vue3-CNEpTgeX.js');
15
15
  var vueDocgenApi = require('vue-docgen-api');
16
16
  var sass = require('sass');
17
17
  var node_url = require('node:url');
@@ -31,14 +31,8 @@ require('assert');
31
31
  require('path');
32
32
  require('readline');
33
33
  require('events');
34
- require('child_process');
35
- require('node:stream/promises');
36
34
  require('node:process');
37
- require('node:tty');
38
- require('node:timers/promises');
39
- require('node:os');
40
- require('node:v8');
41
- require('node:buffer');
35
+ require('node:stream/promises');
42
36
  require('os');
43
37
  require('http');
44
38
  require('https');
@@ -451,13 +445,16 @@ function topnavProcessor(filename, title) {
451
445
  }
452
446
 
453
447
  async function getGitBranch() {
454
- const { CHANGE_BRANCH, CHANGE_NAME } = process.env;
448
+ const { CHANGE_BRANCH, CHANGE_NAME, GITHUB_HEAD_REF } = process.env;
455
449
  if (CHANGE_BRANCH) {
456
450
  return CHANGE_BRANCH;
457
451
  }
458
452
  if (CHANGE_NAME) {
459
453
  return CHANGE_NAME;
460
454
  }
455
+ if (GITHUB_HEAD_REF) {
456
+ return GITHUB_HEAD_REF;
457
+ }
461
458
  const branch = await runCommand(
462
459
  "git rev-parse --abbrev-ref HEAD",
463
460
  "unknown"
@@ -769,6 +766,7 @@ function parseFile$1(filePath, basePath, content) {
769
766
  visible: attributes.visible ?? true,
770
767
  attributes: {
771
768
  title: attributes.title ?? name,
769
+ shortTitle: attributes["short-title"],
772
770
  layout: attributes.layout,
773
771
  status: attributes.status,
774
772
  badge: getBadge(attributes),
@@ -1385,7 +1383,7 @@ function generateNavtree(docs) {
1385
1383
  }
1386
1384
  for (const doc of docs) {
1387
1385
  const [name, isSection] = pathFromDoc(doc);
1388
- const title = doc.attributes.title ?? doc.fileInfo.name;
1386
+ const title = doc.attributes.shortTitle ?? doc.attributes.title ?? doc.fileInfo.name;
1389
1387
  const sortorder = doc.attributes.sortorder;
1390
1388
  if (doc.attributes.href) {
1391
1389
  const parent2 = attach(name);
@@ -1707,13 +1705,11 @@ async function compileExamples(options) {
1707
1705
  external: vendors.map((it) => it.package),
1708
1706
  tasks: dirtyTasks
1709
1707
  };
1710
- const result = await vendor.execa("node", [scriptPath], {
1711
- input: JSON.stringify(batch),
1712
- all: true
1708
+ const result = await vendor.spawn("node", [scriptPath], {
1709
+ stdin: { string: JSON.stringify(batch) }
1713
1710
  });
1714
- const hasOutput = result.all ? result.all.length > 0 : false;
1715
- if (hasOutput) {
1716
- console.log(result.all);
1711
+ if (result.output.length > 0) {
1712
+ console.log(result.output);
1717
1713
  }
1718
1714
  }
1719
1715
  async function compileStandalones(options) {
@@ -1803,7 +1799,8 @@ async function render(doc, docs, nav, vendors, options) {
1803
1799
  },
1804
1800
  handleSoftError(error) {
1805
1801
  throw error;
1806
- }
1802
+ },
1803
+ messagebox: options.markdown.messagebox
1807
1804
  });
1808
1805
  njk.addFilter("marked", (content2) => {
1809
1806
  return markdownRenderer.render(doc, content2);
@@ -2423,7 +2420,8 @@ class Generator {
2423
2420
  cacheFolder,
2424
2421
  exampleFolders,
2425
2422
  templateFolders,
2426
- setupPath
2423
+ setupPath,
2424
+ markdown: {}
2427
2425
  }),
2428
2426
  ...this.processors
2429
2427
  ];
@@ -183,6 +183,13 @@ export declare interface MarkdownOptions {
183
183
  * @returns A replacement string or rethrows error.
184
184
  */
185
185
  handleSoftError(error: SoftErrorType): string;
186
+ /**
187
+ * Options for messagebox container.
188
+ */
189
+ messagebox?: {
190
+ /** Default titles for messageboxes */
191
+ title?: Record<string, string>;
192
+ };
186
193
  }
187
194
 
188
195
  /**
@@ -206,6 +213,7 @@ export declare interface MarkdownRenderer {
206
213
  */
207
214
  export declare interface NormalizedDocumentAttributes {
208
215
  title?: string;
216
+ shortTitle?: string;
209
217
  layout?: string;
210
218
  status?: string;
211
219
  badge?: DocumentBadge;
package/dist/markdown.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var createMarkdownRenderer = require('./create-markdown-renderer-iznOQQKw.js');
4
- require('./vendor-BFdBzDIw.js');
3
+ var createMarkdownRenderer = require('./create-markdown-renderer-Bun8U6bd.js');
4
+ require('./vendor-CYT__b1C.js');
5
5
  require('@vue/compiler-sfc');
6
6
  require('typescript');
7
7
  require('node:url');
@@ -19,16 +19,10 @@ require('assert');
19
19
  require('path');
20
20
  require('readline');
21
21
  require('events');
22
- require('child_process');
23
- require('node:stream/promises');
24
- require('node:child_process');
25
- require('node:util');
26
22
  require('node:process');
27
- require('node:tty');
28
- require('node:timers/promises');
29
- require('node:os');
30
- require('node:v8');
31
- require('node:buffer');
23
+ require('node:util');
24
+ require('node:child_process');
25
+ require('node:stream/promises');
32
26
  require('os');
33
27
  require('http');
34
28
  require('https');
package/dist/runtime.js CHANGED
@@ -139392,6 +139392,137 @@ onContentReady(() => {
139392
139392
  }
139393
139393
  });
139394
139394
 
139395
+ // src/runtime/debounce.ts
139396
+ function debounce2(func, delay2, immediate = false) {
139397
+ let timeout2 = null;
139398
+ return function functionToExecute(...args) {
139399
+ const timedOutFunction = () => {
139400
+ timeout2 = null;
139401
+ if (!immediate) {
139402
+ func.apply(this, args);
139403
+ }
139404
+ };
139405
+ const callNow = immediate && !timeout2;
139406
+ if (timeout2 !== null) {
139407
+ clearTimeout(timeout2);
139408
+ }
139409
+ timeout2 = setTimeout(timedOutFunction, delay2);
139410
+ if (callNow) {
139411
+ func.apply(this);
139412
+ }
139413
+ };
139414
+ }
139415
+
139416
+ // src/runtime/topnav.ts
139417
+ function getElementsRefs() {
139418
+ const nav = document.querySelector("#topnav");
139419
+ if (!nav) {
139420
+ return;
139421
+ }
139422
+ const menuItems = Array.from(
139423
+ nav.querySelectorAll(".imenu__list__item")
139424
+ );
139425
+ const moreItem = menuItems.pop();
139426
+ const moreButton = moreItem.querySelector("button");
139427
+ const popoverContainer = moreItem.querySelector(".ipopupmenu");
139428
+ const popover = popoverContainer.querySelector(".ipopupmenu__list");
139429
+ const popoverItems = Array.from(
139430
+ popover.querySelectorAll(".ipopupmenu__list__item")
139431
+ );
139432
+ const highlightIndex = menuItems.findIndex(
139433
+ (it) => it.classList.contains("imenu__list__item--highlight")
139434
+ );
139435
+ const itemPairs = menuItems.map((menu, index2) => ({
139436
+ menu,
139437
+ popover: popoverItems[index2]
139438
+ }));
139439
+ return {
139440
+ nav,
139441
+ moreItem,
139442
+ moreButton,
139443
+ popoverContainer,
139444
+ popover,
139445
+ itemPairs,
139446
+ highlightIndex
139447
+ };
139448
+ }
139449
+ function setPopoverVisibility(visible, refs) {
139450
+ refs.popover.style.visibility = visible ? "visible" : "hidden";
139451
+ refs.moreButton.ariaExpanded = visible.toString();
139452
+ }
139453
+ function togglePopover(event3, refs) {
139454
+ event3.stopPropagation();
139455
+ setPopoverVisibility(refs.popover.style.visibility === "hidden", refs);
139456
+ }
139457
+ function closePopoverOnEsc(event3, refs) {
139458
+ if (event3.key === "Escape") {
139459
+ setPopoverVisibility(false, refs);
139460
+ refs.moreButton.focus();
139461
+ }
139462
+ }
139463
+ function onClickItem(event3) {
139464
+ const clickable = event3.target.querySelector(
139465
+ "a, button"
139466
+ );
139467
+ clickable.click();
139468
+ }
139469
+ function onClickPopover(event3) {
139470
+ event3.stopPropagation();
139471
+ }
139472
+ function hasOverflow(container2, content) {
139473
+ return content.offsetLeft + content.offsetWidth > container2.offsetLeft + container2.offsetWidth;
139474
+ }
139475
+ function setMenuItemVisibility(itemPair, visible) {
139476
+ itemPair.menu.style.visibility = visible ? "visible" : "hidden";
139477
+ itemPair.popover.style.display = visible ? "none" : "block";
139478
+ }
139479
+ function calculateVisibility(refs) {
139480
+ refs.moreItem.style.left = "0";
139481
+ const menuItems = refs.itemPairs.map((item) => item.menu);
139482
+ let overflowIndex = menuItems.findIndex((it) => hasOverflow(refs.nav, it));
139483
+ if (overflowIndex === -1) {
139484
+ refs.itemPairs.forEach((it) => setMenuItemVisibility(it, true));
139485
+ refs.moreItem.style.visibility = "hidden";
139486
+ setPopoverVisibility(false, refs);
139487
+ return;
139488
+ }
139489
+ if (hasOverflow(refs.nav, {
139490
+ offsetLeft: menuItems[overflowIndex].offsetLeft,
139491
+ offsetWidth: refs.moreItem.offsetWidth
139492
+ })) {
139493
+ overflowIndex--;
139494
+ }
139495
+ refs.itemPairs.forEach(
139496
+ (it, index2) => setMenuItemVisibility(it, index2 < overflowIndex)
139497
+ );
139498
+ const classOperation = refs.highlightIndex >= overflowIndex ? "add" : "remove";
139499
+ refs.moreItem.classList[classOperation]("imenu__list__item--highlight");
139500
+ refs.moreItem.style.left = `${menuItems[overflowIndex].offsetLeft}px`;
139501
+ refs.moreItem.style.visibility = "visible";
139502
+ const popupTop = refs.moreItem.offsetHeight + 16;
139503
+ refs.popover.style.top = `${popupTop}px`;
139504
+ }
139505
+ onContentReady(() => {
139506
+ const refs = getElementsRefs();
139507
+ if (!refs) {
139508
+ return;
139509
+ }
139510
+ window.addEventListener(
139511
+ "resize",
139512
+ debounce2(() => calculateVisibility(refs), 100)
139513
+ );
139514
+ document.addEventListener("click", () => setPopoverVisibility(false, refs));
139515
+ refs.itemPairs.forEach((pair) => {
139516
+ pair.menu.addEventListener("click", onClickItem);
139517
+ pair.popover.addEventListener("click", onClickItem);
139518
+ });
139519
+ refs.moreItem.addEventListener("click", (e6) => togglePopover(e6, refs));
139520
+ refs.moreItem.addEventListener("keyup", (e6) => closePopoverOnEsc(e6, refs));
139521
+ refs.popoverContainer.addEventListener("click", onClickPopover);
139522
+ setPopoverVisibility(false, refs);
139523
+ calculateVisibility(refs);
139524
+ });
139525
+
139395
139526
  // src/runtime/index.ts
139396
139527
  window.toggleMarkup = toggleMarkup;
139397
139528
  /*! Bundled license information: