@myrmidon/gve-snapshot-rendition 0.0.2 → 0.0.4

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
@@ -16,6 +16,11 @@ Operations also inject metadata, in form of features (essentially name=value pai
16
16
 
17
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
18
 
19
+ ## Usage Guide
20
+
21
+ - [Angular integration](docs/dev/angular-integration.md)
22
+ - [vanilla integration](docs/dev/vanilla-integration.md)
23
+
19
24
  ## Documentation
20
25
 
21
26
  Conceptual documentation and sample data:
@@ -24,7 +29,7 @@ Conceptual documentation and sample data:
24
29
  - [rendition description](docs/rendition.md): details about the architecture and logic of this component.
25
30
  - [sample request to backend snapshot processor](docs/sample/request.json): the request used to generate our sample data via backend. This is used only when we want to change our sample data.
26
31
  - [sample response from backend snapshot processor](docs/sample/response.json): the response received from backend corresponding to our request. This is used only when we want to change our sample data.
27
- - [data used in the demo](data.json): the data loaded in the web component to test it. This is copied from [response.json](docs/sample/response.json), and contains all the data received by the web component for rendering.
32
+ - data used in the demo are found in the `data` folder. Each sample has 3 files for base text, data received from backend service, and settings. For the default sample, data is copied from [response.json](docs/sample/response.json). These represent all the data received by the web component for rendering.
28
33
  - [features adapter services](docs/adapter.md): complementary services independent from the GVE snapshot rendition component, possibly used to adapt data before passing it to the component.
29
34
 
30
35
  The test page used in this project is `index.html` and its code is `consumer.js`. The data model is `CharChainResult` and it is found with all the imported models in `models.ts`. These are the models imported from another package and should not be touched.
@@ -51,6 +56,8 @@ pnpm run start:designer
51
56
 
52
57
  This will build the component and open the hint designer in your browser.
53
58
 
59
+ >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
+
54
61
  ## Quick Start
55
62
 
56
63
  To start working with this code:
@@ -59,12 +66,12 @@ To start working with this code:
59
66
  2. download dependencies with `pnpm i`.
60
67
  3. run with `pnpm start`.
61
68
 
62
- Note: if you need to **update sample data**, follow these steps:
69
+ 💡 Note: if you need to **update sample data**, follow these steps:
63
70
 
64
- 1. open the GVE backend solution and run the demo.
71
+ 1. open the [GVE backend solution](https://github.com/vedph/gve-core) and run the demo.
65
72
  2. set text and operations as you want (to start with the current data, pick the "rendition features" preset).
66
73
  3. click the "build request" button.
67
- 4. paste the request in [docs/sample/request.json](docs/sample/request.json) if you want to make it the default data.
74
+ 4. optionally, paste the request in [docs/sample/request.json](docs/sample/request.json) if you want to make it the default data.
68
75
  5. run the GVE backend API and use Postman or similar to send the request body with this header:
69
76
 
70
77
  ```txt
@@ -133,3 +140,23 @@ npm unpublish @myrmidon/gve-snapshot-rendition --force
133
140
  ```
134
141
 
135
142
  >⚠️ Unpublishing can break projects that depend on your package. Only do this for critical security issues or accidental publications.
143
+
144
+ Package structure:
145
+
146
+ ```txt
147
+ @myrmidon/gve-snapshot-rendition/
148
+ ├── dist/
149
+ │ ├── index.js # ES Module bundle
150
+ │ ├── index.d.ts # TypeScript declarations
151
+ │ ├── index.cjs.min.js # CommonJS bundle (minified)
152
+ │ └── ...
153
+ ├── README.md
154
+ └── LICENSE
155
+ ```
156
+
157
+ ## Deploy Demo at Surge
158
+
159
+ To deploy demo in surge:
160
+
161
+ 1. run the script for the demo you want to create (`deploy-demo.ps1` or `deploy-hint-demo.ps1`).
162
+ 2. in the created folder, run `surge`, enter your credentials, confirm the local source directory, and specify a URL to use (e.g. <http://gve-hint-designer.surge.sh/>).
@@ -41,6 +41,8 @@ export declare class GveHintDesigner extends HTMLElement {
41
41
  private _pauseButton?;
42
42
  private _restartButton?;
43
43
  private _progressBar?;
44
+ private _variablesValidationMsg?;
45
+ private _variablesPanelHeader?;
44
46
  private _currentTimeline?;
45
47
  private _isPlaying;
46
48
  private _progressUpdateInterval?;
@@ -168,6 +170,11 @@ export declare class GveHintDesigner extends HTMLElement {
168
170
  * Clear the hint form.
169
171
  */
170
172
  private clearHintForm;
173
+ /**
174
+ * Validate SVG code for well-formedness and structure.
175
+ * Returns an error message if validation fails, or null if valid.
176
+ */
177
+ private validateSvgCode;
171
178
  /**
172
179
  * Add a new hint.
173
180
  */
@@ -192,6 +199,19 @@ export declare class GveHintDesigner extends HTMLElement {
192
199
  * Resolve variables in SVG code.
193
200
  */
194
201
  private resolveVariables;
202
+ /**
203
+ * Extract variable names from SVG code (variables in {{...}} placeholders).
204
+ */
205
+ private extractVariablesFromSvg;
206
+ /**
207
+ * Validate SVG variables and update validation message.
208
+ * Shows a warning if any variables used in SVG are not defined in hint variables.
209
+ */
210
+ private validateSvgVariables;
211
+ /**
212
+ * Update warning icon in variables panel header.
213
+ */
214
+ private updateVariablesHeaderWarning;
195
215
  /**
196
216
  * Play animation.
197
217
  */
@@ -280,6 +300,17 @@ export declare class GveHintDesigner extends HTMLElement {
280
300
  * Delete all variables.
281
301
  */
282
302
  private deleteAllVariables;
303
+ /**
304
+ * Extract all variable names from all hints in data.
305
+ * Returns a sorted array of unique variable names.
306
+ */
307
+ private extractAllVariablesFromHints;
308
+ /**
309
+ * Populate hint variables from all hints.
310
+ * Extracts all variables from all hints' SVG code and merges them into hintVariables.
311
+ * Only adds variables that don't already exist.
312
+ */
313
+ private populateVariablesFromHints;
283
314
  /**
284
315
  * Refresh the variables table.
285
316
  */