jclic 2.2.1 → 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 -672
  8. package/TRANSLATIONS.md +0 -11
  9. package/build-locales.mjs +0 -82
  10. package/dist/jclic-node.js +0 -31680
  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 -660
  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,325 +0,0 @@
1
- /**
2
- * File : boxes/BoxConnector.js
3
- * Created : 26/05/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 Catalan Educational Telematic Network (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
- import { Point, Dimension, Rectangle } from '../AWT.js';
33
-
34
- const DEFAULT_COMPOSITE_OP = 'source-over';
35
-
36
- /**
37
- * BoxConnector allows users to visually connect two {@link module:boxes/ActiveBox.ActiveBox ActiveBox} objects of an
38
- * {@link module:Activity.ActivityPanel ActivityPanel}. There are two modes of operation:
39
- *
40
- * - Drawing a line between an origin point (usually the point where the user clicks on) and a
41
- * destination point.
42
- * - Dragging the ActiveBox from one location to another.
43
- *
44
- * The connecting lines can have arrowheads at its endings.
45
- */
46
- export class BoxConnector {
47
- /**
48
- * BoxConnector constructor
49
- * @param {module:AWT.Container} parent - The Container to which this BoxConnector belongs
50
- * @param {external:jQuery} $canvas - The HTML `canvas` element where this BoxConnector will draw.
51
- */
52
- constructor(parent, $canvas) {
53
- this.parent = parent;
54
- this.ctx = $canvas.get(-1).getContext('2d', { willReadFrequently: true });
55
- this.dim = new Dimension(this.ctx.canvas.width, this.ctx.canvas.height);
56
- this.origin = new Point();
57
- this.dest = new Point();
58
- this.relativePos = new Point();
59
- }
60
-
61
- /**
62
- * Displaces the ending point of the connector
63
- * @param {number} dx - Displacement on the X axis
64
- * @param {number} dy - Displacement on the Y axis
65
- */
66
- moveBy(dx, dy) {
67
- this.moveTo(Point(this.dest.x + dx, this.dest.y + dy));
68
- }
69
-
70
- /**
71
- * Moves the ending point of the connector to a new position
72
- * @param {module:AWT.Point} pt - The new position
73
- * @param {boolean} forcePaint - When `true`, forces the repaint of all the area also if there is
74
- * no movement at all.
75
- */
76
- moveTo(pt, forcePaint) {
77
- if (!this.active || !forcePaint && this.dest.equals(pt))
78
- return;
79
-
80
- // Restore the background
81
- if (this.bgRect) {
82
- if (this.bgImg) {
83
- this.ctx.putImageData(
84
- this.bgImg,
85
- 0, 0,
86
- this.bgRect.pos.x, this.bgRect.pos.y,
87
- this.bgRect.dim.width, this.bgRect.dim.height);
88
- } else if (this.parent)
89
- this.parent.updateContent();
90
- }
91
-
92
- this.dest.moveTo(pt);
93
-
94
- // Calculate the bounds of the invalidated area after the move:
95
- // Start with the origin point or box area
96
- const pt1 = new Point(this.origin.x - this.relativePos.x, this.origin.y - this.relativePos.y);
97
- this.bgRect = new Rectangle(pt1, this.bx ? this.bx.dim : new Dimension());
98
- // Add the destination point or box area
99
- const pt2 = new Point(pt.x - this.relativePos.x, pt.y - this.relativePos.y);
100
- this.bgRect.add(new Rectangle(pt2, this.bx ? this.bx.dim : new Dimension()));
101
- // Add a generous border around the area
102
- this.bgRect.grow(10, 10);
103
-
104
- if (this.bx !== null) {
105
- // Move the ActiveBox
106
- this.bx.moveTo(new Point(pt.x - this.relativePos.x, pt.y - this.relativePos.y));
107
- this.bx.setTemporaryHidden(false);
108
- this.bx.update(this.ctx, null);
109
- this.bx.setTemporaryHidden(true);
110
- } else {
111
- // Draw the connecting line
112
- this.drawLine();
113
- this.linePainted = true;
114
- }
115
- }
116
-
117
- /**
118
- * Starts the box connector operation
119
- * @param {module:AWT.Point} pt - Starting point
120
- * @param {module:boxes/ActiveBox.ActiveBox} [box] - Passed only when the BoxConnector runs in drag&drop mode
121
- */
122
- begin(pt, box) {
123
- if (this.active)
124
- this.end();
125
- this.origin.moveTo(pt);
126
- this.dest.moveTo(pt);
127
- this.linePainted = false;
128
- this.active = true;
129
-
130
- if (box) {
131
- // Remember what box will be moved, hide it from the panel and repaint all
132
- this.bx = box;
133
- this.relativePos.moveTo(pt.x - box.pos.x, pt.y - box.pos.y);
134
- this.bx.setFocused(true);
135
- this.bx.setTemporaryHidden(true);
136
- this.linePainted = false;
137
- this.parent.invalidate().update();
138
- }
139
-
140
- // Save the full image currently displayed on the panel (with the box hidden)
141
- try {
142
- this.bgImg = this.ctx.getImageData(0, 0, this.dim.width, this.dim.height);
143
- } catch (_ex) {
144
- // Avoid "canvas tainted by cross-origin data" errors
145
- // Setting bgImg to null is less efficient, but works
146
- this.bgImg = null;
147
- }
148
- this.bgRect = null;
149
-
150
- // Make a first movement to make the box appear
151
- if (box)
152
- this.moveTo(pt, true);
153
- }
154
-
155
- /**
156
- * Finalizes the operation of this box connector until a new call to `begin`
157
- */
158
- end() {
159
- if (!this.active)
160
- return;
161
-
162
- this.active = false;
163
- this.linePainted = false;
164
- this.bgRect = null;
165
- this.bgImg = null;
166
-
167
- if (this.bx) {
168
- // Restore the original position and attributes of the box
169
- this.bx.setFocused(false);
170
- this.bx.moveTo(this.origin.x - this.relativePos.x, this.origin.y - this.relativePos.y);
171
- this.bx.setTemporaryHidden(false);
172
- this.bx = null;
173
- this.relativePos.moveTo(0, 0);
174
- }
175
-
176
- // Repaint all
177
- this.ctx.clearRect(0, 0, this.dim.width, this.dim.height);
178
- this.parent.invalidate().update();
179
- }
180
-
181
- /**
182
- * Strokes a line between `origin` and `dest`, optionally ended with an arrowhead.
183
- */
184
- drawLine() {
185
- if (this.compositeOp !== DEFAULT_COMPOSITE_OP) {
186
- this.ctx.strokeStyle = this.xorColor;
187
- this.ctx.globalCompositeOperation = this.compositeOp;
188
- } else
189
- this.ctx.strokeStyle = this.lineColor;
190
-
191
- this.ctx.lineWidth = this.lineWidth;
192
-
193
- this.ctx.beginPath();
194
- this.ctx.moveTo(this.origin.x, this.origin.y);
195
- this.ctx.lineTo(this.dest.x, this.dest.y);
196
- this.ctx.stroke();
197
-
198
- if (this.arrow) {
199
- // Draws the arrow head
200
- const
201
- beta = Math.atan2(this.origin.x - this.dest.x, this.dest.x - this.origin.x),
202
- arp = new Point(this.dest.x - this.arrowLength * Math.cos(beta + this.arrowAngle),
203
- this.dest.y + this.arrowLength * Math.sin(beta + this.arrowAngle));
204
- this.ctx.beginPath();
205
- this.ctx.moveTo(this.dest.x, this.dest.y);
206
- this.ctx.lineTo(arp.x, arp.y);
207
- this.ctx.stroke();
208
-
209
- arp.moveTo(this.dest.x - this.arrowLength * Math.cos(beta - this.arrowAngle),
210
- this.dest.y + this.arrowLength * Math.sin(beta - this.arrowAngle));
211
- this.ctx.beginPath();
212
- this.ctx.moveTo(this.dest.x, this.dest.y);
213
- this.ctx.lineTo(arp.x, arp.y);
214
- this.ctx.stroke();
215
- }
216
- if (this.compositeOp !== DEFAULT_COMPOSITE_OP) {
217
- // reset default settings
218
- this.ctx.globalCompositeOperation = DEFAULT_COMPOSITE_OP;
219
- }
220
- }
221
- }
222
-
223
- Object.assign(BoxConnector.prototype, {
224
- /**
225
- * The background image, saved and redrawn on each movement
226
- * @name module:boxes/BoxConnector.BoxConnector#bgImg
227
- * @type {external:HTMLImageElement} */
228
- bgImg: null,
229
- /**
230
- * The rectangle of {@link module:Activity.ActivityPanel ActivityPanel} saved in `bgImg`
231
- * @name module:boxes/BoxConnector.BoxConnector#bgRect
232
- * @type {module:AWT.Rectangle} */
233
- bgRect: null,
234
- /**
235
- * Initial position of the connector
236
- * @name module:boxes/BoxConnector.BoxConnector#origin
237
- * @type {module:AWT.Point} */
238
- origin: null,
239
- /**
240
- * Current (while moving) and final position of the connector
241
- * @name module:boxes/BoxConnector.BoxConnector#dest
242
- * @type {module:AWT.Point} */
243
- dest: null,
244
- /**
245
- * When `true`, the connector must end on arrowhead
246
- * @name module:boxes/BoxConnector.BoxConnector#arrow
247
- * @type {boolean} */
248
- arrow: false,
249
- /**
250
- * `true` while the connector is active
251
- * @name module:boxes/BoxConnector.BoxConnector#active
252
- * @type {boolean} */
253
- active: false,
254
- /**
255
- * `true` while the line has already been painted (used for XOR expressions)
256
- * @name module:boxes/BoxConnector.BoxConnector#linePainted
257
- * @type {boolean} */
258
- linePainted: false,
259
- /**
260
- * The arrowhead length (in pixels)
261
- * @name module:boxes/BoxConnector.BoxConnector#arrowLength
262
- * @type {number} */
263
- arrowLength: 10,
264
- /**
265
- * The arrowhead angle
266
- * @name module:boxes/BoxConnector.BoxConnector#arrowAngle
267
- * @type {number} */
268
- arrowAngle: Math.PI / 6,
269
- /**
270
- * The main color used in XOR operations
271
- * @name module:boxes/BoxConnector.BoxConnector#lineColor
272
- * @type {string} */
273
- lineColor: 'black',
274
- /**
275
- * The complementary color used in XOR operations
276
- * @name module:boxes/BoxConnector.BoxConnector#xorColor
277
- * @type {string} */
278
- xorColor: 'white',
279
- /**
280
- * The global composite operator used when drawing in XOR mode. Default is "difference".
281
- * For a list of possible values see:
282
- * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation}
283
- * @name module:boxes/BoxConnector.BoxConnector#compositeOp
284
- * @type {string} */
285
- compositeOp: 'difference',
286
- /**
287
- * The default {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation composite operator}
288
- * ("source-over").
289
- * @name module:boxes/BoxConnector.BoxConnector#DEFAULT_COMPOSITE_OP
290
- * @static
291
- * @type {string} */
292
- DEFAULT_COMPOSITE_OP: DEFAULT_COMPOSITE_OP,
293
- /**
294
- * Relative position of point B regarding A
295
- * @name module:boxes/BoxConnector.BoxConnector#relativePos
296
- * @type {module:AWT.Point} */
297
- relativePos: null,
298
- /**
299
- * The ActiveBox to connect or move
300
- * @name module:boxes/BoxConnector.BoxConnector#bx
301
- * @type {module:boxes/ActiveBox.ActiveBox} */
302
- bx: null,
303
- /**
304
- * The Graphics context where the BoxConnector will paint
305
- * @name module:boxes/BoxConnector.BoxConnector#ctx
306
- * @type {external:CanvasRenderingContext2D} */
307
- ctx: null,
308
- /**
309
- * The dimension of the HTML canvas where to draw
310
- * @name module:boxes/BoxConnector.BoxConnector#dim
311
- * @type {module:AWT.Dimension} */
312
- dim: null,
313
- /**
314
- * The container to which this connector belongs
315
- * @name module:boxes/BoxConnector.BoxConnector#parent
316
- * @type {module:AWT.Container} */
317
- parent: null,
318
- /**
319
- * Width of the connector line
320
- * @name module:boxes/BoxConnector.BoxConnector#lineWidth
321
- * @type {number} */
322
- lineWidth: 1.5,
323
- });
324
-
325
- export default BoxConnector;