Skip to content

Commit

Permalink
Release v0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilafian committed Nov 6, 2023
1 parent 5dca2b1 commit 9158032
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 40 deletions.
40 changes: 23 additions & 17 deletions docs/presentation-template.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,21 @@
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css>
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/[email protected]/dist/dna-engine.css>
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/[email protected]/dist/panel-nav.css>
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/reveal.js@4.5/dist/reveal.css>
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/reveal.js@5.0/dist/reveal.css>
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/[email protected]/hljs-enhance.css>
<link rel=stylesheet href=https://cdn.jsdelivr.net/gh/center-key/reveal.js-local@0.2/docs/reveal.js-local.css>
<script defer src=https://cdn.jsdelivr.net/npm/reveal.js@4.5/dist/reveal.js></script>
<script defer src=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8/build/highlight.min.js></script>
<script defer src=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8/build/languages/http.min.js></script>
<link rel=stylesheet href=https://cdn.jsdelivr.net/gh/center-key/reveal.js-local@0.3/docs/reveal.js-local.css>
<script defer src=https://cdn.jsdelivr.net/npm/reveal.js@5.0/dist/reveal.js></script>
<script defer src=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.9/build/highlight.min.js></script>
<script defer src=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.9/build/languages/http.min.js></script>
<script defer src=https://cdn.jsdelivr.net/npm/[email protected]/dist/dna-engine.min.js></script>
<script defer src=https://cdn.jsdelivr.net/npm/[email protected]/hljs-enhance.js></script>
<script defer src=https://cdn.jsdelivr.net/gh/center-key/reveal.js-local@0.2/docs/reveal.js-local.js></script>
<script src=https://cdn.jsdelivr.net/npm/chart.js@4.3/dist/chart.umd.js></script> <!-- wait for loading -->
<script defer src=https://cdn.jsdelivr.net/gh/center-key/reveal.js-local@0.3/docs/reveal.js-local.js></script>
<script src=https://cdn.jsdelivr.net/npm/chart.js@4.4/dist/chart.umd.js></script> <!-- wait for loading -->
<script src=https://cdn.jsdelivr.net/npm/[email protected]/dist/chartjs-plugin-datalabels.min.js></script> <!-- wait for loading -->
<script src=https://cdn.jsdelivr.net/npm/[email protected]/dist/chartjs-plugin-annotation.min.js></script> <!-- wait for loading -->

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- reveal.js-local v0.2.0 -->
<!-- reveal.js-local v0.3.0 -->
<!-- ====================== -->
<!-- A single HTML file for showing a reveal.js presentation locally. -->
<!-- -->
Expand Down Expand Up @@ -73,13 +74,14 @@
const autoAdvance = false;
const autoAdvanceSeconds = 10;
Chart.register(ChartDataLabels);
Chart.register(globalThis['chartjs-plugin-annotation']);
Chart.defaults.font.size = 20;
Chart.defaults.color = 'white';
Chart.defaults.plugins.datalabels.display = false;
</script>

<!-- Custom JavaScript -->
<script id=presentation-custom-js>
<script id=presentation-custom-setup>
const presentationCustomSetup = () => {
console.log('Presentation is ready.');
// Put custom code here.
Expand Down Expand Up @@ -170,23 +172,24 @@ <h4>Header 4</h4>
<!-- Slide - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<section>
<h2>Building a Bullet List</h2>
<p class=fragment><code><b>class=fragment</b></code></p>
<ul>
<li class=fragment>HTML5</li>
<li class=fragment>CSS3</li>
<li class=fragment>JavaScript</li>
</ul>
<p class=fragment>Hover over the HTML to highlight tags.</p>
<br><br>
<figure>
<pre><code class=language-html>
&lt;!-- Slide --&gt;
&lt;section&gt;
&lt;h2&gt;Building a Bullet List&lt;/h2&gt;
&lt;p class=fragment&gt;&lt;code&gt;&lt;b&gt;class=fragment&lt;/b&gt;&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li class=fragment&gt;HTML5&lt;/li&gt;
&lt;li class=fragment&gt;CSS3&lt;/li&gt;
&lt;li class=fragment&gt;JavaScript&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=fragment&gt;Hover over the HTML to highlight tags.&lt;/p&gt;
&lt;/section&gt;
</code></pre>
</figure>
Expand Down Expand Up @@ -299,6 +302,9 @@ <h2>JavaScript</h2>
console.log('Fibonacci of 100 is:', fibonacci(100));
</code></pre>
</figure>
<aside class=notes>
<p><code>Fibonacci of 100 is: 354224848179262000000</code></p>
</aside>
</section>

<!-- Slide - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
Expand Down Expand Up @@ -372,7 +378,7 @@ <h2>Chart.js Slides</h2>
<h2>Chart.js</h2>
<figure>
<figcaption>Highest Mountains by U.S. State</figcaption>
<canvas id=my-chart></canvas>
<canvas id=peaks-chart></canvas>
</figure>
<script>
const peaks = [
Expand Down Expand Up @@ -400,7 +406,7 @@ <h2>Chart.js</h2>
textAlign: 'center',
},
};
const myChart = {
const peaksChart = {
type: 'bar',
data: { labels: states, datasets: [peaksDataset] },
options: {
Expand All @@ -410,7 +416,7 @@ <h2>Chart.js</h2>
},
},
};
new Chart(document.getElementById('my-chart'), myChart);
new Chart(document.getElementById('peaks-chart'), peaksChart);
</script>
</section>

Expand All @@ -424,7 +430,7 @@ <h2>Chart.js Code</h2>
&lt;h2&gt;Chart.js&lt;/h2&gt;
&lt;figure&gt;
&lt;figcaption&gt;Highest Mountains by U.S. State&lt;/figcaption&gt;
&lt;canvas id=my-chart&gt;&lt;/canvas&gt;
&lt;canvas id=peaks-chart&gt;&lt;/canvas&gt;
&lt;/figure&gt;
&lt;script&gt;
const peaks = [
Expand Down Expand Up @@ -452,7 +458,7 @@ <h2>Chart.js Code</h2>
},
-->
};
const myChart = {
const peaksChart = {
type: &#39;bar&#39;,
data: { labels: states, datasets: [peaksDataset] },
options: {
Expand All @@ -462,7 +468,7 @@ <h2>Chart.js Code</h2>
},
},
};
new Chart(document.getElementById(&#39;my-chart&#39;), myChart);
new Chart(document.getElementById(&#39;peaks-chart&#39;), peaksChart);
&lt;/script&gt;
&lt;/section&gt;
</code></pre>
Expand Down
2 changes: 1 addition & 1 deletion docs/reveal.js-local.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! reveal.js-local v0.2.0 ~~ https://github.com/center-key/reveal.js-local ~~ MIT License */
/*! reveal.js-local v0.3.0 ~~ https://github.com/center-key/reveal.js-local ~~ MIT License */

.reveal .slides * { box-sizing: border-box; }
.reveal .slides >section { padding-bottom: 50px; }
Expand Down
57 changes: 39 additions & 18 deletions docs/reveal.js-local.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,47 @@
//! reveal.js-local v0.2.0 ~~ https://github.com/center-key/reveal.js-local ~~ MIT License
//! reveal.js-local v0.3.0 ~~ https://github.com/center-key/reveal.js-local ~~ MIT License

const settings = {
// jshint ignore:start
themes,
selectedTheme,
baseFontSizePercent,
backgroundTypeToUse,
backgroundColor,
backgroundGradient,
backgroundImages,
selectedBackgroundImage,
syntaxHighlightingTheme,
autoAdvance,
autoAdvanceSeconds,
presentationCustomSetup, //see: <script id=presentation-custom-setup>
// jshint ignore:end
};

const revealJsLocal = {
version: '0.2.0',
version: '0.3.0',
themes() {
const version = {
reveal: '5.0',
highlight: '11.9',
};
const addCss = (url) => {
const link = dna.dom.create('link', { rel: 'stylesheet', type: 'text/css', href: url });
link.rel = 'stylesheet';
globalThis.document.head.appendChild(link);
};
const theme = themes[selectedTheme];
const highlightTheme = dna.util.toKebab(syntaxHighlightingTheme);
addCss(`https://cdn.jsdelivr.net/npm/reveal.js@4.5/dist/theme/${theme}.css`);
addCss(`https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8/build/styles/${highlightTheme}.min.css`);
const theme = settings.themes[settings.selectedTheme];
const highlightTheme = dna.util.toKebab(settings.syntaxHighlightingTheme);
addCss(`https://cdn.jsdelivr.net/npm/reveal.js@${version.reveal}/dist/theme/${theme}.css`); //!!!!!! VERSION
addCss(`https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@${version.highlight}/build/styles/${highlightTheme}.min.css`);
},
background() {
globalThis.document.body.style.backgroundSize = 'cover';
globalThis.document.body.style.backgroundPosition = 'center center';
const url = backgroundImages[selectedBackgroundImage];
if (backgroundTypeToUse.color)
globalThis.document.body.style.backgroundColor = backgroundColor;
else if (backgroundTypeToUse.gradient)
globalThis.document.body.style.backgroundImage = backgroundGradient;
const url = settings.backgroundImages[settings.selectedBackgroundImage];
if (settings.backgroundTypeToUse.color)
globalThis.document.body.style.backgroundColor = settings.backgroundColor;
else if (settings.backgroundTypeToUse.gradient)
globalThis.document.body.style.backgroundImage = settings.backgroundGradient;
else
globalThis.document.body.style.backgroundImage = 'url(' + url + ')';
},
Expand All @@ -34,15 +55,15 @@ const revealJsLocal = {
links() {
const links = globalThis.document.querySelectorAll('a.external-site, .external-site a');
links.forEach(link => link.target = '_blank');
// <span class=display-address data-name=sales data-domain=ibm.com></span>
// Usage: <span class=display-address data-name=sales data-domain=ibm.com></span>
const elems = [...globalThis.document.getElementsByClassName('display-address')];
const at = '<span>' + String.fromCharCode(64) + '</span>';
elems.forEach(elem => elem.innerHTML = elem.dataset.name + at + elem.dataset.domain);
},
images() {
const folder = globalThis.window.location.pathname.split('/').slice(0, -1).join('/');
console.log('Images folder:');
console.log('%c' + folder + '/assets', 'font-family: monospace;');
const folder = globalThis.window.location.pathname.split('/').slice(0, -1).join('/');
const pathCss = 'font-family: monospace; font-size: 16px;';
console.log('Images folder: %c' + folder + '/assets', pathCss);
const configureImage = (img) => {
if (!img.src.includes('//'))
img.src = folder + img.src;
Expand Down Expand Up @@ -107,19 +128,19 @@ const revealJsLocal = {
},
reveal() {
const config = { //see: https://revealjs.com/config
autoSlide: autoAdvance ? autoAdvanceSeconds * 1000 : 0, //milliseconds to automatically advance slide (0 = disable)
autoSlide: settings.autoAdvance ? settings.autoAdvanceSeconds * 1000 : 0, //milliseconds to automatically advance slide (0 = disable)
controls: true,
controlsTutorial: true,
hash: false,
loop: false,
progress: true,
};
Reveal.initialize(config).then(presentationCustomSetup);
Reveal.initialize(config).then(settings.presentationCustomSetup);
},
setup() {
const logStyle = 'font-size: 2rem; font-weight: bold; color: teal;';
console.log('%creveal.js-local v' + revealJsLocal.version, logStyle);
const fontSize = String(baseFontSizePercent) + '%';
const fontSize = String(settings.baseFontSizePercent) + '%';
globalThis.document.querySelector('.reveal .slides').style.fontSize = fontSize;
revealJsLocal.themes();
revealJsLocal.background();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reveal.js-local",
"version": "0.2.0",
"version": "0.3.0",
"description": "A single HTML file for showing a reveal.js presentation locally",
"license": "MIT",
"main": "docs/presentation-template.html",
Expand Down
7 changes: 4 additions & 3 deletions task-runner.sh.command
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ setupTools() {
releaseInstructions() {
# NOTE: This package is not published to npm.
cd $projectHome
repository=$(grep repository package.json | awk -F'"' '{print $4}' | sed s/github://)
package=https://raw.githubusercontent.com/$repository/main/package.json
org=$(grep git+https package.json | awk -F'/' '{print $4}')
name=$(grep '"name":' package.json | awk -F'"' '{print $4}')
package=https://raw.githubusercontent.com/$org/$name/main/package.json
version=v$(grep '"version"' package.json | awk -F'"' '{print $4}')
pushed=v$(curl --silent $package | grep '"version":' | awk -F'"' '{print $4}')
minorVersion=$(echo ${pushed:1} | awk -F"." '{ print $1 "." $2 }')
Expand All @@ -55,7 +56,7 @@ releaseInstructions() {
echo "When ready to do the next release:"
echo
echo " === Increment version ==="
echo " Edit pacakge.json to bump $version to next version number"
echo " Edit package.json to bump $version to next version number"
echo " $projectHome/package.json"
}
nextActionCommitTagPub() {
Expand Down

0 comments on commit 9158032

Please sign in to comment.