@myrmidon/gve-core 1.0.0 → 2.0.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.
package/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # Gve Core
2
2
 
3
+ - 🚀 `npm i @myrmidon/gve-core`.
4
+
3
5
  This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 17.0.0.
4
6
 
5
- This is the core UI library for GVE.
7
+ This is the core UI library for [GVE](https://vedph.github.io/gve-doc).
6
8
 
7
9
  ```plantuml
8
10
  @startuml
@@ -19,6 +21,7 @@ This is the core UI library for GVE.
19
21
  [feature set view]
20
22
  [ln heights editor]
21
23
  [batch ops editor]
24
+ [snapshot text editor]
22
25
  [op source editor]
23
26
  [snapshot editor]
24
27
  [steps map]
@@ -38,6 +41,7 @@ This is the core UI library for GVE.
38
41
  [chain result view] --> [base text view]
39
42
  [chain result view] --> [feature set view]
40
43
  [chain result view] --> [steps map]
44
+ [snapshot editor] --> [snapshot text editor]
41
45
  [snapshot editor] --> [batch ops editor]
42
46
  [snapshot editor] --> [animation timeline set]
43
47
  [snapshot editor] --> [base text editor]
@@ -49,3 +53,38 @@ This is the core UI library for GVE.
49
53
  [snapshot editor] --> [api service]
50
54
  @enduml
51
55
  ```
56
+
57
+ ## Snapshot Editor
58
+
59
+ The snapshot editor is the top-level component in the library and orchestrates the behavior of all the components included in it. Its API is very simple, as it just deals with a full snapshot:
60
+
61
+ - ▶️ `snapshot` (`Snapshot`): the snapshot to edit.
62
+ - ▶️ `batchOps` (`string`): the batch operations text to set for the editor.
63
+ - ▶️ `noSave` (`boolean`): true to disable saving.
64
+ - 🔥 `snapshotChange` (`Snapshot`): emitted when the user saves the edited snapshot.
65
+ - 🔥 `snapshotCancel` (`void`): emitted when the user cancels the snapshot editing.
66
+
67
+ The only data directly handled by the component are:
68
+
69
+ - size and style;
70
+ - base text and related data;
71
+ - background image.
72
+
73
+ Operations and timelines are handled by other children components. The snapshot model is built dynamically when required (via `getSnapshot`), and it is displayed by a snapshot view.
74
+
75
+ View data, wrapping the snapshot and some options (debug mode, delayed rendering, rules, grid, pan and zoom, transparent SVG elements IDs), are built via `setViewData`, which in turns gets the snapshot from `getSnapshot` unless it receives one.
76
+
77
+ The key logic for displaying the snapshot is implemented in `runTo`, which runs the operations up to the specified index. This gets called when:
78
+
79
+ - a preview is requested by the operation editor.
80
+ - the currently edited operation is saved.
81
+ - the user picks a step in the chain result view.
82
+ - `runToLast` is called, which happens when:
83
+ - setting the snapshot from the parent.
84
+ - the number of operations changes, either by parsing a batch of operations or by deleting an operation.
85
+
86
+ This function gets the snapshot (via `getSnapshot`), patches it so that it corresponds to the set of operations up to the specified index, and runs all these operations. Once done, it extracts the transparent elements IDs from the last operation, updates view data (via `setViewData` passing the built snapshot to it), and returns the execution result.
87
+
88
+ After running operations, the result is stored in `result` (of type `CharChainResult`), which feeds the `ChainResultViewComponent` in charge of showing the details of each generated text version. In turn, this may fire step-pick events, which are handled by getting the snapshot at that step, updating the transparent element IDs, and updating view data (via `setViewData` passing the built snapshot to it); also, an animation is played if required, after running operations up to the one corresponding to the picked step.
89
+
90
+ When an operation is saved from the child operation editor (`onOperationChange`), all the operations are run up to the saved one.