jclic 2.2.0 → 2.3.0

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 (177) hide show
  1. package/README.md +5 -7
  2. package/dist-node/jclic-node.js +14157 -0
  3. package/dist-node/jclic-node.umd.cjs +530 -0
  4. package/package.json +38 -26
  5. package/.vscode/launch.json +0 -33
  6. package/.vscode/settings.json +0 -13
  7. package/CHANGELOG.md +0 -664
  8. package/TRANSLATIONS.md +0 -11
  9. package/build-locales.mjs +0 -82
  10. package/dist/jclic-node.js +0 -31678
  11. package/dist/jclic-node.js.map +0 -1
  12. package/dist/jclic.components.LICENSE +0 -2254
  13. package/dist/jclic.min.js +0 -27
  14. package/dist/jclic.min.js.map +0 -1
  15. package/eslint.config.mjs +0 -31
  16. package/jsdoc.config.js +0 -71
  17. package/locales/ar.po +0 -244
  18. package/locales/ast.po +0 -246
  19. package/locales/bs.po +0 -247
  20. package/locales/ca.po +0 -248
  21. package/locales/ca_ES@valencia.po +0 -248
  22. package/locales/cs.po +0 -244
  23. package/locales/da.po +0 -244
  24. package/locales/de.po +0 -246
  25. package/locales/el.po +0 -244
  26. package/locales/es.po +0 -248
  27. package/locales/eu.po +0 -244
  28. package/locales/fr.po +0 -244
  29. package/locales/gl.po +0 -244
  30. package/locales/he.po +0 -244
  31. package/locales/hr.po +0 -245
  32. package/locales/it.po +0 -246
  33. package/locales/ja.po +0 -242
  34. package/locales/jclic.js.pot +0 -241
  35. package/locales/nb_NO.po +0 -244
  36. package/locales/nl.po +0 -244
  37. package/locales/pl.po +0 -244
  38. package/locales/pt.po +0 -244
  39. package/locales/pt_BR.po +0 -248
  40. package/locales/ro.po +0 -248
  41. package/locales/ru.po +0 -245
  42. package/locales/ta.po +0 -244
  43. package/locales/tr.po +0 -246
  44. package/locales/uk.po +0 -247
  45. package/locales/vec.po +0 -244
  46. package/locales/zh_TW.po +0 -246
  47. package/patches/po2json+1.0.0-beta-3.patch +0 -12
  48. package/src/AWT.js +0 -2067
  49. package/src/Activity.js +0 -1311
  50. package/src/Deps.js +0 -232
  51. package/src/GlobalData.js +0 -5
  52. package/src/JClic.js +0 -196
  53. package/src/JClicPlayer.js +0 -1308
  54. package/src/PlayerHistory.js +0 -305
  55. package/src/Utils.js +0 -1355
  56. package/src/activities/associations/ComplexAssociation.js +0 -321
  57. package/src/activities/associations/SimpleAssociation.js +0 -519
  58. package/src/activities/memory/MemoryGame.js +0 -423
  59. package/src/activities/panels/Explore.js +0 -349
  60. package/src/activities/panels/Identify.js +0 -356
  61. package/src/activities/panels/InformationScreen.js +0 -262
  62. package/src/activities/panels/Menu.js +0 -209
  63. package/src/activities/panels/icons/ico00.png +0 -0
  64. package/src/activities/panels/icons/ico01.png +0 -0
  65. package/src/activities/panels/icons/ico02.png +0 -0
  66. package/src/activities/panels/icons/ico03.png +0 -0
  67. package/src/activities/panels/icons/icofolder.png +0 -0
  68. package/src/activities/puzzles/DoublePuzzle.js +0 -424
  69. package/src/activities/puzzles/ExchangePuzzle.js +0 -374
  70. package/src/activities/puzzles/HolePuzzle.js +0 -360
  71. package/src/activities/text/Complete.js +0 -127
  72. package/src/activities/text/Evaluator.js +0 -534
  73. package/src/activities/text/FillInBlanks.js +0 -426
  74. package/src/activities/text/IdentifyText.js +0 -253
  75. package/src/activities/text/OrderText.js +0 -421
  76. package/src/activities/text/TextActivityBase.js +0 -557
  77. package/src/activities/text/TextActivityDocument.js +0 -658
  78. package/src/activities/text/WrittenAnswer.js +0 -557
  79. package/src/activities/textGrid/CrossWord.js +0 -565
  80. package/src/activities/textGrid/WordSearch.js +0 -458
  81. package/src/activities/textGrid/icons/hIcon.svg +0 -3
  82. package/src/activities/textGrid/icons/vIcon.svg +0 -3
  83. package/src/automation/AutoContentProvider.js +0 -182
  84. package/src/automation/arith/Arith.js +0 -864
  85. package/src/bags/ActivitySequence.js +0 -318
  86. package/src/bags/ActivitySequenceElement.js +0 -161
  87. package/src/bags/ActivitySequenceJump.js +0 -140
  88. package/src/bags/ConditionalJumpInfo.js +0 -113
  89. package/src/bags/JumpInfo.js +0 -136
  90. package/src/bags/MediaBag.js +0 -215
  91. package/src/bags/MediaBagElement.js +0 -516
  92. package/src/boxes/AbstractBox.js +0 -699
  93. package/src/boxes/ActiveBagContent.js +0 -494
  94. package/src/boxes/ActiveBox.js +0 -810
  95. package/src/boxes/ActiveBoxBag.js +0 -357
  96. package/src/boxes/ActiveBoxContent.js +0 -484
  97. package/src/boxes/ActiveBoxGrid.js +0 -179
  98. package/src/boxes/BoxBag.js +0 -500
  99. package/src/boxes/BoxBase.js +0 -398
  100. package/src/boxes/BoxConnector.js +0 -325
  101. package/src/boxes/TextGrid.js +0 -887
  102. package/src/boxes/TextGridContent.js +0 -215
  103. package/src/init-jsdom.js +0 -65
  104. package/src/jclic-node.js +0 -219
  105. package/src/media/ActiveMediaBag.js +0 -145
  106. package/src/media/ActiveMediaPlayer.js +0 -297
  107. package/src/media/AudioBuffer.js +0 -219
  108. package/src/media/EventSounds.js +0 -169
  109. package/src/media/EventSoundsElement.js +0 -155
  110. package/src/media/MediaContent.js +0 -328
  111. package/src/media/MidiAudioPlayer.js +0 -254
  112. package/src/media/icons/audio.svg +0 -3
  113. package/src/media/icons/generic.svg +0 -3
  114. package/src/media/icons/mic.svg +0 -3
  115. package/src/media/icons/movie.svg +0 -3
  116. package/src/media/icons/music.svg +0 -3
  117. package/src/media/icons/url.svg +0 -3
  118. package/src/media/sounds/actionError.mp3 +0 -0
  119. package/src/media/sounds/actionOk.mp3 +0 -0
  120. package/src/media/sounds/click.mp3 +0 -0
  121. package/src/media/sounds/finishedError.mp3 +0 -0
  122. package/src/media/sounds/finishedOk.mp3 +0 -0
  123. package/src/media/sounds/start.mp3 +0 -0
  124. package/src/project/JClicProject.js +0 -282
  125. package/src/project/ProjectSettings.js +0 -273
  126. package/src/report/ActionReg.js +0 -123
  127. package/src/report/ActivityReg.js +0 -271
  128. package/src/report/EncryptMin.js +0 -210
  129. package/src/report/Reporter.js +0 -727
  130. package/src/report/SCORM.js +0 -272
  131. package/src/report/SequenceReg.js +0 -275
  132. package/src/report/SessionReg.js +0 -340
  133. package/src/report/SessionStorageReporter.js +0 -131
  134. package/src/report/TCPReporter.js +0 -628
  135. package/src/shapers/ClassicJigSaw.js +0 -138
  136. package/src/shapers/Holes.js +0 -77
  137. package/src/shapers/JigSaw.js +0 -161
  138. package/src/shapers/Rectangular.js +0 -78
  139. package/src/shapers/Shaper.js +0 -386
  140. package/src/shapers/TriangularJigSaw.js +0 -121
  141. package/src/skins/BlueSkin.js +0 -80
  142. package/src/skins/Counter.js +0 -152
  143. package/src/skins/CustomSkin.js +0 -412
  144. package/src/skins/DefaultSkin.js +0 -376
  145. package/src/skins/EmptySkin.js +0 -82
  146. package/src/skins/GreenSkin.js +0 -94
  147. package/src/skins/MiniSkin.js +0 -130
  148. package/src/skins/OrangeSkin.js +0 -78
  149. package/src/skins/SimpleSkin.js +0 -92
  150. package/src/skins/Skin.js +0 -1021
  151. package/src/skins/assets/actionsIcon.svg +0 -3
  152. package/src/skins/assets/appLogo.svg +0 -8
  153. package/src/skins/assets/basic.css +0 -41
  154. package/src/skins/assets/closeDialogIcon.svg +0 -3
  155. package/src/skins/assets/closeIcon.svg +0 -3
  156. package/src/skins/assets/copyIcon.svg +0 -3
  157. package/src/skins/assets/fullScreenExitIcon.svg +0 -3
  158. package/src/skins/assets/fullScreenIcon.svg +0 -3
  159. package/src/skins/assets/infoIcon.svg +0 -3
  160. package/src/skins/assets/main.css +0 -43
  161. package/src/skins/assets/mainHalf.css +0 -23
  162. package/src/skins/assets/mainTwoThirds.css +0 -23
  163. package/src/skins/assets/mini.css +0 -15
  164. package/src/skins/assets/nextIcon.svg +0 -3
  165. package/src/skins/assets/okDialogIcon.svg +0 -3
  166. package/src/skins/assets/prevIcon.svg +0 -3
  167. package/src/skins/assets/reports.css +0 -156
  168. package/src/skins/assets/reportsIcon.svg +0 -3
  169. package/src/skins/assets/scoreIcon.svg +0 -3
  170. package/src/skins/assets/simple.css +0 -16
  171. package/src/skins/assets/simpleHalf.css +0 -11
  172. package/src/skins/assets/simpleTwoThirds.css +0 -11
  173. package/src/skins/assets/timeIcon.svg +0 -4
  174. package/src/skins/assets/waitAnim.css +0 -54
  175. package/src/skins/assets/waitImgBig.svg +0 -3
  176. package/src/skins/assets/waitImgSmall.svg +0 -3
  177. package/webpack.config.mjs +0 -169
@@ -1,305 +0,0 @@
1
- /**
2
- * File : PlayerHistory.js
3
- * Created : 28/04/2015
4
- * By : Francesc Busquets <francesc@gmail.com>
5
- *
6
- * JClic.js
7
- * An HTML5 player of JClic activities
8
- * https://projectestac.github.io/jclic.js
9
- *
10
- * @source https://github.com/projectestac/jclic.js
11
- *
12
- * @license EUPL-1.2
13
- * @licstart
14
- * (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)
15
- *
16
- * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
17
- * the European Commission- subsequent versions of the EUPL (the "Licence");
18
- * You may not use this work except in compliance with the Licence.
19
- *
20
- * You may obtain a copy of the Licence at:
21
- * https://joinup.ec.europa.eu/software/page/eupl
22
- *
23
- * Unless required by applicable law or agreed to in writing, software
24
- * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
25
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
26
- * Licence for the specific language governing permissions and limitations
27
- * under the Licence.
28
- * @licend
29
- * @module
30
- */
31
-
32
- /* global window */
33
-
34
- import $ from 'jquery';
35
- import { log, isEquivalent, getPath, isNullOrUndef } from './Utils.js';
36
-
37
- /**
38
- *
39
- * PlayerHistory uses an array to store the list of projects and activities done by the user.
40
- * This class allows {@link module:JClicPlayer.JClicPlayer JClicPlayer} objects to rewind a sequence or to go back to a caller menu.
41
- */
42
- export class PlayerHistory {
43
- /**
44
- * PlayerHistory constructor
45
- * @param {module:JClicPlayer.JClicPlayer} player - The JClicPlayer associated to this history
46
- */
47
- constructor(player) {
48
- this.player = player;
49
- this.sequenceStack = [];
50
- if (window && window.history && player.options.browserHistory) {
51
- this.browserHistory = true;
52
- $(window).on('popstate', (ev) => {
53
- const state = ev.originalEvent.state;
54
- if (state)
55
- this.processPopStateEvent(state);
56
- });
57
- }
58
- }
59
-
60
- /**
61
- *
62
- * Process the `state` object received in a `popstate` event
63
- * @param {PlayerHistory#HistoryElement} state - The previously stored state
64
- */
65
- processPopStateEvent(state) {
66
- log('info', 'Processing History popstate event with state:', state);
67
- this.processingPop = true;
68
- if (state.projectPath === this.player.project.path &&
69
- isEquivalent(state.fullZipPath, this.player.zip ? this.player.zip.fullZipPath : null))
70
- this.player.load(null, state.activity, null);
71
- else
72
- this.player.load(state.fullZipPath || state.projectPath, state.activity, null);
73
- }
74
-
75
- /**
76
- * Push a new entry on the window.History stack,
77
- * only when `browserHistory` is true and there is no `popstate` event in progress
78
- */
79
- pushBrowserHistory() {
80
- if (this.browserHistory) {
81
-
82
- if (this.processingPop) {
83
- // A 'popstate' event is currently being processed, so just clear this flag and return
84
- this.processingPop = false;
85
- return;
86
- }
87
-
88
- const
89
- ase = this.player.project.activitySequence,
90
- act = ase.currentAct,
91
- title = this.player.actPanel.act.name || 'No name',
92
- state = new this.HistoryElement(
93
- this.player.project.path,
94
- ase.getSequenceForElement(act),
95
- act,
96
- this.player.zip ? this.player.zip.fullZipPath : null);
97
-
98
- // Push a new history entry, or update the current one if it has no `state`
99
- if (!window.history.state)
100
- window.history.replaceState(state, title);
101
- else
102
- window.history.pushState(state, title);
103
- }
104
- }
105
-
106
- /**
107
- *
108
- * Counts the number of {@link module:PlayerHistory.PlayerHistory#HistoryElement HistoryElement} objects stored in
109
- * {@link module:PlayerHistory.PlayerHistory#sequenceStack sequenceStack}
110
- * @returns {number}
111
- */
112
- storedElementsCount() {
113
- return this.sequenceStack.length;
114
- }
115
-
116
- /**
117
- *
118
- * Removes all elements from {@link module:PlayerHistory.PlayerHistory#sequenceStack sequenceStack}
119
- */
120
- clearHistory() {
121
- this.sequenceStack = [0];
122
- }
123
-
124
- /**
125
- * Adds the current project and activity to the top of the history stack.
126
- */
127
- push() {
128
- if (this.player.project !== null && this.player.project.path !== null) {
129
- const
130
- ase = this.player.project.activitySequence,
131
- act = ase.currentAct;
132
- if (act >= 0) {
133
- if (this.sequenceStack.length > 0) {
134
- const last = this.sequenceStack[this.sequenceStack.length - 1];
135
- if (last.projectPath === this.player.project.path && last.activity === act)
136
- return;
137
- }
138
- this.sequenceStack.push(
139
- new this.HistoryElement(
140
- this.player.project.path,
141
- ase.getSequenceForElement(act),
142
- act,
143
- this.player.zip ? this.player.zip.fullZipPath : null));
144
- }
145
- }
146
- }
147
-
148
- /**
149
- * Retrieves the {@link module:PlayerHistory.PlayerHistory#HistoryElement HistoryElement} placed at the top of the
150
- * stack (if any) and instructs {@link module:JClicPlayer.JClicPlayer JClicPlayer} to load it. The obtained effect is to
151
- * "rewind" or "go back", usually to an activity that acts as a menu.
152
- * @returns {boolean}
153
- */
154
- pop() {
155
- // todo: check return value
156
- if (this.sequenceStack.length > 0) {
157
- const e = this.sequenceStack.pop();
158
- if (e.projectPath === this.player.project.path &&
159
- isEquivalent(e.fullZipPath, this.player.zip ? this.player.zip.fullZipPath : null))
160
- this.player.load(null, e.activity, null);
161
- else
162
- if (this.testMode && e.projectPath !== null && e.projectPath.length > 0)
163
- log('info', `At this point, a jump to "${e.projectPath}" should be performed.`);
164
- else
165
- this.player.load(e.fullZipPath || e.projectPath, e.activity, null);
166
- }
167
- return true;
168
- }
169
-
170
- /**
171
- *
172
- * Processes the provided {@link module:bags/JumpInfo.JumpInfo JumpInfo} object, instructing {@link module:JClicPlayer.JClicPlayer JClicPlayer} to go back,
173
- * stop or jump to another point in the sequence.
174
- * @param {module:bags/JumpInfo.JumpInfo} ji - The object to be processed
175
- * @param {boolean} allowReturn - When this parameter is `true`, the jump instructed by `ji` (if any)
176
- * will be recorded, thus allowing to return to the current activity.
177
- * @returns {boolean} - `true` if the jump can be processed without errors, `false` otherwise.
178
- */
179
- processJump(ji, allowReturn) {
180
- let result = false;
181
- if (ji !== null && this.player.project !== null) {
182
- switch (ji.action) {
183
- case 'STOP':
184
- break;
185
- case 'RETURN':
186
- if (this.sequenceStack.length > 0 || !this.player.options.returnAsExit) {
187
- result = this.pop();
188
- break;
189
- }
190
- case 'EXIT':
191
- if (this.testMode)
192
- log('info', 'At this point, the program should exit.');
193
- else
194
- this.player.exit(ji.sequence);
195
- break;
196
- case 'JUMP':
197
- if (!ji.sequence && !ji.projectPath) {
198
- const ase = this.player.project.activitySequence.getElement(ji.actNum, true);
199
- if (ase !== null) {
200
- if (allowReturn)
201
- this.push();
202
- this.player.load(null, null, ase.activity);
203
- result = true;
204
- }
205
- } else {
206
- if (this.testMode && ji.projectPath !== null && ji.projectPath.length > 0) {
207
- log('info', `At this point, a jump to "${ji.projectPath}" should be performed.`);
208
- } else {
209
- result = this.jumpToSequence(ji.sequence,
210
- ji.projectPath ? getPath(this.player.project.basePath, ji.projectPath) : null,
211
- allowReturn);
212
- }
213
- }
214
- break;
215
- }
216
- }
217
- return result;
218
- }
219
-
220
- /**
221
- * Performs a jump to the specified sequence
222
- * @param {string} sequence - The {@link module:bags/ActivitySequence.ActivitySequence ActivitySequence} tag to jump to.
223
- * @param {string} [path] - When not `null`, indicates a new project file that must be loaded.
224
- * Otherwise, the `sequence` parameter refers to a tag on the {@link module:bags/ActivitySequence.ActivitySequence ActivitySequence} of the
225
- * current project.
226
- * @param {boolean} [allowReturn] - When this parameter is `true`, the jump will be recorded, thus
227
- * allowing to return to the current activity.
228
- */
229
- jumpToSequence(sequence, path = null, allowReturn = false) {
230
- if (isNullOrUndef(sequence) && isNullOrUndef(path))
231
- return false;
232
- if (isNullOrUndef(path))
233
- path = this.player.project.path;
234
- if (this.sequenceStack.length > 0) {
235
- const e = this.sequenceStack[this.sequenceStack.length - 1];
236
- if (!isNullOrUndef(sequence) && path === e.projectPath) {
237
- let same = sequence === e.sequence;
238
- if (path === this.player.project.path) {
239
- const ase = this.player.project.activitySequence.getElement(e.activity, false);
240
- same = ase !== null && sequence === ase.tag;
241
- }
242
- if (same)
243
- return this.pop();
244
- }
245
- }
246
- if (allowReturn)
247
- this.push();
248
- if (path === this.player.project.path)
249
- this.player.load(null, sequence, null);
250
- else
251
- this.player.load(path, sequence, null);
252
- return true;
253
- }
254
- }
255
-
256
- Object.assign(PlayerHistory.prototype, {
257
- /**
258
- * The {@link module:JClicPlayer.JClicPlayer JClicPlayer} object to which this `PlayerHistory` belongs
259
- * @name module:PlayerHistory.PlayerHistory#player
260
- * @type {module:JClicPlayer.JClicPlayer} */
261
- player: null,
262
- /**
263
- * This is the main member of the class. PlayerHistory puts and retrieves
264
- * on it information about the proects and activities done by the current user.
265
- * @name module:PlayerHistory.PlayerHistory#sequenceStack
266
- * @type {module:PlayerHistory.PlayerHistory#HistoryElement[]} */
267
- sequenceStack: [],
268
- /**
269
- * When in test mode, jumps are only simulated.
270
- * @name module:PlayerHistory.PlayerHistory#testMode
271
- * @type {boolean} */
272
- testMode: false,
273
- /**
274
- * When true, JClic history is in sync with browser history
275
- * @name PlayerHistory#browserHistory
276
- * @type {boolean} */
277
- browserHistory: false,
278
- /**
279
- * When true, a window.history event is currently being processed, so window.pushState should not be performed
280
- * @name PlayerHistory#processingPop
281
- * @type {boolean} */
282
- processingPop: false,
283
- /**
284
- * Inner class used to store history elements.
285
- * @name module:PlayerHistory.PlayerHistory#HistoryElement
286
- */
287
- HistoryElement: class {
288
- /**
289
- * HistoryElement constructor
290
- * @param {string} projectPath - The full path of the project file
291
- * @param {string} sequence - The nearest sequence tag
292
- * @param {number} activity - The index of the current activity on the project's {@link module:bags/ActivitySequence.ActivitySequence ActivitySequence}
293
- * @param {string} fullZipPath - If `projectPath` resides in a {@link external:JSZip JSZip} object,
294
- * the full path of the zip file.
295
- */
296
- constructor(projectPath, sequence, activity, fullZipPath) {
297
- this.projectPath = projectPath;
298
- this.sequence = sequence;
299
- this.activity = activity;
300
- this.fullZipPath = fullZipPath;
301
- }
302
- }
303
- });
304
-
305
- export default PlayerHistory;