@arcblock/ux 0.78.26 → 1.6.60

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.
Files changed (174) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +0 -56
  3. package/lib/ActionButton/index.js +6 -4
  4. package/lib/ActivityIndicator/index.js +75 -23
  5. package/lib/Alert/index.js +15 -11
  6. package/lib/Async/index.js +1 -1
  7. package/lib/Badge/index.js +17 -15
  8. package/lib/Blocklet/index.js +261 -0
  9. package/lib/Button/wrap.js +96 -43
  10. package/lib/ButtonGroup/index.js +3 -16
  11. package/lib/Center/index.js +30 -4
  12. package/lib/ClickToCopy/index.js +10 -8
  13. package/lib/CodeBlock/index.js +40 -13
  14. package/lib/Colors/index.js +15 -0
  15. package/lib/Colors/themes/default.js +85 -0
  16. package/lib/ContactForm/index.js +9 -10
  17. package/lib/CookieConsent/index.js +98 -0
  18. package/lib/CountDown/index.js +18 -14
  19. package/lib/Dialog/confirm.js +84 -0
  20. package/lib/Dialog/dialog.js +137 -0
  21. package/lib/Dialog/index.js +23 -0
  22. package/lib/Earth/index.js +33 -33
  23. package/lib/Empty/index.js +61 -0
  24. package/lib/Footer/index.js +16 -18
  25. package/lib/Icon/image.js +10 -13
  26. package/lib/Icon/index.js +10 -8
  27. package/lib/Img/index.js +212 -0
  28. package/lib/InfoRow/index.js +7 -6
  29. package/lib/Layout/dashboard/header.js +60 -42
  30. package/lib/Layout/dashboard/index.js +72 -60
  31. package/lib/Layout/dashboard/sidebar.js +41 -25
  32. package/lib/Layout/index.js +113 -51
  33. package/lib/Locale/browser-lang.js +0 -2
  34. package/lib/Locale/context.js +85 -61
  35. package/lib/Locale/selector.js +33 -20
  36. package/lib/Logo/index.js +15 -13
  37. package/lib/Metric/index.js +5 -6
  38. package/lib/NFTDisplay/README.md +59 -0
  39. package/lib/NFTDisplay/aspect-ratio-container.js +52 -0
  40. package/lib/NFTDisplay/broken.js +25 -0
  41. package/lib/NFTDisplay/index.js +317 -0
  42. package/lib/NFTDisplay/loading.js +23 -0
  43. package/lib/NFTDisplay/svg-embedder/img.js +68 -0
  44. package/lib/NFTDisplay/svg-embedder/inline-svg.js +54 -0
  45. package/lib/PageScroller/index.js +10 -11
  46. package/lib/PageScroller/usePrevValue.js +2 -2
  47. package/lib/PricingTable/PricingPlan.js +12 -15
  48. package/lib/PricingTable/index.js +5 -5
  49. package/lib/QRCode/index.js +89 -0
  50. package/lib/Result/common.js +176 -0
  51. package/lib/Result/index.js +61 -0
  52. package/lib/Result/result.js +69 -0
  53. package/lib/Result/translations.js +61 -0
  54. package/lib/Screenshot/index.js +14 -13
  55. package/lib/Spinner/index.js +37 -0
  56. package/lib/SplitButton/index.js +126 -0
  57. package/lib/Switch/index.js +107 -0
  58. package/lib/Tabs/index.js +24 -47
  59. package/lib/Tag/index.js +15 -13
  60. package/lib/Terminal/Player.js +43 -45
  61. package/lib/Terminal/index.js +3 -1
  62. package/lib/Terminal/util.js +2 -3
  63. package/lib/TextCollapse/index.js +21 -14
  64. package/lib/Theme/index.js +79 -63
  65. package/lib/Theme/responsiveFontSizes.js +8 -8
  66. package/lib/Toast/index.js +12 -11
  67. package/lib/Util/index.js +197 -26
  68. package/lib/Video/index.js +8 -11
  69. package/lib/Wallet/Action.js +15 -13
  70. package/lib/Wallet/Download.js +60 -58
  71. package/lib/Wallet/Open.js +2 -2
  72. package/lib/WechatPrompt/index.js +10 -10
  73. package/lib/index.js +6 -6
  74. package/lib/withTheme/index.js +5 -17
  75. package/lib/withTracker/error_boundary.js +3 -3
  76. package/lib/withTracker/index.js +6 -7
  77. package/package.json +23 -17
  78. package/src/ActionButton/index.js +65 -0
  79. package/src/ActivityIndicator/index.js +141 -0
  80. package/src/Alert/index.js +104 -0
  81. package/src/Async/index.js +39 -0
  82. package/src/Badge/index.js +71 -0
  83. package/src/Blocklet/index.js +424 -0
  84. package/src/Button/index.js +4 -0
  85. package/src/Button/wrap.js +101 -0
  86. package/src/ButtonGroup/index.js +6 -0
  87. package/src/Center/index.js +40 -0
  88. package/src/ClickToCopy/index.js +90 -0
  89. package/src/CodeBlock/index.js +160 -0
  90. package/src/Colors/index.js +1 -0
  91. package/src/Colors/themes/default.js +54 -0
  92. package/src/ContactForm/index.js +240 -0
  93. package/src/CookieConsent/index.js +90 -0
  94. package/src/CountDown/index.js +151 -0
  95. package/src/Dialog/confirm.js +76 -0
  96. package/src/Dialog/dialog.js +162 -0
  97. package/src/Dialog/index.js +2 -0
  98. package/src/DriftBot/index.js +81 -0
  99. package/src/Earth/countries.json +8057 -0
  100. package/src/Earth/index.js +511 -0
  101. package/src/Earth/util.js +69 -0
  102. package/src/Empty/index.js +41 -0
  103. package/src/Footer/index.js +110 -0
  104. package/src/Icon/image.js +55 -0
  105. package/src/Icon/index.js +69 -0
  106. package/src/Img/index.js +172 -0
  107. package/src/InfoRow/index.js +83 -0
  108. package/src/Layout/dashboard/header.js +157 -0
  109. package/src/Layout/dashboard/index.js +150 -0
  110. package/src/Layout/dashboard/sidebar.js +122 -0
  111. package/src/Layout/index.js +318 -0
  112. package/src/Locale/browser-lang.js +63 -0
  113. package/src/Locale/context.js +94 -0
  114. package/src/Locale/images/globe-dark.png +0 -0
  115. package/src/Locale/images/globe-light.png +0 -0
  116. package/src/Locale/selector.js +135 -0
  117. package/src/Logo/images/logo-dark-text.svg +3 -0
  118. package/src/Logo/images/logo-dark-top.svg +6 -0
  119. package/src/Logo/images/logo-light-text.svg +3 -0
  120. package/src/Logo/images/logo-light-top.svg +6 -0
  121. package/src/Logo/index.js +47 -0
  122. package/src/Metric/index.js +115 -0
  123. package/src/NFTDisplay/README.md +59 -0
  124. package/src/NFTDisplay/aspect-ratio-container.js +34 -0
  125. package/src/NFTDisplay/broken.js +18 -0
  126. package/src/NFTDisplay/index.js +257 -0
  127. package/src/NFTDisplay/loading.js +17 -0
  128. package/src/NFTDisplay/svg-embedder/img.js +36 -0
  129. package/src/NFTDisplay/svg-embedder/inline-svg.js +37 -0
  130. package/src/PageScroller/index.js +342 -0
  131. package/src/PageScroller/usePrevValue.js +12 -0
  132. package/src/PricingTable/PricingPlan.js +112 -0
  133. package/src/PricingTable/index.js +43 -0
  134. package/src/QRCode/index.js +56 -0
  135. package/src/Result/common.js +116 -0
  136. package/src/Result/index.js +31 -0
  137. package/src/Result/result.js +57 -0
  138. package/src/Result/translations.js +56 -0
  139. package/src/Screenshot/devices.css +1366 -0
  140. package/src/Screenshot/index.js +181 -0
  141. package/src/Spinner/index.js +19 -0
  142. package/src/SplitButton/index.js +112 -0
  143. package/src/Switch/index.js +78 -0
  144. package/src/Tabs/index.js +46 -0
  145. package/src/Tag/index.js +73 -0
  146. package/src/Terminal/Player.js +364 -0
  147. package/src/Terminal/index.js +150 -0
  148. package/src/Terminal/player.css +378 -0
  149. package/src/Terminal/util.js +167 -0
  150. package/src/Terminal/xterm.css +171 -0
  151. package/src/TextCollapse/index.js +92 -0
  152. package/src/Theme/index.js +184 -0
  153. package/src/Theme/responsiveFontSizes.js +94 -0
  154. package/src/Toast/index.js +118 -0
  155. package/src/Util/index.js +281 -0
  156. package/src/Video/index.js +72 -0
  157. package/src/Wallet/Action.js +105 -0
  158. package/src/Wallet/Download.js +130 -0
  159. package/src/Wallet/Open.js +50 -0
  160. package/src/Wallet/images/abtwallet.png +0 -0
  161. package/src/Wallet/images/android_download.svg +23 -0
  162. package/src/Wallet/images/app-store.svg +20 -0
  163. package/src/Wallet/images/google-play.svg +70 -0
  164. package/src/WechatPrompt/images/android.png +0 -0
  165. package/src/WechatPrompt/images/ios.png +0 -0
  166. package/src/WechatPrompt/index.js +81 -0
  167. package/src/index.js +63 -0
  168. package/src/withTheme/index.js +72 -0
  169. package/src/withTracker/README.md +34 -0
  170. package/src/withTracker/error_boundary.js +34 -0
  171. package/src/withTracker/index.js +70 -0
  172. package/lib/GraphQLPlayground/graphiql.css +0 -1850
  173. package/lib/GraphQLPlayground/index.js +0 -302
  174. package/lib/GraphQLPlayground/util.js +0 -55
@@ -0,0 +1,378 @@
1
+ .terminal-player,
2
+ .terminal {
3
+ display: inline-block;
4
+ }
5
+
6
+ .terminal .xterm .xterm-viewport {
7
+ overflow-y: hidden !important;
8
+ }
9
+
10
+ .terminal-frame {
11
+ position: relative;
12
+ }
13
+
14
+ /*//// [ Reset ] ////*/
15
+
16
+ .terminal div {
17
+ margin: 0;
18
+ padding: 0;
19
+ border: 0;
20
+ outline: 0;
21
+ font-weight: inherit;
22
+ font-style: inherit;
23
+ font-size: 100%;
24
+ font-family: inherit;
25
+ vertical-align: baseline;
26
+ }
27
+
28
+ /*//// [ Window ] ////*/
29
+
30
+ .terminal-frame.terminal-window {
31
+ -moz-border-radius: 6px;
32
+ -webkit-border-radius: 6px;
33
+ border-radius: 6px;
34
+ border: 1px solid #b3b3b3;
35
+ box-shadow: 0px 0px 18px #b3b3b3;
36
+ margin: 18px;
37
+ overflow: hidden;
38
+ }
39
+
40
+ .terminal-frame.terminal-window .terminal-titlebar {
41
+ -moz-border-top-left-radius: 6px;
42
+ -moz-border-top-right-radius: 6px;
43
+ -webkit-border-top-left-radius: 6px;
44
+ -webkit-border-top-right-radius: 6px;
45
+ background: #e8e8e8;
46
+ border-bottom: 1px solid #b1aeb1;
47
+ border-top-left-radius: 6px;
48
+ border-top-right-radius: 6px;
49
+ border-top: 1px solid #f3f1f3;
50
+ color: #3b4247;
51
+ font-family: Arial, sans-serif;
52
+ font-size: 14px;
53
+ height: 22px;
54
+ line-height: 22px;
55
+ position: relative;
56
+ text-align: center;
57
+ width: 100%;
58
+ }
59
+
60
+ .terminal-frame.terminal-window .terminal-titlebar .buttons {
61
+ left: 8px;
62
+ line-height: 0px;
63
+ position: absolute;
64
+ top: 3.5px;
65
+ }
66
+
67
+ .terminal-frame.terminal-window .terminal-titlebar .close-button {
68
+ -moz-border-radius: 50%;
69
+ -webkit-border-radius: 50%;
70
+ background: #ff5c5c;
71
+ border-radius: 50%;
72
+ border: 1px solid #e33e41;
73
+ display: inline-block;
74
+ height: 12px;
75
+ width: 12px;
76
+ }
77
+
78
+ .terminal-frame.terminal-window .terminal-titlebar .minimize-button {
79
+ -moz-border-radius: 50%;
80
+ -webkit-border-radius: 50%;
81
+ background: #ffbd4c;
82
+ border-radius: 50%;
83
+ border: 1px solid #e09e3e;
84
+ display: inline-block;
85
+ height: 12px;
86
+ margin-left: 4px;
87
+ width: 12px;
88
+ }
89
+
90
+ .terminal-frame.terminal-window .terminal-titlebar .maximize-button {
91
+ -moz-border-radius: 50%;
92
+ -webkit-border-radius: 50%;
93
+ background: #00ca56;
94
+ border-radius: 50%;
95
+ border: 1px solid #14ae46;
96
+ display: inline-block;
97
+ height: 12px;
98
+ margin-left: 4px;
99
+ width: 12px;
100
+ }
101
+
102
+ .terminal-frame.terminal-window .terminal-body {
103
+ background-color: #1d1d1d;
104
+ padding: 10px;
105
+ }
106
+
107
+ /*//// [ Floating ] ////*/
108
+
109
+ .terminal-frame.terminal-floating {
110
+ -moz-border-radius: 6px;
111
+ -webkit-border-radius: 6px;
112
+ background-color: #1d1d1d;
113
+ border-radius: 6px;
114
+ box-shadow: 0px 0px 18px #b3b3b3;
115
+ margin: 18px;
116
+ overflow: hidden;
117
+ }
118
+
119
+ .terminal-frame.terminal-floating .terminal-titlebar {
120
+ color: white;
121
+ font-family: Arial, sans-serif;
122
+ font-size: 14px;
123
+ height: 34px;
124
+ line-height: 34px;
125
+ position: relative;
126
+ text-align: center;
127
+ width: 100%;
128
+ }
129
+
130
+ .terminal-frame.terminal-floating .terminal-titlebar .buttons {
131
+ left: 13px;
132
+ line-height: 0px;
133
+ position: absolute;
134
+ top: 9px;
135
+ }
136
+
137
+ .terminal-frame.terminal-floating .terminal-titlebar .close-button {
138
+ -moz-border-radius: 50%;
139
+ -webkit-border-radius: 50%;
140
+ background: #ff5c5c;
141
+ border-radius: 50%;
142
+ display: inline-block;
143
+ height: 15px;
144
+ width: 15px;
145
+ }
146
+
147
+ .terminal-frame.terminal-floating .terminal-titlebar .minimize-button {
148
+ -moz-border-radius: 50%;
149
+ -webkit-border-radius: 50%;
150
+ background: #ffbd4c;
151
+ border-radius: 50%;
152
+ display: inline-block;
153
+ height: 15px;
154
+ line-height: 10px;
155
+ margin-left: 4px;
156
+ width: 15px;
157
+ }
158
+
159
+ .terminal-frame.terminal-floating .terminal-titlebar .maximize-button {
160
+ -moz-border-radius: 50%;
161
+ -webkit-border-radius: 50%;
162
+ background: #00ca56;
163
+ border-radius: 50%;
164
+ display: inline-block;
165
+ height: 15px;
166
+ line-height: 10px;
167
+ margin-left: 4px;
168
+ width: 15px;
169
+ }
170
+
171
+ .terminal-frame.terminal-floating .terminal-body {
172
+ padding: 20px;
173
+ }
174
+
175
+ /*//// [ Solid ] ////*/
176
+
177
+ .terminal-frame.terminal-solid {
178
+ -moz-border-radius: 6px;
179
+ -webkit-border-radius: 6px;
180
+ background-color: #1d1d1d;
181
+ border-radius: 6px;
182
+ box-shadow: 0px 0px 18px #b3b3b3;
183
+ margin: 18px;
184
+ overflow: hidden;
185
+ }
186
+
187
+ .terminal-frame.terminal-solid .terminal-titlebar {
188
+ color: white;
189
+ font-family: Arial, sans-serif;
190
+ font-size: 14px;
191
+ position: relative;
192
+ text-align: center;
193
+ width: 100%;
194
+ }
195
+
196
+ .terminal-frame.terminal-solid .terminal-titlebar .title {
197
+ margin: 15px 15px 15px;
198
+ }
199
+
200
+ .terminal-frame.terminal-solid .terminal-titlebar .title:empty {
201
+ display: none;
202
+ }
203
+
204
+ .terminal-frame.terminal-solid .terminal-titlebar .buttons {
205
+ display: none;
206
+ }
207
+
208
+ .terminal-frame.terminal-solid .terminal-body {
209
+ padding: 20px;
210
+ }
211
+
212
+ /*//// [ Player ] ////*/
213
+
214
+ .terminal-player {
215
+ position: relative;
216
+ font-size: 0;
217
+ }
218
+
219
+ .terminal-player .controller {
220
+ background: #45484d;
221
+ bottom: 0px;
222
+ display: none;
223
+ font-family: Helvetica, Arial, sans-serif;
224
+ font-size: 12px;
225
+ height: 40px;
226
+ position: absolute;
227
+ width: 100%;
228
+ z-index: 20;
229
+ background: #222222;
230
+ transition: height ease 200ms;
231
+ -webkit-transition: height ease 200ms;
232
+ -moz-transition: height ease 200ms;
233
+ -o-transition: height ease 200ms;
234
+ }
235
+
236
+ .terminal-player.controls .controller {
237
+ display: block;
238
+ }
239
+
240
+ .terminal-player.playing .controller {
241
+ height: 0px;
242
+ overflow: hidden;
243
+ }
244
+
245
+ .terminal-player.playing:hover .controller {
246
+ height: 40px;
247
+ overflow: hidden;
248
+ }
249
+
250
+ .terminal-player .play,
251
+ .terminal-player .pause {
252
+ fill: #cacaca;
253
+ float: left;
254
+ height: 40px;
255
+ line-height: 40px;
256
+ text-align: center;
257
+ width: 40px;
258
+ }
259
+
260
+ .terminal-player .play .icon,
261
+ .terminal-player .pause .icon {
262
+ border-color: transparent transparent transparent #cacaca;
263
+ box-sizing: border-box;
264
+ cursor: pointer;
265
+ display: inline-block;
266
+ height: 15px;
267
+ }
268
+
269
+ .terminal-player .pause .icon {
270
+ border-style: double;
271
+ border-width: 0px 0px 0px 12px;
272
+ margin-top: 11px;
273
+ }
274
+
275
+ .terminal-player .play .icon {
276
+ border-style: solid;
277
+ border-width: 8px 0px 8px 13px;
278
+ margin-top: 10px;
279
+ }
280
+
281
+ .terminal-player .pause {
282
+ display: none;
283
+ }
284
+
285
+ .terminal-player.playing .play {
286
+ display: none;
287
+ }
288
+
289
+ .terminal-player.playing .pause {
290
+ display: inline-block;
291
+ }
292
+
293
+ .terminal-player .timer {
294
+ color: #cacaca;
295
+ float: right;
296
+ line-height: 40px;
297
+ padding: 0 10px;
298
+ }
299
+
300
+ .terminal-player .progressbar-wrapper {
301
+ height: 40px;
302
+ line-height: 38px;
303
+ overflow: hidden;
304
+ }
305
+
306
+ .terminal-player .progressbar {
307
+ background-color: #424242;
308
+ display: inline-block;
309
+ height: 7px;
310
+ overflow: hidden;
311
+ width: 100%;
312
+ border-radius: 10px;
313
+ -moz-border-radius: 10px;
314
+ -webkit-border-radius: 10px;
315
+ }
316
+
317
+ .terminal-player.started .progressbar {
318
+ cursor: pointer;
319
+ }
320
+
321
+ .terminal-player .progress {
322
+ background-color: #cacaca;
323
+ height: 7px;
324
+ position: relative;
325
+ width: 0%;
326
+ }
327
+
328
+ .terminal-player .cover {
329
+ cursor: pointer;
330
+ height: 100%;
331
+ position: absolute;
332
+ width: 100%;
333
+ z-index: 10;
334
+ }
335
+
336
+ .terminal-player .start svg {
337
+ cursor: pointer;
338
+ fill: #eaeaea;
339
+ height: 130px;
340
+ left: 50%;
341
+ margin-left: -65px;
342
+ margin-top: -65px;
343
+ position: absolute;
344
+ top: 50%;
345
+ width: 130px;
346
+ z-index: 20;
347
+ filter: drop-shadow(10px 10px 15px rgba(0, 0, 0, 0.4));
348
+ -webkit-filter: drop-shadow(10px 10px 15px rgba(0, 0, 0, 0.4));
349
+ }
350
+
351
+ .terminal-player.small .start svg {
352
+ height: 60px;
353
+ margin-left: -30px;
354
+ margin-top: -30px;
355
+ width: 60px;
356
+ }
357
+
358
+ .terminal-player.framed .start svg {
359
+ transform: translate(0px, 8px);
360
+ -webkit-transform: translate(0px, 8px);
361
+ -moz-transform: translate(0px, 8px);
362
+ -o-transform: translate(0px, 8px);
363
+ -ms-transform: translate(0px, 8px);
364
+ }
365
+
366
+ .terminal-player .cover:hover + .start svg,
367
+ .terminal-player .start:hover svg {
368
+ fill: white;
369
+ }
370
+
371
+ .terminal-player.started .cover,
372
+ .terminal-player.started .start {
373
+ display: none;
374
+ }
375
+
376
+ .terminal-player .terminal-watermark {
377
+ z-index: 99999;
378
+ }
@@ -0,0 +1,167 @@
1
+ /**
2
+ * Adjust the delays of the frames, considering to the options
3
+ *
4
+ * - frameDelay
5
+ * - Delay between frames in ms
6
+ * - If the value is `auto` use the actual recording delays
7
+ *
8
+ * - maxIdleTime
9
+ * - Maximum delay between frames in ms
10
+ * - Ignored if the `frameDelay` isn't set to `auto`
11
+ * - Set to `auto` to prevnt limiting the max idle time
12
+ *
13
+ * - speedFactor
14
+ * - Multiply the frames delays by this factor
15
+ */
16
+ export const formatFrames = (frames, options) => {
17
+ frames.forEach(x => {
18
+ let { delay } = x;
19
+
20
+ // Adjust the delay according to the options
21
+ if (options.frameDelay !== 'auto') {
22
+ delay = options.frameDelay;
23
+ } else if (options.maxIdleTime !== 'auto' && delay > options.maxIdleTime) {
24
+ delay = options.maxIdleTime;
25
+ }
26
+
27
+ // Apply speedFactor
28
+ delay *= options.speedFactor;
29
+
30
+ // Set the adjusted delay
31
+ x.delay = delay;
32
+ });
33
+
34
+ // Calculate and set the duration, startTime, and endTime for each frame
35
+ let currentTime = 0;
36
+ const framesCount = frames.length;
37
+ frames.forEach((x, index) => {
38
+ // Set the duration (the delay of the next frame)
39
+ // The % is used to take the delay of the first frame
40
+ // as the duration of the last frame
41
+ const duration = frames[(index + 1) % framesCount].delay;
42
+
43
+ // Set timing values for the current frame
44
+ x.duration = duration;
45
+ x.startTime = currentTime;
46
+ x.endTime = currentTime + duration;
47
+
48
+ currentTime += duration;
49
+ });
50
+
51
+ // Total duration
52
+ const totalDuration = frames.reduce((sum, x) => sum + x.delay, 0);
53
+
54
+ return { frames, totalDuration };
55
+ };
56
+
57
+ /**
58
+ * Get the frame's index at a specific time
59
+ */
60
+ export const findFrameAt = (frames, time, fromIndex) => {
61
+ let frame = null;
62
+
63
+ if (typeof fromIndex === 'undefined') {
64
+ // eslint-disable-next-line no-param-reassign
65
+ fromIndex = 0;
66
+ }
67
+
68
+ for (let i = fromIndex; i < frames.length; i++) {
69
+ frame = frames[i];
70
+
71
+ if (frame.startTime <= time && time < frame.endTime) {
72
+ return i;
73
+ }
74
+ }
75
+
76
+ // The endTime of the final frame belongs to it
77
+ if (frame.startTime <= time && time <= frame.endTime) {
78
+ return frames.length - 1;
79
+ }
80
+
81
+ return -1;
82
+ };
83
+
84
+ /**
85
+ * Check if the time belongs to the frame's duration
86
+ *
87
+ * @param {Number} time
88
+ * @param {Number} frameIndex
89
+ * @return {Number}
90
+ */
91
+ export const isFrameAt = (frames, time, frameIndex) => {
92
+ const frame = frames[frameIndex];
93
+
94
+ if (typeof frame === 'undefined') {
95
+ return false;
96
+ }
97
+
98
+ if (frame.startTime <= time && time < frame.endTime) {
99
+ return true;
100
+ }
101
+
102
+ return false;
103
+ };
104
+
105
+ export const formatTime = time => {
106
+ let minutes = Math.floor(time / 60000);
107
+ let seconds = parseInt((time - minutes * 60000) / 1000, 10);
108
+
109
+ if (minutes < 10) {
110
+ minutes = `0${minutes}`;
111
+ }
112
+ if (seconds < 10) {
113
+ seconds = `0${seconds}`;
114
+ }
115
+
116
+ return `${minutes}:${seconds}`;
117
+ };
118
+
119
+ export const getPlayerClass = (options, state) => {
120
+ const playerClass = ['terminal-player'];
121
+ if (options.controls) {
122
+ playerClass.push('controls');
123
+ }
124
+ if (options.frameBox.type) {
125
+ playerClass.push('framed');
126
+ }
127
+ if (options.rows < 10) {
128
+ playerClass.push('small');
129
+ }
130
+ if (state.isStarted) {
131
+ playerClass.push('started');
132
+ }
133
+ if (state.isPlaying) {
134
+ playerClass.push('playing');
135
+ }
136
+
137
+ return playerClass.filter(Boolean).join(' ');
138
+ };
139
+
140
+ export const getFrameClass = options => {
141
+ const frameClass = ['terminal-frame'];
142
+ if (options.frameBox.type) {
143
+ frameClass.push(`terminal-${options.frameBox.type}`);
144
+ }
145
+
146
+ return frameClass.join(' ');
147
+ };
148
+
149
+ export const defaultState = {
150
+ isPlaying: false,
151
+ isStarted: false,
152
+ isRendering: false,
153
+ requireReset: false,
154
+ currentFrame: -1,
155
+ currentTime: 0,
156
+ lastTickTime: null,
157
+ };
158
+
159
+ export const defaultOptions = {
160
+ realTiming: false,
161
+ speedFactor: 1.0,
162
+ controls: true,
163
+ repeat: false,
164
+ autoplay: false,
165
+ thumbnailTime: 999999,
166
+ frameBox: {},
167
+ };
@@ -0,0 +1,171 @@
1
+ /**
2
+ * Copyright (c) 2014 The xterm.js authors. All rights reserved.
3
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
4
+ * https://github.com/chjj/term.js
5
+ * @license MIT
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ *
25
+ * Originally forked from (with the author's permission):
26
+ * Fabrice Bellard's javascript vt100 for jslinux:
27
+ * http://bellard.org/jslinux/
28
+ * Copyright (c) 2011 Fabrice Bellard
29
+ * The original design remains. The terminal itself
30
+ * has been extended to include xterm CSI codes, among
31
+ * other features.
32
+ */
33
+
34
+ /**
35
+ * Default styles for xterm.js
36
+ */
37
+
38
+ .xterm {
39
+ font-feature-settings: 'liga' 0;
40
+ position: relative;
41
+ user-select: none;
42
+ -ms-user-select: none;
43
+ -webkit-user-select: none;
44
+ }
45
+
46
+ .xterm.focus,
47
+ .xterm:focus {
48
+ outline: none;
49
+ }
50
+
51
+ .xterm .xterm-helpers {
52
+ position: absolute;
53
+ top: 0;
54
+ /**
55
+ * The z-index of the helpers must be higher than the canvases in order for
56
+ * IMEs to appear on top.
57
+ */
58
+ z-index: 5;
59
+ }
60
+
61
+ .xterm .xterm-helper-textarea {
62
+ /*
63
+ * HACK: to fix IE's blinking cursor
64
+ * Move textarea out of the screen to the far left, so that the cursor is not visible.
65
+ */
66
+ position: absolute;
67
+ opacity: 0;
68
+ left: -9999em;
69
+ top: 0;
70
+ width: 0;
71
+ height: 0;
72
+ z-index: -5;
73
+ /** Prevent wrapping so the IME appears against the textarea at the correct position */
74
+ white-space: nowrap;
75
+ overflow: hidden;
76
+ resize: none;
77
+ }
78
+
79
+ .xterm .composition-view {
80
+ /* TODO: Composition position got messed up somewhere */
81
+ background: #000;
82
+ color: #fff;
83
+ display: none;
84
+ position: absolute;
85
+ white-space: nowrap;
86
+ z-index: 1;
87
+ }
88
+
89
+ .xterm .composition-view.active {
90
+ display: block;
91
+ }
92
+
93
+ .xterm .xterm-viewport {
94
+ /* On OS X this is required in order for the scroll bar to appear fully opaque */
95
+ background-color: #000;
96
+ overflow-y: scroll;
97
+ cursor: default;
98
+ position: absolute;
99
+ right: 0;
100
+ left: 0;
101
+ top: 0;
102
+ bottom: 0;
103
+ }
104
+
105
+ .xterm .xterm-screen {
106
+ position: relative;
107
+ }
108
+
109
+ .xterm .xterm-screen canvas {
110
+ position: absolute;
111
+ left: 0;
112
+ top: 0;
113
+ }
114
+
115
+ .xterm .xterm-scroll-area {
116
+ visibility: hidden;
117
+ }
118
+
119
+ .xterm-char-measure-element {
120
+ display: inline-block;
121
+ visibility: hidden;
122
+ position: absolute;
123
+ top: 0;
124
+ left: -9999em;
125
+ line-height: normal;
126
+ }
127
+
128
+ .xterm {
129
+ cursor: text;
130
+ }
131
+
132
+ .xterm.enable-mouse-events {
133
+ /* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */
134
+ cursor: default;
135
+ }
136
+
137
+ .xterm.xterm-cursor-pointer {
138
+ cursor: pointer;
139
+ }
140
+
141
+ .xterm.column-select.focus {
142
+ /* Column selection mode */
143
+ cursor: crosshair;
144
+ }
145
+
146
+ .xterm .xterm-accessibility,
147
+ .xterm .xterm-message {
148
+ position: absolute;
149
+ left: 0;
150
+ top: 0;
151
+ bottom: 0;
152
+ right: 0;
153
+ z-index: 10;
154
+ color: transparent;
155
+ }
156
+
157
+ .xterm .live-region {
158
+ position: absolute;
159
+ left: -9999px;
160
+ width: 1px;
161
+ height: 1px;
162
+ overflow: hidden;
163
+ }
164
+
165
+ .xterm-dim {
166
+ opacity: 0.5;
167
+ }
168
+
169
+ .xterm-underline {
170
+ text-decoration: underline;
171
+ }