@myrmidon/gve-snapshot-rendition 0.0.8 → 1.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 +30 -55
- package/dist/index.cjs.min.js +8 -8
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.js +162 -400
- package/dist/index.js.map +1 -1
- package/dist/src/adapter/data-feature-adapter.d.ts +2 -3
- package/dist/src/core/gve-snapshot-rendition.d.ts +15 -25
- package/dist/src/models.d.ts +21 -50
- package/dist/src/rendering/feature-resolver.d.ts +2 -3
- package/dist/src/ui/details-area.d.ts +2 -1
- package/dist/src/ui/hilites.d.ts +3 -9
- package/dist/src/ui/operation-summary-service.d.ts +4 -7
- package/package.json +20 -28
package/README.md
CHANGED
|
@@ -1,47 +1,33 @@
|
|
|
1
1
|
# GVE Snapshot Rendition Component
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
For the purpose of the visualization of the digital model designed to represent this text with all its variations together with its diplomatic data, we consider 3 entities to display:
|
|
6
|
-
|
|
7
|
-
- the base text, which is the starting point and the bearer of all the annotations.
|
|
8
|
-
- the added text. This is text added by operations like add or replace.
|
|
9
|
-
- all other signs: these are the visual counterparts of editing operations on the text, which hint at them in a graphical way. For instance, a line on top of a text meaning it should be deleted. There is no limit to the variety of these signs: they might be lines, shapes, callouts, boxes, etc.
|
|
10
|
-
|
|
11
|
-
Text (whether it is base or added text) is represented character by character; each character is named _node_, because in backend, where all the transformations happen, there is a graph-like structure which recombines the same characters to form different versions of the text, just like nodes are connected by edges in a graph.
|
|
12
|
-
|
|
13
|
-
The transformations are essentially represented by a set of editing operations (like delete, replace, add, move, swap) which are executed one after another starting with a base text. The base text is known as version 0 (tag=`v0`). All the operations are executed in their order and each outputs a new version of the text, progressively numbered (`v1`, `v2`...).
|
|
14
|
-
|
|
15
|
-
Operations also inject metadata, in form of features (essentially name=value pairs), either into versions as a whole (for global features), or into specific characters of the output text (node features). A specific set of features (rendition features, all starting with prefix `r_`) is used to represent the visual counterpart of each operation; for instance, a delete might be visually represented by a diagonal line on top of the portion of the text being deleted. In this case, multiple features of the operation (which injects them into nodes) are used to set the drawing connected to it, in this case a line, and specify additional parameters like its color. Such drawings are often recurring multiple times; so, they belong to a catalog of so-called "hints", because they hint at the operation with their appearance (e.g. a line stroke on a text hints at its deletion). These hints have entrance animations, handled by GSAP (like any other animations in this project). These too typically belong to a catalog of animations.
|
|
16
|
-
|
|
17
|
-
Both hints and animations are part of the settings for the component. The component is found under [src/core/gve-snapshot-rendition.ts](src/core/gve-snapshot-rendition.ts), and most of its logic is properly encapsulated in its own set of classes, following a systematic separation of concerns to ensure flexibility, extendibility, and easy maintenance.
|
|
18
|
-
|
|
19
|
-
## Usage Guide
|
|
20
|
-
|
|
21
|
-
- [Angular integration](docs/dev/angular-integration.md)
|
|
22
|
-
- [vanilla integration](docs/dev/vanilla-integration.md)
|
|
23
|
-
|
|
24
|
-
## Documentation
|
|
3
|
+
## 📖 Documentation
|
|
25
4
|
|
|
26
5
|
Conceptual documentation and sample data:
|
|
27
6
|
|
|
28
7
|
- [snapshot backend model](docs/snapshot.md): overview of the backend data used by the component.
|
|
29
|
-
- [rendition description](docs/rendition.md):
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
8
|
+
- [rendition description](docs/rendition.md): documentation about the architecture and logic of the snapshot renderer custom web control.
|
|
9
|
+
- data used in the demo are found in the `data` folder. Each sample has 4 files:
|
|
10
|
+
- (no suffix): base text and operations DSL. This is the snapshot data.
|
|
11
|
+
- `*.base.txt`: base text.
|
|
12
|
+
- `*.request.json`: request to API. You can generate this from the backend demo app.
|
|
13
|
+
- `*.data.json`: response from API. These are the data bound to the renderer control.
|
|
14
|
+
- `*.settings.json`: settings for the renderer control.
|
|
15
|
+
- [hint designer](docs/hint-designer.md): documentation about hints designer custom web control.
|
|
16
|
+
- [features adapter services](docs/adapter.md): documentation about complementary services independent from the GVE snapshot rendition component, optionally used to adapt data before passing it to the component.
|
|
17
|
+
|
|
18
|
+
Developer's usage guide:
|
|
34
19
|
|
|
35
|
-
|
|
20
|
+
- [Angular integration](docs/dev/angular-integration.md)
|
|
21
|
+
- [vanilla integration](docs/dev/vanilla-integration.md)
|
|
36
22
|
|
|
37
|
-
### Feature Adapter
|
|
23
|
+
### 🟢 Feature Adapter
|
|
38
24
|
|
|
39
25
|
The **Feature Adapter** is a utility system for transforming features in snapshot data. It enables you to adapt high-level features into low-level rendition features that the component can use:
|
|
40
26
|
|
|
41
|
-
- [Feature Adapter Overview](docs/adapter.md):
|
|
42
|
-
- [Detailed Documentation](src/adapter/README.md):
|
|
27
|
+
- [Feature Adapter Overview](docs/adapter.md): architecture and usage guide.
|
|
28
|
+
- [Detailed Documentation](src/adapter/README.md): complete API reference and examples.
|
|
43
29
|
|
|
44
|
-
### Hint Designer
|
|
30
|
+
### 🟢 Hint Designer
|
|
45
31
|
|
|
46
32
|
The **Hint Designer** is a companion web component which can be used to help users edit and test their hints SVG and JS animation code. The main web component used for display has no relation with it. Rather, the hint designer component reuses some logic from the main component, while still being aside.
|
|
47
33
|
|
|
@@ -58,7 +44,7 @@ This will build the component and open the hint designer in your browser.
|
|
|
58
44
|
|
|
59
45
|
>If you want to pick a different sample, add it to the URL with a `sample` argument, e.g. <localhost:3000?sample=h5-48>.
|
|
60
46
|
|
|
61
|
-
## Quick Start
|
|
47
|
+
## 🚀 Quick Start
|
|
62
48
|
|
|
63
49
|
To start working with this code:
|
|
64
50
|
|
|
@@ -66,12 +52,12 @@ To start working with this code:
|
|
|
66
52
|
2. download dependencies with `pnpm i`.
|
|
67
53
|
3. run with `pnpm start`.
|
|
68
54
|
|
|
69
|
-
💡 Note: if you need to **
|
|
55
|
+
💡 Note: if you need to **create sample data**, follow these steps:
|
|
70
56
|
|
|
71
|
-
1.
|
|
72
|
-
2.
|
|
73
|
-
3.
|
|
74
|
-
4.
|
|
57
|
+
1. create a .txt file with base text and operations DSL.
|
|
58
|
+
2. open the [GVE backend solution](https://github.com/vedph/gve-core) and run the demo.
|
|
59
|
+
3. set text and operations copying them from the .txt file.
|
|
60
|
+
4. click the "build request" button.
|
|
75
61
|
5. run the GVE backend API and use Postman or similar to send the request body with this header:
|
|
76
62
|
|
|
77
63
|
```txt
|
|
@@ -82,24 +68,15 @@ To start working with this code:
|
|
|
82
68
|
...paste your JSON request body here...
|
|
83
69
|
```
|
|
84
70
|
|
|
85
|
-
6. copy the response and paste it into
|
|
71
|
+
6. copy the response and paste it into a new set of data files.
|
|
72
|
+
7. run with the name of the data file: <localhost:3000?NAME>.
|
|
86
73
|
|
|
87
|
-
##
|
|
74
|
+
## 📦 Deployment
|
|
88
75
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
- [GSAP](https://gsap.com) for animations (`pnpm i gsap @types/gsap`).
|
|
92
|
-
- [svg-pan-zoom](https://github.com/bumbu/svg-pan-zoom) for zooming and panning (`pnpm i svg-pan-zoom @types/svg-pan-zoom`).
|
|
93
|
-
- [fast-diff](https://github.com/jhchen/fast-diff) for text diffing (`pnpm i fast-diff @types/fast-diff`).
|
|
94
|
-
- [feather-icons](https://github.com/feathericons/feather) for icons. See also the [icons list](https://feathericons.com) (`pnpm i feather-icons`).
|
|
95
|
-
- [highlight.js](https://highlightjs.org/) for the hint designer (syntax highlight for SVG and JS code; `pnpm i highlight.js`).
|
|
96
|
-
|
|
97
|
-
## Deployment
|
|
98
|
-
|
|
99
|
-
🚀 You must be logged into NPM with your account (verify with `npm whoami`, login with `npm login` if required).
|
|
76
|
+
You must be logged into NPM with your account (verify with `npm whoami`, login with `npm login` if required).
|
|
100
77
|
|
|
101
78
|
1. ensure that tests pass (`pnpm test`) and be sure to build (`pnpm build`).
|
|
102
|
-
2. publish via `pnpm run publish:public` or directly via `
|
|
79
|
+
2. publish via `pnpm run publish:public` or directly via `pnpm publish --access=public`.
|
|
103
80
|
|
|
104
81
|
Check that your package is available:
|
|
105
82
|
|
|
@@ -148,9 +125,7 @@ Package structure:
|
|
|
148
125
|
└── LICENSE
|
|
149
126
|
```
|
|
150
127
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
To deploy demo in surge:
|
|
128
|
+
To **deploy a static HTML demo page in surge**:
|
|
154
129
|
|
|
155
130
|
1. run the script for the demo you want to create (`deploy-demo.ps1` or `deploy-hint-demo.ps1`).
|
|
156
131
|
2. in the created folder, run `surge`, enter your credentials, confirm the local source directory, and specify a URL to use (e.g. <gve-rendition.surge.sh> or <gve-hint-designer.surge.sh/>).
|