jclic 2.1.21 → 2.1.22
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/CHANGELOG.md +4 -0
- package/dist/jclic-node.js +1 -1
- package/dist/jclic-node.js.map +1 -1
- package/dist/jclic.min.js +2 -2
- package/dist/jclic.min.js.map +1 -1
- package/package.json +1 -1
- package/src/GlobalData.js +1 -1
- package/dist/1078.jclic-node.js +0 -282
- package/dist/1078.jclic-node.js.map +0 -1
- package/dist/1196.jclic-node.js +0 -808
- package/dist/1196.jclic-node.js.map +0 -1
- package/dist/1253.jclic-node.js +0 -1432
- package/dist/1253.jclic-node.js.map +0 -1
- package/dist/13.jclic-node.js +0 -103
- package/dist/13.jclic-node.js.map +0 -1
- package/dist/1567.jclic-node.js +0 -2313
- package/dist/1567.jclic-node.js.map +0 -1
- package/dist/1588.jclic-node.js +0 -602
- package/dist/1588.jclic-node.js.map +0 -1
- package/dist/1725.jclic-node.js +0 -836
- package/dist/1725.jclic-node.js.map +0 -1
- package/dist/1731.jclic-node.js +0 -438
- package/dist/1731.jclic-node.js.map +0 -1
- package/dist/1842.jclic-node.js +0 -651
- package/dist/1842.jclic-node.js.map +0 -1
- package/dist/2160.jclic-node.js +0 -1016
- package/dist/2160.jclic-node.js.map +0 -1
- package/dist/222.jclic-node.js +0 -129
- package/dist/222.jclic-node.js.map +0 -1
- package/dist/2316.jclic-node.js +0 -949
- package/dist/2316.jclic-node.js.map +0 -1
- package/dist/2355.jclic-node.js +0 -371
- package/dist/2355.jclic-node.js.map +0 -1
- package/dist/2366.jclic-node.js +0 -431
- package/dist/2366.jclic-node.js.map +0 -1
- package/dist/2379.jclic-node.js +0 -202
- package/dist/2379.jclic-node.js.map +0 -1
- package/dist/2437.jclic-node.js +0 -450
- package/dist/2437.jclic-node.js.map +0 -1
- package/dist/2531.jclic-node.js +0 -869
- package/dist/2531.jclic-node.js.map +0 -1
- package/dist/2608.jclic-node.js +0 -160
- package/dist/2608.jclic-node.js.map +0 -1
- package/dist/2715.jclic-node.js +0 -554
- package/dist/2715.jclic-node.js.map +0 -1
- package/dist/277.jclic-node.js +0 -22
- package/dist/277.jclic-node.js.map +0 -1
- package/dist/2921.jclic-node.js +0 -660
- package/dist/2921.jclic-node.js.map +0 -1
- package/dist/2952.jclic-node.js +0 -101
- package/dist/2952.jclic-node.js.map +0 -1
- package/dist/3018.jclic-node.js +0 -421
- package/dist/3018.jclic-node.js.map +0 -1
- package/dist/3019.jclic-node.js +0 -682
- package/dist/3019.jclic-node.js.map +0 -1
- package/dist/3231.jclic-node.js +0 -274
- package/dist/3231.jclic-node.js.map +0 -1
- package/dist/331.jclic-node.js +0 -115
- package/dist/331.jclic-node.js.map +0 -1
- package/dist/3391.jclic-node.js +0 -276
- package/dist/3391.jclic-node.js.map +0 -1
- package/dist/3502.jclic-node.js +0 -671
- package/dist/3502.jclic-node.js.map +0 -1
- package/dist/3653.jclic-node.js +0 -982
- package/dist/3653.jclic-node.js.map +0 -1
- package/dist/371.jclic.min.js +0 -2
- package/dist/371.jclic.min.js.map +0 -1
- package/dist/3856.jclic-node.js +0 -575
- package/dist/3856.jclic-node.js.map +0 -1
- package/dist/4112.jclic-node.js +0 -659
- package/dist/4112.jclic-node.js.map +0 -1
- package/dist/4123.jclic-node.js +0 -910
- package/dist/4123.jclic-node.js.map +0 -1
- package/dist/427.jclic-node.js +0 -894
- package/dist/427.jclic-node.js.map +0 -1
- package/dist/4483.jclic-node.js +0 -327
- package/dist/4483.jclic-node.js.map +0 -1
- package/dist/4548.jclic-node.js +0 -1078
- package/dist/4548.jclic-node.js.map +0 -1
- package/dist/466.jclic-node.js +0 -99
- package/dist/466.jclic-node.js.map +0 -1
- package/dist/485.jclic-node.js +0 -783
- package/dist/485.jclic-node.js.map +0 -1
- package/dist/4921.jclic-node.js +0 -500
- package/dist/4921.jclic-node.js.map +0 -1
- package/dist/5091.jclic-node.js +0 -239
- package/dist/5091.jclic-node.js.map +0 -1
- package/dist/520.jclic-node.js +0 -550
- package/dist/520.jclic-node.js.map +0 -1
- package/dist/5312.jclic-node.js +0 -1126
- package/dist/5312.jclic-node.js.map +0 -1
- package/dist/5338.jclic-node.js +0 -212
- package/dist/5338.jclic-node.js.map +0 -1
- package/dist/5344.jclic-node.js +0 -229
- package/dist/5344.jclic-node.js.map +0 -1
- package/dist/5550.jclic-node.js +0 -238
- package/dist/5550.jclic-node.js.map +0 -1
- package/dist/5626.jclic-node.js +0 -614
- package/dist/5626.jclic-node.js.map +0 -1
- package/dist/5977.jclic-node.js +0 -1081
- package/dist/5977.jclic-node.js.map +0 -1
- package/dist/6148.jclic-node.js +0 -345
- package/dist/6148.jclic-node.js.map +0 -1
- package/dist/6176.jclic-node.js +0 -481
- package/dist/6176.jclic-node.js.map +0 -1
- package/dist/6221.jclic-node.js +0 -1072
- package/dist/6221.jclic-node.js.map +0 -1
- package/dist/6238.jclic-node.js +0 -718
- package/dist/6238.jclic-node.js.map +0 -1
- package/dist/6454.jclic-node.js +0 -1413
- package/dist/6454.jclic-node.js.map +0 -1
- package/dist/6565.jclic-node.js +0 -294
- package/dist/6565.jclic-node.js.map +0 -1
- package/dist/6579.jclic-node.js +0 -719
- package/dist/6579.jclic-node.js.map +0 -1
- package/dist/6715.jclic-node.js +0 -148
- package/dist/6715.jclic-node.js.map +0 -1
- package/dist/6777.jclic-node.js +0 -171
- package/dist/6777.jclic-node.js.map +0 -1
- package/dist/6782.jclic-node.js +0 -1611
- package/dist/6782.jclic-node.js.map +0 -1
- package/dist/6847.jclic-node.js +0 -601
- package/dist/6847.jclic-node.js.map +0 -1
- package/dist/6856.jclic-node.js +0 -252
- package/dist/6856.jclic-node.js.map +0 -1
- package/dist/696.jclic-node.js +0 -1821
- package/dist/696.jclic-node.js.map +0 -1
- package/dist/698.jclic-node.js +0 -583
- package/dist/698.jclic-node.js.map +0 -1
- package/dist/704.jclic-node.js +0 -80
- package/dist/704.jclic-node.js.map +0 -1
- package/dist/7046.jclic-node.js +0 -735
- package/dist/7046.jclic-node.js.map +0 -1
- package/dist/7220.jclic-node.js +0 -156
- package/dist/7220.jclic-node.js.map +0 -1
- package/dist/7257.jclic-node.js +0 -931
- package/dist/7257.jclic-node.js.map +0 -1
- package/dist/743.jclic-node.js +0 -583
- package/dist/743.jclic-node.js.map +0 -1
- package/dist/757.jclic-node.js +0 -1072
- package/dist/757.jclic-node.js.map +0 -1
- package/dist/7781.jclic-node.js +0 -202
- package/dist/7781.jclic-node.js.map +0 -1
- package/dist/7912.jclic-node.js +0 -2103
- package/dist/7912.jclic-node.js.map +0 -1
- package/dist/827.jclic-node.js +0 -708
- package/dist/827.jclic-node.js.map +0 -1
- package/dist/8276.jclic-node.js +0 -409
- package/dist/8276.jclic-node.js.map +0 -1
- package/dist/8322.jclic-node.js +0 -498
- package/dist/8322.jclic-node.js.map +0 -1
- package/dist/8641.jclic-node.js +0 -360
- package/dist/8641.jclic-node.js.map +0 -1
- package/dist/8837.jclic-node.js +0 -651
- package/dist/8837.jclic-node.js.map +0 -1
- package/dist/8895.jclic-node.js +0 -151
- package/dist/8895.jclic-node.js.map +0 -1
- package/dist/9072.jclic-node.js +0 -1285
- package/dist/9072.jclic-node.js.map +0 -1
- package/dist/9078.jclic-node.js +0 -935
- package/dist/9078.jclic-node.js.map +0 -1
- package/dist/9103.jclic-node.js +0 -718
- package/dist/9103.jclic-node.js.map +0 -1
- package/dist/9359.jclic-node.js +0 -145
- package/dist/9359.jclic-node.js.map +0 -1
- package/dist/9409.jclic-node.js +0 -921
- package/dist/9409.jclic-node.js.map +0 -1
- package/dist/9513.jclic-node.js +0 -720
- package/dist/9513.jclic-node.js.map +0 -1
- package/dist/9704.jclic-node.js +0 -81
- package/dist/9704.jclic-node.js.map +0 -1
- package/dist/9950.jclic-node.js +0 -827
- package/dist/9950.jclic-node.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"5977.jclic-node.js","mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEyC;;AAEzC;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oCAAoC;AACpC,aAAa,iBAAiB;AAC9B,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR,QAAQ,wDAAG,gDAAgD,UAAU;AACrE;AACA;AACA;;AAEA;AACA;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA,WAAW,4DAAO;AAClB;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,UAAU;AACvB,eAAe;AACf;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gBAAgB,qFAAqF;AACrG,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,kDAAkD,gDAAgD;AAC/G;AACA,aAAa,SAAS,yCAAyC,uEAAuE;AACtI,eAAe,SAAS;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,2DAA2D;AACxE,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,UAAU;AACvB,eAAe,2DAA2D;AAC1E;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA,CAAC;;AAED;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,kDAAkD,gDAAgD;AAC7G;AACA,WAAW,SAAS,wCAAwC,uEAAuE;AACnI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oEAAoE,iDAAiD;AACrH,UAAU,QAAQ;AAClB;AACA;AACA;AACA;;AAEA;AACA;;AAEA,iEAAe,mBAAmB,EAAC;;;;;;;;;;;;;;;;ACrLnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEuB;AACqC;AAC0B;;AAEtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,oBAAoB,+DAAmB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,SAAS;AACtB,qBAAqB,OAAO;AAC5B;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA,oBAAoB,6CAAC;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,+DAAU;AACnC,2BAA2B,+DAAU;AACrC,0BAA0B,+DAAU;AACpC,yBAAyB,+DAAU;AACnC;AACA;AACA,yBAAyB,+DAAU;AACnC,yBAAyB,+DAAU;AACnC,yBAAyB,+DAAU;AACnC,0BAA0B,+DAAU;AACpC,0BAA0B,+DAAU;AACpC;AACA;AACA;AACA,8BAA8B,8DAAS;AACvC;AACA,8BAA8B,8DAAS;AACvC,6BAA6B,+DAAU;AACvC,8BAA8B,+DAAU;AACxC;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA,WAAW,4DAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;AACA,WAAW,4DAAO;AAClB;AACA,QAAQ,gCAAgC;AACxC,QAAQ,gCAAgC;AACxC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kCAAkC,4CAA4C;AAC9E,iCAAiC,sDAAsD;AACvF,aAAa,mCAAmC;AAChD,aAAa,wCAAwC;AACrD,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,yBAAyB,uDAAuD;AAChF,aAAa,wCAAwC;AACrD,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAoB,eAAe;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,QAAQ;AAC9B;AACA;AACA,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oBAAoB,eAAe;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,QAAQ;AAC9B;AACA;AACA,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oBAAoB,eAAe;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oBAAoB,eAAe;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,2DAA2D;AACxE,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB,YAAY;AAC5B;AACA,kBAAkB,eAAe;AACjC;AACA;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,OAAO;AAClC,oBAAoB,OAAO;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,qBAAqB,GAAG,WAAW,GAAG,MAAM,SAAS,MAAM,GAAG;AAC9D;AACA,qBAAqB,GAAG,MAAM,SAAS,MAAM,GAAG,WAAW,GAAG;;AAE9D;AACA;AACA;AACA,gCAAgC,GAAG,WAAW,GAAG,MAAM,SAAS,YAAY,GAAG,MAAM,SAAS,gBAAgB,GAAG;AACjH;;AAEA;AACA;AACA,gCAAgC,GAAG,gBAAgB,SAAS,MAAM,GAAG,YAAY,SAAS,MAAM,GAAG,WAAW,GAAG;AACjH;;AAEA;AACA;AACA,gCAAgC,GAAG,WAAW,GAAG,WAAW,GAAG,OAAO,GAAG,WAAW,GAAG,WAAW,GAAG;AACrG;;AAEA;AACA;AACA,0CAA0C,GAAG,MAAM,SAAS,MAAM,GAAG,OAAO,GAAG,MAAM,SAAS,MAAM,GAAG;AACvG;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,YAAY;AAC9B,oBAAoB,OAAO;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;;AAEA;AACA,kBAAkB,OAAO;AACzB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,wCAAwC;AACpD;AACA;AACA;AACA;AACA,YAAY,wCAAwC;AACpD;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA,WAAW;AACX;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA,IAAI,gEAAW;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB,6CAAC;AACvB;AACA;AACA,yBAAyB,+DAAU;AACnC,wBAAwB,+DAAU;AAClC,6BAA6B,+DAAU;AACvC;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA,WAAW,4DAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;AACA,WAAW,4DAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,UAAU;AACtB;AACA,CAAC;;AAED;AACA;AACA,mBAAmB;AACnB,gBAAgB;AAChB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iEAAe,+DAAmB,qCAAqC,EAAC","sources":["webpack://jclic/./src/automation/AutoContentProvider.js","webpack://jclic/./src/automation/arith/Arith.js"],"sourcesContent":["/**\n * File : automation/AutoContentProvider.js\n * Created : 13/04/2015\n * By : Francesc Busquets <francesc@gmail.com>\n *\n * JClic.js\n * An HTML5 player of JClic activities\n * https://projectestac.github.io/jclic.js\n *\n * @source https://github.com/projectestac/jclic.js\n *\n * @license EUPL-1.2\n * @licstart\n * (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)\n *\n * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by\n * the European Commission- subsequent versions of the EUPL (the \"Licence\");\n * You may not use this work except in compliance with the Licence.\n *\n * You may obtain a copy of the Licence at:\n * https://joinup.ec.europa.eu/software/page/eupl\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the Licence is distributed on an \"AS IS\" basis, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * Licence for the specific language governing permissions and limitations\n * under the Licence.\n * @licend\n * @module\n */\n\nimport {log, getAttr} from '../Utils.js';\n\n/**\n * This abstract class is the base for classes that create on-time automatic content for JClic\n * activities, usually using random parameters to assure different content in each session.\n *\n * Activities with `AutoContentProvider` objects rely on them to build new content on every start.\n */\nexport class AutoContentProvider {\n /**\n * AutoContentProvider constructor\n */\n constructor() {\n }\n\n /**\n * Dynamic constructor that returns a specific type of AutoContentProvider based on the `class`\n * attribute declared on an $xml element.\n * It should be called only from {@link module:Activity.Activity#setProperties Activity.setProperties}\n * @param {external.jQuery} $xml - The XML element to parse\n * @returns {module:automation/AutoContentProvider.AutoContentProvider}\n */\n static getProvider($xml) {\n let automation = null;\n if ($xml) {\n const\n className = ($xml.attr('class') || '').replace(/^edu\\.xtec\\.jclic\\.automation\\./, '@'),\n cl = AutoContentProvider.CLASSES[className];\n if (cl) {\n automation = new cl();\n automation.setProperties($xml);\n } else\n log('error', `Unknown AutoContentProvider class: ${className}`);\n }\n return automation;\n }\n\n /**\n * Loads the object settings from a specific jQuery XML element\n * @param {external:jQuery} $xml - The XML element to parse\n */\n setProperties($xml) {\n this.className = ($xml.attr('class') || '').replace(/^edu\\.xtec\\.jclic\\.automation\\./, '@');\n return this;\n }\n\n /**\n * Gets a object with the basic attributes needed to rebuild this instance excluding functions,\n * parent references, constants and also attributes retaining the default value.\n * The resulting object is commonly usued to serialize elements in JSON format.\n * @returns {object} - The resulting object, with minimal attrributes\n */\n getAttributes() {\n // To be overrided!\n return getAttr(this, ['className']);\n }\n\n /**\n * Builds a new AutoContentProvider, based on the properties specified in a data object\n * @param {object} data - The data object to be parsed\n * @param {object[]} params - Optional parameters to be passed to `setAttributes`\n * @returns {module:shapers/Shaper.Shaper}\n */\n static factory(data, params = []) {\n const cl = AutoContentProvider.CLASSES[data.className];\n return (new cl()).setAttributes(data, ...params);\n }\n\n /**\n * Initializes the content provider\n */\n init() {\n // To be implemented in real content providers\n }\n\n /**\n * Builds an {@link module:automation/AutoContentProvider/ActiveBagContentKit ActiveBagContentKit} and generates the automatized content.\n * @param {number} nRows - Number of rows to be processed\n * @param {number} nCols - Number of columns to be processed\n * @param {module:boxes/ActiveBagContent.ActiveBagContent[]} content - Array with one or more containers of {@link module:boxes/ActiveBoxContent.ActiveBoxContent ActiveBoxContent}\n * objects to be filled with new content.\n * @param {boolean} useIds - When `true`, the `id` field of {@link module:boxes/ActiveBoxContent.ActiveBoxContent ActiveBoxContent} objects is significant\n * @returns {boolean} - `true` if the process was OK. `false` otherwise.\n */\n generateContent(nRows, nCols, content, useIds) {\n return this.process(new AutoContentProvider.ActiveBagContentKit(nRows, nCols, content, useIds));\n }\n\n /**\n * Generates the automatized content\n * @param {module:automation/AutoContentProvider.ActiveBagContentKit} _kit - The objects to be filled with content\n * @returns {boolean} - `true` if the process was OK. `false` otherwise.\n */\n process(_kit) {\n // To be implemented in subclasses\n return false;\n }\n\n /**\n * Registers a new type of AutoContentProvider\n * @param {string} providerName - The name used to identify this AutoContentProvider\n * @param {function} providerClass - The activity class, usually extending AutoContentProvider\n * @returns {module:automation/AutoContentProvider.AutoContentProvider} - The provider class\n */\n static registerClass(providerName, providerClass) {\n AutoContentProvider.CLASSES[providerName] = providerClass;\n return providerClass;\n }\n}\n\nObject.assign(AutoContentProvider.prototype, {\n /**\n * This AutoContentProvider manages numeric expressions, so text literals should be\n * converted to numbers for comparisions, taking in account the\n * number format of the current locale (dot or comma as decimal separator)\n * @name module:automation/AutoContentProvider.AutoContentProvider#numericContent\n * @type {boolean} */\n numericContent: false,\n});\n\n/**\n * Utility class used to encapsulate multiple sets of box contents\n * @param {number} nRows - Number of rows to be processed\n * @param {number} nCols - Number of columns to be processed\n * @param {module:boxes/ActiveBagContent.ActiveBagContent[]} content - Array with one or more containers of {@link module:boxes/ActiveBoxContent.ActiveBoxContent ActiveBoxContent}\n * objects to be filled with new content.\n * @param {boolean} useIds - `true` when the `id` field of {@link module:boxes/ActiveBoxContent.ActiveBoxContent ActiveBoxContent} objects is significant.\n */\nAutoContentProvider.ActiveBagContentKit = class {\n constructor(nRows, nCols, content, useIds) {\n this.nRows = nRows;\n this.nCols = nCols;\n this.content = content;\n this.useIds = useIds;\n }\n};\n\n/**\n * Contains the current list of classes derived from AutoContentProvider.\n * This object should be updated by real automation classes at declaration time.\n * Currently, only two types of \"AutoContentProvider\" are defined: {@link module:automation/arith/Arith.Arith Arith} and TagReplace.\n * @type {object} */\nAutoContentProvider.CLASSES = {\n // TODO: Implement TagReplace\n '@tagreplace.TagReplace': AutoContentProvider\n};\n\n// TODO: Implement TagReplace\nAutoContentProvider.registerClass('@tagreplace.TagReplace', AutoContentProvider);\n\nexport default AutoContentProvider;\n","/**\n * File : automation/arith/Arith.js\n * Created : 28/05/2015\n * By : Francesc Busquets <francesc@gmail.com>\n *\n * JClic.js\n * An HTML5 player of JClic activities\n * https://projectestac.github.io/jclic.js\n *\n * @source https://github.com/projectestac/jclic.js\n *\n * @license EUPL-1.2\n * @licstart\n * (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)\n *\n * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by\n * the European Commission- subsequent versions of the EUPL (the \"Licence\");\n * You may not use this work except in compliance with the Licence.\n *\n * You may obtain a copy of the Licence at:\n * https://joinup.ec.europa.eu/software/page/eupl\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the Licence is distributed on an \"AS IS\" basis, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * Licence for the specific language governing permissions and limitations\n * under the Licence.\n * @licend\n * @module\n */\n\n/* global Intl */\n\nimport $ from 'jquery';\nimport AutoContentProvider from '../AutoContentProvider.js';\nimport { getNumber, getBoolean, getAttr, setAttr, attrForEach } from '../../Utils.js';\n\n//\n// Miscellaneous constants used by Arith:\nconst\n NMAXLOOPS = 60,\n OPSTR = ['+', '-', String.fromCharCode(215), ':'],\n RES = -12345,\n // Use comma as a decimal separator, based on current locale settings\n // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl\n DOTASCOMMA = Intl && Intl.NumberFormat().format(1.1).indexOf(',') > 0;\n\n/**\n * Arith provides randomly generated mental arithmetics operations, ready to be used in JClic activities.\n *\n * The operations can be additions, subtractions, multiplications or divides. The unknown of these\n * operations can be the result of the operation (`A op B = ?`), any of the two operators\n * (`A op ? = C` or `? op B = C`) or also the operator itself (`A ? B = C`).\n * @extends module:automation/AutoContentProvider.AutoContentProvider\n */\nexport class Arith extends AutoContentProvider {\n /**\n * Arith constructor\n */\n constructor() {\n super();\n this.className = '@arith.Arith';\n this.numericContent = true;\n this.opA = new Arith.Operator();\n this.opB = new Arith.Operator();\n }\n\n /**\n * Formats the number with a fixed number of decimals, optionally filling the result with leading\n * zeroes to have a fixed number of digits.\n * @param {number} val - The value to format\n * @param {number} dec - Number of decimals\n * @param {number} pre - Minimal number of digits before dot.\n * @returns {string}\n */\n static DecFormat(val, dec, pre) {\n let result = val.toFixed(dec);\n if (pre) {\n let n = result.indexOf('.');\n if (n < 0)\n n = result.length;\n for (; n < pre; n++)\n result = `0${result}`;\n }\n return result;\n }\n\n /**\n * Loads the object settings from a specific JQuery XML element\n * @override\n * @param {external:jQuery} $xml - The XML element to parse\n */\n setProperties($xml) {\n $xml.children().each((_n, child) => {\n const $node = $(child);\n let xNum = '';\n switch (child.nodeName) {\n case 'operand':\n switch ($node.attr('id')) {\n case 'A':\n this.opA.setProperties($node);\n break;\n case 'B':\n this.opB.setProperties($node);\n break;\n }\n break;\n case 'operations':\n this.use_add = getBoolean($node.attr('plus'));\n this.use_subst = getBoolean($node.attr('minus'));\n this.use_mult = getBoolean($node.attr('multiply'));\n this.use_div = getBoolean($node.attr('divide'));\n break;\n case 'unknown':\n this.exp_abx = getBoolean($node.attr('result'));\n this.exp_xbc = getBoolean($node.attr('first'));\n this.exp_axc = getBoolean($node.attr('last'));\n this.exp_axbc = getBoolean($node.attr('operand'));\n this.exp_caxb = getBoolean($node.attr('inverse'));\n break;\n case 'result':\n xNum = $node.attr('from');\n this.resultLimInf = getNumber(xNum === 'x' ? 0 : xNum, this.resultLimInf);\n xNum = $node.attr('to');\n this.resultLimSup = getNumber(xNum === 'x' ? 0 : xNum, this.resultLimSup);\n this.resultCarry = getBoolean($node.attr('notCarry'), this.resultCarry);\n this.resultNoDup = !getBoolean($node.attr('duplicates'), !this.resultNoDup);\n let s = $node.attr('order');\n this.resultOrder = s === 'ascending' ? 'SORTASC' : s === 'descending' ? 'SORTDESC' : 'NOSORT';\n s = $node.attr('condition');\n this.opCond = s === 'firstBig' ? 'AGB' : s === 'lastBig' ? 'BGA' : 'INDIF';\n break;\n }\n });\n return this;\n }\n\n /**\n * Gets a object with the basic attributes needed to rebuild this instance excluding functions,\n * parent references, constants and also attributes retaining the default value.\n * The resulting object is commonly usued to serialize elements in JSON format.\n * @returns {object} - The resulting object, with minimal attrributes\n */\n getAttributes() {\n return getAttr(this, [\n 'className',\n 'opA', 'opB', // Operator\n 'use_add', 'use_subst', 'use_mult', 'use_div',\n 'exp_abx|true', 'exp_axc|false', 'exp_xbc|false', 'exp_axbc|false', 'exp_caxb|false',\n 'resultLimInf|0', 'resultLimSup|9999', 'resultCarry|false', 'resultNoDup|false', 'resultOrder|NOSORT',\n 'opCond|INDIF'\n ]);\n }\n\n /**\n * Reads the properties of this Arith object from a dataset\n * @param {object} data - The data object to be parsed\n * @returns {object}\n */\n setAttributes(data) {\n return setAttr(this, data, [\n 'className',\n { key: 'opA', fn: Arith.Operator },\n { key: 'opB', fn: Arith.Operator },\n 'use_add', 'use_subst', 'use_mult', 'use_div',\n 'exp_abx', 'exp_axc', 'exp_xbc', 'exp_axbc', 'exp_caxb',\n 'resultLimInf', 'resultLimSup', 'resultCarry', 'resultNoDup', 'resultOrder',\n 'opCond',\n ]);\n }\n\n /**\n * Fills the `n` parameter (an {@link module:automation/arith/Arith.Num Num}) with a value in accordance with the\n * specifications of `op` (an {@link module:automation/arith/Arith.Operator Operator}), between two limits.\n * @param {module:automation/arith/Arith.Num} n - The number\n * @param {module:automation/arith/Arith.Operator} op - The operator\n * @param {number} limInf2 - Lower limit\n * @param {number} limSup2 - Upper limit\n * @returns {boolean} - `true` if all was OK\n */\n genNum(n, op, limInf2, limSup2) {\n let solved = false;\n n.c = op.numDec;\n const exp = n.c === 0 ? 1 : n.c === 1 ? 10 : 100;\n\n let ls = op.limSup;\n if (limSup2 !== RES && limSup2 < ls)\n ls = limSup2;\n let li = op.limInf;\n if (limInf2 !== RES && limInf2 > li)\n li = limInf2;\n\n if (op.fromList > 0) {\n n.vf = op.lst[Math.floor(Math.random() * op.fromList)];\n solved = true;\n }\n if (!solved) {\n const r = Math.floor(Math.random() * 100);\n if (op.wZero && r <= 10) {\n n.vf = 0;\n solved = true;\n } else if (op.wOne && r > 10 && r <= 20) {\n n.vf = 1;\n solved = true;\n } else if (op.wMinusOne && r > 20 && r <= 30) {\n n.vf = -1;\n solved = true;\n }\n }\n if (!solved) {\n if (li > ls) {\n const k = li;\n li = ls;\n ls = k;\n }\n let rang = Math.floor(ls - li + 1);\n if (rang < 0)\n rang = 1;\n let v = (Math.floor(Math.random() * rang) + li) * exp;\n if (exp > 1)\n v += Math.floor(Math.random() * exp);\n n.vf = v / exp;\n }\n return true;\n }\n\n /**\n * Fills the provided {@link module:automation/arith/Arith.Operator Operator} with real values\n * @param {module:automation/arith/Arith.Operator} o - The operator to use to generate the operation\n * @returns {boolean} - `true` if all was OK\n */\n genOp(o) {\n let i, ri2, rs2, q, va, vb, bufa, bufb;\n const\n ops = [],\n rlinf = this.resultLimInf,\n rlsup = this.resultLimSup;\n\n let nops = 0;\n if (this.use_add)\n ops[nops++] = 'SUM';\n if (this.use_subst)\n ops[nops++] = 'REST';\n if (this.use_mult)\n ops[nops++] = 'MULT';\n if (this.use_div)\n ops[nops++] = 'DIV';\n\n const op = ops[Math.floor(Math.random() * nops)];\n switch (op) {\n case 'SUM':\n for (i = 0; i < NMAXLOOPS; i++) {\n this.genNum(o.numA, this.opA, this.RES, rlsup);\n ri2 = o.numA.vf < rlinf ? rlinf - Math.floor(o.numA.vf) : this.RES;\n rs2 = rlsup - Math.floor(o.numA.vf);\n switch (this.opCond) {\n case 'AGB':\n if (rs2 === this.RES || rs2 > o.numA.vf)\n rs2 = Math.floor(o.numA.vf);\n break;\n case 'BGA':\n if (ri2 === this.RES || ri2 < o.numA.vf)\n ri2 = Math.floor(o.numA.vf);\n break;\n }\n this.genNum(o.numB, this.opB, ri2, rs2);\n o.numR.vf = o.numA.vf + o.numB.vf;\n if (o.numR.vf >= rlinf && o.numR.vf <= rlsup)\n break;\n }\n o.numR.c = o.numA.c > o.numB.c ? o.numA.c : o.numB.c;\n o.op = 0;\n if (this.resultCarry && o.numA.vf > 0 && o.numB.vf > 0) {\n q = o.numR.c === 2 ? 100 : o.numR.c === 1 ? 10 : 1;\n\n bufa = Arith.DecFormat(Math.floor(o.numA.vf * q + 0.5), 0, 10).split('');\n bufb = Arith.DecFormat(Math.floor(o.numB.vf * q + 0.5), 0, 10).split('');\n for (i = 0; i < 10; i++)\n if (bufa[i] !== '0' || bufb[i] !== '0')\n break;\n for (; i < 10; i++) {\n va = parseInt(bufa[i]);\n vb = parseInt(bufb[i]);\n if (va + vb < 10)\n continue;\n while (va + vb > 9) {\n if (va > vb)\n va = va > 0 ? Math.floor(Math.random() * va) : 0;\n else\n vb = vb > 0 ? Math.floor(Math.random() * vb) : 0;\n }\n bufa[i] = va.toFixed(0);\n bufb[i] = vb.toFixed(0);\n }\n\n o.numA.vf = parseInt(bufa.join('')) / q;\n o.numB.vf = parseInt(bufb.join('')) / q;\n // Corrected 2019/02/11: Factors should be multiplied by 'q'!\n // INCORRECT: o.numR.vf = Math.floor(o.numA.vf + o.numB.vf + 0.5) / q\n o.numR.vf = Math.floor(o.numA.vf * q + o.numB.vf * q + 0.5) / q;\n }\n break;\n\n case 'REST':\n for (i = 0; i < NMAXLOOPS; i++) {\n this.genNum(o.numA, this.opA, rlinf, this.RES);\n ri2 = o.numA.vf > rlsup ? Math.floor(o.numA.vf - rlsup) : this.RES;\n rs2 = Math.floor(o.numA.vf - rlinf);\n switch (this.opCond) {\n case 'AGB':\n if (rs2 === this.RES || rs2 > o.numA.vf)\n rs2 = Math.floor(o.numA.vf);\n break;\n case 'BGA':\n if (ri2 === this.RES || ri2 < o.numA.vf)\n ri2 = Math.floor(o.numA.vf);\n break;\n }\n this.genNum(o.numB, this.opB, ri2, rs2);\n o.numR.vf = o.numA.vf - o.numB.vf;\n if (o.numR.vf >= rlinf && o.numR.vf <= rlsup)\n break;\n }\n o.numR.c = o.numA.c > o.numB.c ? o.numA.c : o.numB.c;\n o.op = 1;\n if (this.resultCarry && o.numA.vf > 0 && o.numB.vf > 0 && o.numA.vf >= o.numB.vf) {\n q = o.numR.c === 2 ? 100 : o.numR.c === 1 ? 10 : 1;\n bufa = Arith.DecFormat(Math.floor(o.numA.vf * q + 0.5), 0, 10).split('');\n bufb = Arith.DecFormat(Math.floor(o.numB.vf * q + 0.5), 0, 10).split('');\n for (i = 0; i < 10; i++)\n if (bufb[i] !== '0')\n break;\n for (; i < 10; i++) {\n va = parseInt(bufa[i]);\n vb = parseInt(bufb[i]);\n if (va >= vb)\n continue;\n vb = va > 0 ? Math.floor(Math.random() * va) : 0;\n bufb[i] = vb.toFixed(0);\n }\n\n o.numA.vf = parseInt(bufa.join('')) / q;\n o.numB.vf = parseInt(bufb.join('')) / q;\n // Corrected 2019/02/11: Factors should be multiplied by 'q'!\n // o.numR.vf = Math.floor(o.numA.vf - o.numB.vf + 0.5) / q\n o.numR.vf = Math.floor(o.numA.vf * q - o.numB.vf * q + 0.5) / q;\n }\n break;\n\n case 'MULT':\n for (i = 0; i < NMAXLOOPS; i++) {\n this.genNum(o.numA, this.opA, this.RES, this.RES);\n ri2 = this.opB.limInf;\n rs2 = this.opB.limSup;\n switch (this.opCond) {\n case 'AGB':\n if (rs2 > o.numA.vf)\n rs2 = Math.floor(o.numA.vf);\n break;\n case 'BGA':\n if (ri2 < o.numA.vf)\n ri2 = Math.floor(o.numA.vf);\n break;\n }\n this.genNum(o.numB, this.opB, ri2, rs2);\n o.numR.vf = o.numA.vf * o.numB.vf;\n if (o.numR.vf >= rlinf && o.numR.vf <= rlsup)\n break;\n }\n o.numR.c = o.numA.c + o.numB.c;\n o.op = 2;\n break;\n\n case 'DIV':\n for (i = 0; i < NMAXLOOPS; i++) {\n this.genNum(o.numA, this.opA, this.RES, this.RES);\n ri2 = this.opB.limInf;\n rs2 = this.opB.limSup;\n switch (this.opCond) {\n case 'AGB':\n if (rs2 > o.numA.vf)\n rs2 = Math.floor(o.numA.vf);\n break;\n case 'BGA':\n if (ri2 < o.numA.vf)\n ri2 = Math.floor(o.numA.vf);\n break;\n }\n this.genNum(o.numB, this.opB, ri2, rs2);\n if (o.numB.vf !== 0 &&\n Math.abs(o.numA.vf) >= Math.abs(o.numB.vf) &&\n (o.numR.vf = o.numA.vf / o.numB.vf) >= rlinf &&\n o.numR.vf <= rlsup)\n break;\n }\n if (o.numB.vf === 0)\n o.numB.vf = 1;\n o.numR.vf = o.numA.vf / o.numB.vf;\n i = o.numA.c - o.numB.c;\n q = Math.pow(10, i);\n o.numA.vf *= q;\n o.numR.vf *= q;\n o.numR.vf = Math.floor(o.numR.vf);\n o.numA.vf = o.numR.vf * o.numB.vf;\n o.numA.vf /= q;\n o.numR.vf /= q;\n o.numR.c = i > 0 ? i : 0;\n o.op = 3;\n break;\n\n default:\n return false;\n }\n return true;\n }\n\n /**\n * Fills the provided ActiveBagContentKit with randomly generated operations\n * @override\n * @param {module:automation/AutoContentProvider.ActiveBagContentKit} kit - The composite object to be filled with data.\n * @returns {boolean} - `true` if all was OK\n */\n process(kit) {\n let nRows = kit.nRows,\n nCols = kit.nCols,\n content = kit.content, //Array of ActiveBagContent\n useIds = kit.useIds,\n i, j, k,\n o, op = [], // Array of Arith.Operation\n tipus = [],\n numTipus, tipX,\n tipInv = this.exp_caxb,\n va = '', vb = '', vc = '', operator = '',\n stra = [], strb = [], strc = [],\n nColsB = nCols, nRowsB = nRows,\n nCells = nRows * nCols,\n ass = null;\n\n if (nRows <= 0 || nCols <= 0 ||\n content === null || content.length < 1 || content[0] === null)\n return false;\n\n if (nCells < 2)\n return false;\n\n numTipus = 0;\n if (this.exp_abx)\n tipus[numTipus++] = 'ABX';\n if (this.exp_axc)\n tipus[numTipus++] = 'AXC';\n if (this.exp_xbc)\n tipus[numTipus++] = 'XBC';\n if (this.exp_axbc)\n tipus[numTipus++] = 'AXBC';\n if (numTipus === 0)\n return false;\n\n for (i = 0; i < nCells; i++) {\n o = new Arith.Operation();\n for (j = 0; j < NMAXLOOPS; j++) {\n this.genOp(o);\n if (this.resultNoDup) {\n for (k = 0; k < i; k++) {\n if (o.numR.vf === op[k].numR.vf)\n break;\n }\n if (k === i)\n break;\n } else\n break;\n }\n op[i] = o;\n }\n\n if (this.resultOrder !== 0) {\n for (i = nCells - 1; i > 0; i--) {\n for (j = 0; j < i; j++) {\n if (this.resultOrder === 'SORTASC' && op[j].numR.vf > op[j + 1].numR.vf ||\n this.resultOrder === 'SORTDESC' && op[j].numR.vf < op[j + 1].numR.vf) {\n // Switch values\n o = op[j];\n op[j] = op[j + 1];\n op[j + 1] = o;\n }\n }\n }\n }\n\n for (i = 0; i < nCells; i++) {\n tipX = tipus[Math.floor(Math.random() * numTipus)];\n va = Arith.DecFormat(op[i].numA.vf, op[0].numA.c);\n vb = Arith.DecFormat(op[i].numB.vf, op[0].numB.c);\n vc = Arith.DecFormat(op[i].numR.vf, op[0].numR.c);\n operator = OPSTR[op[i].op];\n\n // Use the special blank space ASCII 160 (\\xA0) instead of regular blank spaces\n\n if (tipInv)\n strc[i] = `${vc}\\xA0=\\xA0${va}\\xA0${operator}\\xA0${vb}`;\n else\n strc[i] = `${va}\\xA0${operator}\\xA0${vb}\\xA0=\\xA0${vc}`;\n\n switch (tipX) {\n case 'AXC':\n strb[i] = vb;\n stra[i] = tipInv ? `${vc}\\xA0=\\xA0${va}\\xA0${operator}\\xA0?` : `${va}\\xA0${operator}\\xA0?\\xA0=\\xA0${vc}`;\n break;\n\n case 'XBC':\n strb[i] = va;\n stra[i] = tipInv ? `${vc}\\xA0=\\xA0?\\xA0${operator}\\xA0${vb}` : `?\\xA0${operator}\\xA0${vb}\\xA0=\\xA0${vc}`;\n break;\n\n case 'AXBC':\n strb[i] = operator;\n stra[i] = tipInv ? `${vc}\\xA0=\\xA0${va}\\xA0?\\xA0${vb}` : `${va}\\xA0?\\xA0${vb}\\xA0=\\xA0${vc}`;\n break;\n\n default:\n strb[i] = vc;\n stra[i] = tipInv ? `?\\xA0=\\xA0${va}\\xA0${operator}\\xA0${vb}` : `${va}\\xA0${operator}\\xA0${vb}\\xA0=`;\n break;\n }\n }\n\n if (useIds) {\n ass = [];\n let strbx = [];\n k = 0;\n for (i = 0; i < nCells; i++) {\n for (j = 0; j < k; j++)\n if (strb[i] === strbx[j])\n break;\n if (j === k) {\n strbx[k] = strb[i];\n ass[i] = k;\n k++;\n } else\n ass[i] = j;\n }\n\n strb = [];\n for (i = 0; i < k; i++)\n strb[i] = strbx[i];\n\n if (nRowsB * nColsB !== k) {\n let distH = false;\n switch (k) {\n case 6:\n nRowsB = distH ? 2 : 3;\n nColsB = distH ? 3 : 2;\n break;\n\n case 8:\n nRowsB = distH ? 2 : 4;\n nColsB = distH ? 4 : 2;\n break;\n\n case 9:\n nRowsB = 3;\n nColsB = 3;\n break;\n\n case 10:\n nRowsB = distH ? 2 : 5;\n nColsB = distH ? 5 : 2;\n break;\n\n case 12:\n nRowsB = distH ? 3 : 4;\n nColsB = distH ? 4 : 3;\n break;\n\n case 14:\n nRowsB = distH ? 2 : 7;\n nColsB = distH ? 7 : 2;\n break;\n\n case 15:\n nRowsB = distH ? 3 : 5;\n nColsB = distH ? 3 : 5;\n break;\n\n case 16:\n nRowsB = 4;\n nColsB = 4;\n break;\n\n case 18:\n nRowsB = distH ? 6 : 3;\n nColsB = distH ? 3 : 6;\n break;\n\n case 20:\n nRowsB = distH ? 4 : 5;\n nColsB = distH ? 5 : 4;\n break;\n\n default:\n nRowsB = distH ? 1 : k;\n nColsB = distH ? k : 1;\n break;\n }\n }\n }\n\n // Added 2019/02/11\n // Use comma instead of dot for decimal separator, accordingly to current locale\n if (DOTASCOMMA) {\n function replaceDot(s) { return s.replace(/\\./g, ','); }\n stra = stra.map(replaceDot);\n strb = strb.map(replaceDot);\n strc = strc.map(replaceDot);\n }\n\n content[0].setTextContent(stra, nCols, nRows);\n if (ass !== null)\n content[0].setIds(ass);\n if (content.length > 1 && content[1] !== null) {\n content[1].setTextContent(strb, nColsB, nRowsB);\n content[1].getShaper().reset(nColsB, nRowsB);\n }\n if (content.length > 2 && content[2] !== null)\n content[2].setTextContent(strc, nCols, nRows);\n\n return true;\n }\n}\n\nObject.assign(Arith.prototype, {\n //\n // Operations use two operators:\n /**\n * First operator\n * @name module:automation/arith/Arith.Arith#opA\n * @type {module:automation/arith/Arith.Operator} */\n opA: null,\n /**\n * Second operator\n * @name module:automation/arith/Arith.Arith#opB\n * @type {module:automation/arith/Arith.Operator} */\n opB: null,\n /**\n * Allow additions\n * @name module:automation/arith/Arith.Arith#use_add\n * @type {boolean} */\n use_add: true,\n /**\n * Allow subtractions\n * @name module:automation/arith/Arith.Arith#use_subst\n * @type {boolean} */\n use_subst: false,\n /**\n * Allow multiplications\n * @name module:automation/arith/Arith.Arith#use_mult\n * @type {boolean} */\n use_mult: false,\n /**\n * Allow divides\n * @name module:automation/arith/Arith.Arith#use_div\n * @type {boolean} */\n use_div: false,\n /**\n * Allow expressions of type `A op B = X`\n * @name module:automation/arith/Arith.Arith#exp_abx\n * @type {boolean} */\n exp_abx: true,\n /**\n * Allow expressions of type `A op X = C`\n * @name module:automation/arith/Arith.Arith#exp_axc\n * @type {boolean} */\n exp_axc: false,\n /**\n * Allow expressions of type `X op B = C`\n * @name module:automation/arith/Arith.Arith#exp_xbc\n * @type {boolean} */\n exp_xbc: false,\n /**\n * Allow expressions of type `A x B = C`\n * @name module:automation/arith/Arith.Arith#exp_axbc\n * @type {boolean} */\n exp_axbc: false,\n /**\n * Allow inverse expressions, like `C = A op B`\n * @name module:automation/arith/Arith.Arith#exp_caxb\n * @type {boolean} */\n exp_caxb: false,\n /**\n * Lower limit of the result\n * @name module:automation/arith/Arith.Arith#resultLimInf\n * @type {number} */\n resultLimInf: 0,\n /**\n * Upper limit of the result\n * @name module:automation/arith/Arith.Arith#resultLimSup\n * @type {number} */\n resultLimSup: 9999,\n /**\n * Allow carry operations\n * @see {@link https://en.wikipedia.org/wiki/Carry_(arithmetic)}\n * @name module:automation/arith/Arith.Arith#resultCarry\n * @type {boolean} */\n resultCarry: false,\n /**\n * Avoid operations with the same result\n * @name module:automation/arith/Arith.Arith#resultNoDup\n * @type {boolean} */\n resultNoDup: false,\n /**\n * Type of sorting of results. Possible values are: 'NOSORT', 'SORTASC' and 'SORTDESC'\n * @name module:automation/arith/Arith.Arith#resultOrder\n * @type {string} */\n resultOrder: 'NOSORT',\n /**\n * Sorting of the operands in commutative operations. Possible values are: 'AGB' (_A greater than B_),\n * 'BGA' (_B greater tan A_) and 'INDIF' (default)\n * @name module:automation/arith/Arith.Arith#opCond\n * @type {string} */\n opCond: 'INDIF',\n});\n\n/**\n * Operator is an Utility class used by Arith to encapsulate the properties and methods related\n * to the members of the operations.\n */\nArith.Operator = class {\n constructor() {\n }\n\n /**\n * Loads Operator settings from a specific JQuery XML element\n * @param {external:jQuery} $xml - The XML element to parse\n */\n setProperties($xml) {\n // Read attributes\n attrForEach($xml.get(0).attributes, (name, val) => {\n switch (name) {\n case 'decimals':\n this.numDec = Number(val);\n break;\n\n case 'values':\n this.lst = val.split(' ').map(v => Number(v));\n this.fromList = this.lst.length;\n break;\n\n case 'from':\n this.limInf = Number(val === 'x' ? 0 : val);\n break;\n\n case 'to':\n this.limSup = Number(val === 'x' ? 0 : val);\n break;\n }\n\n $xml.children().each((_n, child) => {\n const $node = $(child);\n switch (child.nodeName) {\n case 'include':\n this.wZero = getBoolean($node.attr('zero'));\n this.wOne = getBoolean($node.attr('one'));\n this.wMinusOne = getBoolean($node.attr('minusOne'));\n break;\n }\n });\n });\n return this;\n }\n\n /**\n * Gets a object with the basic attributes needed to rebuild this instance excluding functions,\n * parent references, constants and also attributes retaining the default value.\n * The resulting object is commonly usued to serialize elements in JSON format.\n * @returns {object} - The resulting object, with minimal attrributes\n */\n getAttributes() {\n return getAttr(this, [\n 'limInf', 'limSup',\n 'numDec|0',\n 'wZero|false', 'wOne|false', 'wMinusOne|false',\n 'fromList|0', 'lst',\n ]);\n }\n\n /**\n * Reads the properties of this operator from a dataset\n * @param {object} data - The data object to be parsed\n * @returns {module:automation/arith/Arith.Arith}\n */\n setAttributes(data) {\n return setAttr(this, data, [\n 'limInf', 'limSup',\n 'numDec',\n 'wZero', 'wOne', 'wMinusOne',\n 'fromList', 'lst',\n ]);\n }\n};\n\nObject.assign(Arith.Operator.prototype, {\n /**\n * Lower limit\n * @name module:automation/arith/Arith.Arith.Operator#limInf\n * @type {number} */\n limInf: 0,\n /**\n * Upper limit\n * @name module:automation/arith/Arith.Arith.Operator#limSup\n * @type {number} */\n limSup: 10,\n /**\n * Number of decimal places\n * @name module:automation/arith/Arith.Arith.Operator#numDec\n * @type {number} */\n numDec: 0,\n /**\n * Including 0\n * @name module:automation/arith/Arith.Arith.Operator#wZero\n * @type {boolean} */\n wZero: false,\n /**\n * Including 1\n * @name module:automation/arith/Arith.Arith.Operator#wOne\n * @type {boolean} */\n wOne: false,\n /**\n * Including -1\n * @name module:automation/arith/Arith.Arith.Operator#wMinusOne\n * @type {boolean} */\n wMinusOne: false,\n /**\n * Take values from list. This member stores the list length.\n * @name module:automation/arith/Arith.Arith.Operator#fromList\n * @type {number} */\n fromList: 0,\n /**\n * The list of possible values\n * @name module:automation/arith/Arith.Arith.Operator#lst\n * @type {number[]} */\n lst: [],\n});\n\nArith.Num = class {\n constructor() {\n this.vf = 0.0; // The number value\n this.c = 0; // Number of decimals to be used when representing the number\n }\n\n format() {\n return Arith.DecFormat(this.vf, this.c);\n }\n};\n\nArith.Operation = class {\n constructor() {\n this.numA = new Arith.Num();\n this.numB = new Arith.Num();\n this.numR = new Arith.Num();\n this.op = 0;\n }\n};\n\n// Register class in AutoContentProvider.CLASSES\nexport default AutoContentProvider.registerClass('@arith.Arith', Arith);\n"],"names":[],"sourceRoot":""}
|
package/dist/6148.jclic-node.js
DELETED
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.id = 6148;
|
|
3
|
-
exports.ids = [6148];
|
|
4
|
-
exports.modules = {
|
|
5
|
-
|
|
6
|
-
/***/ 6148:
|
|
7
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
8
|
-
|
|
9
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10
|
-
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
11
|
-
/* harmony export */ });
|
|
12
|
-
/* unused harmony export BoxConnector */
|
|
13
|
-
/* harmony import */ var _AWT_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7912);
|
|
14
|
-
/**
|
|
15
|
-
* File : boxes/BoxConnector.js
|
|
16
|
-
* Created : 26/05/2015
|
|
17
|
-
* By : Francesc Busquets <francesc@gmail.com>
|
|
18
|
-
*
|
|
19
|
-
* JClic.js
|
|
20
|
-
* An HTML5 player of JClic activities
|
|
21
|
-
* https://projectestac.github.io/jclic.js
|
|
22
|
-
*
|
|
23
|
-
* @source https://github.com/projectestac/jclic.js
|
|
24
|
-
*
|
|
25
|
-
* @license EUPL-1.2
|
|
26
|
-
* @licstart
|
|
27
|
-
* (c) 2000-2020 Catalan Educational Telematic Network (XTEC)
|
|
28
|
-
*
|
|
29
|
-
* Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
|
|
30
|
-
* the European Commission- subsequent versions of the EUPL (the "Licence");
|
|
31
|
-
* You may not use this work except in compliance with the Licence.
|
|
32
|
-
*
|
|
33
|
-
* You may obtain a copy of the Licence at:
|
|
34
|
-
* https://joinup.ec.europa.eu/software/page/eupl
|
|
35
|
-
*
|
|
36
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
37
|
-
* distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
|
|
38
|
-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
39
|
-
* Licence for the specific language governing permissions and limitations
|
|
40
|
-
* under the Licence.
|
|
41
|
-
* @licend
|
|
42
|
-
* @module
|
|
43
|
-
*/
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const DEFAULT_COMPOSITE_OP = 'source-over';
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* BoxConnector allows users to visually connect two {@link module:boxes/ActiveBox.ActiveBox ActiveBox} objects of an
|
|
51
|
-
* {@link module:Activity.ActivityPanel ActivityPanel}. There are two modes of operation:
|
|
52
|
-
*
|
|
53
|
-
* - Drawing a line between an origin point (usually the point where the user clicks on) and a
|
|
54
|
-
* destination point.
|
|
55
|
-
* - Dragging the ActiveBox from one location to another.
|
|
56
|
-
*
|
|
57
|
-
* The connecting lines can have arrowheads at its endings.
|
|
58
|
-
*/
|
|
59
|
-
class BoxConnector {
|
|
60
|
-
/**
|
|
61
|
-
* BoxConnector constructor
|
|
62
|
-
* @param {module:AWT.Container} parent - The Container to which this BoxConnector belongs
|
|
63
|
-
* @param {external:jQuery} $canvas - The HTML `canvas` element where this BoxConnector will draw.
|
|
64
|
-
*/
|
|
65
|
-
constructor(parent, $canvas) {
|
|
66
|
-
this.parent = parent;
|
|
67
|
-
this.ctx = $canvas.get(-1).getContext('2d', { willReadFrequently: true });
|
|
68
|
-
this.dim = new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Dimension */ .fg(this.ctx.canvas.width, this.ctx.canvas.height);
|
|
69
|
-
this.origin = new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Point */ .bR();
|
|
70
|
-
this.dest = new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Point */ .bR();
|
|
71
|
-
this.relativePos = new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Point */ .bR();
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Displaces the ending point of the connector
|
|
76
|
-
* @param {number} dx - Displacement on the X axis
|
|
77
|
-
* @param {number} dy - Displacement on the Y axis
|
|
78
|
-
*/
|
|
79
|
-
moveBy(dx, dy) {
|
|
80
|
-
this.moveTo((0,_AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Point */ .bR)(this.dest.x + dx, this.dest.y + dy));
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Moves the ending point of the connector to a new position
|
|
85
|
-
* @param {module:AWT.Point} pt - The new position
|
|
86
|
-
* @param {boolean} forcePaint - When `true`, forces the repaint of all the area also if there is
|
|
87
|
-
* no movement at all.
|
|
88
|
-
*/
|
|
89
|
-
moveTo(pt, forcePaint) {
|
|
90
|
-
if (!this.active || !forcePaint && this.dest.equals(pt))
|
|
91
|
-
return;
|
|
92
|
-
|
|
93
|
-
// Restore the background
|
|
94
|
-
if (this.bgRect) {
|
|
95
|
-
if (this.bgImg) {
|
|
96
|
-
this.ctx.putImageData(
|
|
97
|
-
this.bgImg,
|
|
98
|
-
0, 0,
|
|
99
|
-
this.bgRect.pos.x, this.bgRect.pos.y,
|
|
100
|
-
this.bgRect.dim.width, this.bgRect.dim.height);
|
|
101
|
-
} else if (this.parent)
|
|
102
|
-
this.parent.updateContent();
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
this.dest.moveTo(pt);
|
|
106
|
-
|
|
107
|
-
// Calculate the bounds of the invalidated area after the move:
|
|
108
|
-
// Start with the origin point or box area
|
|
109
|
-
const pt1 = new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Point */ .bR(this.origin.x - this.relativePos.x, this.origin.y - this.relativePos.y);
|
|
110
|
-
this.bgRect = new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Rectangle */ .M_(pt1, this.bx ? this.bx.dim : new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Dimension */ .fg());
|
|
111
|
-
// Add the destination point or box area
|
|
112
|
-
const pt2 = new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Point */ .bR(pt.x - this.relativePos.x, pt.y - this.relativePos.y);
|
|
113
|
-
this.bgRect.add(new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Rectangle */ .M_(pt2, this.bx ? this.bx.dim : new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Dimension */ .fg()));
|
|
114
|
-
// Add a generous border around the area
|
|
115
|
-
this.bgRect.grow(10, 10);
|
|
116
|
-
|
|
117
|
-
if (this.bx !== null) {
|
|
118
|
-
// Move the ActiveBox
|
|
119
|
-
this.bx.moveTo(new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Point */ .bR(pt.x - this.relativePos.x, pt.y - this.relativePos.y));
|
|
120
|
-
this.bx.setTemporaryHidden(false);
|
|
121
|
-
this.bx.update(this.ctx, null);
|
|
122
|
-
this.bx.setTemporaryHidden(true);
|
|
123
|
-
} else {
|
|
124
|
-
// Draw the connecting line
|
|
125
|
-
this.drawLine();
|
|
126
|
-
this.linePainted = true;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Starts the box connector operation
|
|
132
|
-
* @param {module:AWT.Point} pt - Starting point
|
|
133
|
-
* @param {module:boxes/ActiveBox.ActiveBox} [box] - Passed only when the BoxConnector runs in drag&drop mode
|
|
134
|
-
*/
|
|
135
|
-
begin(pt, box) {
|
|
136
|
-
if (this.active)
|
|
137
|
-
this.end();
|
|
138
|
-
this.origin.moveTo(pt);
|
|
139
|
-
this.dest.moveTo(pt);
|
|
140
|
-
this.linePainted = false;
|
|
141
|
-
this.active = true;
|
|
142
|
-
|
|
143
|
-
if (box) {
|
|
144
|
-
// Remember what box will be moved, hide it from the panel and repaint all
|
|
145
|
-
this.bx = box;
|
|
146
|
-
this.relativePos.moveTo(pt.x - box.pos.x, pt.y - box.pos.y);
|
|
147
|
-
this.bx.setFocused(true);
|
|
148
|
-
this.bx.setTemporaryHidden(true);
|
|
149
|
-
this.linePainted = false;
|
|
150
|
-
this.parent.invalidate().update();
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
// Save the full image currently displayed on the panel (with the box hidden)
|
|
154
|
-
try {
|
|
155
|
-
this.bgImg = this.ctx.getImageData(0, 0, this.dim.width, this.dim.height);
|
|
156
|
-
} catch (_ex) {
|
|
157
|
-
// Avoid "canvas tainted by cross-origin data" errors
|
|
158
|
-
// Setting bgImg to null is less efficient, but works
|
|
159
|
-
this.bgImg = null;
|
|
160
|
-
}
|
|
161
|
-
this.bgRect = null;
|
|
162
|
-
|
|
163
|
-
// Make a first movement to make the box appear
|
|
164
|
-
if (box)
|
|
165
|
-
this.moveTo(pt, true);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Finalizes the operation of this box connector until a new call to `begin`
|
|
170
|
-
*/
|
|
171
|
-
end() {
|
|
172
|
-
if (!this.active)
|
|
173
|
-
return;
|
|
174
|
-
|
|
175
|
-
this.active = false;
|
|
176
|
-
this.linePainted = false;
|
|
177
|
-
this.bgRect = null;
|
|
178
|
-
this.bgImg = null;
|
|
179
|
-
|
|
180
|
-
if (this.bx) {
|
|
181
|
-
// Restore the original position and attributes of the box
|
|
182
|
-
this.bx.setFocused(false);
|
|
183
|
-
this.bx.moveTo(this.origin.x - this.relativePos.x, this.origin.y - this.relativePos.y);
|
|
184
|
-
this.bx.setTemporaryHidden(false);
|
|
185
|
-
this.bx = null;
|
|
186
|
-
this.relativePos.moveTo(0, 0);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// Repaint all
|
|
190
|
-
this.ctx.clearRect(0, 0, this.dim.width, this.dim.height);
|
|
191
|
-
this.parent.invalidate().update();
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Strokes a line between `origin` and `dest`, optionally ended with an arrowhead.
|
|
196
|
-
*/
|
|
197
|
-
drawLine() {
|
|
198
|
-
if (this.compositeOp !== DEFAULT_COMPOSITE_OP) {
|
|
199
|
-
this.ctx.strokeStyle = this.xorColor;
|
|
200
|
-
this.ctx.globalCompositeOperation = this.compositeOp;
|
|
201
|
-
} else
|
|
202
|
-
this.ctx.strokeStyle = this.lineColor;
|
|
203
|
-
|
|
204
|
-
this.ctx.lineWidth = this.lineWidth;
|
|
205
|
-
|
|
206
|
-
this.ctx.beginPath();
|
|
207
|
-
this.ctx.moveTo(this.origin.x, this.origin.y);
|
|
208
|
-
this.ctx.lineTo(this.dest.x, this.dest.y);
|
|
209
|
-
this.ctx.stroke();
|
|
210
|
-
|
|
211
|
-
if (this.arrow) {
|
|
212
|
-
// Draws the arrow head
|
|
213
|
-
const
|
|
214
|
-
beta = Math.atan2(this.origin.x - this.dest.x, this.dest.x - this.origin.x),
|
|
215
|
-
arp = new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Point */ .bR(this.dest.x - this.arrowLength * Math.cos(beta + this.arrowAngle),
|
|
216
|
-
this.dest.y + this.arrowLength * Math.sin(beta + this.arrowAngle));
|
|
217
|
-
this.ctx.beginPath();
|
|
218
|
-
this.ctx.moveTo(this.dest.x, this.dest.y);
|
|
219
|
-
this.ctx.lineTo(arp.x, arp.y);
|
|
220
|
-
this.ctx.stroke();
|
|
221
|
-
|
|
222
|
-
arp.moveTo(this.dest.x - this.arrowLength * Math.cos(beta - this.arrowAngle),
|
|
223
|
-
this.dest.y + this.arrowLength * Math.sin(beta - this.arrowAngle));
|
|
224
|
-
this.ctx.beginPath();
|
|
225
|
-
this.ctx.moveTo(this.dest.x, this.dest.y);
|
|
226
|
-
this.ctx.lineTo(arp.x, arp.y);
|
|
227
|
-
this.ctx.stroke();
|
|
228
|
-
}
|
|
229
|
-
if (this.compositeOp !== DEFAULT_COMPOSITE_OP) {
|
|
230
|
-
// reset default settings
|
|
231
|
-
this.ctx.globalCompositeOperation = DEFAULT_COMPOSITE_OP;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
Object.assign(BoxConnector.prototype, {
|
|
237
|
-
/**
|
|
238
|
-
* The background image, saved and redrawn on each movement
|
|
239
|
-
* @name module:boxes/BoxConnector.BoxConnector#bgImg
|
|
240
|
-
* @type {external:HTMLImageElement} */
|
|
241
|
-
bgImg: null,
|
|
242
|
-
/**
|
|
243
|
-
* The rectangle of {@link module:Activity.ActivityPanel ActivityPanel} saved in `bgImg`
|
|
244
|
-
* @name module:boxes/BoxConnector.BoxConnector#bgRect
|
|
245
|
-
* @type {module:AWT.Rectangle} */
|
|
246
|
-
bgRect: null,
|
|
247
|
-
/**
|
|
248
|
-
* Initial position of the connector
|
|
249
|
-
* @name module:boxes/BoxConnector.BoxConnector#origin
|
|
250
|
-
* @type {module:AWT.Point} */
|
|
251
|
-
origin: null,
|
|
252
|
-
/**
|
|
253
|
-
* Current (while moving) and final position of the connector
|
|
254
|
-
* @name module:boxes/BoxConnector.BoxConnector#dest
|
|
255
|
-
* @type {module:AWT.Point} */
|
|
256
|
-
dest: null,
|
|
257
|
-
/**
|
|
258
|
-
* When `true`, the connector must end on arrowhead
|
|
259
|
-
* @name module:boxes/BoxConnector.BoxConnector#arrow
|
|
260
|
-
* @type {boolean} */
|
|
261
|
-
arrow: false,
|
|
262
|
-
/**
|
|
263
|
-
* `true` while the connector is active
|
|
264
|
-
* @name module:boxes/BoxConnector.BoxConnector#active
|
|
265
|
-
* @type {boolean} */
|
|
266
|
-
active: false,
|
|
267
|
-
/**
|
|
268
|
-
* `true` while the line has already been painted (used for XOR expressions)
|
|
269
|
-
* @name module:boxes/BoxConnector.BoxConnector#linePainted
|
|
270
|
-
* @type {boolean} */
|
|
271
|
-
linePainted: false,
|
|
272
|
-
/**
|
|
273
|
-
* The arrowhead length (in pixels)
|
|
274
|
-
* @name module:boxes/BoxConnector.BoxConnector#arrowLength
|
|
275
|
-
* @type {number} */
|
|
276
|
-
arrowLength: 10,
|
|
277
|
-
/**
|
|
278
|
-
* The arrowhead angle
|
|
279
|
-
* @name module:boxes/BoxConnector.BoxConnector#arrowAngle
|
|
280
|
-
* @type {number} */
|
|
281
|
-
arrowAngle: Math.PI / 6,
|
|
282
|
-
/**
|
|
283
|
-
* The main color used in XOR operations
|
|
284
|
-
* @name module:boxes/BoxConnector.BoxConnector#lineColor
|
|
285
|
-
* @type {string} */
|
|
286
|
-
lineColor: 'black',
|
|
287
|
-
/**
|
|
288
|
-
* The complementary color used in XOR operations
|
|
289
|
-
* @name module:boxes/BoxConnector.BoxConnector#xorColor
|
|
290
|
-
* @type {string} */
|
|
291
|
-
xorColor: 'white',
|
|
292
|
-
/**
|
|
293
|
-
* The global composite operator used when drawing in XOR mode. Default is "difference".
|
|
294
|
-
* For a list of possible values see:
|
|
295
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation}
|
|
296
|
-
* @name module:boxes/BoxConnector.BoxConnector#compositeOp
|
|
297
|
-
* @type {string} */
|
|
298
|
-
compositeOp: 'difference',
|
|
299
|
-
/**
|
|
300
|
-
* The default {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation composite operator}
|
|
301
|
-
* ("source-over").
|
|
302
|
-
* @name module:boxes/BoxConnector.BoxConnector#DEFAULT_COMPOSITE_OP
|
|
303
|
-
* @static
|
|
304
|
-
* @type {string} */
|
|
305
|
-
DEFAULT_COMPOSITE_OP: DEFAULT_COMPOSITE_OP,
|
|
306
|
-
/**
|
|
307
|
-
* Relative position of point B regarding A
|
|
308
|
-
* @name module:boxes/BoxConnector.BoxConnector#relativePos
|
|
309
|
-
* @type {module:AWT.Point} */
|
|
310
|
-
relativePos: null,
|
|
311
|
-
/**
|
|
312
|
-
* The ActiveBox to connect or move
|
|
313
|
-
* @name module:boxes/BoxConnector.BoxConnector#bx
|
|
314
|
-
* @type {module:boxes/ActiveBox.ActiveBox} */
|
|
315
|
-
bx: null,
|
|
316
|
-
/**
|
|
317
|
-
* The Graphics context where the BoxConnector will paint
|
|
318
|
-
* @name module:boxes/BoxConnector.BoxConnector#ctx
|
|
319
|
-
* @type {external:CanvasRenderingContext2D} */
|
|
320
|
-
ctx: null,
|
|
321
|
-
/**
|
|
322
|
-
* The dimension of the HTML canvas where to draw
|
|
323
|
-
* @name module:boxes/BoxConnector.BoxConnector#dim
|
|
324
|
-
* @type {module:AWT.Dimension} */
|
|
325
|
-
dim: null,
|
|
326
|
-
/**
|
|
327
|
-
* The container to which this connector belongs
|
|
328
|
-
* @name module:boxes/BoxConnector.BoxConnector#parent
|
|
329
|
-
* @type {module:AWT.Container} */
|
|
330
|
-
parent: null,
|
|
331
|
-
/**
|
|
332
|
-
* Width of the connector line
|
|
333
|
-
* @name module:boxes/BoxConnector.BoxConnector#lineWidth
|
|
334
|
-
* @type {number} */
|
|
335
|
-
lineWidth: 1.5,
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BoxConnector);
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
/***/ })
|
|
342
|
-
|
|
343
|
-
};
|
|
344
|
-
;
|
|
345
|
-
//# sourceMappingURL=6148.jclic-node.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"6148.jclic-node.js","mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEwD;;AAExD;;AAEA;AACA,sDAAsD,kDAAkD;AACxG,IAAI,kDAAkD;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA,aAAa,sBAAsB;AACnC,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA,kDAAkD,0BAA0B;AAC5E,mBAAmB,wDAAS;AAC5B,sBAAsB,oDAAK;AAC3B,oBAAoB,oDAAK;AACzB,2BAA2B,oDAAK;AAChC;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB;AACA;AACA,gBAAgB,wDAAK;AACrB;;AAEA;AACA;AACA,aAAa,kBAAkB;AAC/B,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;;AAEA;;AAEA;AACA;AACA,oBAAoB,oDAAK;AACzB,sBAAsB,wDAAS,kCAAkC,wDAAS;AAC1E;AACA,oBAAoB,oDAAK;AACzB,wBAAwB,wDAAS,kCAAkC,wDAAS;AAC5E;AACA;;AAEA;AACA;AACA,yBAAyB,oDAAK;AAC9B;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,kBAAkB;AAC/B,aAAa,kCAAkC;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,oDAAK;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,2BAA2B;AACvC;AACA;AACA,uBAAuB,mDAAmD;AAC1E;AACA,YAAY,sBAAsB;AAClC;AACA;AACA;AACA;AACA,YAAY,kBAAkB;AAC9B;AACA;AACA;AACA;AACA,YAAY,kBAAkB;AAC9B;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,YAAY,QAAQ;AACpB;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,kBAAkB;AAC9B;AACA;AACA;AACA;AACA,YAAY,kCAAkC;AAC9C;AACA;AACA;AACA;AACA,YAAY,mCAAmC;AAC/C;AACA;AACA;AACA;AACA,YAAY,sBAAsB;AAClC;AACA;AACA;AACA;AACA,YAAY,sBAAsB;AAClC;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA,CAAC;;AAED,iEAAe,YAAY,EAAC","sources":["webpack://jclic/./src/boxes/BoxConnector.js"],"sourcesContent":["/**\n * File : boxes/BoxConnector.js\n * Created : 26/05/2015\n * By : Francesc Busquets <francesc@gmail.com>\n *\n * JClic.js\n * An HTML5 player of JClic activities\n * https://projectestac.github.io/jclic.js\n *\n * @source https://github.com/projectestac/jclic.js\n *\n * @license EUPL-1.2\n * @licstart\n * (c) 2000-2020 Catalan Educational Telematic Network (XTEC)\n *\n * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by\n * the European Commission- subsequent versions of the EUPL (the \"Licence\");\n * You may not use this work except in compliance with the Licence.\n *\n * You may obtain a copy of the Licence at:\n * https://joinup.ec.europa.eu/software/page/eupl\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the Licence is distributed on an \"AS IS\" basis, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * Licence for the specific language governing permissions and limitations\n * under the Licence.\n * @licend\n * @module\n */\n\nimport { Point, Dimension, Rectangle } from '../AWT.js';\n\nconst DEFAULT_COMPOSITE_OP = 'source-over';\n\n/**\n * BoxConnector allows users to visually connect two {@link module:boxes/ActiveBox.ActiveBox ActiveBox} objects of an\n * {@link module:Activity.ActivityPanel ActivityPanel}. There are two modes of operation:\n *\n * - Drawing a line between an origin point (usually the point where the user clicks on) and a\n * destination point.\n * - Dragging the ActiveBox from one location to another.\n *\n * The connecting lines can have arrowheads at its endings.\n */\nexport class BoxConnector {\n /**\n * BoxConnector constructor\n * @param {module:AWT.Container} parent - The Container to which this BoxConnector belongs\n * @param {external:jQuery} $canvas - The HTML `canvas` element where this BoxConnector will draw.\n */\n constructor(parent, $canvas) {\n this.parent = parent;\n this.ctx = $canvas.get(-1).getContext('2d', { willReadFrequently: true });\n this.dim = new Dimension(this.ctx.canvas.width, this.ctx.canvas.height);\n this.origin = new Point();\n this.dest = new Point();\n this.relativePos = new Point();\n }\n\n /**\n * Displaces the ending point of the connector\n * @param {number} dx - Displacement on the X axis\n * @param {number} dy - Displacement on the Y axis\n */\n moveBy(dx, dy) {\n this.moveTo(Point(this.dest.x + dx, this.dest.y + dy));\n }\n\n /**\n * Moves the ending point of the connector to a new position\n * @param {module:AWT.Point} pt - The new position\n * @param {boolean} forcePaint - When `true`, forces the repaint of all the area also if there is\n * no movement at all.\n */\n moveTo(pt, forcePaint) {\n if (!this.active || !forcePaint && this.dest.equals(pt))\n return;\n\n // Restore the background\n if (this.bgRect) {\n if (this.bgImg) {\n this.ctx.putImageData(\n this.bgImg,\n 0, 0,\n this.bgRect.pos.x, this.bgRect.pos.y,\n this.bgRect.dim.width, this.bgRect.dim.height);\n } else if (this.parent)\n this.parent.updateContent();\n }\n\n this.dest.moveTo(pt);\n\n // Calculate the bounds of the invalidated area after the move:\n // Start with the origin point or box area\n const pt1 = new Point(this.origin.x - this.relativePos.x, this.origin.y - this.relativePos.y);\n this.bgRect = new Rectangle(pt1, this.bx ? this.bx.dim : new Dimension());\n // Add the destination point or box area\n const pt2 = new Point(pt.x - this.relativePos.x, pt.y - this.relativePos.y);\n this.bgRect.add(new Rectangle(pt2, this.bx ? this.bx.dim : new Dimension()));\n // Add a generous border around the area\n this.bgRect.grow(10, 10);\n\n if (this.bx !== null) {\n // Move the ActiveBox\n this.bx.moveTo(new Point(pt.x - this.relativePos.x, pt.y - this.relativePos.y));\n this.bx.setTemporaryHidden(false);\n this.bx.update(this.ctx, null);\n this.bx.setTemporaryHidden(true);\n } else {\n // Draw the connecting line\n this.drawLine();\n this.linePainted = true;\n }\n }\n\n /**\n * Starts the box connector operation\n * @param {module:AWT.Point} pt - Starting point\n * @param {module:boxes/ActiveBox.ActiveBox} [box] - Passed only when the BoxConnector runs in drag&drop mode\n */\n begin(pt, box) {\n if (this.active)\n this.end();\n this.origin.moveTo(pt);\n this.dest.moveTo(pt);\n this.linePainted = false;\n this.active = true;\n\n if (box) {\n // Remember what box will be moved, hide it from the panel and repaint all\n this.bx = box;\n this.relativePos.moveTo(pt.x - box.pos.x, pt.y - box.pos.y);\n this.bx.setFocused(true);\n this.bx.setTemporaryHidden(true);\n this.linePainted = false;\n this.parent.invalidate().update();\n }\n\n // Save the full image currently displayed on the panel (with the box hidden)\n try {\n this.bgImg = this.ctx.getImageData(0, 0, this.dim.width, this.dim.height);\n } catch (_ex) {\n // Avoid \"canvas tainted by cross-origin data\" errors\n // Setting bgImg to null is less efficient, but works\n this.bgImg = null;\n }\n this.bgRect = null;\n\n // Make a first movement to make the box appear\n if (box)\n this.moveTo(pt, true);\n }\n\n /**\n * Finalizes the operation of this box connector until a new call to `begin`\n */\n end() {\n if (!this.active)\n return;\n\n this.active = false;\n this.linePainted = false;\n this.bgRect = null;\n this.bgImg = null;\n\n if (this.bx) {\n // Restore the original position and attributes of the box\n this.bx.setFocused(false);\n this.bx.moveTo(this.origin.x - this.relativePos.x, this.origin.y - this.relativePos.y);\n this.bx.setTemporaryHidden(false);\n this.bx = null;\n this.relativePos.moveTo(0, 0);\n }\n\n // Repaint all\n this.ctx.clearRect(0, 0, this.dim.width, this.dim.height);\n this.parent.invalidate().update();\n }\n\n /**\n * Strokes a line between `origin` and `dest`, optionally ended with an arrowhead.\n */\n drawLine() {\n if (this.compositeOp !== DEFAULT_COMPOSITE_OP) {\n this.ctx.strokeStyle = this.xorColor;\n this.ctx.globalCompositeOperation = this.compositeOp;\n } else\n this.ctx.strokeStyle = this.lineColor;\n\n this.ctx.lineWidth = this.lineWidth;\n\n this.ctx.beginPath();\n this.ctx.moveTo(this.origin.x, this.origin.y);\n this.ctx.lineTo(this.dest.x, this.dest.y);\n this.ctx.stroke();\n\n if (this.arrow) {\n // Draws the arrow head\n const\n beta = Math.atan2(this.origin.x - this.dest.x, this.dest.x - this.origin.x),\n arp = new Point(this.dest.x - this.arrowLength * Math.cos(beta + this.arrowAngle),\n this.dest.y + this.arrowLength * Math.sin(beta + this.arrowAngle));\n this.ctx.beginPath();\n this.ctx.moveTo(this.dest.x, this.dest.y);\n this.ctx.lineTo(arp.x, arp.y);\n this.ctx.stroke();\n\n arp.moveTo(this.dest.x - this.arrowLength * Math.cos(beta - this.arrowAngle),\n this.dest.y + this.arrowLength * Math.sin(beta - this.arrowAngle));\n this.ctx.beginPath();\n this.ctx.moveTo(this.dest.x, this.dest.y);\n this.ctx.lineTo(arp.x, arp.y);\n this.ctx.stroke();\n }\n if (this.compositeOp !== DEFAULT_COMPOSITE_OP) {\n // reset default settings\n this.ctx.globalCompositeOperation = DEFAULT_COMPOSITE_OP;\n }\n }\n}\n\nObject.assign(BoxConnector.prototype, {\n /**\n * The background image, saved and redrawn on each movement\n * @name module:boxes/BoxConnector.BoxConnector#bgImg\n * @type {external:HTMLImageElement} */\n bgImg: null,\n /**\n * The rectangle of {@link module:Activity.ActivityPanel ActivityPanel} saved in `bgImg`\n * @name module:boxes/BoxConnector.BoxConnector#bgRect\n * @type {module:AWT.Rectangle} */\n bgRect: null,\n /**\n * Initial position of the connector\n * @name module:boxes/BoxConnector.BoxConnector#origin\n * @type {module:AWT.Point} */\n origin: null,\n /**\n * Current (while moving) and final position of the connector\n * @name module:boxes/BoxConnector.BoxConnector#dest\n * @type {module:AWT.Point} */\n dest: null,\n /**\n * When `true`, the connector must end on arrowhead\n * @name module:boxes/BoxConnector.BoxConnector#arrow\n * @type {boolean} */\n arrow: false,\n /**\n * `true` while the connector is active\n * @name module:boxes/BoxConnector.BoxConnector#active\n * @type {boolean} */\n active: false,\n /**\n * `true` while the line has already been painted (used for XOR expressions)\n * @name module:boxes/BoxConnector.BoxConnector#linePainted\n * @type {boolean} */\n linePainted: false,\n /**\n * The arrowhead length (in pixels)\n * @name module:boxes/BoxConnector.BoxConnector#arrowLength\n * @type {number} */\n arrowLength: 10,\n /**\n * The arrowhead angle\n * @name module:boxes/BoxConnector.BoxConnector#arrowAngle\n * @type {number} */\n arrowAngle: Math.PI / 6,\n /**\n * The main color used in XOR operations\n * @name module:boxes/BoxConnector.BoxConnector#lineColor\n * @type {string} */\n lineColor: 'black',\n /**\n * The complementary color used in XOR operations\n * @name module:boxes/BoxConnector.BoxConnector#xorColor\n * @type {string} */\n xorColor: 'white',\n /**\n * The global composite operator used when drawing in XOR mode. Default is \"difference\".\n * For a list of possible values see:\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation}\n * @name module:boxes/BoxConnector.BoxConnector#compositeOp\n * @type {string} */\n compositeOp: 'difference',\n /**\n * The default {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation composite operator}\n * (\"source-over\").\n * @name module:boxes/BoxConnector.BoxConnector#DEFAULT_COMPOSITE_OP\n * @static\n * @type {string} */\n DEFAULT_COMPOSITE_OP: DEFAULT_COMPOSITE_OP,\n /**\n * Relative position of point B regarding A\n * @name module:boxes/BoxConnector.BoxConnector#relativePos\n * @type {module:AWT.Point} */\n relativePos: null,\n /**\n * The ActiveBox to connect or move\n * @name module:boxes/BoxConnector.BoxConnector#bx\n * @type {module:boxes/ActiveBox.ActiveBox} */\n bx: null,\n /**\n * The Graphics context where the BoxConnector will paint\n * @name module:boxes/BoxConnector.BoxConnector#ctx\n * @type {external:CanvasRenderingContext2D} */\n ctx: null,\n /**\n * The dimension of the HTML canvas where to draw\n * @name module:boxes/BoxConnector.BoxConnector#dim\n * @type {module:AWT.Dimension} */\n dim: null,\n /**\n * The container to which this connector belongs\n * @name module:boxes/BoxConnector.BoxConnector#parent\n * @type {module:AWT.Container} */\n parent: null,\n /**\n * Width of the connector line\n * @name module:boxes/BoxConnector.BoxConnector#lineWidth\n * @type {number} */\n lineWidth: 1.5,\n});\n\nexport default BoxConnector;\n"],"names":[],"sourceRoot":""}
|