presi-slides 1.0.4 → 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 +2 -0
- package/includes/presi-slides.cjs +1 -1
- package/includes/presi-slides.js +14 -8
- package/includes/slides.css +97 -256
- package/package.json +6 -5
- package/public/slides.css +97 -256
- package/slide-decks/Sample Presi.textbundle/text.md +20 -1
- package/src/slide-presi.js +5 -0
- package/src/slide-view.js +12 -1
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";
|
|
@@ -13,6 +14,7 @@ export default async function (eleventyConfig) {
|
|
|
13
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
|
|
|
@@ -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();
|
package/includes/presi-slides.js
CHANGED
|
@@ -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
|