@pixodesk/svg-animator-rn 1.0.35 → 1.0.39

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.
@@ -4,7 +4,7 @@
4
4
  *---------------------------------------------------------------------------------------*/
5
5
 
6
6
  import { describe, expect, it } from 'vitest';
7
- import { generateNewIds, materialiseAllInTree, PxTimelineEngine, type PxAnimatedSvgDocument } from '@pixodesk/svg-animator-core';
7
+ import { generateNewIds, materializeAllInTree, PxTimelineEngine, type PxAnimatedSvgDocument } from '@pixodesk/svg-animator-core';
8
8
  import { compileTracks, sampleProps } from './PxRnTracks';
9
9
  import { toRnPropName } from './PxRnPropNames';
10
10
 
@@ -37,8 +37,8 @@ function makeDoc(): PxAnimatedSvgDocument {
37
37
  }
38
38
 
39
39
  function compile(doc = makeDoc(), opts?: Parameters<typeof compileTracks>[1]) {
40
- const materialised = generateNewIds(materialiseAllInTree(doc, PxTimelineEngine.js));
41
- return compileTracks(materialised, opts);
40
+ const materialized = generateNewIds(materializeAllInTree(doc, PxTimelineEngine.js));
41
+ return compileTracks(materialized, opts);
42
42
  }
43
43
 
44
44
  describe('compileTracks', () => {
@@ -76,7 +76,7 @@ describe('compileTracks', () => {
76
76
  expect(+rect.props.strokeWidth[rect.props.strokeWidth.length - 1]).toBe(5);
77
77
  });
78
78
 
79
- it('samples colour props as rgba strings', () => {
79
+ it('samples color props as rgba strings', () => {
80
80
  const tracks = compile();
81
81
  const rect = tracks.elements.find(e => 'fill' in e.props)!;
82
82
  expect(String(rect.props.fill[0])).toMatch(/^rgba\(/);
@@ -156,8 +156,8 @@ describe('length-list props (stroke-dasharray)', () => {
156
156
  effects: { strokeTrim: { range: { keyframes: [{ time: 0, value: [0, 0.1] }, { time: 1000, value: [0, 1] }] } } },
157
157
  }],
158
158
  };
159
- const materialised = generateNewIds(materialiseAllInTree(doc, PxTimelineEngine.native));
160
- const tracks = compileTracks(materialised);
159
+ const materialized = generateNewIds(materializeAllInTree(doc, PxTimelineEngine.native));
160
+ const tracks = compileTracks(materialized);
161
161
  const el = tracks.elements.find(e => 'strokeDasharray' in e.props)!;
162
162
  expect(el).toBeDefined();
163
163
  const first = el.props.strokeDasharray[0];
@@ -167,7 +167,7 @@ describe('length-list props (stroke-dasharray)', () => {
167
167
  });
168
168
  });
169
169
 
170
- describe('animated <use> flattening (waapi materialisation)', () => {
170
+ describe('animated <use> flattening (waapi materialization)', () => {
171
171
  it('inlines animated <use> clones so no live references remain', () => {
172
172
  const doc: PxAnimatedSvgDocument = {
173
173
  type: 'svg', viewBox: '0 0 300 200',
@@ -181,12 +181,12 @@ describe('animated <use> flattening (waapi materialisation)', () => {
181
181
  { type: 'use', id: 'u2', href: '#sym', x: 80, effects: { clone: { source: '#sym', retime: { start: -600 } } } },
182
182
  ],
183
183
  };
184
- const materialised = generateNewIds(materialiseAllInTree(doc, PxTimelineEngine.native));
184
+ const materialized = generateNewIds(materializeAllInTree(doc, PxTimelineEngine.native));
185
185
  const countUse = (n: any): number =>
186
186
  (n.type === 'use' ? 1 : 0) + (n.children || []).reduce((s: number, c: any) => s + countUse(c), 0);
187
- expect(countUse(materialised)).toBe(0);
187
+ expect(countUse(materialized)).toBe(0);
188
188
 
189
- const tracks = compileTracks(materialised);
189
+ const tracks = compileTracks(materialized);
190
190
  const cyTracks = tracks.elements.filter(e => 'cy' in e.props);
191
191
  expect(cyTracks.length).toBe(2);
192
192
  expect(cyTracks[0].props.cy[0]).not.toBe(cyTracks[1].props.cy[0]);
@@ -195,9 +195,9 @@ describe('animated <use> flattening (waapi materialisation)', () => {
195
195
 
196
196
  describe('compileTracks platform gating', () => {
197
197
  /** The DEFAULT is the DOM form. react-native-web passes values straight to
198
- * the DOM, where a matrix array serialises to `transform="1,0,0,1,x,y"` —
198
+ * the DOM, where a matrix array serializes to `transform="1,0,0,1,x,y"` —
199
199
  * invalid, so the element silently stops moving. Web is the priority
200
- * behaviour; native is the one that has to opt in. */
200
+ * behavior; native is the one that has to opt in. */
201
201
  it('samples transforms as SVG STRINGS by default', () => {
202
202
  const tracks = compile();
203
203
  const g = tracks.elements.find(e => 'transform' in e.props)!;
package/src/PxRnTracks.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  import {
7
7
  calcAnimationValues,
8
8
  getAnimatorConfig,
9
- getNormalisedBindings,
9
+ getNormalizedBindings,
10
10
  DEFAULT_DURATION_MS,
11
11
  PxTimelineEngine,
12
12
  type PxAnimatedSvgDocument,
@@ -20,7 +20,7 @@ import { toRnPropName, toRnPropValue } from './PxRnPropNames';
20
20
  * The compiler densely samples every animated property through core's
21
21
  * `calcAnimationValues` — the exact function the web frames engine renders
22
22
  * with — so RN playback is value-identical to the web player. Easing, loops,
23
- * transform composition, colour interpolation and path morphing are all baked
23
+ * transform composition, color interpolation and path morphing are all baked
24
24
  * into the samples at compile time; the UI-thread worklet only indexes arrays.
25
25
  */
26
26
  export interface PxElementTracks {
@@ -70,7 +70,7 @@ export interface CompileTracksOptions {
70
70
 
71
71
 
72
72
  /**
73
- * Compiles a MATERIALISED document (run `materialiseAllInTree(doc, 'frames')`
73
+ * Compiles a MATERIALIZED document (run `materializeAllInTree(doc, 'frames')`
74
74
  * + `generateNewIds` first) into densely sampled per-element tracks.
75
75
  */
76
76
  export function compileTracks(doc: PxAnimatedSvgDocument, opts?: CompileTracksOptions): PxCompiledTracks {
@@ -99,7 +99,7 @@ export function compileTracks(doc: PxAnimatedSvgDocument, opts?: CompileTracksOp
99
99
  };
100
100
  indexTags(doc);
101
101
 
102
- const bindings = getNormalisedBindings(doc, PxTimelineEngine.js) || [];
102
+ const bindings = getNormalizedBindings(doc, PxTimelineEngine.js) || [];
103
103
 
104
104
  const elements: Array<PxElementTracks> = [];
105
105
  for (const binding of bindings) {