@netless/app-slide 0.2.39 → 0.2.40

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.
@@ -1,228 +1,228 @@
1
- @import "./variables.scss";
2
-
3
- $namespace: $slide-namespace;
4
-
5
- .#{$namespace}-content {
6
- position: relative;
7
- height: 100%;
8
- overflow: hidden;
9
- }
10
-
11
- .#{$namespace}-preview-mask {
12
- display: none;
13
- position: absolute;
14
- z-index: 200;
15
- top: 0;
16
- left: 0;
17
- width: 100%;
18
- height: 100%;
19
- }
20
-
21
- .#{$namespace}-preview {
22
- display: flex;
23
- flex-direction: column;
24
- align-items: center;
25
- position: absolute;
26
- z-index: 300;
27
- top: 0;
28
- left: 0;
29
- width: 33%;
30
- max-width: 200px;
31
- height: 100%;
32
- padding-top: 10px;
33
- transform: translateX(-100%);
34
- background: rgba(237, 237, 240, 0.9);
35
- box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.11);
36
- transition: transform 0.4s;
37
- }
38
-
39
- .#{$namespace}-preview-active {
40
- .#{$namespace}-preview-mask {
41
- display: block;
42
- }
43
-
44
- .#{$namespace}-preview {
45
- transform: translateX(0);
46
- }
47
- }
48
-
49
- .#{$namespace}-preview-page {
50
- position: relative;
51
- display: block;
52
- width: 55%;
53
- margin-bottom: 10px;
54
- font-size: 0;
55
- color: transparent;
56
- outline: none;
57
- border: 7px solid transparent;
58
- border-radius: 4px;
59
- transition: border-color 0.3s;
60
- user-select: none;
61
-
62
- &:hover,
63
- &.#{$namespace}-preview-page-active {
64
- border-color: rgba(68, 78, 96, 0.1);
65
- }
66
-
67
- & > img {
68
- width: 100%;
69
- height: auto;
70
- box-sizing: border-box;
71
- border: 1px solid rgba(0, 0, 0, 0.5);
72
- border-radius: 1px;
73
- background-color: rgba(255, 255, 255, 1);
74
- box-shadow: 0 2px 8px rgb(0 0 0 / 30%);
75
- }
76
- }
77
-
78
- .#{$namespace}-preview-page-name {
79
- position: absolute;
80
- top: 1px;
81
- left: -10px;
82
- transform: translate(-100%);
83
- text-align: right;
84
- font-size: 12px;
85
- color: #5f5f5f;
86
- user-select: none;
87
- }
88
-
89
- .#{$namespace}-footer {
90
- box-sizing: border-box;
91
- height: 26px;
92
- display: flex;
93
- align-items: center;
94
- padding: 0 16px;
95
- border-top: 1px solid #eeeef7;
96
- color: #191919;
97
- }
98
-
99
- .#{$namespace}-float-footer {
100
- width: 100%;
101
- min-height: 26px;
102
- position: absolute;
103
- left: 0;
104
- bottom: 0;
105
- z-index: 2000;
106
- background: rgba(249, 249, 252, 0.9);
107
- transition: opacity 0.4s;
108
- }
109
-
110
- .#{$namespace}-footer-btn {
111
- box-sizing: border-box;
112
- width: 26px;
113
- height: 26px;
114
- font-size: 0;
115
- margin: 0;
116
- padding: 3px;
117
- border: none;
118
- border-radius: 1px;
119
- outline: none;
120
- color: currentColor;
121
- background: transparent;
122
- transition: background 0.4s;
123
- cursor: pointer;
124
- user-select: none;
125
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
126
-
127
- &:hover {
128
- background: rgba(237, 237, 240, 0.9);
129
- }
130
-
131
- @media (hover: none) {
132
- &:hover {
133
- background: transparent !important;
134
- }
135
- }
136
-
137
- & > svg {
138
- width: 100%;
139
- height: 100%;
140
- }
141
-
142
- & > svg:nth-of-type(2) {
143
- display: none;
144
- }
145
-
146
- &.#{$namespace}-footer-btn-playing {
147
- & > svg:nth-of-type(1) {
148
- display: none;
149
- }
150
-
151
- & > svg:nth-of-type(2) {
152
- display: initial;
153
- }
154
- }
155
-
156
- & ~ & {
157
- margin-left: 15px;
158
- }
159
- }
160
-
161
- .#{$namespace}-page-jumps {
162
- flex: 1;
163
- display: flex;
164
- justify-content: center;
165
- align-items: center;
166
- }
167
-
168
- .#{$namespace}-page-number {
169
- margin-left: auto;
170
- font-size: 13px;
171
- user-select: none;
172
- white-space: nowrap;
173
- word-break: keep-all;
174
- }
175
-
176
- .#{$namespace}-page-number-input {
177
- border: none;
178
- outline: none;
179
- width: 3em;
180
- margin: 0;
181
- padding: 0 2px;
182
- text-align: right;
183
- font-size: 13px;
184
- line-height: 1;
185
- font-weight: normal;
186
- font-family: inherit;
187
- border-radius: 2px;
188
- color: currentColor;
189
- background: transparent;
190
- transition: background 0.4s;
191
- user-select: text;
192
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
193
-
194
- &:hover,
195
- &:focus,
196
- &:active {
197
- background: #fff;
198
- box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;
199
- }
200
- }
201
-
202
- .#{$namespace}-readonly {
203
- &.#{$namespace}-footer {
204
- display: none;
205
- }
206
- }
207
-
208
- .telebox-color-scheme-dark {
209
- .#{$namespace}-page-number-input {
210
- color: #a6a6a8;
211
- }
212
- .#{$namespace}-page-number-input:active,
213
- .#{$namespace}-page-number-input:focus,
214
- .#{$namespace}-page-number-input:hover {
215
- color: #222;
216
- }
217
- .#{$namespace}-footer {
218
- color: #a6a6a8;
219
- background: #2d2d33;
220
- border-top: none;
221
- }
222
- .#{$namespace}-footer-btn:hover {
223
- background: #212126;
224
- }
225
- .#{$namespace}-preview {
226
- background: rgba(50, 50, 50, 0.9);
227
- }
228
- }
1
+ @import "./variables.scss";
2
+
3
+ $namespace: $slide-namespace;
4
+
5
+ .#{$namespace}-content {
6
+ position: relative;
7
+ height: 100%;
8
+ overflow: hidden;
9
+ }
10
+
11
+ .#{$namespace}-preview-mask {
12
+ display: none;
13
+ position: absolute;
14
+ z-index: 200;
15
+ top: 0;
16
+ left: 0;
17
+ width: 100%;
18
+ height: 100%;
19
+ }
20
+
21
+ .#{$namespace}-preview {
22
+ display: flex;
23
+ flex-direction: column;
24
+ align-items: center;
25
+ position: absolute;
26
+ z-index: 300;
27
+ top: 0;
28
+ left: 0;
29
+ width: 33%;
30
+ max-width: 200px;
31
+ height: 100%;
32
+ padding-top: 10px;
33
+ transform: translateX(-100%);
34
+ background: rgba(237, 237, 240, 0.9);
35
+ box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.11);
36
+ transition: transform 0.4s;
37
+ }
38
+
39
+ .#{$namespace}-preview-active {
40
+ .#{$namespace}-preview-mask {
41
+ display: block;
42
+ }
43
+
44
+ .#{$namespace}-preview {
45
+ transform: translateX(0);
46
+ }
47
+ }
48
+
49
+ .#{$namespace}-preview-page {
50
+ position: relative;
51
+ display: block;
52
+ width: 55%;
53
+ margin-bottom: 10px;
54
+ font-size: 0;
55
+ color: transparent;
56
+ outline: none;
57
+ border: 7px solid transparent;
58
+ border-radius: 4px;
59
+ transition: border-color 0.3s;
60
+ user-select: none;
61
+
62
+ &:hover,
63
+ &.#{$namespace}-preview-page-active {
64
+ border-color: rgba(68, 78, 96, 0.1);
65
+ }
66
+
67
+ & > img {
68
+ width: 100%;
69
+ height: auto;
70
+ box-sizing: border-box;
71
+ border: 1px solid rgba(0, 0, 0, 0.5);
72
+ border-radius: 1px;
73
+ background-color: rgba(255, 255, 255, 1);
74
+ box-shadow: 0 2px 8px rgb(0 0 0 / 30%);
75
+ }
76
+ }
77
+
78
+ .#{$namespace}-preview-page-name {
79
+ position: absolute;
80
+ top: 1px;
81
+ left: -10px;
82
+ transform: translate(-100%);
83
+ text-align: right;
84
+ font-size: 12px;
85
+ color: #5f5f5f;
86
+ user-select: none;
87
+ }
88
+
89
+ .#{$namespace}-footer {
90
+ box-sizing: border-box;
91
+ height: 26px;
92
+ display: flex;
93
+ align-items: center;
94
+ padding: 0 16px;
95
+ border-top: 1px solid #eeeef7;
96
+ color: #191919;
97
+ }
98
+
99
+ .#{$namespace}-float-footer {
100
+ width: 100%;
101
+ min-height: 26px;
102
+ position: absolute;
103
+ left: 0;
104
+ bottom: 0;
105
+ z-index: 2000;
106
+ background: rgba(249, 249, 252, 0.9);
107
+ transition: opacity 0.4s;
108
+ }
109
+
110
+ .#{$namespace}-footer-btn {
111
+ box-sizing: border-box;
112
+ width: 26px;
113
+ height: 26px;
114
+ font-size: 0;
115
+ margin: 0;
116
+ padding: 3px;
117
+ border: none;
118
+ border-radius: 1px;
119
+ outline: none;
120
+ color: currentColor;
121
+ background: transparent;
122
+ transition: background 0.4s;
123
+ cursor: pointer;
124
+ user-select: none;
125
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
126
+
127
+ &:hover {
128
+ background: rgba(237, 237, 240, 0.9);
129
+ }
130
+
131
+ @media (hover: none) {
132
+ &:hover {
133
+ background: transparent !important;
134
+ }
135
+ }
136
+
137
+ & > svg {
138
+ width: 100%;
139
+ height: 100%;
140
+ }
141
+
142
+ & > svg:nth-of-type(2) {
143
+ display: none;
144
+ }
145
+
146
+ &.#{$namespace}-footer-btn-playing {
147
+ & > svg:nth-of-type(1) {
148
+ display: none;
149
+ }
150
+
151
+ & > svg:nth-of-type(2) {
152
+ display: initial;
153
+ }
154
+ }
155
+
156
+ & ~ & {
157
+ margin-left: 15px;
158
+ }
159
+ }
160
+
161
+ .#{$namespace}-page-jumps {
162
+ flex: 1;
163
+ display: flex;
164
+ justify-content: center;
165
+ align-items: center;
166
+ }
167
+
168
+ .#{$namespace}-page-number {
169
+ margin-left: auto;
170
+ font-size: 13px;
171
+ user-select: none;
172
+ white-space: nowrap;
173
+ word-break: keep-all;
174
+ }
175
+
176
+ .#{$namespace}-page-number-input {
177
+ border: none;
178
+ outline: none;
179
+ width: 3em;
180
+ margin: 0;
181
+ padding: 0 2px;
182
+ text-align: right;
183
+ font-size: 13px;
184
+ line-height: 1;
185
+ font-weight: normal;
186
+ font-family: inherit;
187
+ border-radius: 2px;
188
+ color: currentColor;
189
+ background: transparent;
190
+ transition: background 0.4s;
191
+ user-select: text;
192
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
193
+
194
+ &:hover,
195
+ &:focus,
196
+ &:active {
197
+ background: #fff;
198
+ box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;
199
+ }
200
+ }
201
+
202
+ .#{$namespace}-readonly {
203
+ &.#{$namespace}-footer {
204
+ display: none;
205
+ }
206
+ }
207
+
208
+ .telebox-color-scheme-dark {
209
+ .#{$namespace}-page-number-input {
210
+ color: #a6a6a8;
211
+ }
212
+ .#{$namespace}-page-number-input:active,
213
+ .#{$namespace}-page-number-input:focus,
214
+ .#{$namespace}-page-number-input:hover {
215
+ color: #222;
216
+ }
217
+ .#{$namespace}-footer {
218
+ color: #a6a6a8;
219
+ background: #2d2d33;
220
+ border-top: none;
221
+ }
222
+ .#{$namespace}-footer-btn:hover {
223
+ background: #212126;
224
+ }
225
+ .#{$namespace}-preview {
226
+ background: rgba(50, 50, 50, 0.9);
227
+ }
228
+ }
@@ -1 +1 @@
1
- $slide-namespace: "netless-app-slide";
1
+ $slide-namespace: "netless-app-slide";
@@ -1,48 +1,48 @@
1
- import type { AppContext, Room } from "@netless/window-manager";
2
- import type { ScenePathType } from "white-web-sdk";
3
- import type { Slide } from "@netless/slide";
4
- import type { DocsViewerPage } from "../DocsViewer";
5
- import type { Attributes } from "../typings";
6
-
7
- export function createDocsViewerPages(slide: Slide): DocsViewerPage[] {
8
- const { width, height, slideCount, slideState } = slide;
9
- const { taskId, url } = slideState;
10
- const pages: DocsViewerPage[] = [];
11
- for (let i = 1; i <= slideCount; ++i) {
12
- pages.push({ width, height, thumbnail: `${url}/${taskId}/preview/${i}.png`, src: "ppt" });
13
- }
14
- return pages;
15
- }
16
-
17
- // because `renderSlide()` is slow, but switching between scenes in whiteboard is fast
18
- // so here we make scenes sync with slide page
19
- export function syncSceneWithSlide(
20
- room: Room,
21
- context: AppContext<Attributes>,
22
- slide: Slide,
23
- baseScenePath: string
24
- ) {
25
- const page = slide.slideState.currentSlideIndex;
26
- if (!(page > 0) || !context.getIsWritable()) return;
27
-
28
- const scenePath = [baseScenePath, page].join("/");
29
-
30
- if (room.scenePathType(scenePath) !== ("page" as ScenePathType.Page)) {
31
- room.removeScenes(baseScenePath);
32
- const count = slide.slideCount;
33
- const scenes: { name: string }[] = [];
34
- for (let i = 1; i <= count; ++i) scenes.push({ name: `${i}` });
35
- room.putScenes(baseScenePath, scenes);
36
- }
37
-
38
- let currentScenePath: string;
39
- if (context.getBox().focus) {
40
- currentScenePath = room.state.sceneState.scenePath;
41
- } else {
42
- currentScenePath = context.getView()?.focusScenePath || "";
43
- }
44
-
45
- if (currentScenePath !== scenePath) {
46
- context.setScenePath(scenePath);
47
- }
48
- }
1
+ import type { AppContext, Room } from "@netless/window-manager";
2
+ import type { ScenePathType } from "white-web-sdk";
3
+ import type { Slide } from "@netless/slide";
4
+ import type { DocsViewerPage } from "../DocsViewer";
5
+ import type { Attributes } from "../typings";
6
+
7
+ export function createDocsViewerPages(slide: Slide): DocsViewerPage[] {
8
+ const { width, height, slideCount, slideState } = slide;
9
+ const { taskId, url } = slideState;
10
+ const pages: DocsViewerPage[] = [];
11
+ for (let i = 1; i <= slideCount; ++i) {
12
+ pages.push({ width, height, thumbnail: `${url}/${taskId}/preview/${i}.png`, src: "ppt" });
13
+ }
14
+ return pages;
15
+ }
16
+
17
+ // because `renderSlide()` is slow, but switching between scenes in whiteboard is fast
18
+ // so here we make scenes sync with slide page
19
+ export function syncSceneWithSlide(
20
+ room: Room,
21
+ context: AppContext<Attributes>,
22
+ slide: Slide,
23
+ baseScenePath: string
24
+ ) {
25
+ const page = slide.slideState.currentSlideIndex;
26
+ if (!(page > 0) || !context.getIsWritable()) return;
27
+
28
+ const scenePath = [baseScenePath, page].join("/");
29
+
30
+ if (room.scenePathType(scenePath) !== ("page" as ScenePathType.Page)) {
31
+ room.removeScenes(baseScenePath);
32
+ const count = slide.slideCount;
33
+ const scenes: { name: string }[] = [];
34
+ for (let i = 1; i <= count; ++i) scenes.push({ name: `${i}` });
35
+ room.putScenes(baseScenePath, scenes);
36
+ }
37
+
38
+ let currentScenePath: string;
39
+ if (context.getBox().focus) {
40
+ currentScenePath = room.state.sceneState.scenePath;
41
+ } else {
42
+ currentScenePath = context.getView()?.focusScenePath || "";
43
+ }
44
+
45
+ if (currentScenePath !== scenePath) {
46
+ context.setScenePath(scenePath);
47
+ }
48
+ }