eligius 1.0.9 → 1.0.11

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/README.md CHANGED
@@ -12,7 +12,7 @@ The main concepts in Eligius are timelines, actions and operations. A timeline c
12
12
 
13
13
  Actions can be called on specified points on such a timeline. An action consists of a list of start and end operations.
14
14
 
15
- An operation is an atomic function. A context, for sharing data, is passed between each successive operation. Examples of operations are `select-element`, `create-element` or `add-class`. [Here is a complete list of all available operations.](https://github.com/rolandzwaga/eligius/tree/dev/src/operation)
15
+ An operation is an atomic function. A context, for sharing data, is passed between each successive operation. Examples of operations are `select-element`, `create-element` or `add-class`. [Here is a complete list of all available operations.](https://github.com/rolandzwaga/eligius/tree/main/src/operation)
16
16
  By composing these atomic operations complex functionality can be achieved.
17
17
 
18
18
  An example of an action is adding an removing an image from the stage at specific times. This action would consist of these start operations: `select-element`(to select the image parent), `create-element`(to create the img element with the required src attribute) and `set-element-contents`(to add the img element to the previously selected parent).
@@ -29,9 +29,9 @@ This section describes the different parts of this configuration.
29
29
  ### systemName property
30
30
 
31
31
  In the rest of this section the property name `systemName` will be shown often. The value of this property describes a named import.
32
- Currently one resource importer is supported by default: [`EligiusResourceImporter`](https://github.com/rolandzwaga/eligius/blob/dev/src/importer/eligius-resource-importer.ts).
32
+ Currently one resource importer is supported by default: [`EligiusResourceImporter`](https://rolandzwaga.github.io/eligius/classes/EligiusResourceImporter.html).
33
33
  However, this importer contains all of Eligius classes, function, providers, etc. So, bundling this with a presentation will bloat the bundle.
34
- Eligius offers a generator function for this: [`generateImporterSourceCode`](https://github.com/rolandzwaga/eligius/blob/dev/src/build/generate-importer-source-code.ts). This function is able to generate source code (Typescript) for a custom resource importer based on a given Eligius configuration. This will result in an importer that only includes the code that is referenced in the configuration.
34
+ Eligius offers a generator function for this: [`generateImporterSourceCode`](https://rolandzwaga.github.io/eligius/functions/generateImporterSourceCode.html). This function is able to generate source code (Typescript) for a custom resource importer based on a given Eligius configuration. This will result in an importer that only includes the code that is referenced in the configuration.
35
35
 
36
36
  ### engine
37
37
 
@@ -234,7 +234,7 @@ This a list of actions that can be triggered by an event broadcast. Since an eve
234
234
  ### labels
235
235
 
236
236
  A list of label information that describes all of the textual content for the presentation.
237
- Labels can be rendered by the [`LabelController`](https://github.com/rolandzwaga/eligius/blob/dev/src/controllers/label-controller.ts). This controller listens for the appropriate language change events as well, and will change the contents of the element it controls accordingly.
237
+ Labels can be rendered by the [`LabelController`](https://rolandzwaga.github.io/eligius/classes/LabelController.html). This controller listens for the appropriate language change events as well, and will change the contents of the element it controls accordingly.
238
238
 
239
239
  ```json
240
240
  {
@@ -271,6 +271,10 @@ const engine = factory.createEngine((engineConfig as unknown) as IEngineConfigur
271
271
  engine.init().then(()=> {console.log('Eligius engine ready for business');});
272
272
  ```
273
273
 
274
+ ## Source documentation
275
+
276
+ [Check out this link for the full type docs](https://rolandzwaga.github.io/eligius/)
277
+
274
278
  ## installation
275
279
 
276
280
  ```sh
@@ -11,6 +11,7 @@ export declare class ProgressbarController implements IController<IProgressbarCo
11
11
  selectedElement: JQuery | null;
12
12
  textElement: JQuery | null;
13
13
  detachers: TEventbusRemover[];
14
+ duration: number;
14
15
  init(operationData: TOperationData): void;
15
16
  attach(eventbus: IEventbus): void;
16
17
  detach(_eventbus: IEventbus): void;
@@ -18,5 +19,5 @@ export declare class ProgressbarController implements IController<IProgressbarCo
18
19
  position: number;
19
20
  duration: number;
20
21
  }): void;
21
- clickHandler(): void;
22
+ clickHandler(eventbus: IEventbus, event: any): void;
22
23
  }
@@ -437,20 +437,26 @@ function prepareValueForSerialization(value) {
437
437
  } else if (value instanceof $__default["default"]) {
438
438
  return 'jQuery object';
439
439
  } else if (value !== null && typeof value === 'object') {
440
+ if (value.constructor.toString().substring(0, 5) === 'class' || !value.constructor.toString().startsWith('function Object()')) {
441
+ var funcString = value.constructor.toString();
442
+ return funcString.substring(0, funcString.indexOf('{') + 1);
443
+ }
444
+
440
445
  return Object.fromEntries(Object.entries(value).map(function (_ref) {
441
446
  var propName = _ref[0],
442
447
  propValue = _ref[1];
443
448
  return [propName, prepareValueForSerialization(propValue)];
444
449
  }));
445
450
  } else if (typeof value === 'function') {
446
- var funcString = value.toString();
447
- var paranIndex = funcString.indexOf('{');
451
+ var _funcString = value.toString();
452
+
453
+ var paranIndex = _funcString.indexOf('{');
448
454
 
449
455
  if (paranIndex > -1) {
450
- return funcString.substring(0, funcString.indexOf('{') + 1);
456
+ return _funcString.substring(0, _funcString.indexOf('{') + 1);
451
457
  }
452
458
 
453
- return funcString;
459
+ return _funcString;
454
460
  }
455
461
 
456
462
  return value;
@@ -1745,6 +1751,7 @@ var ProgressbarController = /*#__PURE__*/function () {
1745
1751
  this.selectedElement = null;
1746
1752
  this.textElement = null;
1747
1753
  this.detachers = [];
1754
+ this.duration = 0;
1748
1755
  }
1749
1756
 
1750
1757
  var _proto = ProgressbarController.prototype;
@@ -1755,17 +1762,20 @@ var ProgressbarController = /*#__PURE__*/function () {
1755
1762
  };
1756
1763
 
1757
1764
  _proto.attach = function attach(eventbus) {
1758
- var _this$selectedElement,
1759
- _this = this;
1765
+ var _this = this,
1766
+ _this$selectedElement;
1760
1767
 
1761
1768
  this.detachers.push(eventbus.on(TimelineEventNames.POSITION_UPDATE, this.positionUpdateHandler.bind(this)));
1762
- var clickHandler = this.clickHandler.bind(this);
1769
+ eventbus.broadcast(TimelineEventNames.DURATION_REQUEST, [function (duration) {
1770
+ return _this.duration = duration;
1771
+ }]);
1772
+ var clickHandler = this.clickHandler.bind(this, eventbus);
1763
1773
  (_this$selectedElement = this.selectedElement) == null ? void 0 : _this$selectedElement.on('click', clickHandler);
1764
1774
  this.detachers.push(function () {
1765
1775
  var _this$selectedElement2;
1766
1776
 
1767
- return (_this$selectedElement2 = _this.selectedElement) == null ? void 0 : _this$selectedElement2.off('click');
1768
- }, clickHandler);
1777
+ return (_this$selectedElement2 = _this.selectedElement) == null ? void 0 : _this$selectedElement2.off('click', clickHandler);
1778
+ });
1769
1779
  };
1770
1780
 
1771
1781
  _proto.detach = function detach(_eventbus) {
@@ -1784,7 +1794,14 @@ var ProgressbarController = /*#__PURE__*/function () {
1784
1794
  (_this$textElement = this.textElement) == null ? void 0 : _this$textElement.text(Math.floor(percentage) + "%");
1785
1795
  };
1786
1796
 
1787
- _proto.clickHandler = function clickHandler() {};
1797
+ _proto.clickHandler = function clickHandler(eventbus, event) {
1798
+ var element = event.target;
1799
+ var rect = element.getBoundingClientRect();
1800
+ var x = event.clientX - rect.left; //x position within the element.
1801
+
1802
+ var percentage = 100 / rect.width * x;
1803
+ eventbus.broadcast(TimelineEventNames.SEEK_REQUEST, [Math.floor(this.duration / 100 * percentage)]);
1804
+ };
1788
1805
 
1789
1806
  return ProgressbarController;
1790
1807
  }();
@@ -5386,7 +5403,7 @@ function setElementAttributes() {
5386
5403
  function setElementContent() {
5387
5404
  return {
5388
5405
  description: 'Sets the given HTML content in the selected element',
5389
- dependentProperties: ['selectedElement'],
5406
+ dependentProperties: ['selectedElement', 'template'],
5390
5407
  properties: {
5391
5408
  insertionType: [{
5392
5409
  value: 'overwrite',
@@ -5398,11 +5415,7 @@ function setElementContent() {
5398
5415
  }, {
5399
5416
  value: 'prepend',
5400
5417
  description: 'the new content will be inserted before the current content'
5401
- }],
5402
- template: {
5403
- type: 'ParameterType:htmlContent',
5404
- required: true
5405
- }
5418
+ }]
5406
5419
  }
5407
5420
  };
5408
5421
  }