@netless/app-slide 0.3.0-canary.4 → 0.3.0-canary.5
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/dist/SlideViewer.d.ts +2 -2
- package/dist/main.iife.js +114 -114
- package/dist/main.iife.js.map +1 -1
- package/dist/main.js +149 -149
- package/dist/main.js.map +1 -1
- package/dist/main.mjs +8969 -8832
- package/dist/main.mjs.map +1 -1
- package/dist/typings.d.ts +2 -15
- package/package.json +6 -4
- package/src/SlideViewer.ts +8 -9
- package/src/index.ts +2 -1
- package/src/style.scss +15 -5
- package/src/typings.ts +2 -15
package/dist/typings.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Slide, SLIDE_EVENTS, SyncEvent } from "@netless/slide";
|
|
1
|
+
import type { ISlideRenderOptions, Slide, SLIDE_EVENTS, SyncEvent } from "@netless/slide";
|
|
2
2
|
import type { RegisterParams } from "@netless/window-manager";
|
|
3
3
|
export declare type SlideState = Slide["slideState"];
|
|
4
4
|
export declare type AddHooks = NonNullable<RegisterParams["addHooks"]>;
|
|
@@ -13,19 +13,6 @@ export interface Attributes {
|
|
|
13
13
|
export interface MagixEvents {
|
|
14
14
|
[SLIDE_EVENTS.syncDispatch]: SyncEvent;
|
|
15
15
|
}
|
|
16
|
-
export interface AppOptions {
|
|
17
|
-
/** show debug controller */
|
|
16
|
+
export interface AppOptions extends ISlideRenderOptions {
|
|
18
17
|
debug?: boolean;
|
|
19
|
-
/** scale */
|
|
20
|
-
resolution?: number;
|
|
21
|
-
/** background color for slide animations */
|
|
22
|
-
bgColor?: string;
|
|
23
|
-
/** minimal fps (default: 25) */
|
|
24
|
-
minFPS?: number;
|
|
25
|
-
/** maximal fps (default: 30) */
|
|
26
|
-
maxFPS?: number;
|
|
27
|
-
/** automatically decrease fps (default: true) */
|
|
28
|
-
autoFPS?: boolean;
|
|
29
|
-
/** whether to re-scale automatically (default: true) */
|
|
30
|
-
autoResolution?: boolean;
|
|
31
18
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netless/app-slide",
|
|
3
|
-
"version": "0.3.0-canary.
|
|
3
|
+
"version": "0.3.0-canary.5",
|
|
4
4
|
"main": "dist/main.js",
|
|
5
5
|
"module": "dist/main.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -9,13 +9,15 @@
|
|
|
9
9
|
"dist",
|
|
10
10
|
"README-zh.md"
|
|
11
11
|
],
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@netless/slide": "^0.5.10"
|
|
14
|
+
},
|
|
12
15
|
"devDependencies": {
|
|
13
|
-
"@netless/slide": "^0.5.3",
|
|
14
16
|
"@types/color-string": "^1.5.2",
|
|
15
17
|
"color-string": "^1.9.1",
|
|
16
18
|
"side-effect-manager": "^1.1.1",
|
|
17
|
-
"value-enhancer": "^1.3.
|
|
18
|
-
"vanilla-lazyload": "^17.8.
|
|
19
|
+
"value-enhancer": "^1.3.2",
|
|
20
|
+
"vanilla-lazyload": "^17.8.3"
|
|
19
21
|
},
|
|
20
22
|
"scripts": {
|
|
21
23
|
"types": "cross-env NODE_ENV=production tsc --declaration --emitDeclarationOnly --outDir dist",
|
package/src/SlideViewer.ts
CHANGED
|
@@ -176,8 +176,8 @@ function create_sidebar() {
|
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
function set_page_index(page_index_: number) {
|
|
180
|
-
if (page_index !== page_index_) {
|
|
179
|
+
function set_page_index(page_index_: number, force = false) {
|
|
180
|
+
if (force || page_index !== page_index_) {
|
|
181
181
|
page_index = page_index_;
|
|
182
182
|
const $page = $preview.querySelector<HTMLElement>(
|
|
183
183
|
`.${wrap_class(`preview-page-${page_index}`)}`
|
|
@@ -292,9 +292,6 @@ function create_footer() {
|
|
|
292
292
|
const $pageNumberInput = h("input");
|
|
293
293
|
set_class($pageNumberInput, "page-number-input");
|
|
294
294
|
$pageNumberInput.value = String(page_index + 1);
|
|
295
|
-
$pageNumberInput.onfocus = function on_focus_page_number_input() {
|
|
296
|
-
$pageNumberInput.select();
|
|
297
|
-
};
|
|
298
295
|
$pageNumberInput.onchange = function on_change_page_number_input() {
|
|
299
296
|
if (readonly) return;
|
|
300
297
|
if ($pageNumberInput.value) {
|
|
@@ -329,8 +326,8 @@ function create_footer() {
|
|
|
329
326
|
}
|
|
330
327
|
}
|
|
331
328
|
|
|
332
|
-
function set_page_index(page_index_: number) {
|
|
333
|
-
if (page_index !== page_index_) {
|
|
329
|
+
function set_page_index(page_index_: number, force = false) {
|
|
330
|
+
if (force || page_index !== page_index_) {
|
|
334
331
|
page_index = page_index_;
|
|
335
332
|
$pageNumberInput.value = String(page_index + 1);
|
|
336
333
|
}
|
|
@@ -414,6 +411,8 @@ export class SlideViewer {
|
|
|
414
411
|
const on_new_page_index = (index: number) => {
|
|
415
412
|
if (this._ready && index >= 0 && index < this._slideCount) {
|
|
416
413
|
this.slide.renderSlide(index + 1);
|
|
414
|
+
} else {
|
|
415
|
+
this.setPage(this.slide.slideState.currentSlideIndex);
|
|
417
416
|
}
|
|
418
417
|
};
|
|
419
418
|
this.sidebar.on_new_page_index(on_new_page_index);
|
|
@@ -533,8 +532,8 @@ export class SlideViewer {
|
|
|
533
532
|
}
|
|
534
533
|
|
|
535
534
|
setPage(page: number) {
|
|
536
|
-
this.sidebar.set_page_index(page - 1);
|
|
537
|
-
this.footer.set_page_index(page - 1);
|
|
535
|
+
this.sidebar.set_page_index(page - 1, true);
|
|
536
|
+
this.footer.set_page_index(page - 1, true);
|
|
538
537
|
}
|
|
539
538
|
|
|
540
539
|
private _isFrozen = false;
|
package/src/index.ts
CHANGED
|
@@ -42,7 +42,8 @@ const SlideApp: NetlessApp<Attributes, MagixEvents, AppOptions, void> = {
|
|
|
42
42
|
autoFPS: options.autoFPS ?? true,
|
|
43
43
|
autoResolution: options.autoResolution ?? true,
|
|
44
44
|
resolution: options.resolution,
|
|
45
|
-
|
|
45
|
+
maxResolutionLevel: options.maxResolutionLevel,
|
|
46
|
+
transactionBgColor: options.transactionBgColor || make_bg_color(context.box.$content),
|
|
46
47
|
},
|
|
47
48
|
|
|
48
49
|
taskId: context.storage.state.taskId,
|
package/src/style.scss
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
@import "./fancy-scrollbar.scss";
|
|
2
2
|
|
|
3
|
+
@mixin no-user-select {
|
|
4
|
+
-webkit-touch-callout: none;
|
|
5
|
+
-webkit-user-select: none;
|
|
6
|
+
-moz-user-select: none;
|
|
7
|
+
-ms-user-select: none;
|
|
8
|
+
user-select: none;
|
|
9
|
+
}
|
|
10
|
+
|
|
3
11
|
$namespace: "netless-app-slide";
|
|
4
12
|
|
|
5
13
|
.#{$namespace}-content {
|
|
@@ -11,6 +19,7 @@ $namespace: "netless-app-slide";
|
|
|
11
19
|
.#{$namespace}-slide {
|
|
12
20
|
width: 100%;
|
|
13
21
|
height: 100%;
|
|
22
|
+
@include no-user-select;
|
|
14
23
|
}
|
|
15
24
|
|
|
16
25
|
.#{$namespace}-preview-mask {
|
|
@@ -39,6 +48,7 @@ $namespace: "netless-app-slide";
|
|
|
39
48
|
background: rgba(237, 237, 240, 0.9);
|
|
40
49
|
box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.11);
|
|
41
50
|
transition: transform 0.4s;
|
|
51
|
+
@include no-user-select;
|
|
42
52
|
}
|
|
43
53
|
|
|
44
54
|
.#{$namespace}-preview-active {
|
|
@@ -62,7 +72,7 @@ $namespace: "netless-app-slide";
|
|
|
62
72
|
border: 7px solid transparent;
|
|
63
73
|
border-radius: 4px;
|
|
64
74
|
transition: border-color 0.3s;
|
|
65
|
-
user-select
|
|
75
|
+
@include no-user-select;
|
|
66
76
|
|
|
67
77
|
&:hover,
|
|
68
78
|
&.#{$namespace}-preview-page-active {
|
|
@@ -88,7 +98,7 @@ $namespace: "netless-app-slide";
|
|
|
88
98
|
text-align: right;
|
|
89
99
|
font-size: 12px;
|
|
90
100
|
color: #5f5f5f;
|
|
91
|
-
user-select
|
|
101
|
+
@include no-user-select;
|
|
92
102
|
}
|
|
93
103
|
|
|
94
104
|
.#{$namespace}-footer {
|
|
@@ -127,7 +137,7 @@ $namespace: "netless-app-slide";
|
|
|
127
137
|
background: transparent;
|
|
128
138
|
transition: background 0.4s;
|
|
129
139
|
cursor: pointer;
|
|
130
|
-
user-select
|
|
140
|
+
@include no-user-select;
|
|
131
141
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
132
142
|
|
|
133
143
|
&:hover {
|
|
@@ -177,7 +187,7 @@ $namespace: "netless-app-slide";
|
|
|
177
187
|
height: 26px;
|
|
178
188
|
margin-left: auto;
|
|
179
189
|
font-size: 13px;
|
|
180
|
-
user-select
|
|
190
|
+
@include no-user-select;
|
|
181
191
|
white-space: nowrap;
|
|
182
192
|
word-break: keep-all;
|
|
183
193
|
font-variant-numeric: tabular-nums;
|
|
@@ -200,13 +210,13 @@ $namespace: "netless-app-slide";
|
|
|
200
210
|
sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
201
211
|
background: transparent;
|
|
202
212
|
transition: background 0.4s;
|
|
203
|
-
user-select: text;
|
|
204
213
|
font-variant-numeric: tabular-nums;
|
|
205
214
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
206
215
|
|
|
207
216
|
&:hover,
|
|
208
217
|
&:focus,
|
|
209
218
|
&:active {
|
|
219
|
+
user-select: text;
|
|
210
220
|
background: #fff;
|
|
211
221
|
box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;
|
|
212
222
|
}
|
package/src/typings.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Slide, SLIDE_EVENTS, SyncEvent } from "@netless/slide";
|
|
1
|
+
import type { ISlideRenderOptions, Slide, SLIDE_EVENTS, SyncEvent } from "@netless/slide";
|
|
2
2
|
import type { RegisterParams } from "@netless/window-manager";
|
|
3
3
|
|
|
4
4
|
export type SlideState = Slide["slideState"];
|
|
@@ -18,19 +18,6 @@ export interface MagixEvents {
|
|
|
18
18
|
[SLIDE_EVENTS.syncDispatch]: SyncEvent;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export interface AppOptions {
|
|
22
|
-
/** show debug controller */
|
|
21
|
+
export interface AppOptions extends ISlideRenderOptions {
|
|
23
22
|
debug?: boolean;
|
|
24
|
-
/** scale */
|
|
25
|
-
resolution?: number;
|
|
26
|
-
/** background color for slide animations */
|
|
27
|
-
bgColor?: string;
|
|
28
|
-
/** minimal fps (default: 25) */
|
|
29
|
-
minFPS?: number;
|
|
30
|
-
/** maximal fps (default: 30) */
|
|
31
|
-
maxFPS?: number;
|
|
32
|
-
/** automatically decrease fps (default: true) */
|
|
33
|
-
autoFPS?: boolean;
|
|
34
|
-
/** whether to re-scale automatically (default: true) */
|
|
35
|
-
autoResolution?: boolean;
|
|
36
23
|
}
|