@sparkle-learning/core 0.0.52 → 0.0.53
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/cjs/header-mobile-collapse_61.cjs.entry.js +15 -2994
- package/dist/cjs/{ion-select_2.cjs.entry.js → ion-select_3.cjs.entry.js} +118 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/signalR.service-5672eebc.js +2987 -0
- package/dist/cjs/sparkle-animation-player.cjs.entry.js +1 -0
- package/dist/cjs/sparkle-core.cjs.js +1 -1
- package/dist/cjs/sparkle-discussion-questions_2.cjs.entry.js +272 -0
- package/dist/cjs/sparkle-discussion.cjs.entry.js +40 -0
- package/dist/collection/collection-manifest.json +3 -0
- package/dist/collection/components/sparkle-animation-player/sparkle-animation-player.js +1 -0
- package/dist/collection/components/sparkle-course-root/sparkle-course-root.js +1 -1
- package/dist/collection/components/sparkle-discussion/sparkle-discussion-questions/sparkle-discussion-questions.css +157 -0
- package/dist/collection/components/sparkle-discussion/sparkle-discussion-questions/sparkle-discussion-questions.js +230 -0
- package/dist/collection/components/sparkle-discussion/sparkle-discussion-results/sparkle-discussion-results.css +158 -0
- package/dist/collection/components/sparkle-discussion/sparkle-discussion-results/sparkle-discussion-results.js +268 -0
- package/dist/collection/components/sparkle-discussion/sparkle-discussion.css +0 -0
- package/dist/collection/components/sparkle-discussion/sparkle-discussion.js +110 -0
- package/dist/esm/header-mobile-collapse_61.entry.js +3 -2982
- package/dist/esm/{ion-select_2.entry.js → ion-select_3.entry.js} +118 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/signalR.service-9d5b9f36.js +2984 -0
- package/dist/esm/sparkle-animation-player.entry.js +1 -0
- package/dist/esm/sparkle-core.js +1 -1
- package/dist/esm/sparkle-discussion-questions_2.entry.js +267 -0
- package/dist/esm/sparkle-discussion.entry.js +36 -0
- package/dist/sparkle-core/{p-0335c863.entry.js → p-0a5d7c4f.entry.js} +26 -26
- package/dist/sparkle-core/p-18cdd458.entry.js +1 -0
- package/dist/sparkle-core/p-30767c1c.entry.js +1 -0
- package/dist/sparkle-core/p-3265ed87.entry.js +1 -0
- package/dist/sparkle-core/{p-564e64fc.entry.js → p-44334ef3.entry.js} +2 -2
- package/dist/sparkle-core/p-4c9f994f.js +1 -0
- package/dist/sparkle-core/sparkle-core.esm.js +1 -1
- package/dist/types/components/sparkle-discussion/sparkle-discussion-questions/sparkle-discussion-questions.d.ts +28 -0
- package/dist/types/components/sparkle-discussion/sparkle-discussion-results/sparkle-discussion-results.d.ts +45 -0
- package/dist/types/components/sparkle-discussion/sparkle-discussion.d.ts +11 -0
- package/dist/types/components.d.ts +66 -1
- package/package.json +1 -1
- package/dist/cjs/sparkle-feed-post.cjs.entry.js +0 -124
- package/dist/esm/sparkle-feed-post.entry.js +0 -120
- package/dist/sparkle-core/p-15403881.entry.js +0 -1
- package/dist/sparkle-core/p-41a9ece7.entry.js +0 -1
- package/dist/types/components/sparkle-quiz/sparkle-quiz.d.ts +0 -41
@@ -5,11 +5,11 @@
|
|
5
5
|
* It contains typing information for all components that exist in this project.
|
6
6
|
*/
|
7
7
|
import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
|
8
|
+
import { SparkleQuizQuestion } from "./models/quiz.model";
|
8
9
|
import { IPageResult } from "./models/page.model";
|
9
10
|
import { RouterHistory } from "@stencil/router";
|
10
11
|
import { ClassFeedPostViewModel, CommentViewModel, StudentAppDataViewModel } from "./models/class.model";
|
11
12
|
import { IGoal } from "./models/goal.model";
|
12
|
-
import { SparkleQuizQuestion } from "./models/quiz.model";
|
13
13
|
import { EnvironmentSparkleConfig } from "./services/environment/environment-config";
|
14
14
|
export namespace Components {
|
15
15
|
interface CompassSvg {
|
@@ -43,6 +43,25 @@ export namespace Components {
|
|
43
43
|
}
|
44
44
|
interface SparkleCourseRoot {
|
45
45
|
}
|
46
|
+
interface SparkleDiscussion {
|
47
|
+
"allowPostToFeed": boolean;
|
48
|
+
"feedStartingText": string;
|
49
|
+
"isTeacherMode": boolean;
|
50
|
+
"questionIds": string;
|
51
|
+
}
|
52
|
+
interface SparkleDiscussionQuestions {
|
53
|
+
"allowPostToFeed": boolean;
|
54
|
+
"feedStartingText": string;
|
55
|
+
"isTeacherMode": boolean;
|
56
|
+
"postToFeedAssignmentName": string;
|
57
|
+
"questions": Array<SparkleQuizQuestion>;
|
58
|
+
}
|
59
|
+
interface SparkleDiscussionResults {
|
60
|
+
"allowPostToFeed": boolean;
|
61
|
+
"feedStartingText": string;
|
62
|
+
"isTeacherMode": boolean;
|
63
|
+
"questions": Array<SparkleQuizQuestion>;
|
64
|
+
}
|
46
65
|
interface SparkleEmoji {
|
47
66
|
"mood": string;
|
48
67
|
"size": 'xs' | 'sm' | 'mg' | 'lg';
|
@@ -276,6 +295,24 @@ declare global {
|
|
276
295
|
prototype: HTMLSparkleCourseRootElement;
|
277
296
|
new (): HTMLSparkleCourseRootElement;
|
278
297
|
};
|
298
|
+
interface HTMLSparkleDiscussionElement extends Components.SparkleDiscussion, HTMLStencilElement {
|
299
|
+
}
|
300
|
+
var HTMLSparkleDiscussionElement: {
|
301
|
+
prototype: HTMLSparkleDiscussionElement;
|
302
|
+
new (): HTMLSparkleDiscussionElement;
|
303
|
+
};
|
304
|
+
interface HTMLSparkleDiscussionQuestionsElement extends Components.SparkleDiscussionQuestions, HTMLStencilElement {
|
305
|
+
}
|
306
|
+
var HTMLSparkleDiscussionQuestionsElement: {
|
307
|
+
prototype: HTMLSparkleDiscussionQuestionsElement;
|
308
|
+
new (): HTMLSparkleDiscussionQuestionsElement;
|
309
|
+
};
|
310
|
+
interface HTMLSparkleDiscussionResultsElement extends Components.SparkleDiscussionResults, HTMLStencilElement {
|
311
|
+
}
|
312
|
+
var HTMLSparkleDiscussionResultsElement: {
|
313
|
+
prototype: HTMLSparkleDiscussionResultsElement;
|
314
|
+
new (): HTMLSparkleDiscussionResultsElement;
|
315
|
+
};
|
279
316
|
interface HTMLSparkleEmojiElement extends Components.SparkleEmoji, HTMLStencilElement {
|
280
317
|
}
|
281
318
|
var HTMLSparkleEmojiElement: {
|
@@ -535,6 +572,9 @@ declare global {
|
|
535
572
|
"sparkle-compass": HTMLSparkleCompassElement;
|
536
573
|
"sparkle-compass-post": HTMLSparkleCompassPostElement;
|
537
574
|
"sparkle-course-root": HTMLSparkleCourseRootElement;
|
575
|
+
"sparkle-discussion": HTMLSparkleDiscussionElement;
|
576
|
+
"sparkle-discussion-questions": HTMLSparkleDiscussionQuestionsElement;
|
577
|
+
"sparkle-discussion-results": HTMLSparkleDiscussionResultsElement;
|
538
578
|
"sparkle-emoji": HTMLSparkleEmojiElement;
|
539
579
|
"sparkle-export-lessons": HTMLSparkleExportLessonsElement;
|
540
580
|
"sparkle-facilitator-dashboard": HTMLSparkleFacilitatorDashboardElement;
|
@@ -606,6 +646,25 @@ declare namespace LocalJSX {
|
|
606
646
|
interface SparkleCourseRoot {
|
607
647
|
"onPageChanged"?: (event: SparkleCourseRootCustomEvent<any>) => void;
|
608
648
|
}
|
649
|
+
interface SparkleDiscussion {
|
650
|
+
"allowPostToFeed"?: boolean;
|
651
|
+
"feedStartingText"?: string;
|
652
|
+
"isTeacherMode"?: boolean;
|
653
|
+
"questionIds"?: string;
|
654
|
+
}
|
655
|
+
interface SparkleDiscussionQuestions {
|
656
|
+
"allowPostToFeed"?: boolean;
|
657
|
+
"feedStartingText"?: string;
|
658
|
+
"isTeacherMode"?: boolean;
|
659
|
+
"postToFeedAssignmentName"?: string;
|
660
|
+
"questions"?: Array<SparkleQuizQuestion>;
|
661
|
+
}
|
662
|
+
interface SparkleDiscussionResults {
|
663
|
+
"allowPostToFeed"?: boolean;
|
664
|
+
"feedStartingText"?: string;
|
665
|
+
"isTeacherMode"?: boolean;
|
666
|
+
"questions"?: Array<SparkleQuizQuestion>;
|
667
|
+
}
|
609
668
|
interface SparkleEmoji {
|
610
669
|
"mood"?: string;
|
611
670
|
"size"?: 'xs' | 'sm' | 'mg' | 'lg';
|
@@ -769,6 +828,9 @@ declare namespace LocalJSX {
|
|
769
828
|
"sparkle-compass": SparkleCompass;
|
770
829
|
"sparkle-compass-post": SparkleCompassPost;
|
771
830
|
"sparkle-course-root": SparkleCourseRoot;
|
831
|
+
"sparkle-discussion": SparkleDiscussion;
|
832
|
+
"sparkle-discussion-questions": SparkleDiscussionQuestions;
|
833
|
+
"sparkle-discussion-results": SparkleDiscussionResults;
|
772
834
|
"sparkle-emoji": SparkleEmoji;
|
773
835
|
"sparkle-export-lessons": SparkleExportLessons;
|
774
836
|
"sparkle-facilitator-dashboard": SparkleFacilitatorDashboard;
|
@@ -823,6 +885,9 @@ declare module "@stencil/core" {
|
|
823
885
|
"sparkle-compass": LocalJSX.SparkleCompass & JSXBase.HTMLAttributes<HTMLSparkleCompassElement>;
|
824
886
|
"sparkle-compass-post": LocalJSX.SparkleCompassPost & JSXBase.HTMLAttributes<HTMLSparkleCompassPostElement>;
|
825
887
|
"sparkle-course-root": LocalJSX.SparkleCourseRoot & JSXBase.HTMLAttributes<HTMLSparkleCourseRootElement>;
|
888
|
+
"sparkle-discussion": LocalJSX.SparkleDiscussion & JSXBase.HTMLAttributes<HTMLSparkleDiscussionElement>;
|
889
|
+
"sparkle-discussion-questions": LocalJSX.SparkleDiscussionQuestions & JSXBase.HTMLAttributes<HTMLSparkleDiscussionQuestionsElement>;
|
890
|
+
"sparkle-discussion-results": LocalJSX.SparkleDiscussionResults & JSXBase.HTMLAttributes<HTMLSparkleDiscussionResultsElement>;
|
826
891
|
"sparkle-emoji": LocalJSX.SparkleEmoji & JSXBase.HTMLAttributes<HTMLSparkleEmojiElement>;
|
827
892
|
"sparkle-export-lessons": LocalJSX.SparkleExportLessons & JSXBase.HTMLAttributes<HTMLSparkleExportLessonsElement>;
|
828
893
|
"sparkle-facilitator-dashboard": LocalJSX.SparkleFacilitatorDashboard & JSXBase.HTMLAttributes<HTMLSparkleFacilitatorDashboardElement>;
|
package/package.json
CHANGED
@@ -1,124 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
-
|
5
|
-
const index = require('./index-51e8292e.js');
|
6
|
-
const environmentConfig_service = require('./environment-config.service-0e02b049.js');
|
7
|
-
require('./auth.store-1e630a7d.js');
|
8
|
-
|
9
|
-
const sparkleFeedPostCss = ":host{display:block}.post-footer-container{display:flex;justify-content:flex-end}.post-footer{display:flex;justify-content:space-between;align-items:center}.error{color:red;margin-right:10px}.success{color:green;margin-right:10px}.uploaded-image{display:block;max-height:140px;width:auto !important}.public-post-toggle{display:flex;justify-content:flex-end;align-items:center}.assignment-name{display:none}";
|
10
|
-
|
11
|
-
const SparkleFeedPost = class {
|
12
|
-
constructor(hostRef) {
|
13
|
-
index.registerInstance(this, hostRef);
|
14
|
-
}
|
15
|
-
// @Prop({ connect: 'ion-toast-controller' })
|
16
|
-
// toastCtrl: HTMLIonToastControllerElement;
|
17
|
-
componentDidLoad() {
|
18
|
-
this.postText = this.textValue;
|
19
|
-
if (this.ref && this.ref.innerText) {
|
20
|
-
this.assignmentName = this.ref.innerText;
|
21
|
-
console.log(this.assignmentName);
|
22
|
-
}
|
23
|
-
}
|
24
|
-
setText(text) {
|
25
|
-
this.postText = text;
|
26
|
-
}
|
27
|
-
// async postToFeed() {
|
28
|
-
// const sparkleConfig: EnvironmentSparkleConfig = EnvironmentConfigService.getInstance().get('sparkle');
|
29
|
-
// const tocData = await AssetsService.getInstance().loadJsonFile<ICourse>(sparkleConfig.tocPath);
|
30
|
-
// var model = {
|
31
|
-
// CourseId: tocData.id,
|
32
|
-
// MiniAppId: SparkleGlobal.MY_GOALS_APP_ID,
|
33
|
-
// PostText: MyGoalTemplate(this.name.value, this.goalUpdateText.value, this.progress),
|
34
|
-
// PostTextJSON: MyGoalTemplateJSON(this.name.value, this.goalUpdateText.value, this.progress),
|
35
|
-
// IsPublic: this.public,
|
36
|
-
// ExternalResourceUrl: "",
|
37
|
-
// }
|
38
|
-
// const result = await FeedService.getInstance().createPost(model);
|
39
|
-
// if (result.Succeeded) {
|
40
|
-
// //show success toast
|
41
|
-
// }
|
42
|
-
// }
|
43
|
-
isAuthenticated() {
|
44
|
-
try {
|
45
|
-
var sparkleConfig = environmentConfig_service.EnvironmentConfigService.getInstance().get('sparkle');
|
46
|
-
if (!!sparkleConfig && !!sparkleConfig.auth && !!sparkleConfig.auth.getToken()) {
|
47
|
-
return true;
|
48
|
-
}
|
49
|
-
}
|
50
|
-
catch (_a) {
|
51
|
-
return false;
|
52
|
-
}
|
53
|
-
}
|
54
|
-
submitPost() {
|
55
|
-
this.errorMessage = '';
|
56
|
-
this.successMessage = '';
|
57
|
-
//let formData = new FormData(this.el.querySelector("form")) as any;
|
58
|
-
//var postText = this.el.getElementsByClassName("PostText")[0] as HTMLInputElement;
|
59
|
-
this.el.getElementsByClassName('PostExternalUrl')[0];
|
60
|
-
this.el.getElementsByClassName('IsPublic')[0];
|
61
|
-
// this.dataSvc.saveData(data, '/api/class/feed').subscribe(
|
62
|
-
// x => {
|
63
|
-
// this.successMessage = 'Posted Successfully.';
|
64
|
-
// // this.presentToast('Success');
|
65
|
-
// },
|
66
|
-
// error => {
|
67
|
-
// this.errorMessage = 'There is an error while posting.';
|
68
|
-
// // this.presentToast('There is an error');
|
69
|
-
// },
|
70
|
-
// );
|
71
|
-
//TODO can we return data from the dataSvc so we know if it's successful and can update the form? (Perhaps replace it with the post itself?)
|
72
|
-
// if (this.assignmentName) {
|
73
|
-
// data.AssignmentData = JSON.stringify({ text: data.PostText, url: data.ExternalResourceUrl });
|
74
|
-
// this.dataSvc.saveData(data, '/api/student/assignment-response').subscribe(
|
75
|
-
// x => {
|
76
|
-
// this.successMessage = 'Posted Successfully.';
|
77
|
-
// // this.presentToast('Success');
|
78
|
-
// },
|
79
|
-
// error => {
|
80
|
-
// this.errorMessage = 'There is an error while posting.';
|
81
|
-
// // this.presentToast('There is an error');
|
82
|
-
// },
|
83
|
-
// );
|
84
|
-
// }
|
85
|
-
}
|
86
|
-
uploadImage(evt) {
|
87
|
-
// this.uploadImageLoading = true;
|
88
|
-
// var files = evt.target.files;
|
89
|
-
// this.dataSvc.uploadImage(files, '/api/mediaitems/upload').subscribe(
|
90
|
-
// x => {
|
91
|
-
// this.uploadImageLoading = false;
|
92
|
-
// this.uploadedImage = x.length > 0 ? x[0].FullImageUrl : '';
|
93
|
-
// this.externalResourceUrl = x.length > 0 ? x[0].FullImageUrl : '';
|
94
|
-
// //this.successMessage = 'Posted Successfully.'
|
95
|
-
// // this.presentToast('Success');
|
96
|
-
// },
|
97
|
-
// error => {
|
98
|
-
// this.uploadImageLoading = false;
|
99
|
-
// this.errorMessage = 'There is an error while uploading an image.';
|
100
|
-
// },
|
101
|
-
// );
|
102
|
-
}
|
103
|
-
selectFile() {
|
104
|
-
var fileInput = document.getElementById('fileInput');
|
105
|
-
fileInput.click();
|
106
|
-
}
|
107
|
-
renderUserInfo() {
|
108
|
-
var tokenInfo = { Token: null, ProfileImageUrl: null };
|
109
|
-
if (tokenInfo != null && tokenInfo.Token) {
|
110
|
-
return (index.h("ion-avatar", { class: "header-avatar", slot: "end" }, index.h("img", { src: "/assets/img/avatar.png" })));
|
111
|
-
}
|
112
|
-
else {
|
113
|
-
return (index.h("ion-button", { slot: "end", href: "/login" }, "Login to Post"));
|
114
|
-
}
|
115
|
-
}
|
116
|
-
render() {
|
117
|
-
const userInfo = this.renderUserInfo();
|
118
|
-
return (index.h(index.Host, null, index.h("div", { class: "assignment-name", ref: el => (this.ref = el) }, index.h("slot", null)), index.h("ion-card", null, index.h("ion-item", { class: "header", lines: "full" }, userInfo), index.h("ion-card-content", null, index.h("form", null, index.h("ion-list", null, index.h("ion-item", { class: "padding" }, index.h("ion-textarea", { class: "PostText", required: true, placeholder: "Post Text", name: "PostText", value: this.postText })), index.h("ion-item", { class: "padding" }, index.h("ion-input", { class: "PostExternalUrl", required: true, type: "text", placeholder: "URL", name: "ExternalResourceUrl", value: this.externalResourceUrl })), this.uploadedImage ? (index.h("ion-item", { class: "padding" }, index.h("img", { class: "uploaded-image", src: this.uploadedImage }))) : (''), index.h("ion-item", { lines: "none" }, index.h("input", { type: "file", id: "fileInput", onChange: evt => this.uploadImage(evt), style: { display: 'none' }, accept: "image/*" }), this.uploadImageLoading ? index.h("ion-spinner", { color: "primary" }) : '', index.h("ion-button", { slot: "start", onClick: evt => this.selectFile() }, index.h("ion-icon", { name: "add" }), "Upload Image")), index.h("div", { class: "public-post-toggle" }, index.h("ion-toggle", { class: "IsPublic", color: "primary", name: "IsPublic" }), index.h("div", null, "Public Post")), index.h("div", { class: "post-footer-container" }, index.h("div", { class: "post-footer" }, index.h("div", null, index.h("div", { class: "error" }, this.errorMessage), index.h("div", { class: "success" }, this.successMessage)), index.h("ion-button", { slot: "end", size: "default", onClick: evt => this.submitPost(), disabled: !this.isAuthenticated() }, "Post")))))))));
|
119
|
-
}
|
120
|
-
get el() { return index.getElement(this); }
|
121
|
-
};
|
122
|
-
SparkleFeedPost.style = sparkleFeedPostCss;
|
123
|
-
|
124
|
-
exports.sparkle_feed_post = SparkleFeedPost;
|
@@ -1,120 +0,0 @@
|
|
1
|
-
import { r as registerInstance, h, H as Host, e as getElement } from './index-c04b9ed5.js';
|
2
|
-
import { E as EnvironmentConfigService } from './environment-config.service-2b5d692b.js';
|
3
|
-
import './auth.store-dba2c2da.js';
|
4
|
-
|
5
|
-
const sparkleFeedPostCss = ":host{display:block}.post-footer-container{display:flex;justify-content:flex-end}.post-footer{display:flex;justify-content:space-between;align-items:center}.error{color:red;margin-right:10px}.success{color:green;margin-right:10px}.uploaded-image{display:block;max-height:140px;width:auto !important}.public-post-toggle{display:flex;justify-content:flex-end;align-items:center}.assignment-name{display:none}";
|
6
|
-
|
7
|
-
const SparkleFeedPost = class {
|
8
|
-
constructor(hostRef) {
|
9
|
-
registerInstance(this, hostRef);
|
10
|
-
}
|
11
|
-
// @Prop({ connect: 'ion-toast-controller' })
|
12
|
-
// toastCtrl: HTMLIonToastControllerElement;
|
13
|
-
componentDidLoad() {
|
14
|
-
this.postText = this.textValue;
|
15
|
-
if (this.ref && this.ref.innerText) {
|
16
|
-
this.assignmentName = this.ref.innerText;
|
17
|
-
console.log(this.assignmentName);
|
18
|
-
}
|
19
|
-
}
|
20
|
-
setText(text) {
|
21
|
-
this.postText = text;
|
22
|
-
}
|
23
|
-
// async postToFeed() {
|
24
|
-
// const sparkleConfig: EnvironmentSparkleConfig = EnvironmentConfigService.getInstance().get('sparkle');
|
25
|
-
// const tocData = await AssetsService.getInstance().loadJsonFile<ICourse>(sparkleConfig.tocPath);
|
26
|
-
// var model = {
|
27
|
-
// CourseId: tocData.id,
|
28
|
-
// MiniAppId: SparkleGlobal.MY_GOALS_APP_ID,
|
29
|
-
// PostText: MyGoalTemplate(this.name.value, this.goalUpdateText.value, this.progress),
|
30
|
-
// PostTextJSON: MyGoalTemplateJSON(this.name.value, this.goalUpdateText.value, this.progress),
|
31
|
-
// IsPublic: this.public,
|
32
|
-
// ExternalResourceUrl: "",
|
33
|
-
// }
|
34
|
-
// const result = await FeedService.getInstance().createPost(model);
|
35
|
-
// if (result.Succeeded) {
|
36
|
-
// //show success toast
|
37
|
-
// }
|
38
|
-
// }
|
39
|
-
isAuthenticated() {
|
40
|
-
try {
|
41
|
-
var sparkleConfig = EnvironmentConfigService.getInstance().get('sparkle');
|
42
|
-
if (!!sparkleConfig && !!sparkleConfig.auth && !!sparkleConfig.auth.getToken()) {
|
43
|
-
return true;
|
44
|
-
}
|
45
|
-
}
|
46
|
-
catch (_a) {
|
47
|
-
return false;
|
48
|
-
}
|
49
|
-
}
|
50
|
-
submitPost() {
|
51
|
-
this.errorMessage = '';
|
52
|
-
this.successMessage = '';
|
53
|
-
//let formData = new FormData(this.el.querySelector("form")) as any;
|
54
|
-
//var postText = this.el.getElementsByClassName("PostText")[0] as HTMLInputElement;
|
55
|
-
this.el.getElementsByClassName('PostExternalUrl')[0];
|
56
|
-
this.el.getElementsByClassName('IsPublic')[0];
|
57
|
-
// this.dataSvc.saveData(data, '/api/class/feed').subscribe(
|
58
|
-
// x => {
|
59
|
-
// this.successMessage = 'Posted Successfully.';
|
60
|
-
// // this.presentToast('Success');
|
61
|
-
// },
|
62
|
-
// error => {
|
63
|
-
// this.errorMessage = 'There is an error while posting.';
|
64
|
-
// // this.presentToast('There is an error');
|
65
|
-
// },
|
66
|
-
// );
|
67
|
-
//TODO can we return data from the dataSvc so we know if it's successful and can update the form? (Perhaps replace it with the post itself?)
|
68
|
-
// if (this.assignmentName) {
|
69
|
-
// data.AssignmentData = JSON.stringify({ text: data.PostText, url: data.ExternalResourceUrl });
|
70
|
-
// this.dataSvc.saveData(data, '/api/student/assignment-response').subscribe(
|
71
|
-
// x => {
|
72
|
-
// this.successMessage = 'Posted Successfully.';
|
73
|
-
// // this.presentToast('Success');
|
74
|
-
// },
|
75
|
-
// error => {
|
76
|
-
// this.errorMessage = 'There is an error while posting.';
|
77
|
-
// // this.presentToast('There is an error');
|
78
|
-
// },
|
79
|
-
// );
|
80
|
-
// }
|
81
|
-
}
|
82
|
-
uploadImage(evt) {
|
83
|
-
// this.uploadImageLoading = true;
|
84
|
-
// var files = evt.target.files;
|
85
|
-
// this.dataSvc.uploadImage(files, '/api/mediaitems/upload').subscribe(
|
86
|
-
// x => {
|
87
|
-
// this.uploadImageLoading = false;
|
88
|
-
// this.uploadedImage = x.length > 0 ? x[0].FullImageUrl : '';
|
89
|
-
// this.externalResourceUrl = x.length > 0 ? x[0].FullImageUrl : '';
|
90
|
-
// //this.successMessage = 'Posted Successfully.'
|
91
|
-
// // this.presentToast('Success');
|
92
|
-
// },
|
93
|
-
// error => {
|
94
|
-
// this.uploadImageLoading = false;
|
95
|
-
// this.errorMessage = 'There is an error while uploading an image.';
|
96
|
-
// },
|
97
|
-
// );
|
98
|
-
}
|
99
|
-
selectFile() {
|
100
|
-
var fileInput = document.getElementById('fileInput');
|
101
|
-
fileInput.click();
|
102
|
-
}
|
103
|
-
renderUserInfo() {
|
104
|
-
var tokenInfo = { Token: null, ProfileImageUrl: null };
|
105
|
-
if (tokenInfo != null && tokenInfo.Token) {
|
106
|
-
return (h("ion-avatar", { class: "header-avatar", slot: "end" }, h("img", { src: "/assets/img/avatar.png" })));
|
107
|
-
}
|
108
|
-
else {
|
109
|
-
return (h("ion-button", { slot: "end", href: "/login" }, "Login to Post"));
|
110
|
-
}
|
111
|
-
}
|
112
|
-
render() {
|
113
|
-
const userInfo = this.renderUserInfo();
|
114
|
-
return (h(Host, null, h("div", { class: "assignment-name", ref: el => (this.ref = el) }, h("slot", null)), h("ion-card", null, h("ion-item", { class: "header", lines: "full" }, userInfo), h("ion-card-content", null, h("form", null, h("ion-list", null, h("ion-item", { class: "padding" }, h("ion-textarea", { class: "PostText", required: true, placeholder: "Post Text", name: "PostText", value: this.postText })), h("ion-item", { class: "padding" }, h("ion-input", { class: "PostExternalUrl", required: true, type: "text", placeholder: "URL", name: "ExternalResourceUrl", value: this.externalResourceUrl })), this.uploadedImage ? (h("ion-item", { class: "padding" }, h("img", { class: "uploaded-image", src: this.uploadedImage }))) : (''), h("ion-item", { lines: "none" }, h("input", { type: "file", id: "fileInput", onChange: evt => this.uploadImage(evt), style: { display: 'none' }, accept: "image/*" }), this.uploadImageLoading ? h("ion-spinner", { color: "primary" }) : '', h("ion-button", { slot: "start", onClick: evt => this.selectFile() }, h("ion-icon", { name: "add" }), "Upload Image")), h("div", { class: "public-post-toggle" }, h("ion-toggle", { class: "IsPublic", color: "primary", name: "IsPublic" }), h("div", null, "Public Post")), h("div", { class: "post-footer-container" }, h("div", { class: "post-footer" }, h("div", null, h("div", { class: "error" }, this.errorMessage), h("div", { class: "success" }, this.successMessage)), h("ion-button", { slot: "end", size: "default", onClick: evt => this.submitPost(), disabled: !this.isAuthenticated() }, "Post")))))))));
|
115
|
-
}
|
116
|
-
get el() { return getElement(this); }
|
117
|
-
};
|
118
|
-
SparkleFeedPost.style = sparkleFeedPostCss;
|
119
|
-
|
120
|
-
export { SparkleFeedPost as sparkle_feed_post };
|
@@ -1 +0,0 @@
|
|
1
|
-
import{r as t,h as e,H as s,e as i}from"./p-ee1e0eb4.js";import{E as n}from"./p-b226f54d.js";import"./p-2f569553.js";const l=class{constructor(e){t(this,e)}componentDidLoad(){this.postText=this.textValue,this.ref&&this.ref.innerText&&(this.assignmentName=this.ref.innerText,console.log(this.assignmentName))}setText(t){this.postText=t}isAuthenticated(){try{var t=n.getInstance().get("sparkle");if(t&&t.auth&&t.auth.getToken())return!0}catch(t){return!1}}submitPost(){this.errorMessage="",this.successMessage="",this.el.getElementsByClassName("PostExternalUrl"),this.el.getElementsByClassName("IsPublic")}uploadImage(t){}selectFile(){document.getElementById("fileInput").click()}renderUserInfo(){var t={Token:null,ProfileImageUrl:null};return null!=t&&t.Token?e("ion-avatar",{class:"header-avatar",slot:"end"},e("img",{src:"/assets/img/avatar.png"})):e("ion-button",{slot:"end",href:"/login"},"Login to Post")}render(){const t=this.renderUserInfo();return e(s,null,e("div",{class:"assignment-name",ref:t=>this.ref=t},e("slot",null)),e("ion-card",null,e("ion-item",{class:"header",lines:"full"},t),e("ion-card-content",null,e("form",null,e("ion-list",null,e("ion-item",{class:"padding"},e("ion-textarea",{class:"PostText",required:!0,placeholder:"Post Text",name:"PostText",value:this.postText})),e("ion-item",{class:"padding"},e("ion-input",{class:"PostExternalUrl",required:!0,type:"text",placeholder:"URL",name:"ExternalResourceUrl",value:this.externalResourceUrl})),this.uploadedImage?e("ion-item",{class:"padding"},e("img",{class:"uploaded-image",src:this.uploadedImage})):"",e("ion-item",{lines:"none"},e("input",{type:"file",id:"fileInput",onChange:t=>this.uploadImage(t),style:{display:"none"},accept:"image/*"}),this.uploadImageLoading?e("ion-spinner",{color:"primary"}):"",e("ion-button",{slot:"start",onClick:()=>this.selectFile()},e("ion-icon",{name:"add"}),"Upload Image")),e("div",{class:"public-post-toggle"},e("ion-toggle",{class:"IsPublic",color:"primary",name:"IsPublic"}),e("div",null,"Public Post")),e("div",{class:"post-footer-container"},e("div",{class:"post-footer"},e("div",null,e("div",{class:"error"},this.errorMessage),e("div",{class:"success"},this.successMessage)),e("ion-button",{slot:"end",size:"default",onClick:()=>this.submitPost(),disabled:!this.isAuthenticated()},"Post"))))))))}get el(){return i(this)}};l.style=":host{display:block}.post-footer-container{display:flex;justify-content:flex-end}.post-footer{display:flex;justify-content:space-between;align-items:center}.error{color:red;margin-right:10px}.success{color:green;margin-right:10px}.uploaded-image{display:block;max-height:140px;width:auto !important}.public-post-toggle{display:flex;justify-content:flex-end;align-items:center}.assignment-name{display:none}";export{l as sparkle_feed_post}
|
@@ -1 +0,0 @@
|
|
1
|
-
import{r as t,h as i,c as s,e}from"./p-ee1e0eb4.js";import{g as a}from"./p-5d409601.js";import{S as o}from"./p-935e7cfc.js";class n{constructor(){this.pItems={}}fromSrt(t,i){var s=!!i;(t=(t=t.replace(/\r/g,"")).split(/(\d+)\n(\d{2}:\d{2}:\d{2},\d{3}) --> (\d{2}:\d{2}:\d{2},\d{3})/g)).shift();for(var e={},a=0;a<t.length;a+=4)e[s?this.timeS(t[a+1].trim()):t[a+1].trim()]=t[a+3].trim();return e}toSrt(t){if(!(t instanceof Array))return"";for(var i="",s=0;s<t.length;s++){var e=t[s];isNaN(e.startTime)||isNaN(e.endTime)||(e.startTime=this.msTime(parseInt(e.startTime,10)),e.endTime=this.msTime(parseInt(e.endTime,10))),i+=e.id+"\r\n",i+=e.startTime+" --\x3e "+e.endTime+"\r\n",i+=e.text.replace("\n","\r\n")+"\r\n\r\n"}return i}timeS(t){var i=/(\d+):(\d{2}):(\d{2}),(\d{3})/.exec(t);if(null===i)return 0;for(var s=1;s<5;s++)i[s]=parseInt(i[s],10).toString(),isNaN(parseInt(i[s],10))&&(i[s]="0");return 3600*parseInt(i[1],10)+60*parseInt(i[2],10)+parseInt(i[3],10)+Math.floor(parseInt(i[4],10)/1e3)}msTime(t){var i=[36e5,6e4,1e3],s=[];for(var e in i){var a=(t/i[e]>>0).toString();a.length<2&&(a="0"+a),t%=i[e],s.push(a)}var o=t.toString();if(o.length<3)for(let t=0;t<=3-o.length;t++)o="0"+o;return s.join(":")+","+o}}const r=class{constructor(i){t(this,i),this.showCaption=!1,this.paused=!0,this.dataLoaded=!1,this.currentProgressWidth=0,this.captionText="",this.showFirstFrame=!1,this.firstFramePath="",this.isBusy=!1,this.animationVideoProgress="0",this.captionData={}}closedCaptionChange(t){this.showCaption=!this.showCaption}onClassRoomModeChanged(t){this.classMode=t.detail}componentWillLoad(){this.classMode=a(o.LOCALSTORAGE_CLASSROOM_MODE);const t=document.createElement("script");this.firstFramePath=this.src.replace(".js",".png"),t.src=this.src,document.body.appendChild(t),this.readTextFile(this.src.replace(".js",".srt")),this.rergisterSoundControls()}readTextFile(t){let i=this;var s=new XMLHttpRequest;s.open("GET",t,!1),s.onreadystatechange=function(){if(4===s.readyState&&(200===s.status||0==s.status)){var t=s.responseText,e=new n;i.captionData=e.fromSrt(t,!0)}},s.send(null)}isScriptLoaded(t){for(var i=document.getElementsByTagName("script"),s=i.length;s--;)if(i[s].getAttribute("src")==t)return!0;return!1}rergisterSoundControls(){window.playSound=t=>(this.sound&&this.sound.stop(),this.sound=createjs.Sound.play(t,{interrupt:createjs.Sound.INTERRUPT_EARLY,loop:0,volume:1}),this.sound),window.resetToStart=()=>{console.log("reset"),this.rewindAnimationToStart()}}startLoading(){this.isBusy=!0,this.paused=!1}doneLoading(){this.isBusy=!1,this.dataLoaded=!0,this.paused=!1}handleFileLoad(t){var i=this.comp.getImages();t&&"image"==t.item.type&&(i[t.item.id]=t.result)}handleQueueProgress(t){return t=>{this.animationVideoProgress=t.loaded?(100*t.loaded).toFixed(0):"0",1==t.loaded&&this.doneLoading()}}handleComplete(t){for(var i=this.comp.getSpriteSheet(),s=t.target,e=this.library.ssMetadata,a=0;a<e.length;a++)i[e[a].name]=new createjs.SpriteSheet({images:[s.getResult(e[a].name)],frames:e[a].frames});var o=this.src.substring(this.src.lastIndexOf("/")+1,this.src.lastIndexOf("."));this.exportRoot=new this.library[o],this.stage=new this.library.Stage(this.canvas),this.makeResponsive(!0,"both",!1,1),AdobeAn.compositionLoaded(this.library.properties.id),this.stage.addChild(this.exportRoot),createjs.Ticker.framerate=this.library.properties.fps,createjs.Ticker.paused=!1,createjs.Ticker.addEventListener("tick",this.stage),createjs.Ticker.addEventListener("tick",(t=>{this.tickHandler(t)}))}loadAnimation(){this.startLoading(),createjs.Sound.initializeDefaultPlugins()&&(this.canvas=this.el.querySelector(".video-canvas"),this.anim_container=this.el.querySelector(".canvas-container"),this.comp=AdobeAn.getComposition(this.composition),this.canvas.style.width="100%",this.canvas.style.height=this.canvas.offsetWidth+"px",this.anim_container.style.height=this.canvas.offsetWidth+"px",this.library=this.comp.getLibrary(),this.loader=new createjs.LoadQueue(!1),this.loader.setMaxConnections(3),this.loader.maintainScriptOrder=!0,this.loader.installPlugin(createjs.Sound),this.loader.addEventListener("complete",(t=>{this.handleComplete(t)})),this.loader.addEventListener("fileload",(t=>{this.handleFileLoad(t)})),this.loader.addEventListener("progress",this.handleQueueProgress(this)),this.loader.loadManifest(this.library.properties.manifest,!0,this.src.substring(0,this.src.lastIndexOf("/")+1)))}playButtonAction(){this.dataLoaded?this.playPauseAnimation():this.loadAnimation()}playPauseAnimation(){createjs.Ticker.paused?this.playAnimation():this.pauseAnimation()}async playAnimation(){if(this.showFirstFrame=!1,null!=this.loader&&this.loader.close(),createjs&&createjs.Ticker){let t=!1,i=this.sound;i&&(i.paused=t),createjs.Ticker.paused=t,createjs.Ticker.addEventListener("tick",this.stage),this.paused=t}}async pauseAnimation(){if(null!=this.loader&&this.loader.close(),createjs&&createjs.Ticker){let t=!0,i=this.sound;i&&(i.paused=t),createjs.Ticker.paused=t,createjs.Ticker.removeEventListener("tick",this.stage),this.paused=t}}disconnectedCallback(){this.pauseAnimation(),createjs.Sound.removeAllSounds()}async classRoomModeChanged(t){this.classMode=t}async destroyAnimation(){this.pauseAnimation()}makeResponsive(t,i,s,e){window.addEventListener("resize",(()=>this.resizeCanvas(t,i,s,e))),this.resizeCanvas(t,i,s,e)}resizeCanvas(t,i,s,e){var a,o,n=1,r=this.library.properties.width,h=this.library.properties.height,l=window.innerWidth,c=window.innerHeight,d=window.devicePixelRatio||1,p=l/r,u=c/h,m=1;t&&("width"==i&&a==l||"height"==i&&o==c?m=n:s?1==e?m=Math.min(p,u):2==e&&(m=Math.max(p,u)):(l<r||c<h)&&(m=Math.min(p,u)));var g=this.el.querySelector(".canvas-container");this.canvas.width=r*d*m,this.canvas.height=h*d*m,this.canvas.style.width="100%",this.canvas.style.height=this.canvas.offsetWidth+"px",g.style.height=this.canvas.offsetWidth+"px",this.stage.scaleX=d*m,this.stage.scaleY=d*m,a=l,o=c,n=m,this.sizeOfCanvas=this.canvas.offsetWidth;var v=this.el.querySelector(".progressBar");this.sizeofProgressBar=v.offsetWidth,this.stage.tickOnUpdate=!1,this.stage.update(),this.stage.tickOnUpdate=!0}tickHandler(t){t.paused||(this.timeline=this.stage.children[0].timeline,this.captionData[Math.floor(this.timeline.position/this.library.properties.fps)]&&(this.captionText=this.captionData[Math.floor(this.timeline.position/this.library.properties.fps)]),this.timeline.position%10==0&&(this.timeline.position>this.timeline.duration-10&&this.animationCompleted(),this.currentProgressWidth=parseFloat((this.timeline.position/this.timeline.duration*this.sizeofProgressBar).toFixed(0))))}animationCompleted(){console.log("completed"),this.showFirstFrame=!0,this.rewindAnimationTo(0),this.pauseAnimation()}rewindAnimationTo(t){let i=this.sound;i&&(i.paused=!0);let s=this.stage.children[0],e=s.timeline;t<0&&(t=0),t>e.duration&&(t=e.duration-10),this.paused?(s.gotoAndStop(t),this.stage.update(),i&&!i.getPaused()&&(createjs.Ticker.paused=!0)):(s.gotoAndPlay(t),createjs.Ticker.paused=!1)}rewindAnimationToStart(){this.paused=!0,this.rewindAnimationTo(0)}rewindAnimation(t){t.stopPropagation();let i=Math.round(t.offsetX/this.sizeofProgressBar*this.stage.children[0].timeline.duration);this.rewindAnimationTo(i)}rewind5Sec(){this.rewindAnimationTo(this.stage.children[0].timeline.position-5*this.library.properties.fps)}fastForward5Sec(){this.rewindAnimationTo(this.stage.children[0].timeline.position+5*this.library.properties.fps)}muteVolume(){let t=this.sound;t&&(t.volume=0)}downVolume(){let t=this.sound;t&&t._getVolume()>.9&&(t.volume=t._getVolume()-.1)}upVolume(){let t=this.sound;t&&t._getVolume()<1&&(t.volume=t._getVolume()+.1)}render(){return i("div",{class:"cavase-main-container"},i("div",{class:"canvas-container",id:"canvas-container"},this.classMode?"":i("div",null,i("canvas",{class:"video-canvas",onClick:()=>this.playButtonAction()}),this.showCaption?i("div",{class:"caption"},this.captionText):""),!this.dataLoaded||this.showFirstFrame?i("img",{class:"frame-img",src:this.firstFramePath}):"",this.classMode?i("img",{class:"overlay-img",src:s("./assets/play-button-disabled-overlay.png")}):"",!this.classMode&&this.paused?i("img",{class:"overlay-img",onClick:()=>this.playButtonAction(),src:s("./assets/play-button-overlay.png")}):"",this.isBusy?i("div",{class:"loading-container"},i("div",{class:"uil-ring-css"},i("div",null),i("a",null,"Loading ",this.animationVideoProgress,"%"))):""),this.dataLoaded?i("div",{class:"navControls"},i("div",{class:"progressBar",onClick:t=>this.rewindAnimation(t)},i("div",{class:"currentProgress",style:{width:this.currentProgressWidth+"px"}})),i("div",{class:"button-panel"},i("ion-button",{size:"small",color:"transperant",onClick:()=>this.rewind5Sec()}," ",i("ion-icon",{name:"play-back-outline"})," "),i("ion-button",{size:"small",color:"transperant",onClick:()=>this.playButtonAction()}," ",i("ion-icon",this.paused?{name:"pause-outline"}:{name:"play-outline"})),i("ion-button",{size:"small",color:"transperant",onClick:()=>this.fastForward5Sec()}," ",i("ion-icon",{name:"play-forward-outline"})))):"",this.dataLoaded&&this.captionText?i("div",{class:"closed-caption"},i("ion-item",{lines:"none"},i("ion-label",null,"Closed Caption"),i("ion-toggle",{slot:"end",color:"primary",checked:this.showCaption}))):"")}static get assetsDirs(){return["assets"]}get el(){return e(this)}};r.style='.video-canvas{position:absolute;display:block;background-color:#f5f5f5;width:auto}.closed-caption{justify-content:flex-end;width:100%;display:flex}sparkle-animation-player{width:100%;margin:0 auto}.caption{position:absolute;bottom:0px;color:white;text-align:center;width:100%;text-shadow:1px 1px 2px #e50539}.canvas-container{width:680px;height:680px;background-color:#f5f5f5;border-radius:10px;position:relative}.frame-img{position:absolute;display:block;max-width:100%;width:100%;height:auto}.overlay-img{position:absolute;z-index:9999;top:0px;display:block;max-width:100%;width:100%;height:auto}.button-panel{display:flex;justify-content:center}ion-icon{color:var(--ion-color-primary)}.navControls{width:680px;background:transparent;border-radius:10px;position:relative;padding-top:15px;display:flex;flex-direction:column;align-items:center}.navControls .progressBar{flex:100%;border-radius:20px;position:relative;left:0;right:0;height:4px;background-color:rgba(205, 205, 205, 0.7);width:100%}.navControls .progressBar .currentProgress{border-radius:20px;position:absolute;height:25px;background-color:var(--ion-color-primary);transition:width 0.5s;width:100%}.navControls .progressBar .currentProgress:before{position:absolute;top:50%;right:4px;content:" ";display:block;width:12px;height:12px;margin-top:-10px;background:#e5053a;border-radius:10px;border:4px solid #d9d4d4;z-index:10}#dom_overlay_container{pointer-events:none;overflow:hidden;position:absolute;left:0px;top:0px;display:block}.cavase-main-container{width:100%;display:flex;flex-wrap:wrap;justify-content:center;padding:15px;background-position:center;background-size:cover;background-repeat:no-repeat}.loading-container{height:100%;display:flex;justify-content:center;align-items:center}.uil-ring-css{position:absolute}ion-button{--ion-color-base:transparent;--ion-color-contrast:var(--ion-color-primary);--box-shadow:none !important}@media screen and (min-width: 760px){.navControls{flex-direction:row}.navControls .progressBar{height:24px;flex:75%;width:75%}.button-panel{flex:25%;width:25%}}';export{r as sparkle_animation_player}
|
@@ -1,41 +0,0 @@
|
|
1
|
-
import { EventEmitter } from '../../stencil-public-runtime';
|
2
|
-
import { SparkleQuizQuestion } from '../../models/quiz.model';
|
3
|
-
export declare class SparkleQuiz {
|
4
|
-
el: HTMLElement;
|
5
|
-
questionId: number;
|
6
|
-
submitted: boolean;
|
7
|
-
correct: boolean;
|
8
|
-
showInstantResult: boolean;
|
9
|
-
quizAnswerChanged: EventEmitter<{
|
10
|
-
answer: any;
|
11
|
-
question: SparkleQuizQuestion;
|
12
|
-
}>;
|
13
|
-
private pageInfo;
|
14
|
-
loadQuestion(): Promise<void>;
|
15
|
-
question: SparkleQuizQuestion;
|
16
|
-
quizData: {
|
17
|
-
[key: string]: SparkleQuizQuestion;
|
18
|
-
};
|
19
|
-
componentWillLoad(): Promise<void>;
|
20
|
-
componentDidLoad(): Promise<void>;
|
21
|
-
quizInputChangeHandler(event: CustomEvent<{
|
22
|
-
value: string;
|
23
|
-
question: SparkleQuizQuestion;
|
24
|
-
}>): void;
|
25
|
-
quizFeedbackChangeHandler(event: CustomEvent<{
|
26
|
-
value: string;
|
27
|
-
question: SparkleQuizQuestion;
|
28
|
-
}>): void;
|
29
|
-
quizSelectChangeHandler(event: CustomEvent<{
|
30
|
-
value: string;
|
31
|
-
question: SparkleQuizQuestion;
|
32
|
-
}>): void;
|
33
|
-
quizOpinionChangeHandler(event: CustomEvent<{
|
34
|
-
value: string;
|
35
|
-
question: SparkleQuizQuestion;
|
36
|
-
}>): void;
|
37
|
-
private getQuestionFeedback;
|
38
|
-
private showAnswerStatus;
|
39
|
-
private renderQuestion;
|
40
|
-
render(): any;
|
41
|
-
}
|