@pixodesk/svg-animator-rn 1.0.40 → 1.0.41
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/dist/index.cjs +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/PixodeskSvgAnimator.tsx +7 -7
- package/src/PxRnPropNames.ts +1 -1
- package/src/PxRnRender.tsx +6 -6
- package/src/PxRnTracks.ts +4 -4
package/src/PxRnPropNames.ts
CHANGED
|
@@ -17,7 +17,7 @@ const DROPPED_ATTRS = new Set(['class', 'className', 'style', 'xmlns', 'xmlns:xl
|
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Converts one normalized wire attribute name (camelCase after core's
|
|
20
|
-
* `
|
|
20
|
+
* `toDomProps`, or kebab-case raw) to a react-native-svg prop name.
|
|
21
21
|
* Returns undefined for props that must be dropped.
|
|
22
22
|
*
|
|
23
23
|
* Pure (no react-native-svg import) so the track compiler and its tests
|
package/src/PxRnRender.tsx
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License. See the LICENSE file in the project root for details.
|
|
4
4
|
*---------------------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import { sanitizeAttributeValue,
|
|
6
|
+
import { toDomProps, type PxDefinitions, type PxNode } from '@pixodesk/svg-animator-core';
|
|
7
|
+
import { sanitizeAttributeValue, PX_DISALLOWED_SVG_TAGS_LOWER, PX_TEXT_CONTENT_ATTR } from '@pixodesk/svg-animator-core/internal';
|
|
8
8
|
import { createElement, type ComponentType, type ReactElement, type ReactNode } from 'react';
|
|
9
9
|
import { RN_SVG_COMPONENTS } from './PxRnTypeMap';
|
|
10
10
|
import { toRnPropName, toRnPropValue } from './PxRnPropNames';
|
|
@@ -14,7 +14,7 @@ export interface RenderRnNodeOptions {
|
|
|
14
14
|
/** Collects non-fatal issues (unsupported tags, dropped attrs). */
|
|
15
15
|
warnings?: Array<string>;
|
|
16
16
|
/** `definitions` from the document, used to resolve named `style` presets. */
|
|
17
|
-
defs?:
|
|
17
|
+
defs?: PxDefinitions;
|
|
18
18
|
/**
|
|
19
19
|
* Wraps the created element for animated nodes: receives the resolved
|
|
20
20
|
* component + static props and returns the element to mount (the animator
|
|
@@ -41,7 +41,7 @@ export interface RenderRnNodeOptions {
|
|
|
41
41
|
* @internal
|
|
42
42
|
*/
|
|
43
43
|
export function toRnProps(props: Record<string, any>, warnings?: Array<string>, tag?: string): Record<string, any> {
|
|
44
|
-
const normalized =
|
|
44
|
+
const normalized = toDomProps(props);
|
|
45
45
|
const out: Record<string, any> = {};
|
|
46
46
|
for (const key of Object.keys(normalized)) {
|
|
47
47
|
const sanitized = sanitizeAttributeValue(key, normalized[key]);
|
|
@@ -72,7 +72,7 @@ export function renderRnNode(node: PxNode, opts: RenderRnNodeOptions = {}, key?:
|
|
|
72
72
|
const domType: string | undefined = props.domType;
|
|
73
73
|
if (domType !== undefined) delete props.domType;
|
|
74
74
|
|
|
75
|
-
if (
|
|
75
|
+
if (PX_DISALLOWED_SVG_TAGS_LOWER.has(tag.toLowerCase())) {
|
|
76
76
|
opts.warnings?.push('tag blocked (dangerous): ' + tag);
|
|
77
77
|
return null;
|
|
78
78
|
}
|
|
@@ -102,7 +102,7 @@ export function renderRnNode(node: PxNode, opts: RenderRnNodeOptions = {}, key?:
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
// Text content: wire nodes carry it in `textContent` — the one key.
|
|
105
|
-
const textContent: string | undefined = props[
|
|
105
|
+
const textContent: string | undefined = props[PX_TEXT_CONTENT_ATTR];
|
|
106
106
|
|
|
107
107
|
let childElements: ReactNode = undefined;
|
|
108
108
|
if (Array.isArray(children) && children.length > 0) {
|
package/src/PxRnTracks.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License. See the LICENSE file in the project root for details.
|
|
4
4
|
*---------------------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
|
-
import { calcAnimationValues, getAnimatorConfig,
|
|
7
|
-
import {
|
|
6
|
+
import { calcAnimationValues, getAnimatorConfig, normalizeBindings, PxTimelineEngine, type PxAnimatedSvgDocument, type PxAnimationDefinition } from '@pixodesk/svg-animator-core';
|
|
7
|
+
import { PX_DEFAULT_DURATION_MS } from '@pixodesk/svg-animator-core/internal';
|
|
8
8
|
import { toRnPropName, toRnPropValue } from './PxRnPropNames';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -73,7 +73,7 @@ export interface CompileTracksOptions {
|
|
|
73
73
|
export function compileTracks(doc: PxAnimatedSvgDocument, opts?: CompileTracksOptions): PxCompiledTracks {
|
|
74
74
|
const config = getAnimatorConfig(doc) || {};
|
|
75
75
|
|
|
76
|
-
const duration = +(config.duration ||
|
|
76
|
+
const duration = +(config.duration || PX_DEFAULT_DURATION_MS);
|
|
77
77
|
const _iterations = config.iterations;
|
|
78
78
|
let iterations = 1;
|
|
79
79
|
if (typeof _iterations === 'number') iterations = _iterations || 1;
|
|
@@ -96,7 +96,7 @@ export function compileTracks(doc: PxAnimatedSvgDocument, opts?: CompileTracksOp
|
|
|
96
96
|
};
|
|
97
97
|
indexTags(doc);
|
|
98
98
|
|
|
99
|
-
const bindings =
|
|
99
|
+
const bindings = normalizeBindings(doc, PxTimelineEngine.js) || [];
|
|
100
100
|
|
|
101
101
|
const elements: Array<PxElementTracks> = [];
|
|
102
102
|
for (const binding of bindings) {
|