@pixodesk/svg-animator-web 1.0.35 → 1.0.40

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.d.cts CHANGED
@@ -1,92 +1,22 @@
1
- import { PxAnimatorAPI as PxAnimatorAPI$1, PxBasicAnimatorAPI as PxBasicAnimatorAPI$1, PxAnimatedSvgDocument, PxPlatformAdapter, PxAnimatorCallbacksConfig, PxAnimatorConfigPatch, PxTrigger, PxNode, PxDefs } from '@pixodesk/svg-animator-core';
2
- export { ApplyResult, COLOUR_ATTR_NAMES, ExtendPathOpts, ExtendedPath, FillMode, GlyphCharBox, GlyphCharBoxAlongPath, GlyphMaterialiseOpts, KeysMatch, MISSING_GLYPH_CLASS_NAME, MaterialiseAllOptions, MotionPathMaterialisationOptions, MotionPathSample, OutAction, PX_ANIM_ATTR_NAME, PX_ANIM_SRC_ATTR_NAME, PX_TRANSFORM_PART_KEYS, PathPoint, PathSampler, PlaybackDirection, PxAnimatable, PxAnimatedSvgDocument, PxAnimatedSvgDocumentSchema, PxAnimationDefinition, PxAnimationDefinitionSchema, PxAnimatorCallbacksConfig, PxAnimatorConfig, PxAnimatorConfigMergeResult, PxAnimatorConfigPatch, PxAnimatorConfigSchema, PxAnimatorConfigShortcuts, PxAnyKeyframe, PxAttrValue, PxAttrValueSchema, PxBezierPath, PxBezierPathSchema, PxBinding, PxBindingSchema, PxCloneEffect, PxCloneEffectSchema, PxCloneWithout, PxCreateElement, PxDefs, PxDefsSchema, PxEasingOrRefSchema, PxEffects, PxEffectsSchema, PxElementAnimation, PxElementAnimationSchema, PxFillGradientEffect, PxFillGradientEffectSchema, PxGlyph, PxGlyphFont, PxGradientSpreadMethod, PxGradientStop, PxGradientStopSchema, PxGradientType, PxGradientUnits, PxInfer, PxKeyframe, PxKeyframeSchema, PxKeyframeValueSchema, PxLoop, PxLoopDirection, PxLoopRepeatAt, PxLoopSchema, PxMaskedByEffect, PxMaskedByEffectSchema, PxNode, PxNodeBase, PxNodeSchema, PxNormalisedKeyframe, PxPlatformAdapter, PxPropertyAnimation, PxPropertyAnimationSchema, PxRepeaterEffect, PxRepeaterEffectSchema, PxRetimeEffect, PxRetimeEffectSchema, PxSchema, PxSchemaDesc, PxStrokeGradientEffect, PxStrokeGradientEffectSchema, PxStrokeTrimEffect, PxStrokeTrimEffectSchema, PxStrokeTrimSubPaths, PxSvgNode, PxSvgNodeExtra, PxTextEffectSchema, PxTextPathEffect, PxTextPathEffectSchema, PxTimelineEngine, PxTimelineEngineExtra, PxTransformByEffect, PxTransformByEffectSchema, PxTransformPartKey, PxTransformParts, PxTransformPartsSchema, PxTransformValue, PxTransformValueSchema, PxTrigger, PxTriggerSchema, PxValidationContext, PxValidationResult, RemoveIndex, STYLE_ATTR_NAMES, StartOn, TRANSFORM_FN_NAMES, Vec2, applyAnimatorConfig, applyPlayerEffects, calcAnimationValues, camelCaseToKebabWordIfNeeded, collectSampleTimes, createBasicFrameLoopAnimator, createPathSampler, describeSchema, diffInEffect, evaluateMotionPathSegment, extendedPathForBrowser, foldAnimatorConfigShortcuts, generateNewIds, getAnimatorConfig, getBindings, getChildren, getDefs, getNormalizedProps, isPxElementFileFormat, isPxElementFileFormatDeep, jsonElementFactory, layoutGlyphTextChars, materialiseAllInTree, materialiseAnimatedUseInstances, materialiseGlyphText, materialiseGlyphTextAlongPath, materialiseGlyphTextHorizontal, materialiseInternalLoopsInPropAnim, materialiseInternalLoopsInTree, materialiseMotionPathInPropAnim, materialiseMotionPathsInTree, mergeAnimatorConfig, getNormalisedBindings as normalizeDocument, propAnimIsMotionPath, px, schemaKeys, shiftAnimatable, toRGBA, validateDocument, validateNodeEffects, visualModelAt } from '@pixodesk/svg-animator-core';
1
+ import { P as PxAnimatorAPI } from './internal-BmFv1B6H.cjs';
2
+ export { a as PX_ANIMATOR_DOC_KEY, b as PxAnimatorOptions, c as PxBasicAnimatorAPI, d as PxInternalAnimatorOptions, e as PxTagAnimatorOptions, f as createAnimator, l as loadTagAnimators } from './internal-BmFv1B6H.cjs';
3
+ import { PxAnimatorCallbacks, PxAnimatedSvgDocument, PxTrigger, PxDiagnostics, PxNode, PxDefs } from '@pixodesk/svg-animator-core';
4
+ export { PxAnimatedSvgDocument, PxAnimatorCallbacks, PxAnimatorConfig, PxAnimatorConfigSchema, PxBinding, PxDefs, PxDefsSchema, PxDiagnostic, PxDiagnosticKind, PxDiagnostics, PxDiagnosticsConfig, PxEngineCallbacks, PxFillMode, PxInfer, PxNode, PxNodeBase, PxPlatformAdapter, PxPlaybackDirection, PxPlaybackOverrideProps, PxSchema, PxScrollSchema, PxStartOn, PxSvgNode, PxSvgNodeExtra, PxTimelineEngineExtra, PxTimelinePatch, PxTrigger, PxTriggerSchema, PxValidationContext, createBasicFrameLoopAnimator, generateNewIds, getNormalizedProps, px, validateDocument } from '@pixodesk/svg-animator-core';
3
5
 
4
6
  /**
5
- * DOM specialisations of the platform-neutral animator API types.
6
- * `getRootElement()` returns a DOM `Element` on the web — these aliases keep
7
- * the historical (pre-core-extraction) signatures for web consumers.
7
+ * Options accepted by the pre-rendered entry points — a subset of `PxAnimatorOptions`: the
8
+ * document and the callbacks INLINE under the same names every surface uses (review §9). No
9
+ * `adapter`: a pre-rendered SVG is by definition already in the DOM (review §25.14).
10
+ * @public
8
11
  */
9
- type PxBasicAnimatorAPI = PxBasicAnimatorAPI$1<Element>;
10
- type PxAnimatorAPI = PxAnimatorAPI$1<Element>;
11
-
12
- /**
13
- * Wire keys shared by every entry point.
14
- *
15
- * These live here rather than in `PxAnimator.ts` on purpose: that module ends with a
16
- * top-level `if (typeof window !== 'undefined')` block that publishes `createAnimator` /
17
- * `loadTagAnimators` as globals. A module-level side effect cannot be tree-shaken, so
18
- * importing ANY symbol from `PxAnimator.ts` pulls the entire full player in with it —
19
- * which silently made the pre-rendered builds the same size as the full one until this
20
- * constant was moved out. See PRERENDERED-PLAYER-BUILDS.md.
21
- */
22
- /** Key under which `createAnimator` options carry an inline animation document. */
23
- declare const PX_ANIMATOR_DATA_KEY = "data";
24
-
25
- /**
26
- * Creates an animator instance from an AnimatedSvgDocument.
27
- *
28
- * This function serves as the main entry point for the animation library. It automatically
29
- * chooses the best animation engine available ('waapi' or 'frames') or can be
30
- * forced to use a specific one.
31
- *
32
- * @param doc The animated SVG document.
33
- * @param callbacks Optional object with callback functions for animation lifecycle events (play, pause, finish, etc.).
34
- * @param containerElement Optional selector or element to render the SVG into.
35
- * @returns An PxAnimatorAPI instance to programmatically control the animation.
36
- */
37
- declare function createAnimatorImpl(doc: PxAnimatedSvgDocument, adapter?: PxPlatformAdapter, callbacks?: PxAnimatorCallbacksConfig, containerElement?: string | Element, config?: PxAnimatorConfigPatch, resetDocDefaults?: boolean): PxAnimatorAPI;
38
-
39
- interface PxAnimatorOptions {
40
- /** URL to fetch the animation document from. Provide either this or `data`, not both. */
41
- src?: string;
42
- /** Inline animation document object. Provide either this or `src`, not both. */
43
- data?: PxAnimatedSvgDocument;
44
- /** Platform adapter for frame-loop rendering. */
45
- adapter?: PxPlatformAdapter;
46
- /** Callback functions for animation lifecycle events. */
47
- callbacks?: PxAnimatorCallbacksConfig;
48
- /** CSS selector or element to render the SVG into. */
49
- container?: string | Element;
12
+ interface PxPrerenderedOptions extends PxAnimatorCallbacks {
50
13
  /**
51
- * Per-instance override of the document's `animator` config — the same shape as
52
- * `animator` in SCHEMA.md, deep-merged over what the document says, so one file can play
53
- * twice on a page with different timing. `null` at any slot DELETES that key, which is
54
- * how you restore a default that absence means.
55
- *
56
- * Also accepts a JSON STRING of the same object. Strings are immune to property mangling,
57
- * so that form survives a build that renames object keys (see docs/library/minification.md).
14
+ * The animation document. For a pre-rendered SVG this carries `animator.definitions`
15
+ * and `animator.bindings` only — no `children`, because the elements are already
16
+ * in the DOM.
58
17
  */
59
- config?: PxAnimatorConfigPatch | string;
60
- /**
61
- * Ignore the document's own playback settings and start from the player's defaults, with
62
- * `config` applied on top. The lookup tables (`definitions`, `animateById`) are kept
63
- * either way — resetting those would leave the animation with nothing to animate.
64
- */
65
- resetDocDefaults?: boolean;
66
- /** Shortcut for `config.timeline.duration` (ms). Wins over the same key inside `config`. */
67
- duration?: number;
68
- /** Shortcut for `config.timeline.delay` (ms). */
69
- delay?: number;
70
- /** Shortcut for `config.timeline.iterations`. */
71
- iterations?: number | 'infinite';
72
- /** Shortcut for `config.timeline.trigger.startOn`. Typed from the WIRE, so it includes
73
- * `'programmatic'` — the value that says "nothing starts this but a `play()` call". */
74
- startOn?: PxTrigger['startOn'];
18
+ doc: PxAnimatedSvgDocument;
75
19
  }
76
- /**
77
- * Creates an animator instance to control SVG animations.
78
- *
79
- * @param options.src URL to fetch the animation document from.
80
- * @param options.data Inline animation document object.
81
- * @param options.container CSS selector or element to render the SVG into.
82
- * @returns A PxAnimatorAPI instance to programmatically control the animation.
83
- */
84
- declare function createAnimator(options: PxAnimatorOptions): PxAnimatorAPI;
85
- /**
86
- * Scan and load for tags, e.g.
87
- * <div data-px-animation-src="animation.json"></div>
88
- */
89
- declare function loadTagAnimators(): void;
90
20
 
91
21
  /**
92
22
  * Sets up event-based triggers for an animation.
@@ -96,7 +26,7 @@ declare function loadTagAnimators(): void;
96
26
  * or visibility changes.
97
27
  *
98
28
  * ### Trigger Options (startOn):
99
- * - 'load': Starts after the page loads.
29
+ * - 'load' (default): Starts after the page loads.
100
30
  * - 'mouseOver': Starts on mouse enter.
101
31
  * - 'click': Toggles play/end action on click.
102
32
  * - 'scrollIntoView': Starts when the element scrolls into the viewport.
@@ -104,51 +34,26 @@ declare function loadTagAnimators(): void;
104
34
  *
105
35
  * ### End Action Options (outAction):
106
36
  * Defines behavior when the trigger condition ends (e.g., mouse leave).
107
- * - 'continue': Animation continues playing.
37
+ * - 'continue' (default): Animation continues playing.
108
38
  * - 'pause': Pauses the animation.
109
39
  * - 'reset': Cancels the animation, resetting it to the start.
110
40
  * - 'reverse': Reverses the animation playback.
111
41
  *
112
42
  * @param {!PxAnimatorAPI} api The animator API instance to control.
113
- * @param {!PxTrigger} config The trigger configuration object.
114
- * @returns {!PxAnimatorAPI} The same animator API instance, for chaining.
43
+ * @param {!PxTrigger} config The trigger configuration object. Only `startOn`, `outAction` and
44
+ * `scrollIntoViewThreshold` are read here; `finishAction` belongs to the PLAYER (what happens
45
+ * after a natural end), not to the trigger wiring.
46
+ * @returns A disposer that detaches every listener and observer this call attached (review §14).
47
+ * `createAnimator` ties it to `destroy()`. Call it yourself before re-arming an element you
48
+ * wired by hand — otherwise the old listeners stay live next to the new ones.
49
+ * @public
115
50
  */
116
- declare function setupAnimationTriggers(api: PxAnimatorAPI, config: PxTrigger): PxAnimatorAPI;
51
+ declare function setupAnimationTriggers(api: PxAnimatorAPI, config: PxTrigger, diag?: PxDiagnostics): () => void;
117
52
 
118
53
  /**
119
54
  * Renders a PxNode tree to DOM elements.
55
+ * @public @advanced
120
56
  */
121
- declare function renderNode(node: PxNode, defs?: PxDefs): Element | null;
122
-
123
- /**
124
- * Creates an animator instance that uses a requestAnimationFrame loop for animations.
125
- * This is the browser DOM-specific version.
126
- *
127
- * @param {PxAnimatorCallbacksConfig=} callbacks Optional lifecycle callbacks.
128
- * @param {Element=} rootElement Optional pre-rendered root element.
129
- * @returns {PxAnimatorAPI} A PxAnimatorAPI instance.
130
- */
131
- declare function createFrameLoopAnimator(doc: PxAnimatedSvgDocument, adapter?: PxPlatformAdapter, callbacks?: PxAnimatorCallbacksConfig, rootElement?: Element | null): PxAnimatorAPI;
132
-
133
- /**
134
- * Creates an animator instance that uses the native Web Animations API.
135
- *
136
- * This is the preferred, more performant animator. It will return null if the
137
- * animation configuration contains properties not supported by the browser's
138
- * Web Animations API implementation, unless forceEvenIfHasUnsupportedAttrs is true.
139
- *
140
- * @param callbacks Optional lifecycle callbacks.
141
- * @param rootElement Root element.
142
- * @param forceEvenIfHasUnsupportedAttrs If true, an animator will be created even if some CSS properties are not supported.
143
- * @returns An PxAnimatorAPI instance, or null if unsupported features are used and not forced.
144
- */
145
- /** Native scroll-timeline payload (`timeline.engine: 'native'` / `auto`; see PxScrollDriver.createNativeScrollTimeline): the
146
- * browser-native timeline every Animation attaches to, plus optional range offsets. */
147
- interface PxWebApiScrollTimeline {
148
- timeline: AnimationTimeline;
149
- rangeStart?: Record<string, unknown>;
150
- rangeEnd?: Record<string, unknown>;
151
- }
152
- declare function createWebApiAnimator(doc: PxAnimatedSvgDocument, callbacks?: PxAnimatorCallbacksConfig, rootElement?: Element | null, forceEvenIfHasUnsupportedAttrs?: boolean, scrollTimeline?: PxWebApiScrollTimeline): PxAnimatorAPI | null;
57
+ declare function renderNode(node: PxNode, defs?: PxDefs, diag?: PxDiagnostics): Element | null;
153
58
 
154
- export { PX_ANIMATOR_DATA_KEY, type PxAnimatorAPI, type PxAnimatorOptions, type PxBasicAnimatorAPI, createAnimator, createAnimatorImpl, createFrameLoopAnimator, createWebApiAnimator, loadTagAnimators, renderNode, setupAnimationTriggers };
59
+ export { PxAnimatorAPI, type PxPrerenderedOptions, renderNode, setupAnimationTriggers };
package/dist/index.d.ts CHANGED
@@ -1,92 +1,22 @@
1
- import { PxAnimatorAPI as PxAnimatorAPI$1, PxBasicAnimatorAPI as PxBasicAnimatorAPI$1, PxAnimatedSvgDocument, PxPlatformAdapter, PxAnimatorCallbacksConfig, PxAnimatorConfigPatch, PxTrigger, PxNode, PxDefs } from '@pixodesk/svg-animator-core';
2
- export { ApplyResult, COLOUR_ATTR_NAMES, ExtendPathOpts, ExtendedPath, FillMode, GlyphCharBox, GlyphCharBoxAlongPath, GlyphMaterialiseOpts, KeysMatch, MISSING_GLYPH_CLASS_NAME, MaterialiseAllOptions, MotionPathMaterialisationOptions, MotionPathSample, OutAction, PX_ANIM_ATTR_NAME, PX_ANIM_SRC_ATTR_NAME, PX_TRANSFORM_PART_KEYS, PathPoint, PathSampler, PlaybackDirection, PxAnimatable, PxAnimatedSvgDocument, PxAnimatedSvgDocumentSchema, PxAnimationDefinition, PxAnimationDefinitionSchema, PxAnimatorCallbacksConfig, PxAnimatorConfig, PxAnimatorConfigMergeResult, PxAnimatorConfigPatch, PxAnimatorConfigSchema, PxAnimatorConfigShortcuts, PxAnyKeyframe, PxAttrValue, PxAttrValueSchema, PxBezierPath, PxBezierPathSchema, PxBinding, PxBindingSchema, PxCloneEffect, PxCloneEffectSchema, PxCloneWithout, PxCreateElement, PxDefs, PxDefsSchema, PxEasingOrRefSchema, PxEffects, PxEffectsSchema, PxElementAnimation, PxElementAnimationSchema, PxFillGradientEffect, PxFillGradientEffectSchema, PxGlyph, PxGlyphFont, PxGradientSpreadMethod, PxGradientStop, PxGradientStopSchema, PxGradientType, PxGradientUnits, PxInfer, PxKeyframe, PxKeyframeSchema, PxKeyframeValueSchema, PxLoop, PxLoopDirection, PxLoopRepeatAt, PxLoopSchema, PxMaskedByEffect, PxMaskedByEffectSchema, PxNode, PxNodeBase, PxNodeSchema, PxNormalisedKeyframe, PxPlatformAdapter, PxPropertyAnimation, PxPropertyAnimationSchema, PxRepeaterEffect, PxRepeaterEffectSchema, PxRetimeEffect, PxRetimeEffectSchema, PxSchema, PxSchemaDesc, PxStrokeGradientEffect, PxStrokeGradientEffectSchema, PxStrokeTrimEffect, PxStrokeTrimEffectSchema, PxStrokeTrimSubPaths, PxSvgNode, PxSvgNodeExtra, PxTextEffectSchema, PxTextPathEffect, PxTextPathEffectSchema, PxTimelineEngine, PxTimelineEngineExtra, PxTransformByEffect, PxTransformByEffectSchema, PxTransformPartKey, PxTransformParts, PxTransformPartsSchema, PxTransformValue, PxTransformValueSchema, PxTrigger, PxTriggerSchema, PxValidationContext, PxValidationResult, RemoveIndex, STYLE_ATTR_NAMES, StartOn, TRANSFORM_FN_NAMES, Vec2, applyAnimatorConfig, applyPlayerEffects, calcAnimationValues, camelCaseToKebabWordIfNeeded, collectSampleTimes, createBasicFrameLoopAnimator, createPathSampler, describeSchema, diffInEffect, evaluateMotionPathSegment, extendedPathForBrowser, foldAnimatorConfigShortcuts, generateNewIds, getAnimatorConfig, getBindings, getChildren, getDefs, getNormalizedProps, isPxElementFileFormat, isPxElementFileFormatDeep, jsonElementFactory, layoutGlyphTextChars, materialiseAllInTree, materialiseAnimatedUseInstances, materialiseGlyphText, materialiseGlyphTextAlongPath, materialiseGlyphTextHorizontal, materialiseInternalLoopsInPropAnim, materialiseInternalLoopsInTree, materialiseMotionPathInPropAnim, materialiseMotionPathsInTree, mergeAnimatorConfig, getNormalisedBindings as normalizeDocument, propAnimIsMotionPath, px, schemaKeys, shiftAnimatable, toRGBA, validateDocument, validateNodeEffects, visualModelAt } from '@pixodesk/svg-animator-core';
1
+ import { P as PxAnimatorAPI } from './internal-BmFv1B6H.js';
2
+ export { a as PX_ANIMATOR_DOC_KEY, b as PxAnimatorOptions, c as PxBasicAnimatorAPI, d as PxInternalAnimatorOptions, e as PxTagAnimatorOptions, f as createAnimator, l as loadTagAnimators } from './internal-BmFv1B6H.js';
3
+ import { PxAnimatorCallbacks, PxAnimatedSvgDocument, PxTrigger, PxDiagnostics, PxNode, PxDefs } from '@pixodesk/svg-animator-core';
4
+ export { PxAnimatedSvgDocument, PxAnimatorCallbacks, PxAnimatorConfig, PxAnimatorConfigSchema, PxBinding, PxDefs, PxDefsSchema, PxDiagnostic, PxDiagnosticKind, PxDiagnostics, PxDiagnosticsConfig, PxEngineCallbacks, PxFillMode, PxInfer, PxNode, PxNodeBase, PxPlatformAdapter, PxPlaybackDirection, PxPlaybackOverrideProps, PxSchema, PxScrollSchema, PxStartOn, PxSvgNode, PxSvgNodeExtra, PxTimelineEngineExtra, PxTimelinePatch, PxTrigger, PxTriggerSchema, PxValidationContext, createBasicFrameLoopAnimator, generateNewIds, getNormalizedProps, px, validateDocument } from '@pixodesk/svg-animator-core';
3
5
 
4
6
  /**
5
- * DOM specialisations of the platform-neutral animator API types.
6
- * `getRootElement()` returns a DOM `Element` on the web — these aliases keep
7
- * the historical (pre-core-extraction) signatures for web consumers.
7
+ * Options accepted by the pre-rendered entry points — a subset of `PxAnimatorOptions`: the
8
+ * document and the callbacks INLINE under the same names every surface uses (review §9). No
9
+ * `adapter`: a pre-rendered SVG is by definition already in the DOM (review §25.14).
10
+ * @public
8
11
  */
9
- type PxBasicAnimatorAPI = PxBasicAnimatorAPI$1<Element>;
10
- type PxAnimatorAPI = PxAnimatorAPI$1<Element>;
11
-
12
- /**
13
- * Wire keys shared by every entry point.
14
- *
15
- * These live here rather than in `PxAnimator.ts` on purpose: that module ends with a
16
- * top-level `if (typeof window !== 'undefined')` block that publishes `createAnimator` /
17
- * `loadTagAnimators` as globals. A module-level side effect cannot be tree-shaken, so
18
- * importing ANY symbol from `PxAnimator.ts` pulls the entire full player in with it —
19
- * which silently made the pre-rendered builds the same size as the full one until this
20
- * constant was moved out. See PRERENDERED-PLAYER-BUILDS.md.
21
- */
22
- /** Key under which `createAnimator` options carry an inline animation document. */
23
- declare const PX_ANIMATOR_DATA_KEY = "data";
24
-
25
- /**
26
- * Creates an animator instance from an AnimatedSvgDocument.
27
- *
28
- * This function serves as the main entry point for the animation library. It automatically
29
- * chooses the best animation engine available ('waapi' or 'frames') or can be
30
- * forced to use a specific one.
31
- *
32
- * @param doc The animated SVG document.
33
- * @param callbacks Optional object with callback functions for animation lifecycle events (play, pause, finish, etc.).
34
- * @param containerElement Optional selector or element to render the SVG into.
35
- * @returns An PxAnimatorAPI instance to programmatically control the animation.
36
- */
37
- declare function createAnimatorImpl(doc: PxAnimatedSvgDocument, adapter?: PxPlatformAdapter, callbacks?: PxAnimatorCallbacksConfig, containerElement?: string | Element, config?: PxAnimatorConfigPatch, resetDocDefaults?: boolean): PxAnimatorAPI;
38
-
39
- interface PxAnimatorOptions {
40
- /** URL to fetch the animation document from. Provide either this or `data`, not both. */
41
- src?: string;
42
- /** Inline animation document object. Provide either this or `src`, not both. */
43
- data?: PxAnimatedSvgDocument;
44
- /** Platform adapter for frame-loop rendering. */
45
- adapter?: PxPlatformAdapter;
46
- /** Callback functions for animation lifecycle events. */
47
- callbacks?: PxAnimatorCallbacksConfig;
48
- /** CSS selector or element to render the SVG into. */
49
- container?: string | Element;
12
+ interface PxPrerenderedOptions extends PxAnimatorCallbacks {
50
13
  /**
51
- * Per-instance override of the document's `animator` config — the same shape as
52
- * `animator` in SCHEMA.md, deep-merged over what the document says, so one file can play
53
- * twice on a page with different timing. `null` at any slot DELETES that key, which is
54
- * how you restore a default that absence means.
55
- *
56
- * Also accepts a JSON STRING of the same object. Strings are immune to property mangling,
57
- * so that form survives a build that renames object keys (see docs/library/minification.md).
14
+ * The animation document. For a pre-rendered SVG this carries `animator.definitions`
15
+ * and `animator.bindings` only — no `children`, because the elements are already
16
+ * in the DOM.
58
17
  */
59
- config?: PxAnimatorConfigPatch | string;
60
- /**
61
- * Ignore the document's own playback settings and start from the player's defaults, with
62
- * `config` applied on top. The lookup tables (`definitions`, `animateById`) are kept
63
- * either way — resetting those would leave the animation with nothing to animate.
64
- */
65
- resetDocDefaults?: boolean;
66
- /** Shortcut for `config.timeline.duration` (ms). Wins over the same key inside `config`. */
67
- duration?: number;
68
- /** Shortcut for `config.timeline.delay` (ms). */
69
- delay?: number;
70
- /** Shortcut for `config.timeline.iterations`. */
71
- iterations?: number | 'infinite';
72
- /** Shortcut for `config.timeline.trigger.startOn`. Typed from the WIRE, so it includes
73
- * `'programmatic'` — the value that says "nothing starts this but a `play()` call". */
74
- startOn?: PxTrigger['startOn'];
18
+ doc: PxAnimatedSvgDocument;
75
19
  }
76
- /**
77
- * Creates an animator instance to control SVG animations.
78
- *
79
- * @param options.src URL to fetch the animation document from.
80
- * @param options.data Inline animation document object.
81
- * @param options.container CSS selector or element to render the SVG into.
82
- * @returns A PxAnimatorAPI instance to programmatically control the animation.
83
- */
84
- declare function createAnimator(options: PxAnimatorOptions): PxAnimatorAPI;
85
- /**
86
- * Scan and load for tags, e.g.
87
- * <div data-px-animation-src="animation.json"></div>
88
- */
89
- declare function loadTagAnimators(): void;
90
20
 
91
21
  /**
92
22
  * Sets up event-based triggers for an animation.
@@ -96,7 +26,7 @@ declare function loadTagAnimators(): void;
96
26
  * or visibility changes.
97
27
  *
98
28
  * ### Trigger Options (startOn):
99
- * - 'load': Starts after the page loads.
29
+ * - 'load' (default): Starts after the page loads.
100
30
  * - 'mouseOver': Starts on mouse enter.
101
31
  * - 'click': Toggles play/end action on click.
102
32
  * - 'scrollIntoView': Starts when the element scrolls into the viewport.
@@ -104,51 +34,26 @@ declare function loadTagAnimators(): void;
104
34
  *
105
35
  * ### End Action Options (outAction):
106
36
  * Defines behavior when the trigger condition ends (e.g., mouse leave).
107
- * - 'continue': Animation continues playing.
37
+ * - 'continue' (default): Animation continues playing.
108
38
  * - 'pause': Pauses the animation.
109
39
  * - 'reset': Cancels the animation, resetting it to the start.
110
40
  * - 'reverse': Reverses the animation playback.
111
41
  *
112
42
  * @param {!PxAnimatorAPI} api The animator API instance to control.
113
- * @param {!PxTrigger} config The trigger configuration object.
114
- * @returns {!PxAnimatorAPI} The same animator API instance, for chaining.
43
+ * @param {!PxTrigger} config The trigger configuration object. Only `startOn`, `outAction` and
44
+ * `scrollIntoViewThreshold` are read here; `finishAction` belongs to the PLAYER (what happens
45
+ * after a natural end), not to the trigger wiring.
46
+ * @returns A disposer that detaches every listener and observer this call attached (review §14).
47
+ * `createAnimator` ties it to `destroy()`. Call it yourself before re-arming an element you
48
+ * wired by hand — otherwise the old listeners stay live next to the new ones.
49
+ * @public
115
50
  */
116
- declare function setupAnimationTriggers(api: PxAnimatorAPI, config: PxTrigger): PxAnimatorAPI;
51
+ declare function setupAnimationTriggers(api: PxAnimatorAPI, config: PxTrigger, diag?: PxDiagnostics): () => void;
117
52
 
118
53
  /**
119
54
  * Renders a PxNode tree to DOM elements.
55
+ * @public @advanced
120
56
  */
121
- declare function renderNode(node: PxNode, defs?: PxDefs): Element | null;
122
-
123
- /**
124
- * Creates an animator instance that uses a requestAnimationFrame loop for animations.
125
- * This is the browser DOM-specific version.
126
- *
127
- * @param {PxAnimatorCallbacksConfig=} callbacks Optional lifecycle callbacks.
128
- * @param {Element=} rootElement Optional pre-rendered root element.
129
- * @returns {PxAnimatorAPI} A PxAnimatorAPI instance.
130
- */
131
- declare function createFrameLoopAnimator(doc: PxAnimatedSvgDocument, adapter?: PxPlatformAdapter, callbacks?: PxAnimatorCallbacksConfig, rootElement?: Element | null): PxAnimatorAPI;
132
-
133
- /**
134
- * Creates an animator instance that uses the native Web Animations API.
135
- *
136
- * This is the preferred, more performant animator. It will return null if the
137
- * animation configuration contains properties not supported by the browser's
138
- * Web Animations API implementation, unless forceEvenIfHasUnsupportedAttrs is true.
139
- *
140
- * @param callbacks Optional lifecycle callbacks.
141
- * @param rootElement Root element.
142
- * @param forceEvenIfHasUnsupportedAttrs If true, an animator will be created even if some CSS properties are not supported.
143
- * @returns An PxAnimatorAPI instance, or null if unsupported features are used and not forced.
144
- */
145
- /** Native scroll-timeline payload (`timeline.engine: 'native'` / `auto`; see PxScrollDriver.createNativeScrollTimeline): the
146
- * browser-native timeline every Animation attaches to, plus optional range offsets. */
147
- interface PxWebApiScrollTimeline {
148
- timeline: AnimationTimeline;
149
- rangeStart?: Record<string, unknown>;
150
- rangeEnd?: Record<string, unknown>;
151
- }
152
- declare function createWebApiAnimator(doc: PxAnimatedSvgDocument, callbacks?: PxAnimatorCallbacksConfig, rootElement?: Element | null, forceEvenIfHasUnsupportedAttrs?: boolean, scrollTimeline?: PxWebApiScrollTimeline): PxAnimatorAPI | null;
57
+ declare function renderNode(node: PxNode, defs?: PxDefs, diag?: PxDiagnostics): Element | null;
153
58
 
154
- export { PX_ANIMATOR_DATA_KEY, type PxAnimatorAPI, type PxAnimatorOptions, type PxBasicAnimatorAPI, createAnimator, createAnimatorImpl, createFrameLoopAnimator, createWebApiAnimator, loadTagAnimators, renderNode, setupAnimationTriggers };
59
+ export { PxAnimatorAPI, type PxPrerenderedOptions, renderNode, setupAnimationTriggers };