presi-slides 1.0.2 → 1.0.3

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.
Binary file
Binary file
Binary file
@@ -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
- <span>Select</span>
7
+ <img src="/dist/images/pointer.png" alt="Pointer"
8
8
  </label>
9
9
  <label>
10
10
  <input type="radio" name="overlay" value="brush">
11
- <span>Brush</span>
11
+ <img src="/dist/images/pencil.png" alt="Draw">
12
12
  </label>
13
13
  <label>
14
14
  <input type="radio" name="overlay" value="eraser">
15
- <span>Eraser</span>
15
+ <img src="/dist/images/eraser.png" alt="Erase">
16
16
  </label>
17
17
  <label>
18
18
  <input type="radio" name="overlay" value="hidden">
19
- <span>Hide</span>
19
+ <img src="/dist/images/hide.png" alt="Hide">
20
20
  </label>
21
21
  </fieldset>
22
22
  <span>
@@ -30,15 +30,18 @@ var e=class extends CustomEvent{constructor(e,t){super(e,{bubbles:!0,cancelable:
30
30
  footer {
31
31
  display: flex;
32
32
  justify-content: space-between;
33
+ align-items: baseline;
33
34
  color: var(--color-text-inverted);
34
35
  }
36
+ fieldset {
37
+ border: none;
38
+ }
35
39
  span {
36
40
  background: rgb(0 0 0 / 0.8);
37
41
  border-radius: var(--size-spacing-small);
38
42
  padding: var(--size-spacing-small);
39
43
  }
40
- input,
41
- select {
44
+ input {
42
45
  font: inherit;
43
46
  color: inherit;
44
47
  line-height: inherit;
@@ -49,6 +52,19 @@ var e=class extends CustomEvent{constructor(e,t){super(e,{bubbles:!0,cancelable:
49
52
  input[type="number"] {
50
53
  width: 3em;
51
54
  }
55
+ input[type="radio"] {
56
+ display: none;
57
+ }
58
+ img {
59
+ height: 2em;
60
+ aspect-ratio: 1;
61
+ opacity: .75;
62
+ }
63
+ img:hover,
64
+ input:checked + img {
65
+ opacity: 1;
66
+ background-color: rgb(255 255 255 / 0.2);
67
+ }
52
68
  `;slideControl=null;overlayControl=null;constructor(){super(),ne(this).template(e.template).styles(e.styles).delegate(`input[name="slide"]`,{input:e=>this.relay(`slide:input`,{slide:e.target.value})}).delegate(`input[name="overlay"]`,{change:e=>this.relay(`slide:overlay`,{overlay:e.target.value})}),this.slideControl=this.shadowRoot.querySelector(`input[name="slide"]`),this.overlayControl=this.shadowRoot.querySelector(`fieldset[name="overlay"]`)}static observedAttributes=[`slide`,`overlay`,`color`];attributeChangedCallback(e,t,n){switch(e){case`slide`:this.slideControl.value=n;break;case`overlay`:{let e=this.overlayControl.querySelector(`input[value="${n}"]`);e&&(e.checked=!0);break}}}relay(e,t){let n=new CustomEvent(e,{bubbles:!0,composed:!0,detail:t});this.dispatchEvent(n)}},E=Math.PI/180;function re(){return typeof window<`u`&&({}.toString.call(window)===`[object Window]`||{}.toString.call(window)===`[object global]`)}var D=typeof global<`u`?global:typeof window<`u`?window:typeof WorkerGlobalScope<`u`?self:{},O={_global:D,version:`10.3.1`,isBrowser:re(),isUnminified:/param/.test(function(e){}.toString()),dblClickWindow:400,getAngle(e){return O.angleDeg?e*E:e},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,_renderBackend:`web`,legacyTextRendering:!1,pixelRatio:typeof window<`u`&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return O.DD.isDragging},isTransforming(){return O.Transformer?.isTransforming()??!1},isDragReady(){return!!O.DD.node},releaseCanvasOnDestroy:!0,document:D.document,_injectGlobal(e){D.Konva!==void 0&&console.error(`Several Konva instances detected. It is not recommended to use multiple Konva instances in the same environment.`),D.Konva=e}},k=e=>{O[e.prototype.getClassName()]=e};O._injectGlobal(O);var A=`Konva.js unsupported environment.
53
69
 
54
70
  Looks like you are trying to use Konva.js in Node.js environment. because "document" object is undefined.
@@ -82,19 +98,17 @@ js: import "konva/skia-backend";
82
98
  }
83
99
  :host([active]) {
84
100
  --slide-opacity: 1;
85
- }
86
- :host([overlay]) {
87
- cursor: pointer;
101
+ cursor: url("/dist/images/pointer.png") 0 0, pointer;
88
102
  }
89
103
  :host([overlay="hidden"]) {
90
104
  --slide-overlay-visibility: hidden;
91
105
  }
92
106
  :host([overlay="brush"]) {
93
- cursor: url("/includes/pencil.png") 0 100, crosshair;
107
+ cursor: url("/dist/images/pencil.png") 0 100, crosshair;
94
108
  --slide-pointer-events: auto;
95
109
  }
96
110
  :host([overlay="eraser"]) {
97
- cursor: not-allowed;
111
+ cursor: url("/dist/images/eraser.png") 50 100, not-allowed;
98
112
  --slide-pointer-events: auto;
99
113
  }
100
114
  #overlay {
@@ -108,4 +122,4 @@ js: import "konva/skia-backend";
108
122
  transition: opacity 1s;
109
123
  }
110
124
  }
111
- `;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`?10: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 ha(){window.addEventListener(`resize`,ga),ga()}function ga(){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":ma,"slide-view":da,"slide-footer":T}),ha();
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 ha(){window.addEventListener(`resize`,ga),ga()}function ga(){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":ma,"slide-view":da,"slide-footer":T}),ha();
@@ -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
- <span>Select</span>
437
+ <img src="/dist/images/pointer.png" alt="Pointer"
438
438
  </label>
439
439
  <label>
440
440
  <input type="radio" name="overlay" value="brush">
441
- <span>Brush</span>
441
+ <img src="/dist/images/pencil.png" alt="Draw">
442
442
  </label>
443
443
  <label>
444
444
  <input type="radio" name="overlay" value="eraser">
445
- <span>Eraser</span>
445
+ <img src="/dist/images/eraser.png" alt="Erase">
446
446
  </label>
447
447
  <label>
448
448
  <input type="radio" name="overlay" value="hidden">
449
- <span>Hide</span>
449
+ <img src="/dist/images/hide.png" alt="Hide">
450
450
  </label>
451
451
  </fieldset>
452
452
  <span>
@@ -461,15 +461,18 @@ var T = class e extends HTMLElement {
461
461
  footer {
462
462
  display: flex;
463
463
  justify-content: space-between;
464
+ align-items: baseline;
464
465
  color: var(--color-text-inverted);
465
466
  }
467
+ fieldset {
468
+ border: none;
469
+ }
466
470
  span {
467
471
  background: rgb(0 0 0 / 0.8);
468
472
  border-radius: var(--size-spacing-small);
469
473
  padding: var(--size-spacing-small);
470
474
  }
471
- input,
472
- select {
475
+ input {
473
476
  font: inherit;
474
477
  color: inherit;
475
478
  line-height: inherit;
@@ -480,6 +483,19 @@ var T = class e extends HTMLElement {
480
483
  input[type="number"] {
481
484
  width: 3em;
482
485
  }
486
+ input[type="radio"] {
487
+ display: none;
488
+ }
489
+ img {
490
+ height: 2em;
491
+ aspect-ratio: 1;
492
+ opacity: .75;
493
+ }
494
+ img:hover,
495
+ input:checked + img {
496
+ opacity: 1;
497
+ background-color: rgb(255 255 255 / 0.2);
498
+ }
483
499
  `;
484
500
  slideControl = null;
485
501
  overlayControl = null;
@@ -8381,19 +8397,17 @@ var ua = $n.Util._assign($n, {
8381
8397
  }
8382
8398
  :host([active]) {
8383
8399
  --slide-opacity: 1;
8384
- }
8385
- :host([overlay]) {
8386
- cursor: pointer;
8400
+ cursor: url("/dist/images/pointer.png") 0 0, pointer;
8387
8401
  }
8388
8402
  :host([overlay="hidden"]) {
8389
8403
  --slide-overlay-visibility: hidden;
8390
8404
  }
8391
8405
  :host([overlay="brush"]) {
8392
- cursor: url("/includes/pencil.png") 0 100, crosshair;
8406
+ cursor: url("/dist/images/pencil.png") 0 100, crosshair;
8393
8407
  --slide-pointer-events: auto;
8394
8408
  }
8395
8409
  :host([overlay="eraser"]) {
8396
- cursor: not-allowed;
8410
+ cursor: url("/dist/images/eraser.png") 50 100, not-allowed;
8397
8411
  --slide-pointer-events: auto;
8398
8412
  }
8399
8413
  #overlay {
@@ -8439,7 +8453,7 @@ var ua = $n.Util._assign($n, {
8439
8453
  let t = this.stage.getPointerPosition();
8440
8454
  console.log("touchstart", t), this.lastLine = new ua.Line({
8441
8455
  stroke: this.overlayColor,
8442
- strokeWidth: this.overlayMode === "eraser" ? 10 : 4,
8456
+ strokeWidth: this.overlayMode === "eraser" ? 20 : 4,
8443
8457
  globalCompositeOperation: this.overlayMode === "brush" ? "source-over" : "destination-out",
8444
8458
  lineCap: "round",
8445
8459
  lineJoin: "round",
package/dist/slides.css CHANGED
@@ -10,7 +10,7 @@
10
10
  --color-link: var(--color-accent);
11
11
  --color-text: rgb(51 51 51);
12
12
  --color-text-heading: var(--color-accent);
13
- --color-text-inverted: rgb(255 255 255);
13
+ --color-text-inverted:#12B0FB;
14
14
  --color-warning: #ce2929;
15
15
  --color-error: var(--color-warning);
16
16
 
@@ -1,5 +1,5 @@
1
1
  import { HtmlBasePlugin } from "@11ty/eleventy";
2
- import slideTransform from "./transforms/slides.js";
2
+ import slideTransform from "./src/11ty-transform.js";
3
3
 
4
4
  const output = process.env.STATIC || "static";
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "presi-slides",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Make slides with Markdown",
5
5
  "keywords": [
6
6
  "Presentation",
Binary file
Binary file
Binary file
package/public/slides.css CHANGED
@@ -10,7 +10,7 @@
10
10
  --color-link: var(--color-accent);
11
11
  --color-text: rgb(51 51 51);
12
12
  --color-text-heading: var(--color-accent);
13
- --color-text-inverted: rgb(255 255 255);
13
+ --color-text-inverted:#12B0FB;
14
14
  --color-warning: #ce2929;
15
15
  --color-error: var(--color-warning);
16
16
 
@@ -0,0 +1 @@
1
+ [Sample Presi](./Sample%20Presi.textbundle)
@@ -7,19 +7,19 @@ export class FooterElement extends HTMLElement {
7
7
  <fieldset name="overlay">
8
8
  <label>
9
9
  <input type="radio" name="overlay" value="pointer" checked>
10
- <span>Select</span>
10
+ <img src="/dist/images/pointer.png" alt="Pointer"
11
11
  </label>
12
12
  <label>
13
13
  <input type="radio" name="overlay" value="brush">
14
- <span>Brush</span>
14
+ <img src="/dist/images/pencil.png" alt="Draw">
15
15
  </label>
16
16
  <label>
17
17
  <input type="radio" name="overlay" value="eraser">
18
- <span>Eraser</span>
18
+ <img src="/dist/images/eraser.png" alt="Erase">
19
19
  </label>
20
20
  <label>
21
21
  <input type="radio" name="overlay" value="hidden">
22
- <span>Hide</span>
22
+ <img src="/dist/images/hide.png" alt="Hide">
23
23
  </label>
24
24
  </fieldset>
25
25
  <span>
@@ -35,15 +35,18 @@ export class FooterElement extends HTMLElement {
35
35
  footer {
36
36
  display: flex;
37
37
  justify-content: space-between;
38
+ align-items: baseline;
38
39
  color: var(--color-text-inverted);
39
40
  }
41
+ fieldset {
42
+ border: none;
43
+ }
40
44
  span {
41
45
  background: rgb(0 0 0 / 0.8);
42
46
  border-radius: var(--size-spacing-small);
43
47
  padding: var(--size-spacing-small);
44
48
  }
45
- input,
46
- select {
49
+ input {
47
50
  font: inherit;
48
51
  color: inherit;
49
52
  line-height: inherit;
@@ -54,6 +57,19 @@ export class FooterElement extends HTMLElement {
54
57
  input[type="number"] {
55
58
  width: 3em;
56
59
  }
60
+ input[type="radio"] {
61
+ display: none;
62
+ }
63
+ img {
64
+ height: 2em;
65
+ aspect-ratio: 1;
66
+ opacity: .75;
67
+ }
68
+ img:hover,
69
+ input:checked + img {
70
+ opacity: 1;
71
+ background-color: rgb(255 255 255 / 0.2);
72
+ }
57
73
  `;
58
74
 
59
75
  slideControl = null;
package/src/slide-view.js CHANGED
@@ -24,19 +24,17 @@ export class SlideElement extends HTMLElement {
24
24
  }
25
25
  :host([active]) {
26
26
  --slide-opacity: 1;
27
- }
28
- :host([overlay]) {
29
- cursor: pointer;
27
+ cursor: url("/dist/images/pointer.png") 0 0, pointer;
30
28
  }
31
29
  :host([overlay="hidden"]) {
32
30
  --slide-overlay-visibility: hidden;
33
31
  }
34
32
  :host([overlay="brush"]) {
35
- cursor: url("/includes/pencil.png") 0 100, crosshair;
33
+ cursor: url("/dist/images/pencil.png") 0 100, crosshair;
36
34
  --slide-pointer-events: auto;
37
35
  }
38
36
  :host([overlay="eraser"]) {
39
- cursor: not-allowed;
37
+ cursor: url("/dist/images/eraser.png") 35 100, not-allowed;
40
38
  --slide-pointer-events: auto;
41
39
  }
42
40
  #overlay {
@@ -106,7 +104,7 @@ export class SlideElement extends HTMLElement {
106
104
  console.log("touchstart", pos);
107
105
  this.lastLine = new Konva.Line({
108
106
  stroke: this.overlayColor,
109
- strokeWidth: this.overlayMode === "eraser" ? 10 : 4,
107
+ strokeWidth: this.overlayMode === "eraser" ? 20 : 4,
110
108
  globalCompositeOperation:
111
109
  this.overlayMode === "brush"
112
110
  ? "source-over"
File without changes
File without changes