hyperbook 0.35.2 → 0.35.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.
@@ -33,6 +33,17 @@ var hyperbook = (function () {
33
33
  const tocDrawerEl = document.getElementById("toc-drawer");
34
34
  tocDrawerEl.open = !tocDrawerEl.open;
35
35
  }
36
+
37
+ function qrcodeOpen() {
38
+ const qrCodeDialog = document.getElementById("qrcode-dialog");
39
+ qrCodeDialog.showModal();
40
+ }
41
+
42
+ function qrcodeClose() {
43
+ const qrCodeDialog = document.getElementById("qrcode-dialog");
44
+ qrCodeDialog.close();
45
+ }
46
+
36
47
  function navToggle() {
37
48
  const navDrawerEl = document.getElementById("nav-drawer");
38
49
  navDrawerEl.open = !navDrawerEl.open;
@@ -83,5 +94,7 @@ var hyperbook = (function () {
83
94
  toggleBookmark,
84
95
  navToggle,
85
96
  tocToggle,
97
+ qrcodeOpen,
98
+ qrcodeClose,
86
99
  };
87
100
  })();
@@ -370,7 +370,8 @@ figure {
370
370
  background-color: var(--color-text);
371
371
  }
372
372
 
373
- .hyperbook-markdown #toc-toggle {
373
+ .hyperbook-markdown #toc-toggle,
374
+ .hyperbook-markdown #qrcode-open {
374
375
  background: var(--color-background);
375
376
  border-color: var(--color-nav-border);
376
377
  cursor: pointer;
@@ -399,7 +400,84 @@ figure {
399
400
  text-decoration: underline;
400
401
  }
401
402
 
402
- .hyperbook-markdown #toc-toggle {
403
+ .hyperbook-markdown #qrcode-dialog {
404
+ background: var(--color-background);
405
+ border: 1px solid var(--color-brand);
406
+ width: 100%;
407
+ height: 100%;
408
+ }
409
+
410
+ #qrcode-dialog .container {
411
+ position: absolute;
412
+ top: 0;
413
+ bottom: 0;
414
+ right: 0;
415
+ left: 0;
416
+ padding: 16px;
417
+ display: flex;
418
+ flex-direction: column;
419
+ align-items: center;
420
+ justify-content: center;
421
+ gap: 8px;
422
+ }
423
+
424
+ #qrcode-dialog .name {
425
+ color: var(--color-text);
426
+ text-align: center;
427
+ font-size: 2rem;
428
+ }
429
+
430
+ #qrcode-dialog .url {
431
+ color: var(--color-text);
432
+ text-align: center;
433
+ font-size: 1.25rem;
434
+ }
435
+
436
+ #qrcode-dialog .close {
437
+ background: none;
438
+ border: none;
439
+ font-size: 2rem;
440
+ color: var(--color-text);
441
+ cursor: pointer;
442
+ position: absolute;
443
+ font: monospace;
444
+ top: 0px;
445
+ right: 0px;
446
+ width: 48px;
447
+ height: 48px;
448
+ display: flex;
449
+ justify-content: center;
450
+ align-items: center;
451
+ background: var(--color-background);
452
+ border-radius: 8px;
453
+ }
454
+
455
+ #qrcode-dialog .close:hover .close-icon {
456
+ background-color: var(--color-brand);
457
+ }
458
+
459
+ .hyperbook-markdown #qrcode-dialog svg {
460
+ width: 100%;
461
+ max-width: 512px;
462
+ margin: 0 auto;
463
+ }
464
+
465
+ .hyperbook-markdown .close-icon {
466
+ background-color: var(--color-text);
467
+ width: 32px;
468
+ height: 32px;
469
+ mask-image: url('data:image/svg+xml,<svg width="32px" height="32px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M5.29289 5.29289C5.68342 4.90237 6.31658 4.90237 6.70711 5.29289L12 10.5858L17.2929 5.29289C17.6834 4.90237 18.3166 4.90237 18.7071 5.29289C19.0976 5.68342 19.0976 6.31658 18.7071 6.70711L13.4142 12L18.7071 17.2929C19.0976 17.6834 19.0976 18.3166 18.7071 18.7071C18.3166 19.0976 17.6834 19.0976 17.2929 18.7071L12 13.4142L6.70711 18.7071C6.31658 19.0976 5.68342 19.0976 5.29289 18.7071C4.90237 18.3166 4.90237 17.6834 5.29289 17.2929L10.5858 12L5.29289 6.70711C4.90237 6.31658 4.90237 5.68342 5.29289 5.29289Z" fill="%230F1729"/></svg>');
470
+ }
471
+
472
+ .hyperbook-markdown .qrcode-icon {
473
+ background-color: var(--color-text);
474
+ width: 32px;
475
+ height: 32px;
476
+ mask-image: url('data:image/svg+xml,<svg width="32px" height="32px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M3 9h6V3H3zm1-5h4v4H4zm1 1h2v2H5zm10 4h6V3h-6zm1-5h4v4h-4zm1 1h2v2h-2zM3 21h6v-6H3zm1-5h4v4H4zm1 1h2v2H5zm15 2h1v2h-2v-3h1zm0-3h1v1h-1zm0-1v1h-1v-1zm-10 2h1v4h-1v-4zm-4-7v2H4v-1H3v-1h3zm4-3h1v1h-1zm3-3v2h-1V3h2v1zm-3 0h1v1h-1zm10 8h1v2h-2v-1h1zm-1-2v1h-2v2h-2v-1h1v-2h3zm-7 4h-1v-1h-1v-1h2v2zm6 2h1v1h-1zm2-5v1h-1v-1zm-9 3v1h-1v-1zm6 5h1v2h-2v-2zm-3 0h1v1h-1v1h-2v-1h1v-1zm0-1v-1h2v1zm0-5h1v3h-1v1h-1v1h-1v-2h-1v-1h3v-1h-1v-1zm-9 0v1H4v-1zm12 4h-1v-1h1zm1-2h-2v-1h2zM8 10h1v1H8v1h1v2H8v-1H7v1H6v-2h1v-2zm3 0V8h3v3h-2v-1h1V9h-1v1zm0-4h1v1h-1zm-1 4h1v1h-1zm3-3V6h1v1z"/><path fill="none" d="M0 0h24v24H0z"/></svg>');
477
+ }
478
+
479
+ .hyperbook-markdown #toc-toggle,
480
+ .hyperbook-markdown #qrcode-open {
403
481
  position: fixed;
404
482
  padding: 4px;
405
483
  top: 90px;
@@ -413,7 +491,12 @@ figure {
413
491
  z-index: 1000;
414
492
  }
415
493
 
416
- .hyperbook-markdown #toc-toggle:hover {
494
+ .hyperbook-markdown #qrcode-open {
495
+ top: 140px;
496
+ }
497
+
498
+ .hyperbook-markdown #toc-toggle:hover,
499
+ .hyperbook-markdown #qrcode-toggle:hover {
417
500
  opacity: 1;
418
501
  }
419
502