@netless/app-slide 0.3.0-canary.0 → 0.3.0-canary.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/app-slide",
3
- "version": "0.3.0-canary.0",
3
+ "version": "0.3.0-canary.1",
4
4
  "main": "dist/main.cjs.js",
5
5
  "module": "dist/main.es.js",
6
6
  "types": "dist/index.d.ts",
@@ -105,7 +105,7 @@ function create_sidebar() {
105
105
 
106
106
  const $preview = h("div");
107
107
  set_class($preview, "preview");
108
- $preview.classList.add("tele-fancy-scrollbar");
108
+ $preview.classList.add(wrap_class("tele-fancy-scrollbar"));
109
109
  $preview.onclick = function on_click_preview(ev) {
110
110
  if (readonly) return;
111
111
  const page_index = (ev.target as HTMLElement).dataset?.pageIndex;
@@ -402,7 +402,6 @@ export class SlideViewer {
402
402
  this.$content = this.sidebar.$content;
403
403
  this.$footer = this.footer.$footer;
404
404
  append(this.$content, this.$slide);
405
- append(this.$content, this.$footer);
406
405
 
407
406
  let resolveReady: () => void;
408
407
  this._readyPromise = new Promise(resolve => {
@@ -441,7 +440,12 @@ export class SlideViewer {
441
440
  })
442
441
  );
443
442
 
444
- this.slide = new Slide({ anchor: this.$slide, ...options });
443
+ this.slide = new Slide({
444
+ anchor: this.$slide,
445
+ resize: true,
446
+ enableGlobalClick: true,
447
+ ...options,
448
+ });
445
449
  this.slide.setResource(options.taskId, options.url || DefaultUrl);
446
450
 
447
451
  let resolveFetching: (response: SlideViewerInfoResponse) => void;
@@ -0,0 +1,57 @@
1
+ $namespace: "netless-app-slide";
2
+
3
+ $scrollbar-size: 8px;
4
+ $scrollbar-ff-width: auto; // FF-only accepts auto, thin, none
5
+ $scrollbar-minlength: 50px; // Minimum length of scrollbar thumb
6
+ $scrollbar-track-color: transparent;
7
+ $scrollbar-color: rgba(68, 78, 96, 0.1);
8
+ $scrollbar-color-hover: rgba(68, 78, 96, 0.2);
9
+ $scrollbar-color-active: rgba(68, 78, 96, 0.2);
10
+
11
+ .#{$namespace}-tele-fancy-scrollbar {
12
+ overscroll-behavior: contain;
13
+ overflow: auto;
14
+ overflow-y: scroll;
15
+ overflow-y: overlay; // for webkit
16
+ -webkit-overflow-scrolling: touch;
17
+ -ms-overflow-style: -ms-autohiding-scrollbar;
18
+ scrollbar-width: $scrollbar-ff-width;
19
+ // Firefox has incorrect track color
20
+ // scrollbar-color: $scrollbar-color $scrollbar-track-color;
21
+
22
+ &::-webkit-scrollbar {
23
+ height: $scrollbar-size;
24
+ width: $scrollbar-size;
25
+ }
26
+
27
+ &::-webkit-scrollbar-track {
28
+ background-color: $scrollbar-track-color;
29
+ }
30
+
31
+ &::-webkit-scrollbar-thumb {
32
+ background-color: $scrollbar-color;
33
+ background-color: $scrollbar-track-color;
34
+ border-radius: $scrollbar-size * 0.5;
35
+ transition: background-color 0.4s;
36
+ }
37
+
38
+ &:hover::-webkit-scrollbar-thumb {
39
+ background-color: $scrollbar-color;
40
+ }
41
+
42
+ &::-webkit-scrollbar-thumb:hover {
43
+ background-color: $scrollbar-color-hover;
44
+ }
45
+
46
+ &::-webkit-scrollbar-thumb:active {
47
+ background-color: $scrollbar-color-active;
48
+ }
49
+
50
+ &::-webkit-scrollbar-thumb:vertical {
51
+ min-height: $scrollbar-minlength;
52
+ }
53
+
54
+ &::-webkit-scrollbar-thumb:horizontal {
55
+ min-width: $scrollbar-minlength;
56
+ }
57
+ }
package/src/index.ts CHANGED
@@ -82,8 +82,13 @@ export default SlideApp;
82
82
 
83
83
  export function previewSlide(options: SlideViewerOptions & { container: HTMLElement }) {
84
84
  const { container } = options;
85
+ container.style.cssText = "display:flex;flex-direction:column";
85
86
  const viewer = new SlideViewer(options);
87
+ container.appendChild(document.createElement("style")).textContent = SlideViewer.styles;
86
88
  container.appendChild(viewer.$content);
89
+ container.appendChild(viewer.$footer);
90
+ viewer.prepare(() => viewer.slide.renderSlide(1));
91
+ viewer.slide.on("slideChange", page => viewer.setPage(page));
87
92
  return viewer;
88
93
  }
89
94
 
package/src/style.scss CHANGED
@@ -1,3 +1,5 @@
1
+ @import "./fancy-scrollbar.scss";
2
+
1
3
  $namespace: "netless-app-slide";
2
4
 
3
5
  .#{$namespace}-content {