presi-slides 1.0.5 → 1.0.7

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.
@@ -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),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();
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`)}}}),te.delegate(this,`.reveal ~ :not(.reveal)`,{click:e=>{let t=e.target;t&&t.classList.add(`reveal-one`)}})}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();
@@ -8433,6 +8433,9 @@ var ua = $n.Util._assign($n, {
8433
8433
  let e = t.nextElementSibling;
8434
8434
  e && e.classList.add("reveal"), t.classList.remove("reveal");
8435
8435
  }
8436
+ } }), te.delegate(this, ".reveal ~ :not(.reveal)", { click: (e) => {
8437
+ let t = e.target;
8438
+ t && t.classList.add("reveal-one");
8436
8439
  } });
8437
8440
  }
8438
8441
  static observedAttributes = ["active", "overlay"];
@@ -484,24 +484,14 @@ slide-view {
484
484
  color: white;
485
485
  }
486
486
  }
487
-
488
- /*&:not(:first-child)::after {
489
- display: block;
490
- position: absolute;
491
- bottom: var(--size-spacing-large);
492
- right: var(--size-spacing-large);
493
- content: attr(data-slide-number);
494
- font-size: 0.75em;
495
- color: var(--color-accent);
496
- }*/
497
487
  }
498
488
 
499
489
  /* progressively revealed lists (li.reveal) */
500
490
 
501
491
  slide-presi:not(.reveal-all) {
502
492
  li.reveal {
503
- &,
504
- & ~ li {
493
+ &:not(.reveal-one),
494
+ & ~ li:not(.reveal-one) {
505
495
  color: transparent;
506
496
  border: 1px solid #ccc;
507
497
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "presi-slides",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Make slides with Markdown",
5
5
  "keywords": [
6
6
  "Presentation",
package/public/slides.css CHANGED
@@ -326,8 +326,9 @@ slide-view {
326
326
  > video:only-child {
327
327
  display: block;
328
328
  object-fit: contain;
329
- height: 100%;
330
- width: 100%;
329
+ max-height: 100%;
330
+ justify-self: center;
331
+ align-self: stretch;
331
332
  }
332
333
 
333
334
  &.max25vh > img:only-child {
@@ -484,24 +485,14 @@ slide-view {
484
485
  color: white;
485
486
  }
486
487
  }
487
-
488
- /*&:not(:first-child)::after {
489
- display: block;
490
- position: absolute;
491
- bottom: var(--size-spacing-large);
492
- right: var(--size-spacing-large);
493
- content: attr(data-slide-number);
494
- font-size: 0.75em;
495
- color: var(--color-accent);
496
- }*/
497
488
  }
498
489
 
499
490
  /* progressively revealed lists (li.reveal) */
500
491
 
501
492
  slide-presi:not(.reveal-all) {
502
493
  li.reveal {
503
- &,
504
- & ~ li {
494
+ &:not(.reveal-one),
495
+ & ~ li:not(.reveal-one) {
505
496
  color: transparent;
506
497
  border: 1px solid #ccc;
507
498
  }
package/src/slide-view.js CHANGED
@@ -73,6 +73,15 @@ export class SlideElement extends HTMLElement {
73
73
  }
74
74
  }
75
75
  });
76
+
77
+ Events.delegate(this, ".reveal ~ :not(.reveal)", {
78
+ click: (ev) => {
79
+ const target = ev.target;
80
+ if (target) {
81
+ target.classList.add("reveal-one");
82
+ }
83
+ }
84
+ });
76
85
  }
77
86
 
78
87
  static observedAttributes = ["active", "overlay"];