@sparkle-learning/core 0.0.26 → 0.0.29

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 (69) hide show
  1. package/dist/cjs/{PrivateRoute-cee9b061.js → PrivateRoute-81e20cbf.js} +4 -38
  2. package/dist/cjs/feed.service-032c2ecc.js +124 -0
  3. package/dist/cjs/header-mobile-collapse_60.cjs.entry.js +5 -3
  4. package/dist/cjs/index.cjs.js +2 -1
  5. package/dist/cjs/{index.es-91493ac6.js → index.es-11437480.js} +5 -3
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/localstorage.service-6346a41d.js +40 -0
  8. package/dist/cjs/{purify-ed567052.js → purify-a443f0eb.js} +1 -1
  9. package/dist/cjs/sparkle-animation-player.cjs.entry.js +55 -49
  10. package/dist/cjs/sparkle-character-intro.cjs.entry.js +26 -0
  11. package/dist/cjs/sparkle-core.cjs.js +1 -1
  12. package/dist/cjs/sparkle-goal-form.cjs.entry.js +9 -8
  13. package/dist/cjs/{feed.service-518d18fd.js → util-b0e2ec9f.js} +1 -121
  14. package/dist/collection/collection-manifest.json +1 -0
  15. package/dist/collection/components/sparkle-animation-player/sparkle-animation-player.js +78 -66
  16. package/dist/collection/components/sparkle-character-intro/assets/characters/character-img.jpg +0 -0
  17. package/dist/collection/components/sparkle-character-intro/assets/characters/jen.png +0 -0
  18. package/dist/collection/components/sparkle-character-intro/assets/characters/kimberly.png +0 -0
  19. package/dist/collection/components/sparkle-character-intro/assets/characters/valeria.png +0 -0
  20. package/dist/collection/components/sparkle-character-intro/assets/characters/yuna.png +0 -0
  21. package/dist/collection/components/sparkle-character-intro/assets/characters/zynab.png +0 -0
  22. package/dist/collection/components/sparkle-character-intro/sparkle-character-intro.css +67 -0
  23. package/dist/collection/components/sparkle-character-intro/sparkle-character-intro.js +64 -0
  24. package/dist/collection/components/sparkle-course-root/sparkle-course-root.js +48 -43
  25. package/dist/collection/util.js +1 -0
  26. package/dist/esm/{PrivateRoute-9f0973bb.js → PrivateRoute-df0d1e6b.js} +1 -35
  27. package/dist/esm/feed.service-694d3d54.js +119 -0
  28. package/dist/esm/header-mobile-collapse_60.entry.js +5 -3
  29. package/dist/esm/{index.es-32e2f407.js → index.es-1d452836.js} +5 -3
  30. package/dist/esm/index.js +2 -1
  31. package/dist/esm/loader.js +1 -1
  32. package/dist/esm/localstorage.service-4bf408c8.js +36 -0
  33. package/dist/esm/{purify-f1a55787.js → purify-7e29b899.js} +1 -1
  34. package/dist/esm/sparkle-animation-player.entry.js +55 -49
  35. package/dist/esm/sparkle-character-intro.entry.js +22 -0
  36. package/dist/esm/sparkle-core.js +1 -1
  37. package/dist/esm/sparkle-goal-form.entry.js +2 -1
  38. package/dist/esm/{feed.service-0fda1e36.js → util-042b5fee.js} +2 -118
  39. package/dist/sparkle-core/assets/characters/character-img.jpg +0 -0
  40. package/dist/sparkle-core/assets/characters/jen.png +0 -0
  41. package/dist/sparkle-core/assets/characters/kimberly.png +0 -0
  42. package/dist/sparkle-core/assets/characters/valeria.png +0 -0
  43. package/dist/sparkle-core/assets/characters/yuna.png +0 -0
  44. package/dist/sparkle-core/assets/characters/zynab.png +0 -0
  45. package/dist/sparkle-core/index.esm.js +1 -1
  46. package/dist/sparkle-core/p-0312758b.js +1 -0
  47. package/dist/sparkle-core/p-396a9849.js +1 -0
  48. package/dist/sparkle-core/p-4328af62.js +1 -0
  49. package/dist/sparkle-core/{p-14ff8097.js → p-522733aa.js} +4 -4
  50. package/dist/sparkle-core/p-5b4938ce.entry.js +1 -0
  51. package/dist/sparkle-core/p-5d409601.js +1 -0
  52. package/dist/sparkle-core/p-62a62b6e.entry.js +1 -0
  53. package/dist/sparkle-core/p-7ecad3fb.entry.js +1 -0
  54. package/dist/sparkle-core/p-8490f1bc.js +1 -0
  55. package/dist/sparkle-core/{p-0d3fe46c.js → p-e23bd285.js} +1 -1
  56. package/dist/sparkle-core/p-e4f41e16.entry.js +1 -0
  57. package/dist/sparkle-core/sparkle-core.esm.js +1 -1
  58. package/dist/types/components/sparkle-animation-player/sparkle-animation-player.d.ts +1 -0
  59. package/dist/types/components/sparkle-character-intro/sparkle-character-intro.d.ts +7 -0
  60. package/dist/types/components/sparkle-course-root/sparkle-course-root.d.ts +2 -2
  61. package/dist/types/components.d.ts +17 -0
  62. package/dist/types/util.d.ts +1 -0
  63. package/package.json +2 -2
  64. package/dist/sparkle-core/p-090f2624.js +0 -1
  65. package/dist/sparkle-core/p-82d95fcd.entry.js +0 -1
  66. package/dist/sparkle-core/p-ab5cdfeb.js +0 -1
  67. package/dist/sparkle-core/p-b080c1e3.entry.js +0 -1
  68. package/dist/sparkle-core/p-bc568dcb.js +0 -1
  69. package/dist/sparkle-core/p-f6ce91f2.entry.js +0 -1
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- const auth_store = require('./auth.store-aba3d22f.js');
4
-
5
3
  var MILLISECONDS_IN_MINUTE = 60000;
6
4
 
7
5
  /**
@@ -5667,127 +5665,11 @@ class SparkleGlobal {
5667
5665
  SparkleGlobal.MY_GOALS_APP_ID = 1;
5668
5666
  SparkleGlobal.MY_HEALTH_APP_ID = 2;
5669
5667
  SparkleGlobal.MY_MOOD_APP_ID = 3;
5668
+ SparkleGlobal.LOCALSTORAGE_CLASSROOM_MODE = "SPARKLE_CLASSROOM_MODE";
5670
5669
  function date(date) {
5671
5670
  return dateFns.format(new Date(date), 'DD MMM YYYY');
5672
5671
  }
5673
5672
 
5674
- const { state, onChange } = auth_store.createStore({
5675
- goals: [],
5676
- goalsLoading: false,
5677
- goalLoading: false
5678
- });
5679
- const goalStore = { state, onChange };
5680
-
5681
- class AppDataService {
5682
- constructor() { }
5683
- static getInstance() {
5684
- if (!AppDataService.instance) {
5685
- AppDataService.instance = new AppDataService();
5686
- }
5687
- return AppDataService.instance;
5688
- }
5689
- async getAllAppData(appId) {
5690
- let result = await auth_store.HttpService.http.get(`api/v1/AppData/${appId}`);
5691
- return result;
5692
- }
5693
- async createAppData(payload) {
5694
- let result = await auth_store.HttpService.http.post(`api/v1/AppData/`, payload);
5695
- return result;
5696
- }
5697
- async updateAppData(payload) {
5698
- let result = await auth_store.HttpService.http.put(`api/v1/AppData/${payload.Id}`, payload);
5699
- return result;
5700
- }
5701
- async getAllGoals() {
5702
- goalStore.state.goalsLoading = true;
5703
- let result = await this.getAllAppData(SparkleGlobal.MY_GOALS_APP_ID);
5704
- if (result) {
5705
- goalStore.state.goals = result.Data.map(item => {
5706
- return Object.assign(Object.assign({}, item), { AppData: JSON.parse(item.AppJsonData) });
5707
- });
5708
- goalStore.state.goalsLoading = false;
5709
- }
5710
- return result;
5711
- }
5712
- async createGoal(payload) {
5713
- goalStore.state.goalLoading = true;
5714
- let result = await this.createAppData(payload);
5715
- if (result) {
5716
- result.Data.AppData = JSON.parse(result.Data.AppJsonData);
5717
- goalStore.state.goals = [...goalStore.state.goals, result.Data];
5718
- goalStore.state.goalLoading = false;
5719
- }
5720
- return result;
5721
- }
5722
- async updateGoal(payload) {
5723
- goalStore.state.goalLoading = true;
5724
- let result = await this.updateAppData(payload);
5725
- if (result) {
5726
- result.Data.AppData = JSON.parse(result.Data.AppJsonData);
5727
- goalStore.state.goals = goalStore.state.goals.map(item => {
5728
- if (item.Id == result.Data.Id) {
5729
- return Object.assign(Object.assign({}, result.Data), { AppData: JSON.parse(result.Data.AppJsonData) });
5730
- }
5731
- return item;
5732
- });
5733
- goalStore.state.goalLoading = false;
5734
- }
5735
- return result;
5736
- }
5737
- }
5738
-
5739
- const { state: state$1, reset } = auth_store.createStore({
5740
- posts: [],
5741
- postsLoading: false,
5742
- createPostLoading: false,
5743
- postIdLoading: null
5744
- });
5745
- const feedStore = { state: state$1, reset };
5746
-
5747
- class FeedService {
5748
- constructor() { }
5749
- static getInstance() {
5750
- if (!FeedService.instance) {
5751
- FeedService.instance = new FeedService();
5752
- }
5753
- return FeedService.instance;
5754
- }
5755
- async getAllPosts() {
5756
- feedStore.state.postsLoading = true;
5757
- let result = await auth_store.HttpService.http.get(`api/v1/Feed/GetAll`);
5758
- if (result) {
5759
- feedStore.state.posts = result.Data;
5760
- feedStore.state.postsLoading = false;
5761
- }
5762
- return result;
5763
- }
5764
- async createPost(payload) {
5765
- feedStore.state.createPostLoading = true;
5766
- let result = await auth_store.HttpService.http.post(`api/v1/Feed/PostFeed`, payload);
5767
- if (result) {
5768
- feedStore.state.posts = [result.Data, ...feedStore.state.posts];
5769
- feedStore.state.createPostLoading = false;
5770
- }
5771
- return result;
5772
- }
5773
- async createPostComment(payload) {
5774
- feedStore.state.postIdLoading = payload.PostId;
5775
- let result = await auth_store.HttpService.http.post(`api/v1/Feed/Comment`, payload);
5776
- if (result) {
5777
- feedStore.state.posts = feedStore.state.posts.map((item) => {
5778
- if (item.Id == result.Data.ClassFeedPostId) {
5779
- return Object.assign(Object.assign({}, item), { Comments: [...item.Comments, result.Data] });
5780
- }
5781
- return item;
5782
- });
5783
- feedStore.state.postIdLoading = null;
5784
- }
5785
- return result;
5786
- }
5787
- }
5788
-
5789
- exports.AppDataService = AppDataService;
5790
- exports.FeedService = FeedService;
5791
5673
  exports.GetGoalAppData = GetGoalAppData;
5792
5674
  exports.MyGoalTemplate = MyGoalTemplate;
5793
5675
  exports.MyGoalTemplateJSON = MyGoalTemplateJSON;
@@ -5797,6 +5679,4 @@ exports.MyMoodTemplate = MyMoodTemplate;
5797
5679
  exports.MyMoodTemplateJSON = MyMoodTemplateJSON;
5798
5680
  exports.SparkleGlobal = SparkleGlobal;
5799
5681
  exports.date = date;
5800
- exports.feedStore = feedStore;
5801
- exports.goalStore = goalStore;
5802
5682
  exports.sample = sample;
@@ -21,6 +21,7 @@
21
21
  "./components/mini-apps/sparkle-mood/sparkle-mood.js",
22
22
  "./components/modal-image/modal-image.js",
23
23
  "./components/sparkle-animation-player/sparkle-animation-player.js",
24
+ "./components/sparkle-character-intro/sparkle-character-intro.js",
24
25
  "./components/sparkle-compass/sparkle-compass.js",
25
26
  "./components/sparkle-compass/sparkle-compass-post/sparkle-compass-post.js",
26
27
  "./components/sparkle-course-root/sparkle-course-root.js",
@@ -1,29 +1,35 @@
1
- import { Component, State, Prop, Method, Element, getAssetPath, Listen, h } from "@stencil/core";
2
- import { CaptionParser } from "./caption-parser";
1
+ import { Component, State, Prop, Method, Element, getAssetPath, Listen, h } from '@stencil/core';
2
+ import { get } from '../../services/core/localstorage.service';
3
+ import { SparkleGlobal } from '../../util';
4
+ import { CaptionParser } from './caption-parser';
3
5
  export class SparkleAnimationPlayer {
4
6
  constructor() {
5
7
  this.showCaption = false;
6
8
  this.paused = true;
7
9
  this.dataLoaded = false;
8
10
  this.currentProgressWidth = 0;
9
- this.captionText = "";
10
- this.firstFramePath = "";
11
+ this.captionText = '';
12
+ this.firstFramePath = '';
11
13
  this.isBusy = false;
12
- this.animationVideoProgress = "0";
14
+ this.animationVideoProgress = '0';
13
15
  this.captionData = {};
14
16
  }
15
17
  closedCaptionChange(event) {
16
18
  this.showCaption = !this.showCaption;
17
19
  }
20
+ onClassRoomModeChanged(event) {
21
+ this.classMode = event.detail;
22
+ }
18
23
  componentWillLoad() {
19
24
  // if (!this.isScriptLoaded(this.src)) {
20
- this.classMode = this.initialClassMode;
21
- const script = document.createElement("script");
22
- this.firstFramePath = this.src.replace(".js", ".png");
25
+ this.classMode = get(SparkleGlobal.LOCALSTORAGE_CLASSROOM_MODE);
26
+ //this.classMode = this.initialClassMode;
27
+ const script = document.createElement('script');
28
+ this.firstFramePath = this.src.replace('.js', '.png');
23
29
  script.src = this.src;
24
30
  //script.async = true;
25
31
  document.body.appendChild(script);
26
- this.readTextFile(this.src.replace(".js", ".srt"));
32
+ this.readTextFile(this.src.replace('.js', '.srt'));
27
33
  this.rergisterSoundControls();
28
34
  // }
29
35
  // else {
@@ -33,7 +39,7 @@ export class SparkleAnimationPlayer {
33
39
  readTextFile(fileName) {
34
40
  let that = this;
35
41
  var rawFile = new XMLHttpRequest();
36
- rawFile.open("GET", fileName, false);
42
+ rawFile.open('GET', fileName, false);
37
43
  rawFile.onreadystatechange = function () {
38
44
  if (rawFile.readyState === 4) {
39
45
  if (rawFile.status === 200 || rawFile.status == 0) {
@@ -55,15 +61,15 @@ export class SparkleAnimationPlayer {
55
61
  return false;
56
62
  }
57
63
  rergisterSoundControls() {
58
- window["playSound"] = (id, loop) => {
64
+ window['playSound'] = (id, loop) => {
59
65
  if (this.sound) {
60
66
  this.sound.stop();
61
67
  }
62
68
  this.sound = createjs.Sound.play(id, { interrupt: createjs.Sound.INTERRUPT_EARLY, loop: 0, volume: 1 });
63
69
  return this.sound;
64
70
  };
65
- window["resetToStart"] = () => {
66
- console.log("reset");
71
+ window['resetToStart'] = () => {
72
+ console.log('reset');
67
73
  this.rewindAnimationToStart();
68
74
  };
69
75
  }
@@ -78,15 +84,13 @@ export class SparkleAnimationPlayer {
78
84
  }
79
85
  handleFileLoad(evt) {
80
86
  var images = this.comp.getImages();
81
- if (evt && (evt.item.type == "image")) {
87
+ if (evt && evt.item.type == 'image') {
82
88
  images[evt.item.id] = evt.result;
83
89
  }
84
90
  }
85
91
  handleQueueProgress(that) {
86
- return (progress) => {
87
- this.animationVideoProgress = progress.loaded
88
- ? (progress.loaded * 100).toFixed(0)
89
- : "0";
92
+ return progress => {
93
+ this.animationVideoProgress = progress.loaded ? (progress.loaded * 100).toFixed(0) : '0';
90
94
  if (progress.loaded == 1) {
91
95
  this.doneLoading();
92
96
  }
@@ -98,18 +102,20 @@ export class SparkleAnimationPlayer {
98
102
  //var lib = this.comp.getLibrary();
99
103
  var ssMetadata = this.library.ssMetadata;
100
104
  for (var i = 0; i < ssMetadata.length; i++) {
101
- ss[ssMetadata[i].name] = new createjs.SpriteSheet({ "images": [queue.getResult(ssMetadata[i].name)], "frames": ssMetadata[i].frames });
105
+ ss[ssMetadata[i].name] = new createjs.SpriteSheet({ images: [queue.getResult(ssMetadata[i].name)], frames: ssMetadata[i].frames });
102
106
  }
103
107
  var jsFileName = this.src.substring(this.src.lastIndexOf('/') + 1, this.src.lastIndexOf('.'));
104
- this.exportRoot = new this.library[jsFileName];
108
+ this.exportRoot = new this.library[jsFileName]();
105
109
  this.stage = new this.library.Stage(this.canvas);
106
110
  this.makeResponsive(true, 'both', false, 1);
107
111
  AdobeAn.compositionLoaded(this.library.properties.id);
108
112
  this.stage.addChild(this.exportRoot);
109
113
  createjs.Ticker.framerate = this.library.properties.fps;
110
114
  createjs.Ticker.paused = false;
111
- createjs.Ticker.addEventListener("tick", this.stage);
112
- createjs.Ticker.addEventListener("tick", (evt) => { this.tickHandler(evt); });
115
+ createjs.Ticker.addEventListener('tick', this.stage);
116
+ createjs.Ticker.addEventListener('tick', evt => {
117
+ this.tickHandler(evt);
118
+ });
113
119
  console.log(createjs.Ticker);
114
120
  }
115
121
  loadAnimation() {
@@ -117,23 +123,27 @@ export class SparkleAnimationPlayer {
117
123
  if (!createjs.Sound.initializeDefaultPlugins()) {
118
124
  return;
119
125
  }
120
- this.canvas = this.el.querySelector(".video-canvas");
121
- this.anim_container = this.el.querySelector(".canvas-container");
126
+ this.canvas = this.el.querySelector('.video-canvas');
127
+ this.anim_container = this.el.querySelector('.canvas-container');
122
128
  this.comp = AdobeAn.getComposition(this.composition);
123
- this.canvas.style.width = "100%";
129
+ this.canvas.style.width = '100%';
124
130
  console.log(this.canvas.offsetWidth);
125
- this.canvas.style.height = this.canvas.offsetWidth + "px";
126
- this.anim_container.style.height = this.canvas.offsetWidth + "px";
131
+ this.canvas.style.height = this.canvas.offsetWidth + 'px';
132
+ this.anim_container.style.height = this.canvas.offsetWidth + 'px';
127
133
  this.library = this.comp.getLibrary();
128
134
  this.loader = new createjs.LoadQueue(false);
129
135
  this.loader.setMaxConnections(3);
130
136
  this.loader.maintainScriptOrder = true;
131
137
  this.loader.installPlugin(createjs.Sound);
132
- this.loader.addEventListener("complete", (evt) => { this.handleComplete(evt); });
133
- this.loader.addEventListener("fileload", (evt) => { this.handleFileLoad(evt); });
134
- this.loader.addEventListener("progress", this.handleQueueProgress(this));
138
+ this.loader.addEventListener('complete', evt => {
139
+ this.handleComplete(evt);
140
+ });
141
+ this.loader.addEventListener('fileload', evt => {
142
+ this.handleFileLoad(evt);
143
+ });
144
+ this.loader.addEventListener('progress', this.handleQueueProgress(this));
135
145
  //TODO :can't figure out https://github.com/CreateJS/SoundJS/issues/283
136
- this.loader.loadManifest(this.library.properties.manifest, true, this.src.substring(0, this.src.lastIndexOf("/") + 1));
146
+ this.loader.loadManifest(this.library.properties.manifest, true, this.src.substring(0, this.src.lastIndexOf('/') + 1));
137
147
  }
138
148
  playButtonAction() {
139
149
  if (!this.dataLoaded) {
@@ -163,7 +173,7 @@ export class SparkleAnimationPlayer {
163
173
  st.paused = newState;
164
174
  }
165
175
  createjs.Ticker.paused = newState;
166
- createjs.Ticker.addEventListener("tick", this.stage);
176
+ createjs.Ticker.addEventListener('tick', this.stage);
167
177
  this.paused = newState;
168
178
  // let stage = this.stage.children[0];
169
179
  // stage.gotoAndStop(0);
@@ -181,7 +191,7 @@ export class SparkleAnimationPlayer {
181
191
  st.paused = newState;
182
192
  }
183
193
  createjs.Ticker.paused = newState;
184
- createjs.Ticker.removeEventListener("tick", this.stage);
194
+ createjs.Ticker.removeEventListener('tick', this.stage);
185
195
  this.paused = newState;
186
196
  }
187
197
  }
@@ -239,16 +249,16 @@ export class SparkleAnimationPlayer {
239
249
  sRatio = Math.max(xRatio, yRatio);
240
250
  }
241
251
  }
242
- var anim_container = this.el.querySelector(".canvas-container");
252
+ var anim_container = this.el.querySelector('.canvas-container');
243
253
  // this.canvas.width = w * pRatio * sRatio;
244
254
  // this.canvas.height = h * pRatio * sRatio;
245
255
  // this.canvas.style.width = this.dom_overlay_container.style.width = anim_container.style.width = w * sRatio + 'px';
246
256
  // this.canvas.style.height = anim_container.style.height = this.dom_overlay_container.style.height = h * sRatio + 'px';
247
257
  this.canvas.width = w * pRatio * sRatio;
248
258
  this.canvas.height = h * pRatio * sRatio;
249
- this.canvas.style.width = "100%";
250
- this.canvas.style.height = this.canvas.offsetWidth + "px";
251
- anim_container.style.height = this.canvas.offsetWidth + "px";
259
+ this.canvas.style.width = '100%';
260
+ this.canvas.style.height = this.canvas.offsetWidth + 'px';
261
+ anim_container.style.height = this.canvas.offsetWidth + 'px';
252
262
  this.stage.scaleX = pRatio * sRatio;
253
263
  this.stage.scaleY = pRatio * sRatio;
254
264
  lastW = iw;
@@ -256,7 +266,7 @@ export class SparkleAnimationPlayer {
256
266
  lastS = sRatio;
257
267
  var newWidth = this.canvas.offsetWidth;
258
268
  this.sizeOfCanvas = newWidth;
259
- var progressBar = this.el.querySelector(".progressBar");
269
+ var progressBar = this.el.querySelector('.progressBar');
260
270
  this.sizeofProgressBar = progressBar.offsetWidth;
261
271
  this.stage.tickOnUpdate = false;
262
272
  this.stage.update();
@@ -265,14 +275,12 @@ export class SparkleAnimationPlayer {
265
275
  tickHandler(event) {
266
276
  if (!event.paused) {
267
277
  let stage = this.stage.children[0];
268
- this.timeline = stage["timeline"];
278
+ this.timeline = stage['timeline'];
269
279
  if (this.captionData[Math.floor(this.timeline.position / this.library.properties.fps)]) {
270
280
  this.captionText = this.captionData[Math.floor(this.timeline.position / this.library.properties.fps)];
271
281
  }
272
282
  if (this.timeline.position % 10 == 0) {
273
- this.currentProgressWidth = parseFloat((this.timeline.position /
274
- this.timeline.duration *
275
- this.sizeofProgressBar).toFixed(0));
283
+ this.currentProgressWidth = parseFloat(((this.timeline.position / this.timeline.duration) * this.sizeofProgressBar).toFixed(0));
276
284
  }
277
285
  }
278
286
  }
@@ -282,7 +290,7 @@ export class SparkleAnimationPlayer {
282
290
  st.paused = true;
283
291
  }
284
292
  let stage = this.stage.children[0];
285
- let timeline = stage["timeline"];
293
+ let timeline = stage['timeline'];
286
294
  if (newPosition < 0) {
287
295
  newPosition = 0;
288
296
  }
@@ -308,7 +316,7 @@ export class SparkleAnimationPlayer {
308
316
  rewindAnimationToStart() {
309
317
  this.paused = true;
310
318
  let stage = this.stage.children[0];
311
- let timeline = stage["timeline"];
319
+ let timeline = stage['timeline'];
312
320
  let newPosition = 0;
313
321
  // var soundPosition = this.sound.position + 5000;
314
322
  // console.log("video", newPosition / 1000);
@@ -337,8 +345,8 @@ export class SparkleAnimationPlayer {
337
345
  rewindAnimation(event) {
338
346
  event.stopPropagation();
339
347
  let stage = this.stage.children[0];
340
- let timeline = stage["timeline"];
341
- let newPosition = Math.round(event.offsetX / this.sizeofProgressBar * timeline.duration);
348
+ let timeline = stage['timeline'];
349
+ let newPosition = Math.round((event.offsetX / this.sizeofProgressBar) * timeline.duration);
342
350
  // var soundPosition = this.sound.position + 5000;
343
351
  // console.log("video", newPosition / 1000);
344
352
  // console.log("sound", soundPosition / 1000);
@@ -347,7 +355,7 @@ export class SparkleAnimationPlayer {
347
355
  rewind5Sec() {
348
356
  let fps = this.library.properties.fps;
349
357
  let stage = this.stage.children[0];
350
- let timeline = stage["timeline"];
358
+ let timeline = stage['timeline'];
351
359
  let newPosition = timeline.position - fps * 5;
352
360
  //var soundPosition = this.sound.position - 5000;
353
361
  this.rewindAnimationTo(newPosition);
@@ -355,7 +363,7 @@ export class SparkleAnimationPlayer {
355
363
  fastForward5Sec() {
356
364
  let fps = this.library.properties.fps;
357
365
  let stage = this.stage.children[0];
358
- let timeline = stage["timeline"];
366
+ let timeline = stage['timeline'];
359
367
  let newPosition = timeline.position + fps * 5;
360
368
  // var soundPosition = this.sound.position + 5000;
361
369
  this.rewindAnimationTo(newPosition);
@@ -387,39 +395,37 @@ export class SparkleAnimationPlayer {
387
395
  h("div", { class: "canvas-container", id: "canvas-container" },
388
396
  !this.classMode ? (h("div", null,
389
397
  h("canvas", { class: "video-canvas", onClick: () => this.playButtonAction() }),
390
- this.showCaption ?
391
- h("div", { class: "caption" }, this.captionText) : "")) : (""),
392
- !this.dataLoaded ? (h("img", { class: "frame-img", src: this.firstFramePath })) : (""),
393
- this.classMode ? (h("img", { class: "overlay-img", src: getAssetPath(`./assets/play-button-disabled-overlay.png`) })) : (""),
394
- !this.classMode && this.paused ? (h("img", { class: "overlay-img", onClick: () => this.playButtonAction(), src: getAssetPath(`./assets/play-button-overlay.png`) })) : (""),
398
+ this.showCaption ? h("div", { class: "caption" }, this.captionText) : '')) : (''),
399
+ !this.dataLoaded ? h("img", { class: "frame-img", src: this.firstFramePath }) : '',
400
+ this.classMode ? h("img", { class: "overlay-img", src: getAssetPath(`./assets/play-button-disabled-overlay.png`) }) : '',
401
+ !this.classMode && this.paused ? h("img", { class: "overlay-img", onClick: () => this.playButtonAction(), src: getAssetPath(`./assets/play-button-overlay.png`) }) : '',
395
402
  this.isBusy ? (h("div", { class: "loading-container" },
396
403
  h("div", { class: "uil-ring-css" },
397
404
  h("div", null),
398
405
  h("a", null,
399
406
  "Loading ",
400
407
  this.animationVideoProgress,
401
- "%")))) : ("")),
408
+ "%")))) : ('')),
402
409
  this.dataLoaded ? (h("div", { class: "navControls" },
403
- h("div", { class: "progressBar", onClick: (ev) => this.rewindAnimation(ev) },
404
- h("div", { class: "currentProgress", style: { width: this.currentProgressWidth + "px" } })),
410
+ h("div", { class: "progressBar", onClick: ev => this.rewindAnimation(ev) },
411
+ h("div", { class: "currentProgress", style: { width: this.currentProgressWidth + 'px' } })),
405
412
  h("div", { class: "button-panel" },
406
413
  h("ion-button", { size: "small", color: "transperant", onClick: () => this.rewind5Sec() },
407
- " ",
414
+ ' ',
408
415
  h("ion-icon", { name: "play-back-outline" }),
409
- " "),
416
+ ' '),
410
417
  h("ion-button", { size: "small", color: "transperant", onClick: () => this.playButtonAction() },
411
- " ",
418
+ ' ',
412
419
  this.paused ? (h("ion-icon", { name: "pause-outline" })) : (h("ion-icon", { name: "play-outline" })
413
420
  // <ion-icon src="/assets/img/play-symbol.svg"></ion-icon>
414
421
  )),
415
422
  h("ion-button", { size: "small", color: "transperant", onClick: () => this.fastForward5Sec() },
416
- " ",
417
- h("ion-icon", { name: "play-forward-outline" }))))) : (""),
418
- (this.dataLoaded && this.captionText) ?
419
- h("div", { class: "closed-caption" },
420
- h("ion-item", { lines: "none" },
421
- h("ion-label", null, "Closed Caption"),
422
- h("ion-toggle", { slot: "end", color: "primary", checked: this.showCaption }))) : ""));
423
+ ' ',
424
+ h("ion-icon", { name: "play-forward-outline" }))))) : (''),
425
+ this.dataLoaded && this.captionText ? (h("div", { class: "closed-caption" },
426
+ h("ion-item", { lines: "none" },
427
+ h("ion-label", null, "Closed Caption"),
428
+ h("ion-toggle", { slot: "end", color: "primary", checked: this.showCaption })))) : ('')));
423
429
  }
424
430
  static get is() { return "sparkle-animation-player"; }
425
431
  static get originalStyleUrls() { return {
@@ -569,5 +575,11 @@ export class SparkleAnimationPlayer {
569
575
  "target": undefined,
570
576
  "capture": false,
571
577
  "passive": false
578
+ }, {
579
+ "name": "classRoomModeChanged",
580
+ "method": "onClassRoomModeChanged",
581
+ "target": "body",
582
+ "capture": false,
583
+ "passive": false
572
584
  }]; }
573
585
  }
@@ -0,0 +1,67 @@
1
+ sparkle-character-intro {
2
+ --sparkle-character-background-color: #e7e7e7;
3
+ }
4
+ sparkle-character-intro .character-phrase-block {
5
+ display: flex;
6
+ width: 100%;
7
+ min-height: 200px;
8
+ align-items: center;
9
+ padding: 20px;
10
+ }
11
+ sparkle-character-intro .character-phrase-block.right {
12
+ justify-content: flex-end;
13
+ }
14
+ sparkle-character-intro .character-phrase-block.left {
15
+ justify-content: flex-start;
16
+ }
17
+ sparkle-character-intro .character-phrase-block.left .character-box {
18
+ order: 2;
19
+ }
20
+ sparkle-character-intro .character-phrase-block.left .character-image-block {
21
+ order: 1;
22
+ }
23
+ sparkle-character-intro .character-box {
24
+ min-width: 300px;
25
+ border-radius: 15px;
26
+ background: var(--sparkle-character-background-color);
27
+ color: var(--text-color);
28
+ padding: 20px;
29
+ text-align: center;
30
+ position: relative;
31
+ box-shadow: 0px 1px 3px rgba(2, 8, 20, 0.06), 0px 1px 2px rgba(2, 8, 20, 0.04);
32
+ }
33
+ sparkle-character-intro .character-box.right:before {
34
+ content: "";
35
+ width: 0px;
36
+ height: 0px;
37
+ position: absolute;
38
+ border-left: 15px solid var(--sparkle-character-background-color);
39
+ border-right: 15px solid transparent;
40
+ border-top: 15px solid var(--sparkle-character-background-color);
41
+ border-bottom: 15px solid transparent;
42
+ right: -16px;
43
+ top: 0px;
44
+ }
45
+ sparkle-character-intro .character-box.left:before {
46
+ content: "";
47
+ width: 0px;
48
+ height: 0px;
49
+ position: absolute;
50
+ border-left: 15px solid transparent;
51
+ border-right: 15px solid var(--sparkle-character-background-color);
52
+ border-top: 15px solid var(--sparkle-character-background-color);
53
+ border-bottom: 15px solid transparent;
54
+ left: -16px;
55
+ top: 0px;
56
+ }
57
+ sparkle-character-intro img {
58
+ max-width: 100%;
59
+ border: 0;
60
+ }
61
+ sparkle-character-intro .character-image-block {
62
+ float: left;
63
+ width: 20%;
64
+ }
65
+ sparkle-character-intro .character-image-block.right {
66
+ transform: rotateY(180deg);
67
+ }
@@ -0,0 +1,64 @@
1
+ import { Component, Element, Prop, getAssetPath, h } from '@stencil/core';
2
+ export class SparkleCharacterIntro {
3
+ constructor() {
4
+ this.character = 'jen';
5
+ this.position = 'right';
6
+ }
7
+ componentDidLoad() {
8
+ console.log(this.character);
9
+ }
10
+ render() {
11
+ return (h("div", { class: `character-phrase-block ${this.position}` },
12
+ h("div", { class: `character-box ${this.position}` },
13
+ h("slot", null)),
14
+ h("div", { class: `character-image-block ${this.position}` },
15
+ h("img", { class: "image-animation", src: getAssetPath('./assets/characters/' + this.character + '.png') }))));
16
+ }
17
+ static get is() { return "sparkle-character-intro"; }
18
+ static get originalStyleUrls() { return {
19
+ "$": ["sparkle-character-intro.scss"]
20
+ }; }
21
+ static get styleUrls() { return {
22
+ "$": ["sparkle-character-intro.css"]
23
+ }; }
24
+ static get assetsDirs() { return ["assets"]; }
25
+ static get properties() { return {
26
+ "character": {
27
+ "type": "string",
28
+ "mutable": false,
29
+ "complexType": {
30
+ "original": "string",
31
+ "resolved": "string",
32
+ "references": {}
33
+ },
34
+ "required": false,
35
+ "optional": false,
36
+ "docs": {
37
+ "tags": [],
38
+ "text": ""
39
+ },
40
+ "attribute": "character",
41
+ "reflect": false,
42
+ "defaultValue": "'jen'"
43
+ },
44
+ "position": {
45
+ "type": "string",
46
+ "mutable": false,
47
+ "complexType": {
48
+ "original": "'left' | 'right'",
49
+ "resolved": "\"left\" | \"right\"",
50
+ "references": {}
51
+ },
52
+ "required": false,
53
+ "optional": false,
54
+ "docs": {
55
+ "tags": [],
56
+ "text": ""
57
+ },
58
+ "attribute": "position",
59
+ "reflect": false,
60
+ "defaultValue": "'right'"
61
+ }
62
+ }; }
63
+ static get elementRef() { return "el"; }
64
+ }