@pixodesk/svg-animator-core 1.0.28 → 1.0.29
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 +66 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.js +65 -10
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.js +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1317,6 +1317,7 @@ declare const PxScrollSchema: PxSchema<{} & {
|
|
|
1317
1317
|
subject?: string | undefined;
|
|
1318
1318
|
smoothing?: number | undefined;
|
|
1319
1319
|
pin?: boolean | undefined;
|
|
1320
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
1320
1321
|
pinTop?: number | undefined;
|
|
1321
1322
|
pinDistance?: number | undefined;
|
|
1322
1323
|
range?: ({} & {
|
|
@@ -1338,6 +1339,7 @@ declare const PxScrollSchema: PxSchema<{} & {
|
|
|
1338
1339
|
subject: PxSchema<string | undefined, true>;
|
|
1339
1340
|
smoothing: PxSchema<number | undefined, true>;
|
|
1340
1341
|
pin: PxSchema<boolean | undefined, true>;
|
|
1342
|
+
pinAlign: PxSchema<"top" | "center" | "bottom" | undefined, true>;
|
|
1341
1343
|
pinTop: PxSchema<number | undefined, true>;
|
|
1342
1344
|
pinDistance: PxSchema<number | undefined, true>;
|
|
1343
1345
|
range: PxSchema<({} & {
|
|
@@ -1644,6 +1646,7 @@ declare const PxAnimatorConfigSchema: PxSchema<{} & {
|
|
|
1644
1646
|
subject?: string | undefined;
|
|
1645
1647
|
smoothing?: number | undefined;
|
|
1646
1648
|
pin?: boolean | undefined;
|
|
1649
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
1647
1650
|
pinTop?: number | undefined;
|
|
1648
1651
|
pinDistance?: number | undefined;
|
|
1649
1652
|
range?: ({} & {
|
|
@@ -1950,6 +1953,7 @@ declare const PxAnimatorConfigSchema: PxSchema<{} & {
|
|
|
1950
1953
|
subject?: string | undefined;
|
|
1951
1954
|
smoothing?: number | undefined;
|
|
1952
1955
|
pin?: boolean | undefined;
|
|
1956
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
1953
1957
|
pinTop?: number | undefined;
|
|
1954
1958
|
pinDistance?: number | undefined;
|
|
1955
1959
|
range?: ({} & {
|
|
@@ -17783,6 +17787,7 @@ declare const PxSvgNodeExtra: PxSchema<{} & {
|
|
|
17783
17787
|
subject?: string | undefined;
|
|
17784
17788
|
smoothing?: number | undefined;
|
|
17785
17789
|
pin?: boolean | undefined;
|
|
17790
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
17786
17791
|
pinTop?: number | undefined;
|
|
17787
17792
|
pinDistance?: number | undefined;
|
|
17788
17793
|
range?: ({} & {
|
|
@@ -18094,6 +18099,7 @@ declare const PxSvgNodeExtra: PxSchema<{} & {
|
|
|
18094
18099
|
subject?: string | undefined;
|
|
18095
18100
|
smoothing?: number | undefined;
|
|
18096
18101
|
pin?: boolean | undefined;
|
|
18102
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
18097
18103
|
pinTop?: number | undefined;
|
|
18098
18104
|
pinDistance?: number | undefined;
|
|
18099
18105
|
range?: ({} & {
|
|
@@ -18424,6 +18430,7 @@ declare const PxAnimatedSvgDocumentSchema: PxSchema<{
|
|
|
18424
18430
|
subject?: string | undefined;
|
|
18425
18431
|
smoothing?: number | undefined;
|
|
18426
18432
|
pin?: boolean | undefined;
|
|
18433
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
18427
18434
|
pinTop?: number | undefined;
|
|
18428
18435
|
pinDistance?: number | undefined;
|
|
18429
18436
|
range?: ({} & {
|
|
@@ -21414,6 +21421,7 @@ declare const PxAnimatedSvgDocumentSchema: PxSchema<{
|
|
|
21414
21421
|
subject?: string | undefined;
|
|
21415
21422
|
smoothing?: number | undefined;
|
|
21416
21423
|
pin?: boolean | undefined;
|
|
21424
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
21417
21425
|
pinTop?: number | undefined;
|
|
21418
21426
|
pinDistance?: number | undefined;
|
|
21419
21427
|
range?: ({} & {
|
|
@@ -24608,6 +24616,14 @@ interface GlyphMaterialiseOpts<E = any> {
|
|
|
24608
24616
|
/** Optional diagnostics sink. */
|
|
24609
24617
|
warnings?: Array<string>;
|
|
24610
24618
|
}
|
|
24619
|
+
/**
|
|
24620
|
+
* Class stamped on the `<path>` holding the □ placeholders — and ONLY on it: the missing
|
|
24621
|
+
* boxes are emitted separately from the real glyphs so a consumer can style them on their
|
|
24622
|
+
* own. The editor uses it to fade them in with a delay: a freshly typed character is
|
|
24623
|
+
* missing for a few frames until its glyph is fetched asynchronously, and a □ that flashes
|
|
24624
|
+
* for that long reads as a rendering glitch.
|
|
24625
|
+
*/
|
|
24626
|
+
declare const MISSING_GLYPH_CLASS_NAME = "px-missing-glyph";
|
|
24611
24627
|
declare function materialiseGlyphTextHorizontal<E = any>(node: PxNode, opts: GlyphMaterialiseOpts<E>): E;
|
|
24612
24628
|
/** Per-CHARACTER advance box (local, pre-transform coords). `x,y` = the char's baseline start,
|
|
24613
24629
|
* `width` = its advance, `ascent`/`fontSize` size its bbox. */
|
|
@@ -24738,4 +24754,4 @@ interface EffectDiff {
|
|
|
24738
24754
|
*/
|
|
24739
24755
|
declare function diffInEffect(a: VmNode, b: VmNode): Array<EffectDiff>;
|
|
24740
24756
|
|
|
24741
|
-
export { type ApplyResult, COLOUR_ATTR_NAMES, CSS_ONLY_STYLE_PROPS, DEFAULT_DURATION_MS, DISALLOWED_SVG_TAGS_LOWER, type ExtendPathOpts, type ExtendedPath, type FillMode, type GlyphCharBox, type GlyphCharBoxAlongPath, type GlyphMaterialiseOpts, INTERNAL_ATTRS, type JsMode, type KeysMatch, LOOP_JUMP_SHIFT_MS, type MaterialiseAllOptions, type MotionPathMaterialisationOptions, type MotionPathSample, type OutAction, PCT_BASED_ATTR_NAMES, PX_ANIM_ATTR_NAME, PX_ANIM_SRC_ATTR_NAME, PX_TRANSFORM_PART_KEYS, type PathPoint, type PathSampler, type PlaybackDirection, type PxAnimatable, type PxAnimatedSvgDocument, PxAnimatedSvgDocumentSchema, type PxAnimationDefinition, PxAnimationDefinitionSchema, type PxAnimatorAPI, type PxAnimatorCallbacksConfig, type PxAnimatorConfig, PxAnimatorConfigSchema, PxAnimatorEngine, PxAnimatorMode, type PxAttrValue, PxAttrValueSchema, type PxBasicAnimatorAPI, type PxBezierPath, PxBezierPathSchema, type PxBinding, PxBindingSchema, type PxCloneEffect, PxCloneEffectSchema, type PxCreateElement, type PxDefs, PxDefsSchema, PxEasingOrRefSchema, type PxEffects, PxEffectsSchema, type PxElementAnimation, PxElementAnimationSchema, type PxFillGradientEffect, PxFillGradientEffectSchema, type PxGlyph, type PxGlyphFont, PxGradientSpreadMethod, type PxGradientStop, PxGradientStopSchema, PxGradientType, PxGradientUnits, type PxInfer, type PxKeyframe, PxKeyframeSchema, PxKeyframeValueSchema, type PxLoop, PxLoopExtend, PxLoopSchema, type PxMaskedByEffect, PxMaskedByEffectSchema, type PxNode, PxNodeBase, PxNodeSchema, type PxPlatformAdapter, type PxPropertyAnimation, PxPropertyAnimationSchema, type PxRepeaterEffect, PxRepeaterEffectSchema, type PxRetimeEffect, PxRetimeEffectSchema, type PxSchema, type PxSchemaDesc, type PxScroll, type PxScrollPhase, type PxScrollRangePoint, PxScrollRangePointSchema, PxScrollRangeSchema, PxScrollSchema, type PxStrokeGradientEffect, PxStrokeGradientEffectSchema, type PxSvgNode, PxSvgNodeExtra, PxTextEffectSchema, type PxTextPathEffect, PxTextPathEffectSchema, type PxTransformByEffect, PxTransformByEffectSchema, type PxTransformPartKey, type PxTransformParts, PxTransformPartsSchema, type PxTransformValue, PxTransformValueSchema, type PxTrigger, PxTriggerSchema, type PxTrimPathEffect, PxTrimPathEffectSchema, PxTrimSubPaths, type PxValidationContext, type PxValidationResult, type RemoveIndex, STYLE_ATTR_NAMES, type StartOn, TEXT_ATTR, TEXT_CONTENT_ATTR, TRANSFORM_FN_NAMES, type Vec2, applyPlayerEffects, bezierToSvgPath, calcAnimationValues, camelCaseToKebabWordIfNeeded, clamp, collectSampleTimes, composeTransformParts, createBasicFrameLoopAnimator, createPathSampler, cubicBezier, deepClone, describeSchema, diffInEffect, evaluateMotionPathSegment, extendedPathForBrowser, generateNewIds, generateUniqueId, getAnimatorConfig, getBindings, getChildren, getDefs, getNormalisedBindings, getNormalizedProps, interpolateBeziers, interpolateValue, isPxElementFileFormat, isPxElementFileFormatDeep, isScrollTimeline, jsonElementFactory, kebabToCamelCaseWord, layoutGlyphTextChars, materialiseAllInTree, materialiseAnimatedUseInstances, materialiseGlyphText, materialiseGlyphTextAlongPath, materialiseGlyphTextHorizontal, materialiseInternalLoopsInPropAnim, materialiseInternalLoopsInTree, materialiseMotionPathInPropAnim, materialiseMotionPathsInTree, propAnimIsMotionPath, px, resolveStyle, reverseEasing, sanitiseAttributeValue, schemaKeys, scrollOffsetProgress, scrollPhaseInterval, scrollResolveAxis, scrollTotalDurationMs, scrollViewProgress, shiftAnimatable, splitEasing, subdivideCubicBezier, toRGBA, validateNodeEffects, visualModelAt };
|
|
24757
|
+
export { type ApplyResult, COLOUR_ATTR_NAMES, CSS_ONLY_STYLE_PROPS, DEFAULT_DURATION_MS, DISALLOWED_SVG_TAGS_LOWER, type ExtendPathOpts, type ExtendedPath, type FillMode, type GlyphCharBox, type GlyphCharBoxAlongPath, type GlyphMaterialiseOpts, INTERNAL_ATTRS, type JsMode, type KeysMatch, LOOP_JUMP_SHIFT_MS, MISSING_GLYPH_CLASS_NAME, type MaterialiseAllOptions, type MotionPathMaterialisationOptions, type MotionPathSample, type OutAction, PCT_BASED_ATTR_NAMES, PX_ANIM_ATTR_NAME, PX_ANIM_SRC_ATTR_NAME, PX_TRANSFORM_PART_KEYS, type PathPoint, type PathSampler, type PlaybackDirection, type PxAnimatable, type PxAnimatedSvgDocument, PxAnimatedSvgDocumentSchema, type PxAnimationDefinition, PxAnimationDefinitionSchema, type PxAnimatorAPI, type PxAnimatorCallbacksConfig, type PxAnimatorConfig, PxAnimatorConfigSchema, PxAnimatorEngine, PxAnimatorMode, type PxAttrValue, PxAttrValueSchema, type PxBasicAnimatorAPI, type PxBezierPath, PxBezierPathSchema, type PxBinding, PxBindingSchema, type PxCloneEffect, PxCloneEffectSchema, type PxCreateElement, type PxDefs, PxDefsSchema, PxEasingOrRefSchema, type PxEffects, PxEffectsSchema, type PxElementAnimation, PxElementAnimationSchema, type PxFillGradientEffect, PxFillGradientEffectSchema, type PxGlyph, type PxGlyphFont, PxGradientSpreadMethod, type PxGradientStop, PxGradientStopSchema, PxGradientType, PxGradientUnits, type PxInfer, type PxKeyframe, PxKeyframeSchema, PxKeyframeValueSchema, type PxLoop, PxLoopExtend, PxLoopSchema, type PxMaskedByEffect, PxMaskedByEffectSchema, type PxNode, PxNodeBase, PxNodeSchema, type PxPlatformAdapter, type PxPropertyAnimation, PxPropertyAnimationSchema, type PxRepeaterEffect, PxRepeaterEffectSchema, type PxRetimeEffect, PxRetimeEffectSchema, type PxSchema, type PxSchemaDesc, type PxScroll, type PxScrollPhase, type PxScrollRangePoint, PxScrollRangePointSchema, PxScrollRangeSchema, PxScrollSchema, type PxStrokeGradientEffect, PxStrokeGradientEffectSchema, type PxSvgNode, PxSvgNodeExtra, PxTextEffectSchema, type PxTextPathEffect, PxTextPathEffectSchema, type PxTransformByEffect, PxTransformByEffectSchema, type PxTransformPartKey, type PxTransformParts, PxTransformPartsSchema, type PxTransformValue, PxTransformValueSchema, type PxTrigger, PxTriggerSchema, type PxTrimPathEffect, PxTrimPathEffectSchema, PxTrimSubPaths, type PxValidationContext, type PxValidationResult, type RemoveIndex, STYLE_ATTR_NAMES, type StartOn, TEXT_ATTR, TEXT_CONTENT_ATTR, TRANSFORM_FN_NAMES, type Vec2, applyPlayerEffects, bezierToSvgPath, calcAnimationValues, camelCaseToKebabWordIfNeeded, clamp, collectSampleTimes, composeTransformParts, createBasicFrameLoopAnimator, createPathSampler, cubicBezier, deepClone, describeSchema, diffInEffect, evaluateMotionPathSegment, extendedPathForBrowser, generateNewIds, generateUniqueId, getAnimatorConfig, getBindings, getChildren, getDefs, getNormalisedBindings, getNormalizedProps, interpolateBeziers, interpolateValue, isPxElementFileFormat, isPxElementFileFormatDeep, isScrollTimeline, jsonElementFactory, kebabToCamelCaseWord, layoutGlyphTextChars, materialiseAllInTree, materialiseAnimatedUseInstances, materialiseGlyphText, materialiseGlyphTextAlongPath, materialiseGlyphTextHorizontal, materialiseInternalLoopsInPropAnim, materialiseInternalLoopsInTree, materialiseMotionPathInPropAnim, materialiseMotionPathsInTree, propAnimIsMotionPath, px, resolveStyle, reverseEasing, sanitiseAttributeValue, schemaKeys, scrollOffsetProgress, scrollPhaseInterval, scrollResolveAxis, scrollTotalDurationMs, scrollViewProgress, shiftAnimatable, splitEasing, subdivideCubicBezier, toRGBA, validateNodeEffects, visualModelAt };
|
package/dist/index.d.ts
CHANGED
|
@@ -1317,6 +1317,7 @@ declare const PxScrollSchema: PxSchema<{} & {
|
|
|
1317
1317
|
subject?: string | undefined;
|
|
1318
1318
|
smoothing?: number | undefined;
|
|
1319
1319
|
pin?: boolean | undefined;
|
|
1320
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
1320
1321
|
pinTop?: number | undefined;
|
|
1321
1322
|
pinDistance?: number | undefined;
|
|
1322
1323
|
range?: ({} & {
|
|
@@ -1338,6 +1339,7 @@ declare const PxScrollSchema: PxSchema<{} & {
|
|
|
1338
1339
|
subject: PxSchema<string | undefined, true>;
|
|
1339
1340
|
smoothing: PxSchema<number | undefined, true>;
|
|
1340
1341
|
pin: PxSchema<boolean | undefined, true>;
|
|
1342
|
+
pinAlign: PxSchema<"top" | "center" | "bottom" | undefined, true>;
|
|
1341
1343
|
pinTop: PxSchema<number | undefined, true>;
|
|
1342
1344
|
pinDistance: PxSchema<number | undefined, true>;
|
|
1343
1345
|
range: PxSchema<({} & {
|
|
@@ -1644,6 +1646,7 @@ declare const PxAnimatorConfigSchema: PxSchema<{} & {
|
|
|
1644
1646
|
subject?: string | undefined;
|
|
1645
1647
|
smoothing?: number | undefined;
|
|
1646
1648
|
pin?: boolean | undefined;
|
|
1649
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
1647
1650
|
pinTop?: number | undefined;
|
|
1648
1651
|
pinDistance?: number | undefined;
|
|
1649
1652
|
range?: ({} & {
|
|
@@ -1950,6 +1953,7 @@ declare const PxAnimatorConfigSchema: PxSchema<{} & {
|
|
|
1950
1953
|
subject?: string | undefined;
|
|
1951
1954
|
smoothing?: number | undefined;
|
|
1952
1955
|
pin?: boolean | undefined;
|
|
1956
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
1953
1957
|
pinTop?: number | undefined;
|
|
1954
1958
|
pinDistance?: number | undefined;
|
|
1955
1959
|
range?: ({} & {
|
|
@@ -17783,6 +17787,7 @@ declare const PxSvgNodeExtra: PxSchema<{} & {
|
|
|
17783
17787
|
subject?: string | undefined;
|
|
17784
17788
|
smoothing?: number | undefined;
|
|
17785
17789
|
pin?: boolean | undefined;
|
|
17790
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
17786
17791
|
pinTop?: number | undefined;
|
|
17787
17792
|
pinDistance?: number | undefined;
|
|
17788
17793
|
range?: ({} & {
|
|
@@ -18094,6 +18099,7 @@ declare const PxSvgNodeExtra: PxSchema<{} & {
|
|
|
18094
18099
|
subject?: string | undefined;
|
|
18095
18100
|
smoothing?: number | undefined;
|
|
18096
18101
|
pin?: boolean | undefined;
|
|
18102
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
18097
18103
|
pinTop?: number | undefined;
|
|
18098
18104
|
pinDistance?: number | undefined;
|
|
18099
18105
|
range?: ({} & {
|
|
@@ -18424,6 +18430,7 @@ declare const PxAnimatedSvgDocumentSchema: PxSchema<{
|
|
|
18424
18430
|
subject?: string | undefined;
|
|
18425
18431
|
smoothing?: number | undefined;
|
|
18426
18432
|
pin?: boolean | undefined;
|
|
18433
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
18427
18434
|
pinTop?: number | undefined;
|
|
18428
18435
|
pinDistance?: number | undefined;
|
|
18429
18436
|
range?: ({} & {
|
|
@@ -21414,6 +21421,7 @@ declare const PxAnimatedSvgDocumentSchema: PxSchema<{
|
|
|
21414
21421
|
subject?: string | undefined;
|
|
21415
21422
|
smoothing?: number | undefined;
|
|
21416
21423
|
pin?: boolean | undefined;
|
|
21424
|
+
pinAlign?: "top" | "center" | "bottom" | undefined;
|
|
21417
21425
|
pinTop?: number | undefined;
|
|
21418
21426
|
pinDistance?: number | undefined;
|
|
21419
21427
|
range?: ({} & {
|
|
@@ -24608,6 +24616,14 @@ interface GlyphMaterialiseOpts<E = any> {
|
|
|
24608
24616
|
/** Optional diagnostics sink. */
|
|
24609
24617
|
warnings?: Array<string>;
|
|
24610
24618
|
}
|
|
24619
|
+
/**
|
|
24620
|
+
* Class stamped on the `<path>` holding the □ placeholders — and ONLY on it: the missing
|
|
24621
|
+
* boxes are emitted separately from the real glyphs so a consumer can style them on their
|
|
24622
|
+
* own. The editor uses it to fade them in with a delay: a freshly typed character is
|
|
24623
|
+
* missing for a few frames until its glyph is fetched asynchronously, and a □ that flashes
|
|
24624
|
+
* for that long reads as a rendering glitch.
|
|
24625
|
+
*/
|
|
24626
|
+
declare const MISSING_GLYPH_CLASS_NAME = "px-missing-glyph";
|
|
24611
24627
|
declare function materialiseGlyphTextHorizontal<E = any>(node: PxNode, opts: GlyphMaterialiseOpts<E>): E;
|
|
24612
24628
|
/** Per-CHARACTER advance box (local, pre-transform coords). `x,y` = the char's baseline start,
|
|
24613
24629
|
* `width` = its advance, `ascent`/`fontSize` size its bbox. */
|
|
@@ -24738,4 +24754,4 @@ interface EffectDiff {
|
|
|
24738
24754
|
*/
|
|
24739
24755
|
declare function diffInEffect(a: VmNode, b: VmNode): Array<EffectDiff>;
|
|
24740
24756
|
|
|
24741
|
-
export { type ApplyResult, COLOUR_ATTR_NAMES, CSS_ONLY_STYLE_PROPS, DEFAULT_DURATION_MS, DISALLOWED_SVG_TAGS_LOWER, type ExtendPathOpts, type ExtendedPath, type FillMode, type GlyphCharBox, type GlyphCharBoxAlongPath, type GlyphMaterialiseOpts, INTERNAL_ATTRS, type JsMode, type KeysMatch, LOOP_JUMP_SHIFT_MS, type MaterialiseAllOptions, type MotionPathMaterialisationOptions, type MotionPathSample, type OutAction, PCT_BASED_ATTR_NAMES, PX_ANIM_ATTR_NAME, PX_ANIM_SRC_ATTR_NAME, PX_TRANSFORM_PART_KEYS, type PathPoint, type PathSampler, type PlaybackDirection, type PxAnimatable, type PxAnimatedSvgDocument, PxAnimatedSvgDocumentSchema, type PxAnimationDefinition, PxAnimationDefinitionSchema, type PxAnimatorAPI, type PxAnimatorCallbacksConfig, type PxAnimatorConfig, PxAnimatorConfigSchema, PxAnimatorEngine, PxAnimatorMode, type PxAttrValue, PxAttrValueSchema, type PxBasicAnimatorAPI, type PxBezierPath, PxBezierPathSchema, type PxBinding, PxBindingSchema, type PxCloneEffect, PxCloneEffectSchema, type PxCreateElement, type PxDefs, PxDefsSchema, PxEasingOrRefSchema, type PxEffects, PxEffectsSchema, type PxElementAnimation, PxElementAnimationSchema, type PxFillGradientEffect, PxFillGradientEffectSchema, type PxGlyph, type PxGlyphFont, PxGradientSpreadMethod, type PxGradientStop, PxGradientStopSchema, PxGradientType, PxGradientUnits, type PxInfer, type PxKeyframe, PxKeyframeSchema, PxKeyframeValueSchema, type PxLoop, PxLoopExtend, PxLoopSchema, type PxMaskedByEffect, PxMaskedByEffectSchema, type PxNode, PxNodeBase, PxNodeSchema, type PxPlatformAdapter, type PxPropertyAnimation, PxPropertyAnimationSchema, type PxRepeaterEffect, PxRepeaterEffectSchema, type PxRetimeEffect, PxRetimeEffectSchema, type PxSchema, type PxSchemaDesc, type PxScroll, type PxScrollPhase, type PxScrollRangePoint, PxScrollRangePointSchema, PxScrollRangeSchema, PxScrollSchema, type PxStrokeGradientEffect, PxStrokeGradientEffectSchema, type PxSvgNode, PxSvgNodeExtra, PxTextEffectSchema, type PxTextPathEffect, PxTextPathEffectSchema, type PxTransformByEffect, PxTransformByEffectSchema, type PxTransformPartKey, type PxTransformParts, PxTransformPartsSchema, type PxTransformValue, PxTransformValueSchema, type PxTrigger, PxTriggerSchema, type PxTrimPathEffect, PxTrimPathEffectSchema, PxTrimSubPaths, type PxValidationContext, type PxValidationResult, type RemoveIndex, STYLE_ATTR_NAMES, type StartOn, TEXT_ATTR, TEXT_CONTENT_ATTR, TRANSFORM_FN_NAMES, type Vec2, applyPlayerEffects, bezierToSvgPath, calcAnimationValues, camelCaseToKebabWordIfNeeded, clamp, collectSampleTimes, composeTransformParts, createBasicFrameLoopAnimator, createPathSampler, cubicBezier, deepClone, describeSchema, diffInEffect, evaluateMotionPathSegment, extendedPathForBrowser, generateNewIds, generateUniqueId, getAnimatorConfig, getBindings, getChildren, getDefs, getNormalisedBindings, getNormalizedProps, interpolateBeziers, interpolateValue, isPxElementFileFormat, isPxElementFileFormatDeep, isScrollTimeline, jsonElementFactory, kebabToCamelCaseWord, layoutGlyphTextChars, materialiseAllInTree, materialiseAnimatedUseInstances, materialiseGlyphText, materialiseGlyphTextAlongPath, materialiseGlyphTextHorizontal, materialiseInternalLoopsInPropAnim, materialiseInternalLoopsInTree, materialiseMotionPathInPropAnim, materialiseMotionPathsInTree, propAnimIsMotionPath, px, resolveStyle, reverseEasing, sanitiseAttributeValue, schemaKeys, scrollOffsetProgress, scrollPhaseInterval, scrollResolveAxis, scrollTotalDurationMs, scrollViewProgress, shiftAnimatable, splitEasing, subdivideCubicBezier, toRGBA, validateNodeEffects, visualModelAt };
|
|
24757
|
+
export { type ApplyResult, COLOUR_ATTR_NAMES, CSS_ONLY_STYLE_PROPS, DEFAULT_DURATION_MS, DISALLOWED_SVG_TAGS_LOWER, type ExtendPathOpts, type ExtendedPath, type FillMode, type GlyphCharBox, type GlyphCharBoxAlongPath, type GlyphMaterialiseOpts, INTERNAL_ATTRS, type JsMode, type KeysMatch, LOOP_JUMP_SHIFT_MS, MISSING_GLYPH_CLASS_NAME, type MaterialiseAllOptions, type MotionPathMaterialisationOptions, type MotionPathSample, type OutAction, PCT_BASED_ATTR_NAMES, PX_ANIM_ATTR_NAME, PX_ANIM_SRC_ATTR_NAME, PX_TRANSFORM_PART_KEYS, type PathPoint, type PathSampler, type PlaybackDirection, type PxAnimatable, type PxAnimatedSvgDocument, PxAnimatedSvgDocumentSchema, type PxAnimationDefinition, PxAnimationDefinitionSchema, type PxAnimatorAPI, type PxAnimatorCallbacksConfig, type PxAnimatorConfig, PxAnimatorConfigSchema, PxAnimatorEngine, PxAnimatorMode, type PxAttrValue, PxAttrValueSchema, type PxBasicAnimatorAPI, type PxBezierPath, PxBezierPathSchema, type PxBinding, PxBindingSchema, type PxCloneEffect, PxCloneEffectSchema, type PxCreateElement, type PxDefs, PxDefsSchema, PxEasingOrRefSchema, type PxEffects, PxEffectsSchema, type PxElementAnimation, PxElementAnimationSchema, type PxFillGradientEffect, PxFillGradientEffectSchema, type PxGlyph, type PxGlyphFont, PxGradientSpreadMethod, type PxGradientStop, PxGradientStopSchema, PxGradientType, PxGradientUnits, type PxInfer, type PxKeyframe, PxKeyframeSchema, PxKeyframeValueSchema, type PxLoop, PxLoopExtend, PxLoopSchema, type PxMaskedByEffect, PxMaskedByEffectSchema, type PxNode, PxNodeBase, PxNodeSchema, type PxPlatformAdapter, type PxPropertyAnimation, PxPropertyAnimationSchema, type PxRepeaterEffect, PxRepeaterEffectSchema, type PxRetimeEffect, PxRetimeEffectSchema, type PxSchema, type PxSchemaDesc, type PxScroll, type PxScrollPhase, type PxScrollRangePoint, PxScrollRangePointSchema, PxScrollRangeSchema, PxScrollSchema, type PxStrokeGradientEffect, PxStrokeGradientEffectSchema, type PxSvgNode, PxSvgNodeExtra, PxTextEffectSchema, type PxTextPathEffect, PxTextPathEffectSchema, type PxTransformByEffect, PxTransformByEffectSchema, type PxTransformPartKey, type PxTransformParts, PxTransformPartsSchema, type PxTransformValue, PxTransformValueSchema, type PxTrigger, PxTriggerSchema, type PxTrimPathEffect, PxTrimPathEffectSchema, PxTrimSubPaths, type PxValidationContext, type PxValidationResult, type RemoveIndex, STYLE_ATTR_NAMES, type StartOn, TEXT_ATTR, TEXT_CONTENT_ATTR, TRANSFORM_FN_NAMES, type Vec2, applyPlayerEffects, bezierToSvgPath, calcAnimationValues, camelCaseToKebabWordIfNeeded, clamp, collectSampleTimes, composeTransformParts, createBasicFrameLoopAnimator, createPathSampler, cubicBezier, deepClone, describeSchema, diffInEffect, evaluateMotionPathSegment, extendedPathForBrowser, generateNewIds, generateUniqueId, getAnimatorConfig, getBindings, getChildren, getDefs, getNormalisedBindings, getNormalizedProps, interpolateBeziers, interpolateValue, isPxElementFileFormat, isPxElementFileFormatDeep, isScrollTimeline, jsonElementFactory, kebabToCamelCaseWord, layoutGlyphTextChars, materialiseAllInTree, materialiseAnimatedUseInstances, materialiseGlyphText, materialiseGlyphTextAlongPath, materialiseGlyphTextHorizontal, materialiseInternalLoopsInPropAnim, materialiseInternalLoopsInTree, materialiseMotionPathInPropAnim, materialiseMotionPathsInTree, propAnimIsMotionPath, px, resolveStyle, reverseEasing, sanitiseAttributeValue, schemaKeys, scrollOffsetProgress, scrollPhaseInterval, scrollResolveAxis, scrollTotalDurationMs, scrollViewProgress, shiftAnimatable, splitEasing, subdivideCubicBezier, toRGBA, validateNodeEffects, visualModelAt };
|
package/dist/index.js
CHANGED
|
@@ -1188,6 +1188,7 @@ var PxScrollSchema = implementsInterface()(px.object({
|
|
|
1188
1188
|
subject: px.string().optional(),
|
|
1189
1189
|
smoothing: px.number().optional(),
|
|
1190
1190
|
pin: px.boolean().optional(),
|
|
1191
|
+
pinAlign: px.enum(["top", "center", "bottom"]).optional(),
|
|
1191
1192
|
pinTop: px.number().optional(),
|
|
1192
1193
|
pinDistance: px.number().optional(),
|
|
1193
1194
|
range: PxScrollRangeSchema.optional()
|
|
@@ -4461,6 +4462,19 @@ var TEXT_ATTR_KEYS = [
|
|
|
4461
4462
|
TEXT_CONTENT_ATTR,
|
|
4462
4463
|
"xml:space"
|
|
4463
4464
|
];
|
|
4465
|
+
var PAINT_STATIC_KEYS = [
|
|
4466
|
+
"fillOpacity",
|
|
4467
|
+
"fillRule",
|
|
4468
|
+
"strokeOpacity",
|
|
4469
|
+
"strokeDasharray",
|
|
4470
|
+
"strokeDashoffset",
|
|
4471
|
+
"strokeLinecap",
|
|
4472
|
+
"strokeLinejoin",
|
|
4473
|
+
"strokeMiterlimit",
|
|
4474
|
+
"mixBlendMode",
|
|
4475
|
+
"filter"
|
|
4476
|
+
];
|
|
4477
|
+
var PAINT_ANIMATE_KEYS = ["fill", "stroke", "strokeWidth", "opacity", "fillOpacity", "strokeOpacity", "strokeDasharray", "strokeDashoffset"];
|
|
4464
4478
|
function parseLen(v) {
|
|
4465
4479
|
if (typeof v === "number") return v;
|
|
4466
4480
|
if (typeof v === "string") {
|
|
@@ -4472,17 +4486,39 @@ function parseLen(v) {
|
|
|
4472
4486
|
function str(v) {
|
|
4473
4487
|
return typeof v === "string" ? v : void 0;
|
|
4474
4488
|
}
|
|
4489
|
+
function paintAnimateOf(node) {
|
|
4490
|
+
const bag = node.animate;
|
|
4491
|
+
if (!bag || typeof bag !== "object") return void 0;
|
|
4492
|
+
let out;
|
|
4493
|
+
for (const k of PAINT_ANIMATE_KEYS) {
|
|
4494
|
+
if (bag[k] !== void 0) (out != null ? out : out = {})[k] = bag[k];
|
|
4495
|
+
}
|
|
4496
|
+
return out;
|
|
4497
|
+
}
|
|
4475
4498
|
function resolveStyle2(node, parent) {
|
|
4476
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
4477
|
-
|
|
4499
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
4500
|
+
const isTextRoot = node.type === "text";
|
|
4501
|
+
const nodeStyle = node.style;
|
|
4502
|
+
const own = (key) => {
|
|
4503
|
+
var _a2;
|
|
4504
|
+
return isTextRoot ? void 0 : (_a2 = node[key]) != null ? _a2 : nodeStyle == null ? void 0 : nodeStyle[key];
|
|
4505
|
+
};
|
|
4506
|
+
const res = {
|
|
4478
4507
|
fontFamily: (_a = str(node.fontFamily)) != null ? _a : parent.fontFamily,
|
|
4479
4508
|
fontSize: (_b = parseLen(node.fontSize)) != null ? _b : parent.fontSize,
|
|
4480
4509
|
fill: (_c = node.fill) != null ? _c : parent.fill,
|
|
4481
4510
|
stroke: (_d = node.stroke) != null ? _d : parent.stroke,
|
|
4482
4511
|
strokeWidth: (_e = node.strokeWidth) != null ? _e : parent.strokeWidth,
|
|
4483
4512
|
letterSpacing: (_f = parseLen(node.letterSpacing)) != null ? _f : parent.letterSpacing,
|
|
4484
|
-
wordSpacing: (_g = parseLen(node.wordSpacing)) != null ? _g : parent.wordSpacing
|
|
4513
|
+
wordSpacing: (_g = parseLen(node.wordSpacing)) != null ? _g : parent.wordSpacing,
|
|
4514
|
+
opacity: (_h = parseLen(own("opacity"))) != null ? _h : parent.opacity,
|
|
4515
|
+
animate: (_i = isTextRoot ? void 0 : paintAnimateOf(node)) != null ? _i : parent.animate
|
|
4485
4516
|
};
|
|
4517
|
+
for (const key of PAINT_STATIC_KEYS) {
|
|
4518
|
+
const v = (_j = own(key)) != null ? _j : parent[key];
|
|
4519
|
+
if (v !== void 0) res[key] = v;
|
|
4520
|
+
}
|
|
4521
|
+
return res;
|
|
4486
4522
|
}
|
|
4487
4523
|
function rootStyleOf(node) {
|
|
4488
4524
|
var _a, _b, _c;
|
|
@@ -4501,6 +4537,11 @@ function paintOf(s) {
|
|
|
4501
4537
|
if (s.fill !== void 0) p.fill = s.fill;
|
|
4502
4538
|
if (s.stroke !== void 0) p.stroke = s.stroke;
|
|
4503
4539
|
if (s.strokeWidth !== void 0) p.strokeWidth = s.strokeWidth;
|
|
4540
|
+
if (s.opacity !== void 0 && s.opacity !== 1) p.opacity = s.opacity;
|
|
4541
|
+
for (const key of PAINT_STATIC_KEYS) {
|
|
4542
|
+
if (s[key] !== void 0) p[key] = s[key];
|
|
4543
|
+
}
|
|
4544
|
+
if (s.animate !== void 0) p.animate = s.animate;
|
|
4504
4545
|
return p;
|
|
4505
4546
|
}
|
|
4506
4547
|
function glyphFontFor(s, glyphs, soleFont, warnings) {
|
|
@@ -4514,6 +4555,7 @@ function soleFontOf(glyphs) {
|
|
|
4514
4555
|
return names.length === 1 ? glyphs[names[0]] : void 0;
|
|
4515
4556
|
}
|
|
4516
4557
|
var MISSING_GLYPH_ADVANCE_EM = 0.6;
|
|
4558
|
+
var MISSING_GLYPH_CLASS_NAME = "px-missing-glyph";
|
|
4517
4559
|
function missingGlyphBoxEm(advanceEm, ascentEm) {
|
|
4518
4560
|
if (advanceEm <= 0 || ascentEm <= 0) return "";
|
|
4519
4561
|
const inset = 0.08;
|
|
@@ -4549,7 +4591,7 @@ function materialiseGlyphTextHorizontal(node, opts) {
|
|
|
4549
4591
|
pen.x += g.width * scale;
|
|
4550
4592
|
} else if (/\S/.test(ch)) {
|
|
4551
4593
|
const advEm = g && g.width > 0 ? g.width : MISSING_GLYPH_ADVANCE_EM * upm;
|
|
4552
|
-
placements.push({ glyphD: missingGlyphBoxEm(advEm, ascentEm), m: [scale, 0, 0, scale, pen.x, pen.y], paint, line, x: pen.x, y: pen.y, scale });
|
|
4594
|
+
placements.push({ glyphD: missingGlyphBoxEm(advEm, ascentEm), m: [scale, 0, 0, scale, pen.x, pen.y], paint, isMissing: true, line, x: pen.x, y: pen.y, scale });
|
|
4553
4595
|
pen.x += advEm * scale;
|
|
4554
4596
|
} else {
|
|
4555
4597
|
pen.x += (g ? g.width : 0) * scale;
|
|
@@ -4740,7 +4782,7 @@ function collectAlongPathCells(node, glyphs, soleFont, warnings) {
|
|
|
4740
4782
|
} else if (/\S/.test(ch)) {
|
|
4741
4783
|
const wEm = g && g.width > 0 ? g.width : MISSING_GLYPH_ADVANCE_EM * gf.unitsPerEm;
|
|
4742
4784
|
const boxAdv = wEm * scale;
|
|
4743
|
-
cells.push({ glyphD: missingGlyphBoxEm(wEm, ascentEm), widthEm: wEm, scale, paint, midBase: adv + boxAdv / 2 });
|
|
4785
|
+
cells.push({ glyphD: missingGlyphBoxEm(wEm, ascentEm), widthEm: wEm, scale, paint, isMissing: true, midBase: adv + boxAdv / 2 });
|
|
4744
4786
|
adv += boxAdv;
|
|
4745
4787
|
} else {
|
|
4746
4788
|
adv += (g ? g.width : 0) * scale;
|
|
@@ -4796,6 +4838,7 @@ function materialiseGlyphTextAlongPath(node, pathD, startOffset, opts, textLengt
|
|
|
4796
4838
|
const placements = placeCells.map((c) => ({
|
|
4797
4839
|
glyphD: c.glyphD,
|
|
4798
4840
|
paint: c.paint,
|
|
4841
|
+
isMissing: c.isMissing,
|
|
4799
4842
|
m: alongAffine(sampler, base + c.midBase * k, c.scale, c.widthEm, perp)
|
|
4800
4843
|
}));
|
|
4801
4844
|
return toGroup(node, buildPaths(placements, create, warnings), create);
|
|
@@ -4878,12 +4921,13 @@ function buildAnimatedAlongPath(cells, sampler, distOf, times, loop, create, isC
|
|
|
4878
4921
|
const transform = { keyframes: kfs };
|
|
4879
4922
|
if (loop !== void 0) transform.loop = loop;
|
|
4880
4923
|
const animate = { transform };
|
|
4924
|
+
if (c.paint.animate) Object.assign(animate, c.paint.animate);
|
|
4881
4925
|
if (isClip && opKfs.some((k) => k.value === 0)) {
|
|
4882
4926
|
const op = { keyframes: opKfs };
|
|
4883
4927
|
if (loop !== void 0) op.loop = loop;
|
|
4884
4928
|
animate.opacity = op;
|
|
4885
4929
|
}
|
|
4886
|
-
out.push(create("path", __spreadProps(__spreadValues({ d }, paintProps(c.paint)), { animate }), []));
|
|
4930
|
+
out.push(create("path", __spreadProps(__spreadValues(__spreadValues({ d }, paintProps(c.paint)), missingGlyphProps(c.isMissing)), { animate }), []));
|
|
4887
4931
|
}
|
|
4888
4932
|
return out;
|
|
4889
4933
|
}
|
|
@@ -4892,24 +4936,34 @@ function paintProps(paint) {
|
|
|
4892
4936
|
if (paint.fill !== void 0) p.fill = paint.fill;
|
|
4893
4937
|
if (paint.stroke !== void 0) p.stroke = paint.stroke;
|
|
4894
4938
|
if (paint.strokeWidth !== void 0) p.strokeWidth = paint.strokeWidth;
|
|
4939
|
+
if (paint.opacity !== void 0) p.opacity = paint.opacity;
|
|
4940
|
+
for (const key of PAINT_STATIC_KEYS) {
|
|
4941
|
+
if (paint[key] !== void 0) p[key] = paint[key];
|
|
4942
|
+
}
|
|
4895
4943
|
return p;
|
|
4896
4944
|
}
|
|
4945
|
+
function missingGlyphProps(isMissing) {
|
|
4946
|
+
return isMissing ? { class: MISSING_GLYPH_CLASS_NAME } : {};
|
|
4947
|
+
}
|
|
4897
4948
|
function buildPaths(placements, create, warnings) {
|
|
4898
|
-
var _a, _b, _c;
|
|
4899
4949
|
if (!placements.length) {
|
|
4900
4950
|
warnings == null ? void 0 : warnings.push("textGlyphs: nothing to render");
|
|
4901
4951
|
return [];
|
|
4902
4952
|
}
|
|
4903
4953
|
const byPaint = /* @__PURE__ */ new Map();
|
|
4904
4954
|
for (const p of placements) {
|
|
4905
|
-
const key = JSON.stringify([
|
|
4955
|
+
const key = JSON.stringify([p.paint, !!p.isMissing]);
|
|
4906
4956
|
const baked = transformPathData(p.glyphD, p.m);
|
|
4907
4957
|
const entry = byPaint.get(key);
|
|
4908
4958
|
if (entry) entry.d += baked;
|
|
4909
|
-
else byPaint.set(key, { paint: p.paint, d: baked });
|
|
4959
|
+
else byPaint.set(key, { paint: p.paint, d: baked, isMissing: p.isMissing });
|
|
4910
4960
|
}
|
|
4911
4961
|
const out = [];
|
|
4912
|
-
for (const { paint, d } of byPaint.values())
|
|
4962
|
+
for (const { paint, d, isMissing } of byPaint.values()) {
|
|
4963
|
+
out.push(create("path", __spreadValues(__spreadValues(__spreadValues({
|
|
4964
|
+
d
|
|
4965
|
+
}, paintProps(paint)), missingGlyphProps(isMissing)), paint.animate !== void 0 ? { animate: __spreadValues({}, paint.animate) } : {}), []));
|
|
4966
|
+
}
|
|
4913
4967
|
return out;
|
|
4914
4968
|
}
|
|
4915
4969
|
function toGroup(node, children, create) {
|
|
@@ -6020,6 +6074,7 @@ export {
|
|
|
6020
6074
|
DISALLOWED_SVG_TAGS_LOWER,
|
|
6021
6075
|
INTERNAL_ATTRS,
|
|
6022
6076
|
LOOP_JUMP_SHIFT_MS,
|
|
6077
|
+
MISSING_GLYPH_CLASS_NAME,
|
|
6023
6078
|
PCT_BASED_ATTR_NAMES,
|
|
6024
6079
|
PX_ANIM_ATTR_NAME,
|
|
6025
6080
|
PX_ANIM_SRC_ATTR_NAME,
|