@lynx-js/testing-environment 0.1.11 → 0.1.12

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @lynx-js/testing-environment
2
2
 
3
+ ## 0.1.12
4
+
5
+ ### Patch Changes
6
+
7
+ - Implement `__ElementAnimate` PAPI for web platform animation lifecycle ([#2329](https://github.com/lynx-family/lynx-stack/pull/2329))
8
+
3
9
  ## 0.1.11
4
10
 
5
11
  ### Patch Changes
@@ -231,6 +231,44 @@ const initElementTree = ()=>{
231
231
  __GetAttributeByName(ele, name) {
232
232
  return ele.getAttribute(name);
233
233
  }
234
+ __ElementAnimate(element, args) {
235
+ const [operation, name] = args;
236
+ switch(operation){
237
+ case 0:
238
+ {
239
+ const keyframes = args[2];
240
+ const options = args[3];
241
+ this.animationMap.set(name, {
242
+ element,
243
+ state: 'running',
244
+ keyframes,
245
+ options
246
+ });
247
+ break;
248
+ }
249
+ case 1:
250
+ {
251
+ const anim = this.animationMap.get(name);
252
+ if (anim) anim.state = 'running';
253
+ break;
254
+ }
255
+ case 2:
256
+ {
257
+ const anim = this.animationMap.get(name);
258
+ if (anim) anim.state = 'paused';
259
+ break;
260
+ }
261
+ case 3:
262
+ this.animationMap.delete(name);
263
+ break;
264
+ case 4:
265
+ {
266
+ const anim = this.animationMap.get(name);
267
+ if (anim) anim.state = 'finished';
268
+ break;
269
+ }
270
+ }
271
+ }
234
272
  clear() {
235
273
  this.root = void 0;
236
274
  }
@@ -254,6 +292,7 @@ const initElementTree = ()=>{
254
292
  constructor(){
255
293
  _define_property(this, "uniqueId2Element", new Map());
256
294
  _define_property(this, "root", void 0);
295
+ _define_property(this, "animationMap", new Map());
257
296
  }
258
297
  }();
259
298
  };
@@ -84,6 +84,14 @@ export declare const initElementTree: () => {
84
84
  __CreateList(parentComponentUniqueId: number, componentAtIndex: any, enqueueComponent: any): LynxElement;
85
85
  __GetTag(ele: LynxElement): string;
86
86
  __GetAttributeByName(ele: LynxElement, name: string): string | null;
87
+ /** @internal */
88
+ animationMap: Map<string, {
89
+ element: LynxElement;
90
+ state: string;
91
+ keyframes?: any[];
92
+ options?: any;
93
+ }>;
94
+ __ElementAnimate(element: LynxElement, args: [number, string, ...any[]]): void;
87
95
  clear(): void;
88
96
  toTree(): LynxElement | undefined;
89
97
  /**
@@ -203,6 +203,44 @@ const initElementTree = ()=>{
203
203
  __GetAttributeByName(ele, name) {
204
204
  return ele.getAttribute(name);
205
205
  }
206
+ __ElementAnimate(element, args) {
207
+ const [operation, name] = args;
208
+ switch(operation){
209
+ case 0:
210
+ {
211
+ const keyframes = args[2];
212
+ const options = args[3];
213
+ this.animationMap.set(name, {
214
+ element,
215
+ state: 'running',
216
+ keyframes,
217
+ options
218
+ });
219
+ break;
220
+ }
221
+ case 1:
222
+ {
223
+ const anim = this.animationMap.get(name);
224
+ if (anim) anim.state = 'running';
225
+ break;
226
+ }
227
+ case 2:
228
+ {
229
+ const anim = this.animationMap.get(name);
230
+ if (anim) anim.state = 'paused';
231
+ break;
232
+ }
233
+ case 3:
234
+ this.animationMap.delete(name);
235
+ break;
236
+ case 4:
237
+ {
238
+ const anim = this.animationMap.get(name);
239
+ if (anim) anim.state = 'finished';
240
+ break;
241
+ }
242
+ }
243
+ }
206
244
  clear() {
207
245
  this.root = void 0;
208
246
  }
@@ -226,6 +264,7 @@ const initElementTree = ()=>{
226
264
  constructor(){
227
265
  _define_property(this, "uniqueId2Element", new Map());
228
266
  _define_property(this, "root", void 0);
267
+ _define_property(this, "animationMap", new Map());
229
268
  }
230
269
  }();
231
270
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/testing-environment",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "A subset of a Lynx environment to be useful for testing",
5
5
  "keywords": [
6
6
  "Lynx",