@hyperbook/markdown 0.43.5 → 0.44.1

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.
@@ -964,6 +964,8 @@ var multievent = {
964
964
  }
965
965
 
966
966
  SK[clNr].style.display = "block";
967
+ SK[clNr].style.visibility = "visible";
968
+ SK[clNr].style.opacity = "1";
967
969
 
968
970
  // Add event listeners to save state on changes
969
971
  var allInputs = SK[clNr].getElementsByTagName("input");
@@ -8,6 +8,7 @@
8
8
  }
9
9
 
10
10
  .directive-multievent {
11
+ transition: opacity 0.2s ease-in;
11
12
 
12
13
  .MECheckbox:not(first-child),
13
14
  .MERadio:not(first-child) {
package/dist/index.js CHANGED
@@ -61475,6 +61475,12 @@ var en_default = {
61475
61475
  "slideshow-next": "Next",
61476
61476
  "slideshow-jump-to": "Jump to {{index}}",
61477
61477
  "toggle-bookmark": "Toggle Bookmark",
61478
+ "shell-share": "Share",
61479
+ "share-dialog-title": "Create Shareable URL",
61480
+ "share-dialog-standalone": "Standalone Mode",
61481
+ "share-dialog-select-sections": "Select Sections",
61482
+ "share-dialog-copy-url": "Copy Shareable URL",
61483
+ "share-dialog-url-copied": "URL copied to clipboard!",
61478
61484
  "webide-code-preview": "Code Preview",
61479
61485
  "webide-html": "HTML",
61480
61486
  "webide-css": "CSS",
@@ -61528,6 +61534,12 @@ var de_default = {
61528
61534
  "slideshow-next": "Weiter",
61529
61535
  "slideshow-jump-to": "Springe zu {{index}}",
61530
61536
  "toggle-bookmark": "Lesezeichen umschalten",
61537
+ "shell-share": "Teilen",
61538
+ "share-dialog-title": "Teilbare URL erstellen",
61539
+ "share-dialog-standalone": "Standalone-Modus",
61540
+ "share-dialog-select-sections": "Abschnitte ausw\xE4hlen",
61541
+ "share-dialog-copy-url": "Teilbare URL kopieren",
61542
+ "share-dialog-url-copied": "URL in Zwischenablage kopiert!",
61531
61543
  "webide-code-preview": "Code-Vorschau",
61532
61544
  "webide-html": "HTML",
61533
61545
  "webide-css": "CSS",
@@ -61690,105 +61702,115 @@ var rehypeTableOfContents_default = (ctx) => () => {
61690
61702
  return (tree, file) => {
61691
61703
  const headings = file.data.headings || [];
61692
61704
  const originalChildren = tree.children;
61693
- const tocSidebar = [
61694
- {
61695
- type: "element",
61696
- tagName: "button",
61697
- properties: {
61698
- id: "toc-toggle",
61699
- onclick: "hyperbook.tocToggle()",
61700
- title: i18n.get("table-of-contents")
61705
+ const tocButton = {
61706
+ type: "element",
61707
+ tagName: "button",
61708
+ properties: {
61709
+ id: "toc-toggle",
61710
+ onclick: "hyperbook.tocToggle()",
61711
+ title: i18n.get("table-of-contents")
61712
+ },
61713
+ children: [
61714
+ {
61715
+ type: "element",
61716
+ tagName: "div",
61717
+ properties: {
61718
+ class: "bar1"
61719
+ },
61720
+ children: []
61701
61721
  },
61702
- children: [
61703
- {
61704
- type: "element",
61705
- tagName: "div",
61706
- properties: {
61707
- class: "bar1"
61708
- },
61709
- children: []
61722
+ {
61723
+ type: "element",
61724
+ tagName: "div",
61725
+ properties: {
61726
+ class: "bar2"
61710
61727
  },
61711
- {
61712
- type: "element",
61713
- tagName: "div",
61714
- properties: {
61715
- class: "bar2"
61716
- },
61717
- children: []
61728
+ children: []
61729
+ },
61730
+ {
61731
+ type: "element",
61732
+ tagName: "div",
61733
+ properties: {
61734
+ class: "bar3"
61718
61735
  },
61719
- {
61720
- type: "element",
61721
- tagName: "div",
61722
- properties: {
61723
- class: "bar3"
61724
- },
61725
- children: []
61736
+ children: []
61737
+ },
61738
+ {
61739
+ type: "element",
61740
+ tagName: "div",
61741
+ properties: {
61742
+ class: "bar4"
61726
61743
  },
61727
- {
61728
- type: "element",
61729
- tagName: "div",
61730
- properties: {
61731
- class: "bar4"
61732
- },
61733
- children: []
61734
- }
61735
- ]
61744
+ children: []
61745
+ }
61746
+ ]
61747
+ };
61748
+ const tocDrawer = {
61749
+ type: "element",
61750
+ tagName: "side-drawer",
61751
+ properties: {
61752
+ id: "toc-drawer",
61753
+ right: true
61736
61754
  },
61755
+ children: [
61756
+ {
61757
+ type: "element",
61758
+ tagName: "div",
61759
+ properties: {
61760
+ class: "toc-drawer-content"
61761
+ },
61762
+ children: [
61763
+ {
61764
+ type: "element",
61765
+ tagName: "nav",
61766
+ properties: {
61767
+ class: "toc"
61768
+ },
61769
+ children: [
61770
+ {
61771
+ type: "element",
61772
+ tagName: "ul",
61773
+ properties: {},
61774
+ children: headings.map((heading3) => ({
61775
+ type: "element",
61776
+ tagName: "li",
61777
+ properties: {
61778
+ class: `level-${heading3.level}`
61779
+ },
61780
+ children: [
61781
+ {
61782
+ type: "element",
61783
+ tagName: "a",
61784
+ properties: {
61785
+ href: `#${heading3.anchor}`
61786
+ },
61787
+ children: [
61788
+ {
61789
+ type: "text",
61790
+ value: heading3.label
61791
+ }
61792
+ ]
61793
+ }
61794
+ ]
61795
+ }))
61796
+ }
61797
+ ]
61798
+ }
61799
+ ]
61800
+ }
61801
+ ]
61802
+ };
61803
+ const tocSidebar = [
61737
61804
  {
61738
61805
  type: "element",
61739
- tagName: "side-drawer",
61806
+ tagName: "div",
61740
61807
  properties: {
61741
- id: "toc-drawer",
61742
- right: true
61808
+ class: "floating-buttons-container",
61809
+ id: "floating-buttons-container"
61743
61810
  },
61744
- children: [
61745
- {
61746
- type: "element",
61747
- tagName: "div",
61748
- properties: {
61749
- class: "toc-drawer-content"
61750
- },
61751
- children: [
61752
- {
61753
- type: "element",
61754
- tagName: "nav",
61755
- properties: {
61756
- class: "toc"
61757
- },
61758
- children: [
61759
- {
61760
- type: "element",
61761
- tagName: "ul",
61762
- properties: {},
61763
- children: headings.map((heading3) => ({
61764
- type: "element",
61765
- tagName: "li",
61766
- properties: {
61767
- class: `level-${heading3.level}`
61768
- },
61769
- children: [
61770
- {
61771
- type: "element",
61772
- tagName: "a",
61773
- properties: {
61774
- href: `#${heading3.anchor}`
61775
- },
61776
- children: [
61777
- {
61778
- type: "text",
61779
- value: heading3.label
61780
- }
61781
- ]
61782
- }
61783
- ]
61784
- }))
61785
- }
61786
- ]
61787
- }
61788
- ]
61789
- }
61790
- ]
61791
- }
61811
+ children: [tocButton]
61812
+ },
61813
+ tocDrawer
61792
61814
  ];
61793
61815
  tree.children = [
61794
61816
  {
@@ -62403,11 +62425,13 @@ body::-webkit-scrollbar {
62403
62425
  font-family: hyperbook-heading;
62404
62426
  src: url(${makeUrl(parseFont(font)[0], "public")});
62405
62427
  size-adjust: ${parseFont(font)[1]};
62428
+ font-display: swap;
62406
62429
  }
62407
62430
  @font-face {
62408
62431
  font-family: hyperbook-body;
62409
62432
  src: url(${makeUrl(parseFont(font)[0], "public")});
62410
62433
  size-adjust: ${parseFont(font)[1]};
62434
+ font-display: swap;
62411
62435
  }
62412
62436
  `;
62413
62437
  }
@@ -62417,6 +62441,7 @@ body::-webkit-scrollbar {
62417
62441
  font-family: hyperbook-body;
62418
62442
  src: url(${makeUrl(parseFont(fonts.body)[0], "public")});
62419
62443
  size-adjust: ${parseFont(fonts.body)[1]};
62444
+ font-display: swap;
62420
62445
  }
62421
62446
  `;
62422
62447
  }
@@ -62426,6 +62451,7 @@ body::-webkit-scrollbar {
62426
62451
  font-family: hyperbook-heading;
62427
62452
  src: url(${makeUrl(parseFont(fonts.heading)[0], "public")});
62428
62453
  size-adjust: ${parseFont(fonts.heading)[1]};
62454
+ font-display: swap;
62429
62455
  }
62430
62456
  `;
62431
62457
  }
@@ -62435,6 +62461,7 @@ body::-webkit-scrollbar {
62435
62461
  font-family: hyperbook-code;
62436
62462
  src: url(${makeUrl(parseFont(fonts.code)[0], "public")});
62437
62463
  size-adjust: ${parseFont(fonts.code)[1]};
62464
+ font-display: swap;
62438
62465
  }
62439
62466
  `;
62440
62467
  }
@@ -62646,7 +62673,8 @@ var rehypeHtmlStructure_default = (ctx) => () => {
62646
62673
  type: "element",
62647
62674
  tagName: "script",
62648
62675
  properties: {
62649
- src: makeUrl(["i18n.js"], "assets")
62676
+ src: makeUrl(["i18n.js"], "assets"),
62677
+ defer: true
62650
62678
  },
62651
62679
  children: []
62652
62680
  },
@@ -62654,7 +62682,8 @@ var rehypeHtmlStructure_default = (ctx) => () => {
62654
62682
  type: "element",
62655
62683
  tagName: "script",
62656
62684
  properties: {
62657
- src: makeUrl(["dexie.min.js"], "assets")
62685
+ src: makeUrl(["dexie.min.js"], "assets"),
62686
+ defer: true
62658
62687
  },
62659
62688
  children: []
62660
62689
  },
@@ -62662,7 +62691,8 @@ var rehypeHtmlStructure_default = (ctx) => () => {
62662
62691
  type: "element",
62663
62692
  tagName: "script",
62664
62693
  properties: {
62665
- src: makeUrl(["dexie-export-import.js"], "assets")
62694
+ src: makeUrl(["dexie-export-import.js"], "assets"),
62695
+ defer: true
62666
62696
  },
62667
62697
  children: []
62668
62698
  },
@@ -62670,7 +62700,8 @@ var rehypeHtmlStructure_default = (ctx) => () => {
62670
62700
  type: "element",
62671
62701
  tagName: "script",
62672
62702
  properties: {
62673
- src: makeUrl(["store.js"], "assets")
62703
+ src: makeUrl(["store.js"], "assets"),
62704
+ defer: true
62674
62705
  },
62675
62706
  children: []
62676
62707
  },
@@ -62691,7 +62722,8 @@ window.Prism.manual = true;`
62691
62722
  type: "element",
62692
62723
  tagName: "script",
62693
62724
  properties: {
62694
- src: makeUrl(["prism", "prism.js"], "assets")
62725
+ src: makeUrl(["prism", "prism.js"], "assets"),
62726
+ defer: true
62695
62727
  },
62696
62728
  children: []
62697
62729
  },
@@ -63351,7 +63383,8 @@ var makeHeaderElements = (ctx) => {
63351
63383
  tagName: "img",
63352
63384
  properties: {
63353
63385
  alt: "logo",
63354
- src: ctx.makeUrl(ctx.config.logo, "public")
63386
+ src: ctx.makeUrl(ctx.config.logo, "public"),
63387
+ height: "40"
63355
63388
  },
63356
63389
  children: []
63357
63390
  }
@@ -63591,6 +63624,26 @@ var makeHeaderElements = (ctx) => {
63591
63624
  ]
63592
63625
  });
63593
63626
  }
63627
+ elements.push({
63628
+ type: "element",
63629
+ tagName: "button",
63630
+ properties: {
63631
+ id: "share-button",
63632
+ class: "icon-button",
63633
+ title: i18n.get("shell-share"),
63634
+ onclick: "hyperbook.shareOpen()"
63635
+ },
63636
+ children: [
63637
+ {
63638
+ type: "element",
63639
+ tagName: "div",
63640
+ properties: {
63641
+ class: "share-icon"
63642
+ },
63643
+ children: []
63644
+ }
63645
+ ]
63646
+ });
63594
63647
  elements.push({
63595
63648
  type: "element",
63596
63649
  tagName: "dark-mode-toggle",
@@ -70898,10 +70951,178 @@ var rehypeQrCode_default = (ctx) => () => {
70898
70951
  ]
70899
70952
  }
70900
70953
  ];
70954
+ const qrcodeButton = qrcodeDialog[0];
70955
+ const qrcodeDialogElement = qrcodeDialog[1];
70901
70956
  if (originalChildren[0].type === "element" && originalChildren[0].tagName === "div") {
70902
- originalChildren[0].children.push(...qrcodeDialog);
70957
+ const floatingContainer = originalChildren[0].children.find(
70958
+ (child) => child.type === "element" && child.properties?.id === "floating-buttons-container"
70959
+ );
70960
+ if (floatingContainer && floatingContainer.type === "element") {
70961
+ floatingContainer.children.push(qrcodeButton);
70962
+ } else {
70963
+ originalChildren[0].children.push(qrcodeButton);
70964
+ }
70965
+ }
70966
+ tree.children = [...originalChildren, qrcodeDialogElement];
70967
+ };
70968
+ };
70969
+
70970
+ // src/rehypeShareDialog.ts
70971
+ var rehypeShareDialog_default = (ctx) => () => {
70972
+ return (tree, file) => {
70973
+ const originalChildren = tree.children;
70974
+ const headings = file.data.headings || [];
70975
+ if (!ctx.navigation.current?.href) {
70976
+ return;
70903
70977
  }
70904
- tree.children = originalChildren;
70978
+ const headingCheckboxes = headings.map((heading3) => ({
70979
+ type: "element",
70980
+ tagName: "label",
70981
+ properties: {
70982
+ class: `heading-item level-${heading3.level}`
70983
+ },
70984
+ children: [
70985
+ {
70986
+ type: "element",
70987
+ tagName: "input",
70988
+ properties: {
70989
+ type: "checkbox",
70990
+ value: heading3.anchor,
70991
+ "data-anchor": heading3.anchor,
70992
+ onchange: "hyperbook.shareUpdatePreview()"
70993
+ },
70994
+ children: []
70995
+ },
70996
+ {
70997
+ type: "text",
70998
+ value: ` ${heading3.label}`
70999
+ }
71000
+ ]
71001
+ }));
71002
+ const shareDialog = [
71003
+ {
71004
+ type: "element",
71005
+ tagName: "dialog",
71006
+ properties: {
71007
+ id: "share-dialog"
71008
+ },
71009
+ children: [
71010
+ {
71011
+ type: "element",
71012
+ tagName: "div",
71013
+ properties: {
71014
+ class: "container"
71015
+ },
71016
+ children: [
71017
+ {
71018
+ type: "element",
71019
+ tagName: "h2",
71020
+ properties: {
71021
+ class: "title"
71022
+ },
71023
+ children: [
71024
+ {
71025
+ type: "text",
71026
+ value: i18n.get("share-dialog-title")
71027
+ }
71028
+ ]
71029
+ },
71030
+ {
71031
+ type: "element",
71032
+ tagName: "label",
71033
+ properties: {
71034
+ class: "standalone-option"
71035
+ },
71036
+ children: [
71037
+ {
71038
+ type: "element",
71039
+ tagName: "input",
71040
+ properties: {
71041
+ type: "checkbox",
71042
+ id: "share-standalone-checkbox",
71043
+ onchange: "hyperbook.shareUpdatePreview()"
71044
+ },
71045
+ children: []
71046
+ },
71047
+ {
71048
+ type: "text",
71049
+ value: ` ${i18n.get("share-dialog-standalone")}`
71050
+ }
71051
+ ]
71052
+ },
71053
+ {
71054
+ type: "element",
71055
+ tagName: "h3",
71056
+ properties: {
71057
+ class: "sections-title"
71058
+ },
71059
+ children: [
71060
+ {
71061
+ type: "text",
71062
+ value: i18n.get("share-dialog-select-sections")
71063
+ }
71064
+ ]
71065
+ },
71066
+ {
71067
+ type: "element",
71068
+ tagName: "div",
71069
+ properties: {
71070
+ class: "sections-list"
71071
+ },
71072
+ children: headingCheckboxes
71073
+ },
71074
+ {
71075
+ type: "element",
71076
+ tagName: "div",
71077
+ properties: {
71078
+ class: "url-preview",
71079
+ id: "share-url-preview"
71080
+ },
71081
+ children: [
71082
+ {
71083
+ type: "text",
71084
+ value: ""
71085
+ }
71086
+ ]
71087
+ },
71088
+ {
71089
+ type: "element",
71090
+ tagName: "button",
71091
+ properties: {
71092
+ class: "copy-button",
71093
+ onclick: "hyperbook.shareCopyUrl()"
71094
+ },
71095
+ children: [
71096
+ {
71097
+ type: "text",
71098
+ value: i18n.get("share-dialog-copy-url")
71099
+ }
71100
+ ]
71101
+ }
71102
+ ]
71103
+ },
71104
+ {
71105
+ type: "element",
71106
+ tagName: "button",
71107
+ properties: {
71108
+ class: "close",
71109
+ onclick: "hyperbook.shareClose()"
71110
+ },
71111
+ children: [
71112
+ {
71113
+ type: "element",
71114
+ tagName: "div",
71115
+ properties: {
71116
+ class: "close-icon"
71117
+ },
71118
+ children: []
71119
+ }
71120
+ ]
71121
+ }
71122
+ ]
71123
+ }
71124
+ ];
71125
+ tree.children = [...originalChildren, ...shareDialog];
70905
71126
  };
70906
71127
  };
70907
71128
 
@@ -72009,7 +72230,8 @@ var remarkDirectiveMultievent_default = (ctx) => () => {
72009
72230
  registerDirective(file, name, ["multievent.js"], ["style.css"], []);
72010
72231
  data.hName = "div";
72011
72232
  data.hProperties = {
72012
- class: "directive-multievent multievent"
72233
+ class: "directive-multievent multievent",
72234
+ style: "visibility: hidden; opacity: 0;"
72013
72235
  };
72014
72236
  }
72015
72237
  });
@@ -78772,6 +78994,7 @@ var process2 = (md, ctx) => {
78772
78994
  rehypeUnwrapImages,
78773
78995
  rehypeTableOfContents_default(ctx),
78774
78996
  rehypeQrCode_default(ctx),
78997
+ rehypeShareDialog_default(ctx),
78775
78998
  rehypeKatex,
78776
78999
  rehypeDirectiveP5_default(ctx),
78777
79000
  [