Skip to content

Commit 38dbd07

Browse files
committed
fix: Add theme-supplemental
1 parent 4022d3d commit 38dbd07

File tree

11 files changed

+393
-1
lines changed

11 files changed

+393
-1
lines changed

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ default: antora
22

33
antora:
44
npx antora antora-playbook.yml --log-level warn
5-
cp CNAME build/site/
65
cp -r static/* build/site/ 2>/dev/null || true
76

87
.PHONY: default antora
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
/*! Asciidoctor Tabs | Copyright (c) 2018-present Dan Allen | MIT License */
2+
.tabs {
3+
margin-bottom: 1.25em;
4+
}
5+
6+
.tablist > ul {
7+
display: flex;
8+
flex-wrap: wrap;
9+
list-style: none;
10+
margin: 0;
11+
padding: 0;
12+
}
13+
14+
.tablist > ul li {
15+
align-items: center;
16+
background-color: #fff;
17+
cursor: pointer;
18+
display: flex;
19+
font-weight: bold;
20+
line-height: 1.5;
21+
padding: 0.25em 1em;
22+
position: relative;
23+
}
24+
25+
.tablist > ul li:focus-visible {
26+
outline: none;
27+
}
28+
29+
.tablist.ulist,
30+
.tablist.ulist > ul li {
31+
margin: 0;
32+
}
33+
34+
.tablist.ulist > ul li + li {
35+
margin-left: 0.25em;
36+
}
37+
38+
.tabs .tablist li::after {
39+
content: "";
40+
display: block;
41+
height: 1px;
42+
position: absolute;
43+
bottom: -1px;
44+
left: 0;
45+
right: 0;
46+
}
47+
48+
.tabs.is-loading .tablist li:not(:first-child),
49+
.tabs:not(.is-loading) .tablist li:not(.is-selected) {
50+
background-color: #f5f5f5;
51+
}
52+
53+
.tabs.is-loading .tablist li:first-child::after,
54+
.tabs:not(.is-loading) .tablist li.is-selected::after {
55+
background-color: #fff;
56+
}
57+
58+
/*
59+
.tabs:not(.is-loading) .tablist li,
60+
.tabs:not(.is-loading) .tablist li::after {
61+
transition: background-color 200ms ease-in-out;
62+
}
63+
*/
64+
65+
.tablist > ul p {
66+
line-height: inherit;
67+
margin: 0;
68+
}
69+
70+
.tabpanel {
71+
background-color: #fff;
72+
padding: 1.25em;
73+
}
74+
75+
.tablist > ul li,
76+
.tabpanel {
77+
border: 1px solid #dcdcdc;
78+
}
79+
80+
.tablist > ul li {
81+
border-bottom: 0;
82+
}
83+
84+
.tabs.is-loading .tabpanel + .tabpanel,
85+
.tabs:not(.is-loading) .tabpanel.is-hidden {
86+
display: none;
87+
}
88+
89+
.tabpanel > :first-child {
90+
margin-top: 0;
91+
}
92+
93+
/* #content is a signature of the Asciidoctor standalone HTML output */
94+
#content .tabpanel > :last-child,
95+
#content .tabpanel > :last-child > :last-child,
96+
#content .tabpanel > :last-child > :last-child > li:last-child > :last-child {
97+
margin-bottom: 0;
98+
}
99+
100+
.tablecontainer {
101+
overflow-x: auto;
102+
}
103+
104+
#content .tablecontainer {
105+
margin-bottom: 1.25em;
106+
}
107+
108+
#content .tablecontainer > table.tableblock {
109+
margin-bottom: 0;
110+
}
111+
112+
.doc .listingblock .title {
113+
background-color: #f0f0f0;
114+
padding-left: 0.875em;
115+
padding-bottom: .5em;
116+
padding-top: .5em;
117+
box-shadow: inset 0 0 1.75px #e1e1e1;
118+
}

theme-supplemental/favicon.ico

14.4 KB
Binary file not shown.
Lines changed: 109 additions & 0 deletions
Loading

theme-supplemental/img/social.png

34.9 KB
Loading
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
;(function () { /*! Asciidoctor Tabs | Copyright (c) 2018-present Dan Allen | MIT License */
2+
'use strict'
3+
4+
var config = (document.currentScript || {}).dataset || {}
5+
var forEach = Array.prototype.forEach
6+
7+
init(document.querySelectorAll('.tabs'))
8+
9+
function init (tabsBlocks) {
10+
if (!tabsBlocks.length) return
11+
forEach.call(tabsBlocks, function (tabs) {
12+
var syncIds = tabs.classList.contains('is-sync') ? {} : undefined
13+
var tablist = tabs.querySelector('.tablist ul')
14+
tablist.setAttribute('role', 'tablist')
15+
var start
16+
forEach.call(tablist.querySelectorAll('li'), function (tab, idx) {
17+
tab.tabIndex = -1
18+
tab.setAttribute('role', tab.classList.add('tab') || 'tab')
19+
var id, anchor, syncId
20+
if (!(id = tab.id) && (anchor = tab.querySelector('a[id]'))) {
21+
id = tab.id = anchor.parentNode.removeChild(anchor).id
22+
}
23+
var panel = id && tabs.querySelector('.tabpanel[aria-labelledby~="' + id + '"]')
24+
if (!panel) return idx ? undefined : toggleSelected(tab, true) // invalid state
25+
syncIds && (((syncId = tab.textContent.trim()) in syncIds) ? (syncId = undefined) : true) &&
26+
(syncIds[(tab.dataset.syncId = syncId)] = tab)
27+
idx || (syncIds && (start = { tab: tab, panel: panel })) ? toggleHidden(panel, true) : toggleSelected(tab, true)
28+
tab.setAttribute('aria-controls', panel.id)
29+
panel.setAttribute('role', 'tabpanel')
30+
var onClick = syncId === undefined ? activateTab : activateTabSync
31+
tab.addEventListener('click', onClick.bind({ tabs: tabs, tab: tab, panel: panel }))
32+
})
33+
if (!tabs.closest('.tabpanel')) {
34+
forEach.call(tabs.querySelectorAll('.tabpanel table.tableblock'), function (table) {
35+
var container = Object.assign(document.createElement('div'), { className: 'tablecontainer' })
36+
table.parentNode.insertBefore(container, table).appendChild(table)
37+
})
38+
}
39+
if (start) {
40+
var syncGroupId
41+
for (var i = 0, lst = tabs.classList, len = lst.length, className; i !== len; i++) {
42+
if (!(className = lst.item(i)).startsWith('data-sync-group-id=')) continue
43+
tabs.dataset.syncGroupId = syncGroupId = lst.remove(className) || className.slice(19).replace(/\u00a0/g, ' ')
44+
break
45+
}
46+
if (syncGroupId === undefined) tabs.dataset.syncGroupId = syncGroupId = Object.keys(syncIds).sort().join('|')
47+
var preferredSyncId = 'syncStorageKey' in config &&
48+
window[(config.syncStorageScope || 'local') + 'Storage'].getItem(config.syncStorageKey + '-' + syncGroupId)
49+
var tab = preferredSyncId && syncIds[preferredSyncId]
50+
tab && Object.assign(start, { tab: tab, panel: document.getElementById(tab.getAttribute('aria-controls')) })
51+
toggleSelected(start.tab, true) || toggleHidden(start.panel, false)
52+
}
53+
})
54+
onHashChange()
55+
toggleClassOnEach(tabsBlocks, 'is-loading', 'remove')
56+
window.setTimeout(toggleClassOnEach.bind(null, tabsBlocks, 'is-loaded', 'add'), 0)
57+
window.addEventListener('hashchange', onHashChange)
58+
}
59+
60+
function activateTab (e) {
61+
var tab = this.tab
62+
var tabs = this.tabs || (this.tabs = tab.closest('.tabs'))
63+
var panel = this.panel || (this.panel = document.getElementById(tab.getAttribute('aria-controls')))
64+
querySelectorWithSiblings(tabs, '.tablist .tab', 'tab').forEach(function (el) {
65+
toggleSelected(el, el === tab)
66+
})
67+
querySelectorWithSiblings(tabs, '.tabpanel', 'tabpanel').forEach(function (el) {
68+
toggleHidden(el, el !== panel)
69+
})
70+
if (!this.isSync && 'syncStorageKey' in config && 'syncGroupId' in tabs.dataset) {
71+
var storageKey = config.syncStorageKey + '-' + tabs.dataset.syncGroupId
72+
window[(config.syncStorageScope || 'local') + 'Storage'].setItem(storageKey, tab.dataset.syncId)
73+
}
74+
if (!e) return
75+
var loc = window.location
76+
var hashIdx = loc.hash ? loc.href.indexOf('#') : -1
77+
if (~hashIdx) window.history.replaceState(null, '', loc.href.slice(0, hashIdx))
78+
e.preventDefault()
79+
}
80+
81+
function activateTabSync (e) {
82+
activateTab.call(this, e)
83+
var thisTabs = this.tabs
84+
var thisTab = this.tab
85+
var initialY = thisTabs.getBoundingClientRect().y
86+
forEach.call(document.querySelectorAll('.tabs'), function (tabs) {
87+
if (tabs === thisTabs || tabs.dataset.syncGroupId !== thisTabs.dataset.syncGroupId) return
88+
querySelectorWithSiblings(tabs, '.tablist .tab', 'tab').forEach(function (tab) {
89+
if (tab.dataset.syncId === thisTab.dataset.syncId) activateTab.call({ tabs: tabs, tab: tab, isSync: true })
90+
})
91+
})
92+
var shiftedBy = thisTabs.getBoundingClientRect().y - initialY
93+
if (shiftedBy && (shiftedBy = Math.round(shiftedBy))) window.scrollBy({ top: shiftedBy, behavior: 'instant' })
94+
}
95+
96+
function querySelectorWithSiblings (scope, selector, siblingClass) {
97+
var el = scope.querySelector(selector)
98+
if (!el) return []
99+
var result = [el]
100+
while ((el = el.nextElementSibling) && el.classList.contains(siblingClass)) result.push(el)
101+
return result
102+
}
103+
104+
function toggleClassOnEach (elements, className, method) {
105+
forEach.call(elements, function (el) {
106+
el.classList[method](className)
107+
})
108+
}
109+
110+
function toggleHidden (el, state) {
111+
el.classList[(el.hidden = state) ? 'add' : 'remove']('is-hidden')
112+
}
113+
114+
function toggleSelected (el, state) {
115+
el.setAttribute('aria-selected', '' + state)
116+
el.classList[state ? 'add' : 'remove']('is-selected')
117+
el.tabIndex = state ? 0 : -1
118+
}
119+
120+
function onHashChange () {
121+
var id = window.location.hash.slice(1)
122+
if (!id) return
123+
var tab = document.getElementById(~id.indexOf('%') ? decodeURIComponent(id) : id)
124+
if (!(tab && tab.classList.contains('tab'))) return
125+
'syncId' in tab.dataset ? activateTabSync.call({ tab: tab }) : activateTab.call({ tab: tab })
126+
}
127+
})()
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<script id="site-script" src="{{{uiRootPath}}}/js/site.js" data-ui-root-path="{{{uiRootPath}}}"></script>
2+
<script async src="{{{uiRootPath}}}/js/vendor/highlight.js"></script>
3+
<script async src="{{{uiRootPath}}}/js/vendor/tabs.js"></script>
4+
{{#if env.SITE_SEARCH_PROVIDER}}
5+
{{> search-scripts}}
6+
{{/if}}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<meta property="og:title" content="{{page.title}}">
2+
<meta property="og:description" content="Upsilon Documentation">
3+
<meta property="og:type" content="article">
4+
<meta property="og:image" content="https://docs.olivetin.app/_/img/social.png">
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<link rel="stylesheet" href="{{{uiRootPath}}}/css/site.css">
2+
<link rel="stylesheet" href="{{{uiRootPath}}}/css/vendor/tabs.css">

0 commit comments

Comments
 (0)