@pixodesk/svg-animator-web 1.0.44 → 1.0.45
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/{PxAnimator-yjuSFhQw.d.cts → PxAnimator-BS-SZULN.d.cts} +10 -0
- package/dist/{PxAnimator-yjuSFhQw.d.ts → PxAnimator-BS-SZULN.d.ts} +10 -0
- package/dist/{chunk-ZEMEZT7X.js → chunk-QE7KJWAN.js} +213 -149
- package/dist/chunk-QE7KJWAN.js.map +1 -0
- package/dist/chunk-RQ5KZXDT.min.js +1 -0
- package/dist/index.cjs +269 -201
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +60 -58
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.prerendered-waapi.umd.js +32 -30
- package/dist/index.prerendered-waapi.umd.js.map +1 -1
- package/dist/index.prerendered.umd.js +34 -32
- package/dist/index.prerendered.umd.js.map +1 -1
- package/dist/index.prerendered.umd.min.js +1 -1
- package/dist/internal.cjs +1 -1
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/dist/internal.min.cjs +1 -1
- package/dist/internal.min.js +1 -1
- package/dist/pixodesk-svg-animator.umd.js +177 -91
- package/dist/pixodesk-svg-animator.umd.js.map +1 -1
- package/dist/pixodesk-svg-animator.umd.min.js +1 -1
- package/mangle-reserved.json +6 -0
- package/package.json +2 -2
- package/dist/chunk-AROHP6GD.min.js +0 -1
- package/dist/chunk-ZEMEZT7X.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PxAnimatorApi } from './PxAnimator-
|
|
2
|
-
export { a as PxAnimatorOptions, b as PxPlaybackApi, c as PxTagAnimatorOptions, d as createAnimator, l as loadTagAnimators } from './PxAnimator-
|
|
1
|
+
import { P as PxAnimatorApi } from './PxAnimator-BS-SZULN.cjs';
|
|
2
|
+
export { a as PxAnimatorOptions, b as PxPlaybackApi, c as PxTagAnimatorOptions, d as createAnimator, l as loadTagAnimators } from './PxAnimator-BS-SZULN.cjs';
|
|
3
3
|
import { PxAnimatorCallbacks, PxAnimatedSvgDocument, PxTrigger, PxDiagnostics, PxNode, PxDefinitions } from '@pixodesk/svg-animator-core';
|
|
4
4
|
export { PxAnimatedSvgDocument, PxAnimatorCallbacks, PxAnimatorConfig, PxAnimatorConfigSchema, PxBinding, PxDefinitions, PxDefinitionsSchema, PxDiagnostic, PxDiagnosticKind, PxDiagnostics, PxDiagnosticsConfig, PxEngineCallbacks, PxFillMode, PxInfer, PxNode, PxNodeBaseSchema, PxPlatformAdapter, PxPlaybackDirection, PxPlaybackOverride, PxSchema, PxScrollSchema, PxSvgNode, PxSvgNodeRootSchema, PxTimelineEngineSetting, PxTimelinePatch, PxTrigger, PxTriggerSchema, PxTriggerStart, PxValidationContext, createAdapterAnimator, generateNewIds, px, toDomProps, validateDocument } from '@pixodesk/svg-animator-core';
|
|
5
5
|
|
|
@@ -84,6 +84,6 @@ declare function onAnimatorsChange(listener: PxAnimatorsListener): () => void;
|
|
|
84
84
|
* Renders a PxNode tree to DOM elements.
|
|
85
85
|
* @public @advanced
|
|
86
86
|
*/
|
|
87
|
-
declare function renderNode(node: PxNode,
|
|
87
|
+
declare function renderNode(node: PxNode, _defs?: PxDefinitions, diag?: PxDiagnostics): Element | null;
|
|
88
88
|
|
|
89
89
|
export { PxAnimatorApi, type PxAnimatorRegistry, type PxAnimatorsEvent, type PxAnimatorsListener, type PxPrerenderedAnimatorOptions, getAllAnimators, onAnimatorsChange, renderNode, setupAnimationTriggers };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PxAnimatorApi } from './PxAnimator-
|
|
2
|
-
export { a as PxAnimatorOptions, b as PxPlaybackApi, c as PxTagAnimatorOptions, d as createAnimator, l as loadTagAnimators } from './PxAnimator-
|
|
1
|
+
import { P as PxAnimatorApi } from './PxAnimator-BS-SZULN.js';
|
|
2
|
+
export { a as PxAnimatorOptions, b as PxPlaybackApi, c as PxTagAnimatorOptions, d as createAnimator, l as loadTagAnimators } from './PxAnimator-BS-SZULN.js';
|
|
3
3
|
import { PxAnimatorCallbacks, PxAnimatedSvgDocument, PxTrigger, PxDiagnostics, PxNode, PxDefinitions } from '@pixodesk/svg-animator-core';
|
|
4
4
|
export { PxAnimatedSvgDocument, PxAnimatorCallbacks, PxAnimatorConfig, PxAnimatorConfigSchema, PxBinding, PxDefinitions, PxDefinitionsSchema, PxDiagnostic, PxDiagnosticKind, PxDiagnostics, PxDiagnosticsConfig, PxEngineCallbacks, PxFillMode, PxInfer, PxNode, PxNodeBaseSchema, PxPlatformAdapter, PxPlaybackDirection, PxPlaybackOverride, PxSchema, PxScrollSchema, PxSvgNode, PxSvgNodeRootSchema, PxTimelineEngineSetting, PxTimelinePatch, PxTrigger, PxTriggerSchema, PxTriggerStart, PxValidationContext, createAdapterAnimator, generateNewIds, px, toDomProps, validateDocument } from '@pixodesk/svg-animator-core';
|
|
5
5
|
|
|
@@ -84,6 +84,6 @@ declare function onAnimatorsChange(listener: PxAnimatorsListener): () => void;
|
|
|
84
84
|
* Renders a PxNode tree to DOM elements.
|
|
85
85
|
* @public @advanced
|
|
86
86
|
*/
|
|
87
|
-
declare function renderNode(node: PxNode,
|
|
87
|
+
declare function renderNode(node: PxNode, _defs?: PxDefinitions, diag?: PxDiagnostics): Element | null;
|
|
88
88
|
|
|
89
89
|
export { PxAnimatorApi, type PxAnimatorRegistry, type PxAnimatorsEvent, type PxAnimatorsListener, type PxPrerenderedAnimatorOptions, getAllAnimators, onAnimatorsChange, renderNode, setupAnimationTriggers };
|
package/dist/index.js
CHANGED
|
@@ -37,7 +37,6 @@ import {
|
|
|
37
37
|
foldTimelineOverride,
|
|
38
38
|
generateNewIds,
|
|
39
39
|
getAnimatorConfig,
|
|
40
|
-
getDefinitions,
|
|
41
40
|
interpolateValue,
|
|
42
41
|
isNativeForced,
|
|
43
42
|
isPxDocument,
|
|
@@ -61,9 +60,53 @@ import {
|
|
|
61
60
|
toRGBA,
|
|
62
61
|
validateDocument,
|
|
63
62
|
validateNodeEffects
|
|
64
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-QE7KJWAN.js";
|
|
65
64
|
|
|
66
65
|
// ../svg-animator-core/dist/internal.js
|
|
66
|
+
var CLASS_NAME_KEY = "className";
|
|
67
|
+
var CLASS_ATTR = "class";
|
|
68
|
+
var DOM_TYPE_KEY = "domType";
|
|
69
|
+
var TYPE_ATTR = "type";
|
|
70
|
+
var DEFAULT_TAG = "g";
|
|
71
|
+
function renderPxTree(node, factory, diag) {
|
|
72
|
+
return node ? renderOne(node, factory, diag, true, 0) : null;
|
|
73
|
+
}
|
|
74
|
+
function renderOne(node, factory, diag, isRoot, index) {
|
|
75
|
+
const _a = node, { type, children, style } = _a, props = __objRest(_a, ["type", "children", "style"]);
|
|
76
|
+
const tag = type || DEFAULT_TAG;
|
|
77
|
+
if (PX_DISALLOWED_SVG_TAGS_LOWER.has(tag.toLowerCase())) {
|
|
78
|
+
(diag != null ? diag : createDiagnostics(void 0, "[PxAnimator]")).warn(PxDiagnosticKind.document, 1103, tag);
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
const domType = props[DOM_TYPE_KEY];
|
|
82
|
+
if (domType !== void 0) delete props[DOM_TYPE_KEY];
|
|
83
|
+
const attrs = {};
|
|
84
|
+
let inlineStyle;
|
|
85
|
+
const domProps = toDomProps(props);
|
|
86
|
+
for (const propName of Object.keys(domProps)) {
|
|
87
|
+
const sanitized = sanitizeAttributeValue(propName, domProps[propName]);
|
|
88
|
+
if (sanitized === void 0) continue;
|
|
89
|
+
if (PX_CSS_ONLY_STYLE_PROPS.has(propName)) {
|
|
90
|
+
(inlineStyle != null ? inlineStyle : inlineStyle = {})[propName] = String(sanitized);
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
attrs[propName === CLASS_NAME_KEY ? CLASS_ATTR : camelCaseToKebabWordIfNeeded(propName)] = sanitized;
|
|
94
|
+
}
|
|
95
|
+
if (domType !== void 0) attrs[TYPE_ATTR] = String(domType);
|
|
96
|
+
if (style) {
|
|
97
|
+
for (const styleProp of Object.keys(style)) (inlineStyle != null ? inlineStyle : inlineStyle = {})[styleProp] = String(style[styleProp]);
|
|
98
|
+
}
|
|
99
|
+
const rendered = [];
|
|
100
|
+
if (children) {
|
|
101
|
+
children.forEach((child, i) => {
|
|
102
|
+
const el = renderOne(child, factory, diag, false, i);
|
|
103
|
+
if (el !== null) rendered.push(el);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
const ownText = props[PX_TEXT_CONTENT_ATTR];
|
|
107
|
+
const text = !rendered.length && typeof ownText === "string" && ownText ? ownText : void 0;
|
|
108
|
+
return factory({ tag, attrs, style: inlineStyle, children: rendered, text, node, isRoot, index });
|
|
109
|
+
}
|
|
67
110
|
function isScrollTimeline(config) {
|
|
68
111
|
return (config == null ? void 0 : config.timelineSource) === "scroll";
|
|
69
112
|
}
|
|
@@ -1015,69 +1058,26 @@ function bindWithEngineChoice(doc, adapter, callbacks, rootElement) {
|
|
|
1015
1058
|
|
|
1016
1059
|
// src/dom/PxAnimatorDOM.ts
|
|
1017
1060
|
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
return null;
|
|
1022
|
-
}
|
|
1023
|
-
const element = document.createElementNS(SVG_NS, tagName);
|
|
1024
|
-
for (const propName in normalizedProps) {
|
|
1025
|
-
const sanitized = sanitizeAttributeValue(propName, normalizedProps[propName]);
|
|
1026
|
-
if (sanitized === void 0) continue;
|
|
1027
|
-
if (PX_CSS_ONLY_STYLE_PROPS.has(propName)) {
|
|
1028
|
-
element.style[propName] = String(sanitized);
|
|
1029
|
-
continue;
|
|
1030
|
-
}
|
|
1031
|
-
element.setAttribute(camelCaseToKebabWordIfNeeded(propName), sanitized);
|
|
1032
|
-
}
|
|
1061
|
+
var createDomElement = ({ tag, attrs, style, children, text }) => {
|
|
1062
|
+
const element = document.createElementNS(SVG_NS, tag);
|
|
1063
|
+
for (const name of Object.keys(attrs)) element.setAttribute(name, attrs[name]);
|
|
1033
1064
|
if (style) {
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
if (children == null ? void 0 : children.length) {
|
|
1039
|
-
for (const child of children) {
|
|
1040
|
-
element.appendChild(child);
|
|
1041
|
-
}
|
|
1042
|
-
} else if (textContent) {
|
|
1043
|
-
element.textContent = textContent;
|
|
1065
|
+
const target = element.style;
|
|
1066
|
+
for (const prop of Object.keys(style)) target[prop] = style[prop];
|
|
1044
1067
|
}
|
|
1068
|
+
for (const child of children) element.appendChild(child);
|
|
1069
|
+
if (text !== void 0) element.textContent = text;
|
|
1045
1070
|
return element;
|
|
1046
|
-
}
|
|
1047
|
-
function renderNode(node,
|
|
1048
|
-
|
|
1049
|
-
const _a = node, { type, children, style } = _a, props = __objRest(_a, ["type", "children", "style"]);
|
|
1050
|
-
const domType = props.domType;
|
|
1051
|
-
if (domType !== void 0) delete props.domType;
|
|
1052
|
-
const nodeDefs = getDefinitions(node) || defs;
|
|
1053
|
-
const resolvedStyle = style;
|
|
1054
|
-
let childElements;
|
|
1055
|
-
if (children) {
|
|
1056
|
-
for (const ch of children) {
|
|
1057
|
-
const child = renderNode(ch, nodeDefs, diag);
|
|
1058
|
-
if (child) {
|
|
1059
|
-
if (!childElements) childElements = [];
|
|
1060
|
-
childElements.push(child);
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
const element = createElement(
|
|
1065
|
-
type || "g",
|
|
1066
|
-
toDomProps(props),
|
|
1067
|
-
resolvedStyle,
|
|
1068
|
-
childElements,
|
|
1069
|
-
props[PX_TEXT_CONTENT_ATTR],
|
|
1070
|
-
diag
|
|
1071
|
-
);
|
|
1072
|
-
if (element && domType !== void 0) element.setAttribute("type", domType);
|
|
1073
|
-
return element;
|
|
1071
|
+
};
|
|
1072
|
+
function renderNode(node, _defs, diag) {
|
|
1073
|
+
return renderPxTree(node, createDomElement, diag);
|
|
1074
1074
|
}
|
|
1075
1075
|
|
|
1076
1076
|
// src/animator/PxAnimator.ts
|
|
1077
1077
|
function createAnimatorFromConfig(doc, adapter, callbacks, rootElement) {
|
|
1078
1078
|
return bindWithEngineChoice(doc, adapter, callbacks, rootElement);
|
|
1079
1079
|
}
|
|
1080
|
-
function createAnimatorImpl(doc, adapter, callbacks, containerElement, patch, resetTimeline) {
|
|
1080
|
+
function createAnimatorImpl(doc, adapter, callbacks, containerElement, patch, resetTimeline, providedRoot) {
|
|
1081
1081
|
const diag = createDiagnostics(callbacks, "[PxAnimator]");
|
|
1082
1082
|
const effectsWarnings = validateNodeEffects(doc);
|
|
1083
1083
|
for (const w of effectsWarnings) diag.warn(PxDiagnosticKind.document, PxDiagnosticCode.effectsShape, w);
|
|
@@ -1101,6 +1101,7 @@ function createAnimatorImpl(doc, adapter, callbacks, containerElement, patch, re
|
|
|
1101
1101
|
}
|
|
1102
1102
|
}
|
|
1103
1103
|
}
|
|
1104
|
+
if (!rootElement && providedRoot) rootElement = providedRoot;
|
|
1104
1105
|
const api = createAnimatorFromConfig(doc, adapter, callbacks, rootElement);
|
|
1105
1106
|
if (containerElement && rootElement) {
|
|
1106
1107
|
const rendered = rootElement;
|
|
@@ -1113,7 +1114,7 @@ function createAnimatorImpl(doc, adapter, callbacks, containerElement, patch, re
|
|
|
1113
1114
|
return api;
|
|
1114
1115
|
}
|
|
1115
1116
|
function isInternalOptions(options) {
|
|
1116
|
-
return "adapter" in options;
|
|
1117
|
+
return "adapter" in options || "rootElement" in options;
|
|
1117
1118
|
}
|
|
1118
1119
|
function resolveTimelineOption(options) {
|
|
1119
1120
|
const { timeline, duration, delay, iterations, start } = options;
|
|
@@ -1122,6 +1123,7 @@ function resolveTimelineOption(options) {
|
|
|
1122
1123
|
function createAnimator(options) {
|
|
1123
1124
|
const { src, doc, container, resetTimeline } = options;
|
|
1124
1125
|
const adapter = isInternalOptions(options) ? options.adapter : void 0;
|
|
1126
|
+
const providedRoot = isInternalOptions(options) ? options.rootElement : void 0;
|
|
1125
1127
|
const patch = resolveTimelineOption(options);
|
|
1126
1128
|
let proxy;
|
|
1127
1129
|
const callbacks = withRegistryEvents(toEngineCallbacks(options), () => proxy);
|
|
@@ -1154,7 +1156,7 @@ function createAnimator(options) {
|
|
|
1154
1156
|
};
|
|
1155
1157
|
const build = (document2) => {
|
|
1156
1158
|
try {
|
|
1157
|
-
ready(createAnimatorImpl(document2, adapter, callbacks, container, patch, resetTimeline));
|
|
1159
|
+
ready(createAnimatorImpl(document2, adapter, callbacks, container, patch, resetTimeline, providedRoot));
|
|
1158
1160
|
} catch (e) {
|
|
1159
1161
|
const err = asThrownError(e);
|
|
1160
1162
|
failed(PxDiagnosticKind.internal, PxDiagnosticCode.buildFailed, err);
|