presi-slides 1.0.3 → 1.0.5
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/eleventy.config.js +4 -2
- package/{dist → includes}/presi-slides.cjs +8 -8
- package/{dist → includes}/presi-slides.js +21 -15
- package/{dist → includes}/slides.css +97 -256
- package/layouts/presentation.njk +3 -3
- package/package.json +7 -6
- package/public/slides.css +97 -256
- package/slide-decks/Sample Presi.textbundle/text.md +20 -1
- package/src/slide-footer.js +4 -4
- package/src/slide-presi.js +5 -0
- package/src/slide-view.js +15 -4
- package/vite.config.js +1 -0
- /package/{dist → includes}/images/eraser.png +0 -0
- /package/{dist → includes}/images/hide.png +0 -0
- /package/{dist → includes}/images/pencil.png +0 -0
- /package/{dist → includes}/images/pointer.png +0 -0
- /package/{dist → includes}/prism-coy-without-shadows.css +0 -0
- /package/{dist → includes}/prism-theme.css +0 -0
package/eleventy.config.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HtmlBasePlugin } from "@11ty/eleventy";
|
|
2
|
+
import htex from "htex/eleventy";
|
|
2
3
|
import slideTransform from "./src/11ty-transform.js";
|
|
3
4
|
|
|
4
5
|
const output = process.env.STATIC || "static";
|
|
@@ -10,9 +11,10 @@ export default async function (eleventyConfig) {
|
|
|
10
11
|
"slide-decks/**/assets/*"
|
|
11
12
|
);
|
|
12
13
|
// make dist available from client
|
|
13
|
-
eleventyConfig.addPassthroughCopy("
|
|
14
|
+
eleventyConfig.addPassthroughCopy("includes");
|
|
14
15
|
|
|
15
16
|
eleventyConfig.addPlugin(HtmlBasePlugin);
|
|
17
|
+
eleventyConfig.addPlugin(htex, {});
|
|
16
18
|
|
|
17
19
|
eleventyConfig.addTransform("slide", slideTransform);
|
|
18
20
|
|
|
@@ -41,7 +43,7 @@ export default async function (eleventyConfig) {
|
|
|
41
43
|
dir: {
|
|
42
44
|
input: "slide-decks/",
|
|
43
45
|
output: output,
|
|
44
|
-
includes: "../
|
|
46
|
+
includes: "../includes",
|
|
45
47
|
layouts: "../layouts"
|
|
46
48
|
}
|
|
47
49
|
};
|
|
@@ -4,19 +4,19 @@ var e=class extends CustomEvent{constructor(e,t){super(e,{bubbles:!0,cancelable:
|
|
|
4
4
|
<fieldset name="overlay">
|
|
5
5
|
<label>
|
|
6
6
|
<input type="radio" name="overlay" value="pointer" checked>
|
|
7
|
-
<img src="/
|
|
7
|
+
<img src="/includes/images/pointer.png" alt="Pointer"
|
|
8
8
|
</label>
|
|
9
9
|
<label>
|
|
10
10
|
<input type="radio" name="overlay" value="brush">
|
|
11
|
-
<img src="/
|
|
11
|
+
<img src="/includes/images/pencil.png" alt="Draw">
|
|
12
12
|
</label>
|
|
13
13
|
<label>
|
|
14
14
|
<input type="radio" name="overlay" value="eraser">
|
|
15
|
-
<img src="/
|
|
15
|
+
<img src="/includes/images/eraser.png" alt="Erase">
|
|
16
16
|
</label>
|
|
17
17
|
<label>
|
|
18
18
|
<input type="radio" name="overlay" value="hidden">
|
|
19
|
-
<img src="/
|
|
19
|
+
<img src="/includes/images/hide.png" alt="Hide">
|
|
20
20
|
</label>
|
|
21
21
|
</fieldset>
|
|
22
22
|
<span>
|
|
@@ -98,17 +98,17 @@ js: import "konva/skia-backend";
|
|
|
98
98
|
}
|
|
99
99
|
:host([active]) {
|
|
100
100
|
--slide-opacity: 1;
|
|
101
|
-
cursor: url("/
|
|
101
|
+
cursor: url("/includes/images/pointer.png") 0 0, pointer;
|
|
102
102
|
}
|
|
103
103
|
:host([overlay="hidden"]) {
|
|
104
104
|
--slide-overlay-visibility: hidden;
|
|
105
105
|
}
|
|
106
106
|
:host([overlay="brush"]) {
|
|
107
|
-
cursor: url("/
|
|
107
|
+
cursor: url("/includes/images/pencil.png") 0 100, crosshair;
|
|
108
108
|
--slide-pointer-events: auto;
|
|
109
109
|
}
|
|
110
110
|
:host([overlay="eraser"]) {
|
|
111
|
-
cursor: url("/
|
|
111
|
+
cursor: url("/includes/images/eraser.png") 35 100, not-allowed;
|
|
112
112
|
--slide-pointer-events: auto;
|
|
113
113
|
}
|
|
114
114
|
#overlay {
|
|
@@ -122,4 +122,4 @@ js: import "konva/skia-backend";
|
|
|
122
122
|
transition: opacity 1s;
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
`;isPaint=!1;overlayMode=`pointer`;overlayColor=`red`;stage=null;constructor(){super(),ne(this).template(e.template).styles(e.styles)}static observedAttributes=[`active`,`overlay`];attributeChangedCallback(e,t,n){switch(e){case`overlay`:this.overlayMode=n,this.createOverlay();break;case`color`:this.overlayColor=n}}disconnectedCallback(){this.stage&&delete this.stage}createOverlay(){if(this.stage)return;let e=this.shadowRoot.getElementById(`overlay`);console.log(`Creating overlay if needed`,this.stage),this.stage=new ua.Stage({container:e,width:e?.clientWidth,height:e?.clientHeight}),this.layer=new ua.Layer,this.stage.add(this.layer),this.stage.on(`mousedown touchstart`,e=>{this.isPaint=!0;let t=this.stage.getPointerPosition();console.log(`touchstart`,t),this.lastLine=new ua.Line({stroke:this.overlayColor,strokeWidth:this.overlayMode===`eraser`?20:4,globalCompositeOperation:this.overlayMode===`brush`?`source-over`:`destination-out`,lineCap:`round`,lineJoin:`round`,points:[t.x,t.y,t.x,t.y]}),this.layer.add(this.lastLine)}),this.stage.on(`mouseup touchend`,()=>{this.isPaint=!1,console.log(`touchend`)}),this.stage.on(`mousemove touchmove`,e=>{if(!this.isPaint)return;e.evt.preventDefault();let t=this.stage.getPointerPosition(),n=this.lastLine.points().concat([t.x,t.y]);this.lastLine.points(n)})}},fa=.4,pa=.8,ma=class extends HTMLElement{VIEW_ELEMENT=`slide-view`;FOOTER_ELEMENT=`slide-footer`;controls=null;active=null;observer=new IntersectionObserver(e=>{let t=0,n=null;e.forEach(e=>{if(e.isIntersecting){let r=e.target;e.intersectionRatio<fa?r.removeAttribute(`active`):e.intersectionRatio>t&&(t=e.intersectionRatio,n=r)}}),n&&n!==this.active&&this.setActiveSlide(n)},{threshold:[0,fa,pa,1],delay:300});constructor(){super(),this.addEventListener(`slide:input`,e=>{let{slide:t}=e.detail,n=this.slide(t);this.setActiveSlide(n),this.jumpToSlide(n)}),this.addEventListener(`slide:overlay`,e=>{this.manageOverlay(e.detail)})}slide(e){return Array.from(this.querySelectorAll(this.VIEW_ELEMENT))[e-1]}connectedCallback(){let e=Array.from(this.querySelectorAll(this.VIEW_ELEMENT));this.controls=this.querySelector(this.FOOTER_ELEMENT),e.forEach(e=>this.observer.observe(e))}gotoSlide(e){console.log(`Going to slide`,e),e&&e.scrollIntoView({behavior:`smooth`,block:`center`,inline:`nearest`})}jumpToSlide(e){e&&e.scrollIntoView({block:`center`,inline:`nearest`})}setActiveSlide(e){if(this.active=e,this.active){this.active.setAttribute(`active`,`active`);let t=Array.from(this.querySelectorAll(this.VIEW_ELEMENT)).findIndex(t=>t===e);this.controls&&(this.controls.setAttribute(`slide`,t+1),this.controls.setAttribute(`overlay`,e.getAttribute(`overlay`)||`pointer`))}}manageOverlay(e){let{overlay:t}=e||{};console.log(`Overlay options`,e),this.active&&t&&this.active.setAttribute(`overlay`,t)}};function
|
|
125
|
+
`;isPaint=!1;overlayMode=`pointer`;overlayColor=`red`;stage=null;constructor(){super(),ne(this).template(e.template).styles(e.styles),te.delegate(this,`.reveal`,{click:e=>{let t=e.target;if(t){let e=t.nextElementSibling;e&&e.classList.add(`reveal`),t.classList.remove(`reveal`)}}})}static observedAttributes=[`active`,`overlay`];attributeChangedCallback(e,t,n){switch(e){case`overlay`:this.overlayMode=n,this.createOverlay();break;case`color`:this.overlayColor=n}}disconnectedCallback(){this.stage&&delete this.stage}createOverlay(){if(this.stage)return;let e=this.shadowRoot.getElementById(`overlay`);console.log(`Creating overlay if needed`,this.stage),this.stage=new ua.Stage({container:e,width:e?.clientWidth,height:e?.clientHeight}),this.layer=new ua.Layer,this.stage.add(this.layer),this.stage.on(`mousedown touchstart`,e=>{this.isPaint=!0;let t=this.stage.getPointerPosition();console.log(`touchstart`,t),this.lastLine=new ua.Line({stroke:this.overlayColor,strokeWidth:this.overlayMode===`eraser`?20:4,globalCompositeOperation:this.overlayMode===`brush`?`source-over`:`destination-out`,lineCap:`round`,lineJoin:`round`,points:[t.x,t.y,t.x,t.y]}),this.layer.add(this.lastLine)}),this.stage.on(`mouseup touchend`,()=>{this.isPaint=!1,console.log(`touchend`)}),this.stage.on(`mousemove touchmove`,e=>{if(!this.isPaint)return;e.evt.preventDefault();let t=this.stage.getPointerPosition(),n=this.lastLine.points().concat([t.x,t.y]);this.lastLine.points(n)})}},fa=.4,pa=.8,ma=new URLSearchParams(document.location.search),ha=class extends HTMLElement{VIEW_ELEMENT=`slide-view`;FOOTER_ELEMENT=`slide-footer`;controls=null;active=null;observer=new IntersectionObserver(e=>{let t=0,n=null;e.forEach(e=>{if(e.isIntersecting){let r=e.target;e.intersectionRatio<fa?r.removeAttribute(`active`):e.intersectionRatio>t&&(t=e.intersectionRatio,n=r)}}),n&&n!==this.active&&this.setActiveSlide(n)},{threshold:[0,fa,pa,1],delay:300});constructor(){super(),this.addEventListener(`slide:input`,e=>{let{slide:t}=e.detail,n=this.slide(t);this.setActiveSlide(n),this.jumpToSlide(n)}),this.addEventListener(`slide:overlay`,e=>{this.manageOverlay(e.detail)}),ma.get(`reveal`)&&this.classList.add(`reveal-all`)}slide(e){return Array.from(this.querySelectorAll(this.VIEW_ELEMENT))[e-1]}connectedCallback(){let e=Array.from(this.querySelectorAll(this.VIEW_ELEMENT));this.controls=this.querySelector(this.FOOTER_ELEMENT),e.forEach(e=>this.observer.observe(e))}gotoSlide(e){console.log(`Going to slide`,e),e&&e.scrollIntoView({behavior:`smooth`,block:`center`,inline:`nearest`})}jumpToSlide(e){e&&e.scrollIntoView({block:`center`,inline:`nearest`})}setActiveSlide(e){if(this.active=e,this.active){this.active.setAttribute(`active`,`active`);let t=Array.from(this.querySelectorAll(this.VIEW_ELEMENT)).findIndex(t=>t===e);this.controls&&(this.controls.setAttribute(`slide`,t+1),this.controls.setAttribute(`overlay`,e.getAttribute(`overlay`)||`pointer`))}}manageOverlay(e){let{overlay:t}=e||{};console.log(`Overlay options`,e),this.active&&t&&this.active.setAttribute(`overlay`,t)}};function ga(){window.addEventListener(`resize`,_a),_a()}function _a(){let e=document.body,t=document.documentElement.clientWidth,n=document.documentElement.clientHeight;e.classList.add(`presentation-scaled`),e.style.setProperty(`--viewport-width`,t.toString()),e.style.setProperty(`--viewport-height`,n.toString()),console.log(`Rescaled`,t,n)}c({"slide-presi":ha,"slide-view":da,"slide-footer":T}),ga();
|
|
@@ -434,19 +434,19 @@ var T = class e extends HTMLElement {
|
|
|
434
434
|
<fieldset name="overlay">
|
|
435
435
|
<label>
|
|
436
436
|
<input type="radio" name="overlay" value="pointer" checked>
|
|
437
|
-
<img src="/
|
|
437
|
+
<img src="/includes/images/pointer.png" alt="Pointer"
|
|
438
438
|
</label>
|
|
439
439
|
<label>
|
|
440
440
|
<input type="radio" name="overlay" value="brush">
|
|
441
|
-
<img src="/
|
|
441
|
+
<img src="/includes/images/pencil.png" alt="Draw">
|
|
442
442
|
</label>
|
|
443
443
|
<label>
|
|
444
444
|
<input type="radio" name="overlay" value="eraser">
|
|
445
|
-
<img src="/
|
|
445
|
+
<img src="/includes/images/eraser.png" alt="Erase">
|
|
446
446
|
</label>
|
|
447
447
|
<label>
|
|
448
448
|
<input type="radio" name="overlay" value="hidden">
|
|
449
|
-
<img src="/
|
|
449
|
+
<img src="/includes/images/hide.png" alt="Hide">
|
|
450
450
|
</label>
|
|
451
451
|
</fieldset>
|
|
452
452
|
<span>
|
|
@@ -8397,17 +8397,17 @@ var ua = $n.Util._assign($n, {
|
|
|
8397
8397
|
}
|
|
8398
8398
|
:host([active]) {
|
|
8399
8399
|
--slide-opacity: 1;
|
|
8400
|
-
cursor: url("/
|
|
8400
|
+
cursor: url("/includes/images/pointer.png") 0 0, pointer;
|
|
8401
8401
|
}
|
|
8402
8402
|
:host([overlay="hidden"]) {
|
|
8403
8403
|
--slide-overlay-visibility: hidden;
|
|
8404
8404
|
}
|
|
8405
8405
|
:host([overlay="brush"]) {
|
|
8406
|
-
cursor: url("/
|
|
8406
|
+
cursor: url("/includes/images/pencil.png") 0 100, crosshair;
|
|
8407
8407
|
--slide-pointer-events: auto;
|
|
8408
8408
|
}
|
|
8409
8409
|
:host([overlay="eraser"]) {
|
|
8410
|
-
cursor: url("/
|
|
8410
|
+
cursor: url("/includes/images/eraser.png") 35 100, not-allowed;
|
|
8411
8411
|
--slide-pointer-events: auto;
|
|
8412
8412
|
}
|
|
8413
8413
|
#overlay {
|
|
@@ -8427,7 +8427,13 @@ var ua = $n.Util._assign($n, {
|
|
|
8427
8427
|
overlayColor = "red";
|
|
8428
8428
|
stage = null;
|
|
8429
8429
|
constructor() {
|
|
8430
|
-
super(), ne(this).template(e.template).styles(e.styles)
|
|
8430
|
+
super(), ne(this).template(e.template).styles(e.styles), te.delegate(this, ".reveal", { click: (e) => {
|
|
8431
|
+
let t = e.target;
|
|
8432
|
+
if (t) {
|
|
8433
|
+
let e = t.nextElementSibling;
|
|
8434
|
+
e && e.classList.add("reveal"), t.classList.remove("reveal");
|
|
8435
|
+
}
|
|
8436
|
+
} });
|
|
8431
8437
|
}
|
|
8432
8438
|
static observedAttributes = ["active", "overlay"];
|
|
8433
8439
|
attributeChangedCallback(e, t, n) {
|
|
@@ -8473,7 +8479,7 @@ var ua = $n.Util._assign($n, {
|
|
|
8473
8479
|
this.lastLine.points(n);
|
|
8474
8480
|
});
|
|
8475
8481
|
}
|
|
8476
|
-
}, fa = .4, pa = .8, ma = class extends HTMLElement {
|
|
8482
|
+
}, fa = .4, pa = .8, ma = new URLSearchParams(document.location.search), ha = class extends HTMLElement {
|
|
8477
8483
|
VIEW_ELEMENT = "slide-view";
|
|
8478
8484
|
FOOTER_ELEMENT = "slide-footer";
|
|
8479
8485
|
controls = null;
|
|
@@ -8501,7 +8507,7 @@ var ua = $n.Util._assign($n, {
|
|
|
8501
8507
|
this.setActiveSlide(n), this.jumpToSlide(n);
|
|
8502
8508
|
}), this.addEventListener("slide:overlay", (e) => {
|
|
8503
8509
|
this.manageOverlay(e.detail);
|
|
8504
|
-
});
|
|
8510
|
+
}), ma.get("reveal") && this.classList.add("reveal-all");
|
|
8505
8511
|
}
|
|
8506
8512
|
slide(e) {
|
|
8507
8513
|
return Array.from(this.querySelectorAll(this.VIEW_ELEMENT))[e - 1];
|
|
@@ -8537,16 +8543,16 @@ var ua = $n.Util._assign($n, {
|
|
|
8537
8543
|
};
|
|
8538
8544
|
//#endregion
|
|
8539
8545
|
//#region src/slides.js
|
|
8540
|
-
function ha() {
|
|
8541
|
-
window.addEventListener("resize", ga), ga();
|
|
8542
|
-
}
|
|
8543
8546
|
function ga() {
|
|
8547
|
+
window.addEventListener("resize", _a), _a();
|
|
8548
|
+
}
|
|
8549
|
+
function _a() {
|
|
8544
8550
|
let e = document.body, t = document.documentElement.clientWidth, n = document.documentElement.clientHeight;
|
|
8545
8551
|
e.classList.add("presentation-scaled"), e.style.setProperty("--viewport-width", t.toString()), e.style.setProperty("--viewport-height", n.toString()), console.log("Rescaled", t, n);
|
|
8546
8552
|
}
|
|
8547
8553
|
c({
|
|
8548
|
-
"slide-presi":
|
|
8554
|
+
"slide-presi": ha,
|
|
8549
8555
|
"slide-view": da,
|
|
8550
8556
|
"slide-footer": T
|
|
8551
|
-
}),
|
|
8557
|
+
}), ga();
|
|
8552
8558
|
//#endregion
|