@pixodesk/svg-animator-web 1.0.30 → 1.0.35

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,5 +1,5 @@
1
- import { PxAnimatorAPI as PxAnimatorAPI$1, PxBasicAnimatorAPI as PxBasicAnimatorAPI$1, PxAnimatedSvgDocument, PxPlatformAdapter, PxAnimatorCallbacksConfig, PxTrigger, PxNode, PxDefs } from '@pixodesk/svg-animator-core';
2
- export { ApplyResult, COLOUR_ATTR_NAMES, ExtendPathOpts, ExtendedPath, FillMode, GlyphCharBox, GlyphCharBoxAlongPath, GlyphMaterialiseOpts, JsMode, 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, PxAnimatorConfigSchema, PxAnimatorEngine, PxAnimatorMode, PxAttrValue, PxAttrValueSchema, PxBezierPath, PxBezierPathSchema, PxBinding, PxBindingSchema, PxCloneEffect, PxCloneEffectSchema, PxCreateElement, PxDefs, PxDefsSchema, PxEasingOrRefSchema, PxEffects, PxEffectsSchema, PxElementAnimation, PxElementAnimationSchema, PxFillGradientEffect, PxFillGradientEffectSchema, PxGlyph, PxGlyphFont, PxGradientSpreadMethod, PxGradientStop, PxGradientStopSchema, PxGradientType, PxGradientUnits, PxInfer, PxKeyframe, PxKeyframeSchema, PxKeyframeValueSchema, PxLoop, PxLoopSchema, PxMaskedByEffect, PxMaskedByEffectSchema, PxNode, PxNodeBase, PxNodeSchema, PxPlatformAdapter, PxPropertyAnimation, PxPropertyAnimationSchema, PxRepeaterEffect, PxRepeaterEffectSchema, PxRetimeEffect, PxRetimeEffectSchema, PxSchema, PxSchemaDesc, PxStrokeGradientEffect, PxStrokeGradientEffectSchema, PxStrokeTrimEffect, PxStrokeTrimEffectSchema, PxSvgNode, PxSvgNodeExtra, PxTextEffectSchema, PxTextPathEffect, PxTextPathEffectSchema, PxTransformByEffect, PxTransformByEffectSchema, PxTransformPartKey, PxTransformParts, PxTransformPartsSchema, PxTransformValue, PxTransformValueSchema, PxTrigger, PxTriggerSchema, PxValidationContext, PxValidationResult, RemoveIndex, STYLE_ATTR_NAMES, StartOn, TRANSFORM_FN_NAMES, Vec2, applyPlayerEffects, calcAnimationValues, camelCaseToKebabWordIfNeeded, collectSampleTimes, createBasicFrameLoopAnimator, createPathSampler, describeSchema, diffInEffect, evaluateMotionPathSegment, extendedPathForBrowser, generateNewIds, getAnimatorConfig, getBindings, getChildren, getDefs, getNormalizedProps, isPxElementFileFormat, isPxElementFileFormatDeep, jsonElementFactory, layoutGlyphTextChars, materialiseAllInTree, materialiseAnimatedUseInstances, materialiseGlyphText, materialiseGlyphTextAlongPath, materialiseGlyphTextHorizontal, materialiseInternalLoopsInPropAnim, materialiseInternalLoopsInTree, materialiseMotionPathInPropAnim, materialiseMotionPathsInTree, getNormalisedBindings as normalizeDocument, propAnimIsMotionPath, px, schemaKeys, shiftAnimatable, toRGBA, validateNodeEffects, visualModelAt } from '@pixodesk/svg-animator-core';
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';
3
3
 
4
4
  /**
5
5
  * DOM specialisations of the platform-neutral animator API types.
@@ -34,7 +34,7 @@ declare const PX_ANIMATOR_DATA_KEY = "data";
34
34
  * @param containerElement Optional selector or element to render the SVG into.
35
35
  * @returns An PxAnimatorAPI instance to programmatically control the animation.
36
36
  */
37
- declare function createAnimatorImpl(doc: PxAnimatedSvgDocument, adapter?: PxPlatformAdapter, callbacks?: PxAnimatorCallbacksConfig, containerElement?: string | Element): PxAnimatorAPI;
37
+ declare function createAnimatorImpl(doc: PxAnimatedSvgDocument, adapter?: PxPlatformAdapter, callbacks?: PxAnimatorCallbacksConfig, containerElement?: string | Element, config?: PxAnimatorConfigPatch, resetDocDefaults?: boolean): PxAnimatorAPI;
38
38
 
39
39
  interface PxAnimatorOptions {
40
40
  /** URL to fetch the animation document from. Provide either this or `data`, not both. */
@@ -47,6 +47,31 @@ interface PxAnimatorOptions {
47
47
  callbacks?: PxAnimatorCallbacksConfig;
48
48
  /** CSS selector or element to render the SVG into. */
49
49
  container?: string | Element;
50
+ /**
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).
58
+ */
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'];
50
75
  }
51
76
  /**
52
77
  * Creates an animator instance to control SVG animations.
@@ -117,7 +142,7 @@ declare function createFrameLoopAnimator(doc: PxAnimatedSvgDocument, adapter?: P
117
142
  * @param forceEvenIfHasUnsupportedAttrs If true, an animator will be created even if some CSS properties are not supported.
118
143
  * @returns An PxAnimatorAPI instance, or null if unsupported features are used and not forced.
119
144
  */
120
- /** `driver: 'native'` payload (see PxScrollDriver.createNativeScrollTimeline): the
145
+ /** Native scroll-timeline payload (`timeline.engine: 'native'` / `auto`; see PxScrollDriver.createNativeScrollTimeline): the
121
146
  * browser-native timeline every Animation attaches to, plus optional range offsets. */
122
147
  interface PxWebApiScrollTimeline {
123
148
  timeline: AnimationTimeline;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { PxAnimatorAPI as PxAnimatorAPI$1, PxBasicAnimatorAPI as PxBasicAnimatorAPI$1, PxAnimatedSvgDocument, PxPlatformAdapter, PxAnimatorCallbacksConfig, PxTrigger, PxNode, PxDefs } from '@pixodesk/svg-animator-core';
2
- export { ApplyResult, COLOUR_ATTR_NAMES, ExtendPathOpts, ExtendedPath, FillMode, GlyphCharBox, GlyphCharBoxAlongPath, GlyphMaterialiseOpts, JsMode, 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, PxAnimatorConfigSchema, PxAnimatorEngine, PxAnimatorMode, PxAttrValue, PxAttrValueSchema, PxBezierPath, PxBezierPathSchema, PxBinding, PxBindingSchema, PxCloneEffect, PxCloneEffectSchema, PxCreateElement, PxDefs, PxDefsSchema, PxEasingOrRefSchema, PxEffects, PxEffectsSchema, PxElementAnimation, PxElementAnimationSchema, PxFillGradientEffect, PxFillGradientEffectSchema, PxGlyph, PxGlyphFont, PxGradientSpreadMethod, PxGradientStop, PxGradientStopSchema, PxGradientType, PxGradientUnits, PxInfer, PxKeyframe, PxKeyframeSchema, PxKeyframeValueSchema, PxLoop, PxLoopSchema, PxMaskedByEffect, PxMaskedByEffectSchema, PxNode, PxNodeBase, PxNodeSchema, PxPlatformAdapter, PxPropertyAnimation, PxPropertyAnimationSchema, PxRepeaterEffect, PxRepeaterEffectSchema, PxRetimeEffect, PxRetimeEffectSchema, PxSchema, PxSchemaDesc, PxStrokeGradientEffect, PxStrokeGradientEffectSchema, PxStrokeTrimEffect, PxStrokeTrimEffectSchema, PxSvgNode, PxSvgNodeExtra, PxTextEffectSchema, PxTextPathEffect, PxTextPathEffectSchema, PxTransformByEffect, PxTransformByEffectSchema, PxTransformPartKey, PxTransformParts, PxTransformPartsSchema, PxTransformValue, PxTransformValueSchema, PxTrigger, PxTriggerSchema, PxValidationContext, PxValidationResult, RemoveIndex, STYLE_ATTR_NAMES, StartOn, TRANSFORM_FN_NAMES, Vec2, applyPlayerEffects, calcAnimationValues, camelCaseToKebabWordIfNeeded, collectSampleTimes, createBasicFrameLoopAnimator, createPathSampler, describeSchema, diffInEffect, evaluateMotionPathSegment, extendedPathForBrowser, generateNewIds, getAnimatorConfig, getBindings, getChildren, getDefs, getNormalizedProps, isPxElementFileFormat, isPxElementFileFormatDeep, jsonElementFactory, layoutGlyphTextChars, materialiseAllInTree, materialiseAnimatedUseInstances, materialiseGlyphText, materialiseGlyphTextAlongPath, materialiseGlyphTextHorizontal, materialiseInternalLoopsInPropAnim, materialiseInternalLoopsInTree, materialiseMotionPathInPropAnim, materialiseMotionPathsInTree, getNormalisedBindings as normalizeDocument, propAnimIsMotionPath, px, schemaKeys, shiftAnimatable, toRGBA, validateNodeEffects, visualModelAt } from '@pixodesk/svg-animator-core';
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';
3
3
 
4
4
  /**
5
5
  * DOM specialisations of the platform-neutral animator API types.
@@ -34,7 +34,7 @@ declare const PX_ANIMATOR_DATA_KEY = "data";
34
34
  * @param containerElement Optional selector or element to render the SVG into.
35
35
  * @returns An PxAnimatorAPI instance to programmatically control the animation.
36
36
  */
37
- declare function createAnimatorImpl(doc: PxAnimatedSvgDocument, adapter?: PxPlatformAdapter, callbacks?: PxAnimatorCallbacksConfig, containerElement?: string | Element): PxAnimatorAPI;
37
+ declare function createAnimatorImpl(doc: PxAnimatedSvgDocument, adapter?: PxPlatformAdapter, callbacks?: PxAnimatorCallbacksConfig, containerElement?: string | Element, config?: PxAnimatorConfigPatch, resetDocDefaults?: boolean): PxAnimatorAPI;
38
38
 
39
39
  interface PxAnimatorOptions {
40
40
  /** URL to fetch the animation document from. Provide either this or `data`, not both. */
@@ -47,6 +47,31 @@ interface PxAnimatorOptions {
47
47
  callbacks?: PxAnimatorCallbacksConfig;
48
48
  /** CSS selector or element to render the SVG into. */
49
49
  container?: string | Element;
50
+ /**
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).
58
+ */
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'];
50
75
  }
51
76
  /**
52
77
  * Creates an animator instance to control SVG animations.
@@ -117,7 +142,7 @@ declare function createFrameLoopAnimator(doc: PxAnimatedSvgDocument, adapter?: P
117
142
  * @param forceEvenIfHasUnsupportedAttrs If true, an animator will be created even if some CSS properties are not supported.
118
143
  * @returns An PxAnimatorAPI instance, or null if unsupported features are used and not forced.
119
144
  */
120
- /** `driver: 'native'` payload (see PxScrollDriver.createNativeScrollTimeline): the
145
+ /** Native scroll-timeline payload (`timeline.engine: 'native'` / `auto`; see PxScrollDriver.createNativeScrollTimeline): the
121
146
  * browser-native timeline every Animation attaches to, plus optional range offsets. */
122
147
  interface PxWebApiScrollTimeline {
123
148
  timeline: AnimationTimeline;