asciidoctor-html 2.2.8 → 2.3.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.
@@ -11,7 +11,7 @@ module Asciidoctor
11
11
  # The template for the book layout
12
12
  module BookTemplate
13
13
  MENU_BTN = <<~HTML
14
- <button type="button" id="menu-btn" class="btn menu"
14
+ <button type="button" id="menu-btn" class="btn menu fadein"
15
15
  aria-expanded="false" aria-controls="sidebar">
16
16
  <i class="bi bi-list"></i>
17
17
  </button>
@@ -259,7 +259,7 @@ module Asciidoctor
259
259
  def self.html(content, nav_items, opts = {})
260
260
  nav = !nav_items.empty? && (nav_items.size > 1 || opts[:has_subnav])
261
261
  page_classes = ["page"]
262
- if nav
262
+ if opts[:has_subnav]
263
263
  page_classes << "multi" unless opts[:pagestyle] == :single
264
264
  page_classes << "presentation" if opts[:pagestyle] == :presentation
265
265
  end
@@ -144,17 +144,18 @@ module Asciidoctor
144
144
  }
145
145
  }
146
146
 
147
+ nav.forEach(el => {
148
+ const a = el.querySelector('a');
149
+ a && a.hash && el.classList.toggle('active', id == a.hash.substring(1));
150
+ });
151
+
147
152
  const typesetEls = paginator ? [...activeSects, paginator] : activeSects;
148
153
  // MathJax needs displayed content to calculate auto line breaks.
149
154
  await MathJax.startup.promise;
150
155
  await MathJax.typesetPromise(typesetEls);
156
+ ADHT.nudgeMenuBtn();
151
157
  page.classList.add('loaded');
152
158
 
153
- nav.forEach(el => {
154
- const a = el.querySelector('a');
155
- a && a.hash && el.classList.toggle('active', id == a.hash.substring(1));
156
- });
157
-
158
159
  if(target == section && page.classList.contains('multi') || target == page) {
159
160
  scrollEl.scrollTo({
160
161
  top: id in scrollTop ? scrollTop[id] : 0,
@@ -173,7 +174,6 @@ module Asciidoctor
173
174
  focusOnLoad();
174
175
  if(isPresentation) focusEl.dataset.flip = id;
175
176
  currentId = id;
176
- ADHT.nudgeMenuBtn();
177
177
  }
178
178
 
179
179
  const dropdownItems = document.querySelectorAll('#viewmode-actions .dropdown-item');
@@ -41,8 +41,8 @@ module Asciidoctor
41
41
  def display_paginator(prv, nxt)
42
42
  blank = %(<span class="blank">&nbsp;</span>)
43
43
  html = [<<~HTML
44
- <div class="paginator-wrapper fadein">
45
- <div id="paginator" class="paginator dynamic-width">
44
+ <div class="paginator-wrapper">
45
+ <div id="paginator" class="paginator dynamic-width fadein">
46
46
  HTML
47
47
  ]
48
48
  html << if prv
@@ -9,19 +9,14 @@ module Asciidoctor
9
9
  const menuBtn = document.getElementById('menu-btn');
10
10
  if(!menuBtn) return;
11
11
 
12
- const isPresentation = page.classList.contains('presentation')
13
- if(isPresentation) {
14
- menuBtn.getAnimations().forEach(anim => anim.cancel());
15
- return menuBtn;
16
- }
17
-
18
12
  const scrollbarWidth = page.offsetWidth - page.clientWidth;
19
13
 
20
14
  // Nudge menuBtn in case there is a scrollbar
21
- menuBtn.animate(
22
- { transform: 'translateX(' + (-scrollbarWidth) + 'px)' },
23
- { fill: 'forwards', duration: 150 }
24
- );
15
+ menuBtn.style.right = (scrollbarWidth + 12) + 'px';
16
+
17
+ if(menuBtn.classList.contains('fadein')) {
18
+ setTimeout(() => menuBtn.classList.remove('fadein'), 600);
19
+ }
25
20
 
26
21
  // Cache scrollbar width
27
22
  ADHT.scrollbarWidth = scrollbarWidth;
@@ -43,7 +38,7 @@ module Asciidoctor
43
38
  addEventListener('resize', hideSidebar);
44
39
  dismissBtn && dismissBtn.addEventListener('click', hideSidebar);
45
40
 
46
- const menuBtn = ADHT.nudgeMenuBtn();
41
+ const menuBtn = document.getElementById('menu-btn');
47
42
  if(!menuBtn) return;
48
43
  // Add click listener to toggle sidebar
49
44
  menuBtn.addEventListener('click', function() {
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Asciidoctor
4
4
  module Html
5
- VERSION = "2.2.8"
5
+ VERSION = "2.3.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-html
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.8
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ravi Rajani